News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

[SM] [ENEMY] frames

Started by Damski, February 06, 2012, 03:02:48 AM

Previous topic - Next topic

Damski

I want know How to take frame rates from enemies, so how its works? I dont want to speed them or slow them.


Thank you.

JAM

I think, Scyzer knows this stuff better than me, as I'm not the enemy expert but I'll try to help.

You'll not need to know ASM to edit delay, but you may have to know it to find exact delay. Sometimes, common sense in enough.

First of all, use the backups and write the changes you've made to the text file.

1. Locate the Enemy Bank. You'll need to open SMILE, selcet desired enemy and look at his DNA until you see it.

2. Find Initiation AI pointer. Again in DNA.

3. After you got the info, open your ROM in the desired enemy bank and go to Initiation AI pointer.

Example:
Enemy is Waver.
Enemy Bank is A3.
Initiation AI is 86ED.
You target is A3:86ED or 1186ED

4. Find Instruction pointer. All you need to do is search for 9D 92 0F. 2 bytes before 9D 92 0F is Instruction pointer. I've found one at 11873C. Bytes are A7 86.

5. Jump for Instruction pointer. If the byte before Instruction pointer is A9 (meaning the whole string is A9 A7 86 9D 92 0F) you may jump to this pointer without fear. In this case, A3:86A7 or 1186A7. Sometimes byte before pointer is B9. In that case, it leads not to the pointer itself, but to array consisting of pointers. Each word there is an individiual pointer, mostly for displaying different sprites when facing left or right or when climbing the walls.

6. Search for positive. You'll see a lot of instructions. Each one is a pointer to the same bank. You'll need to search for XX 00. It will be the delay most likely. Sometimes, such kind of values are used for some sort of counters.

Just change a few values, save and exit and notice what is changed. Keep in mind that the whole array is not continuus. There are also instuctions that jumps to another place in the same bank.


7. Pair rule. Delays and tilemap pointers are always forming the pairs. Look what I've found at 1186A7:

01 00 4A 88

01 00 is a delay of 1 frame and 884A is the pointer for the sprite tilemap.


8. You can also edit the tilemap. To do it, read this doc. Format is the same. Tile number is offset from Enemy Tiles pointer. Again, look for it in SMILE. For the Waver, it is AE8600 (8600 in bank AE or 170600). Just open TLP at this offset and you'll see the tiles. View format should be SNES. To get the correct palette, extract it from SMILE and Load in TLP.

This is enough to edit tilemaps for normal enemies that having Normal GFX (Not Special GFX like Space Pirates, their tilemap is complex).

9. Repeat steps 4-8. There are maybe a few Instruction pointers in Initiation AI.

A. Find Running AI pointer (or pointers). Again in DNA.

B. Repeat steps 3-8.

Crashtour99

As an alternative, it's been my experience that "almost" universally the Graphic AI (table of entries consisting of frame delays, tilemap pointers, and code pointers) starts right after the enemy's palette ends, and ends right before the Initiation AI.

As an example:
Enemy Zeb
Palette location: $B3/878B - $B3/87AA
Graphic AI:  $B3/87AB - $B3/882A

Table of entries to direct to correct location in Graphic AI (used by Initiation AI)
$B3/882B - $B3/883A  (this is used because enemies Zeb and Zebbo both use the same Init. and Running AI, and you can change one to the other by using the Speed value in SMILE)

Initiation AI: Starts at $B3/883B

I find it easiest to just copy/paste the whole Graphic AI into a .txt file and sort through all the pointers that way, separating frame delay and tilemaps into 4 byte pairs.  Once you start looking at it, it's pretty easy to spot patterns used by most enemies.

As an example, here's part of Zeb's Graphic AI:

$B3/87AB 02 00 B7 89 ;tilemap
$B3/87AF 02 00 BE 89 ;tilemap
$B3/87B3 02 00 C5 89 ;tilemap
$B3/87B7 02 00 CC 89 ;tilemap
$B3/87BB 02 00 D3 89 ;tilemap
$B3/87BF 02 00 CC 89 ;tilemap
$B3/87C3 02 00 C5 89 ;tilemap
$B3/87C7 02 00 BE 89 ;tilemap
$B3/87CB ED 80 AB 87 ;return to 87AB

$B3/87CF 01 00 B7 89 ;tilemap
$B3/87D3 01 00 BE 89 ;tilemap
$B3/87D7 01 00 CC 89 ;tilemap
$B3/87DB 01 00 D3 89 ;tilemap
$B3/87DF 01 00 CC 89 ;tilemap
$B3/87E3 01 00 BE 89 ;tilemap
$B3/87E7 ED 80 CF 87 ;return to 87CF


As JAM said, first 2 bytes are frame delay, next 2 bytes are tilemap pointers.  The routine at $80ED uses the next 2 bytes as a return address so it will usually cycle through the same animation unless directed by the Running AI.  Some enemies will mix this up with extra routines, especially if they fire projectiles.  Just look for animation patterns and experiment with a backup and you should be fine.

Damski

Thank you guys very much!!!  :oh:

Damski

#4
I found it