The code uses the level number as an offset into 86:D362 to load another byte sized offset into 86:D3D5 to figure out which bits to set in 7E:1F99 which stores the upgrades X has. Chill Penguin is level 8 which reads 86:D362+8 and gets the value 3. Then it reads 86:D3D5+3 and gets the value 8. 8 is then set in 7E:1F99 to give X dash.
Sounds like there is some uninitialized variable problem with the settings it is trying to load when it opens. If I have some time this weekend I'll look at it.
March 20, 2016, 12:54:06 am - (Auto Merged - Double Posts are not allowed before 7 days.)
I changed the settings over to use the registry. The load last rom at startup value wasn't initialized and hopefully was the cause of the loading problems. I didn't setup an emulator to use, yet.
I hacked around on the sprite code and got most (~80%) of the enemy sprites to show up correctly. A lot of objects have custom memory locations, hard coded LDA constants to get the graphics pointer for decompression or sprite assembly, and custom palette locations. I didn't spend much time on those. The sprites work in X1-X3.
- You can hit 'T' now to toggle on all enemy sprite display in the level.
- Going through the event editor will show sprites, if possible, on enemy types.
- If you go to a 2,15,x which is a sprite load (or 2,18,x) event it also displays all enemies in the level, draws a green box around ones whose graphics load in the forward direction of the event, a blue box on the reverse direction, and red box for ones that aren't loaded.
- Also on the 2,15,x there's a graphics loading dialog where you can scroll through the sprites that get loaded and modify them. This allows you to remove or change the sprites that get loaded by these events to add enemy graphics that didn't exist before. There's a window that attempts to display a sprite of what is loaded by one of the indices in the event. If you change the sprite tiles that are loaded the palette won't refresh until add an enemy of that type in the level and you save/reload the level. This code is a mess right now so I didn't spend a lot of time making it work right.
I was able to add an enemy from a different level in by adding the enemy event after a 2,15,x event and then editing the 2,15,x event to swap in the correct graphics and palette. Make sure you use an unused palette slot if you play with this. I think the VRAM Offset is also really a slot in VRAM to load the graphics and not the actual address, but I haven't looked at it close enough to be sure.
This all very experimental (and messy code) so don't count on it staying in this format or working properly.