Jul 6, 2008 at 10:26 PM
Join Date: Jun 18, 2006
Location: Montreal, Canada
Posts: 581
Age: 40
So everyone's going crazy over weapons and entities, and I can't help but feel bad for the little guy. The data that nobody notices but everyone would miss were it gone. That's right, I'm talking about effects.
There are 18 different types of effects. Each effect can have a mode which can alter what happens exactly.
The pointer table to their code can be found at 0048F8C0.
Here's how the data is laid out.
Aside from this, here are a few functions that may prove interesting (I've transformed them into pseudocode to make them easier to understand.)
Happy hacking!
There are 18 different types of effects. Each effect can have a mode which can alter what happens exactly.
Code:
00 Nothing
01 Pulsing Disc Particles (mode 0: blue discs, mode 1: red discs)
02 Rising Disc / Exploding Diamond (mode 0: green disc, mode 1: diamond explosion)
03 Star (mode 0 only)
04 Fireball Impact (mode 0 only)
05 ZzZ... (mode 0 only)
06 (same as 04)
07 Booster smoke (mode 0 only)
08 Drowned Quote (mode 0: face left, mode 1: face right)
09 Exclamation (mode 0: question mark, mode 1: exclamation mark)
0A Level Up/Down (mode 0: level up, mode 1: level down)
0B Red "damage" discs (mode 0 only)
0C White "explosion" disc (mode 0 only)
0D Headbump sparks (mode 0 only)
0E ?
0F Small white "explosion" disc (mode 0 only)
10 "Empty!" (mode 0 only)
11 "Push jump key!" (mode 0 only)
The rest seem rather buggy...
The pointer table to their code can be found at 0048F8C0.
Code:
70964000
80964000
80984000
809B4000
709C4000
009E4000
709C4000
609F4000
20A14000
B0A14000
80A24000
F0A34000
A0A54000
50A64000
E0A74000
F0A84000
E0A94000
A0AA4000
90C24800
A4C24800
BCC24800
Here's how the data is laid out.
Code:
0049BCA8 EffectObj[0x00].InUse +0x00 0x44 in len
0049BCAC EffectObj[0x00].ID +0x04
0049BCB0 EffectObj[0x00].Mode +0x08
0049BCB4 EffectObj[0x00].X +0x0C
0049BCB8 EffectObj[0x00].Y +0x10
0049BCBC EffectObj[0x00].MoveX +0x14
0049BCC0 EffectObj[0x00].MoveY +0x18
0049BCC4 EffectObj[0x00].WasInit +0x1C
0049BCC8 EffectObj[0x00]. +0x20 ; Unused?
0049BCCC EffectObj[0x00].FrameID +0x24 ; This is the actual frame to display, from the rects.
0049BCD0 EffectObj[0x00].FrameTimer +0x28
0049BCD4 EffectObj[0x00].XOffset +0x2C
0049BCD8 EffectObj[0x00].YOffset +0x30
0049BCDC EffectObj[0x00].Display_L +0x34
0049BCE0 EffectObj[0x00].Display_U +0x38
0049BCE4 EffectObj[0x00].Display_R +0x3C
0049BCE8 EffectObj[0x00].Display_D +0x40
Aside from this, here are a few functions that may prove interesting (I've transformed them into pseudocode to make them easier to understand.)
Code:
| |
| Clear All Effects |
| |
409650::clear_all_effects
{
// Clear 64 x 68 bytes.
409650 push 0x00001100 // Size : 4352 bytes (64 x 68)
409658 push 0x00000000 // Value : 0
40965a push &EffectObj // Offset: Effect Objects
40965f call 480D30::memset
// Exit.
409670 return
}
| |
| Update All Effects |
| |
40ab50::update_all_effects
{
40ab50 L04_SlotID = 0
40ab5d Goto 40ab68
// Iterate through all 64 effect slots.
40ab5f {
L04_SlotID++
40ab68 if(L04_SlotID >= 64)
return
// Skip this slot if it's not in use.
40ab6e if(EffectObj[L04_SlotID].InUse & 0x80 != 0x00)
{
// Call the appropriate effect code and move along.
40ab82 push &EffectObj[L04_SlotID]
40ab9e call ROM_PEffects[EffectObj[L04_SlotID].ID]
}
40abab }
}
| |
| Create Animated Effect |
| 08_X X position. |
| 0C_Y Y position. |
| 10_ID Effect ID. |
| 14_Mode Effect Mode. |
| |
40ac90::create_animated_effect
{
// Find a free slot.
40ac90 L04_EffectSlot = 0
40ac9b Goto 40aca6
40ac9d {
L04_EffectSlot++
40aca6 if(L04_EffectSlot >= 64)
break
40acac if(EffectObj[L04_EffectSlot].InUse == 0)
40acbb break
40acbd }
// Exit if no slots are free.
// That is, if we've hit slot 64, that means we've gone through all slots without finding anything.
40acbf if(L04_EffectSlot == 64)
40acc5 return
// Clear the slot.
// Writes 0x00 to 68 bytes.
40acca push 0x00000044 // Size : 68 bytes
40accc push 0x00000000 // Value : 0
40acce push &EffectObj[L04_EffectSlot] // Offset: Specified Effect
40acdb call 480D30::memset
// Fill the slot with data.
40ace3 EffectObj[L04_EffectSlot].InUse = 0x80
40acf3 EffectObj[L04_EffectSlot].ID = 10_ID
40ad02 EffectObj[L04_EffectSlot].X = 08_X
40ad11 EffectObj[L04_EffectSlot].Y = 0C_Y
40ad20 EffectObj[L04_EffectSlot].XOffset = [10_ID * 8 + 0048f830] // 0048F830: Effect Offset Table.X
40ad36 EffectObj[L04_EffectSlot].YOffset = [10_ID * 8 + 0048f834] // 0048F830: Effect Offset Table.Y
40ad4c EffectObj[L04_EffectSlot].Mode = 14_Mode
// Exit.
40ad5b return
}
Happy hacking!