RIC: add more documentation (#1573)

Follow-up to #1569 .

Loads of changes, where the most prominent one is synchronising the
`self->ext.*.subweaponId` field across entities to make it work on
`RicSetSubweaponParams`. I added some static assertions with the new
macro `SYNC_FIELD`, which is easier to read.

The new `enum RicSubweapons` decouples the subweapons of Richter from
those found in DRA. This is important because
`assets/ric/subweapondefs.json` is different from the definition stored
in DRA.

I discovered new entities and renamed them accordingly. I am following
the format `RicEntity` for each entity. Then `RicEntitySubwpn` or
`RicEntityCrash` for the appropriate category.

The BSS section has been assigned to the right places and `ric.h` has
been cleaned as most of the declarations are no longer necessary. More
data and functions have been marked as `static`.

`src/st/st0/2DAC8.c` had a reference to `.ext.agunea`, which was
probably put there by mistake. The fake symbol `D_801758D0` has been
removed and I think I found a way to fix the stopwatch subweapon without
the `#ifdef`.

```c
#ifdef VERSION_PC
#ifdef _MSC_VER
            {
                s32 temp_x = (rcos(primLine->angle) << 8);
                s32 temp_y = (-(rsin(primLine->angle) << 8));
                primLine->velocityX = *(f32*)&temp_x;
                primLine->velocityY = *(f32*)&temp_y;
            }
#else
            primLine->velocityX = (f32)(rcos(primLine->angle) << 8);
            primLine->velocityY = (f32) - (rsin(primLine->angle) << 8);
#endif
#else
            primLine->velocityX = (rcos(primLine->angle) << 8);
            primLine->velocityY = -(rsin(primLine->angle) << 8);
#endif
```
this one has been resolved by just using `velocityX.val`.
This commit is contained in:
Luciano Ciccariello 2024-08-27 18:18:26 +01:00 committed by GitHub
parent 38a2cbe9bb
commit af503baa43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 1218 additions and 1011 deletions

View File

@ -42,13 +42,14 @@ segments:
- [0x1895C, .data, 21250] # g_RicEntityTbl
- [0x18A6C, assets, factory_blueprint, g_RicFactoryBlueprints]
- [0x18C40, .data, 24788]
- [0x18ED4, .data, 26C84]
- [0x1938C, .data, pl_anims]
- [0x18ED4, .data, 24788] # func_80162C84
- [0x18F7C, .data, 26C84]
- [0x1938C, .data, pl_anims]
- [0x199AC, .data, 2A060]
- [0x19D94, .data, 2C4C4]
- [0x19EE0, .data, 319C4]
- [0x19EFC, .data, e_giant_spinning_cross]
- [0x1A444, .rodata, 1AC60] #UpdateEntityRichter
- [0x1A444, .rodata, 1AC60] # UpdateEntityRichter
- [0x1A5E0, .rodata, 1AC60]
- [0x1A5F0, .rodata, 1CB04]
- [0x1A7A8, .rodata, 1FCD0]
@ -56,17 +57,16 @@ segments:
- [0x1A800, .rodata, 20920]
- [0x1A80C, .rodata, 21250]
- [0x1A918, .rodata, 24788]
- [0x1A9D0, .rodata, 26C84]
- [0x1A9E8, .rodata, 26C84] #EntityPlayerBlinkWhite
- [0x1A9D0, .rodata, 24788] # func_80162C84
- [0x1A9E8, .rodata, 26C84] # EntityPlayerBlinkWhite
- [0x1AA28, .rodata, 2A060]
- [0x1AAA0, .rodata, 2A060]
- [0x1AABC, .rodata, 2C4C4]
- [0x1AAD4, .rodata, 2C4C4] #EntitySubwpnCrashCross
- [0x1AAEC, .rodata, 2C4C4] #EntityRichterRevivalColumn
- [0x1AB04, .rodata, 2C4C4] #EntityCrossBoomerang
- [0x1AB24, .rodata, 2C4C4] #EntitySubwpnAgunea
- [0x1AAD4, .rodata, 2C4C4] # RicEntitySubwpnCrashCross
- [0x1AAEC, .rodata, 2C4C4] # RicEntityRevivalColumn
- [0x1AB04, .rodata, 2C4C4] # RicEntitySubwpnCross
- [0x1AB24, .rodata, 2C4C4] # RicEntitySubwpnAgunea
- [0x1AB38, .rodata, 319C4]
- [0x1AB50, .rodata, 319C4]
- [0x1AB68, .rodata, e_giant_spinning_cross]
- [0x1AC50, .rodata, e_giant_spinning_cross]
- [0x1AC60, c, 1AC60]
@ -80,6 +80,12 @@ segments:
- [0x2A060, c, 2A060]
- [0x2C4C4, c, 2C4C4]
- [0x319C4, c, 319C4]
- [0x3328C, c, e_giant_spinning_cross]
- [0x37B64, .bss, bss]
- [0x359A4, c, 319C4]
- [0x3728C, c, e_giant_spinning_cross]
- [0x37B64, .bss, 1CB04]
- [0x37F80, .bss, 21250]
- [0x38000, .bss, 2A060]
- [0x38088, .bss, 2C4C4]
- [0x39894, .bss, 319C4]
- [0x398E0, .bss, bss]
- [0x39A58]

View File

@ -127,7 +127,7 @@ int sprintf(char* dst, const char* fmt, ...);
#define PAD_FIELD(size) const CRITICAL_PAD_FIELD(size)
#define STATIC_PAD_BSS(size) static CRITICAL_PAD_FIELD(size)
#define STATIC_PAD_DATA(size) STATIC_PAD_BSS(size) = {0}
#define STATIC_PAD_RODATA(size) static const STATIC_PAD_BSS(size) = {0}
#define STATIC_PAD_RODATA(size) const STATIC_PAD_BSS(size) = {0}
#else
#define PAD_FIELD(size)
#define STATIC_PAD_BSS(size)

View File

@ -944,7 +944,7 @@ typedef struct {
typedef struct {
s16 unk7C;
byte pad[14];
unk_sub_8011E4BC* unk8C;
/* 0x8C */ struct Entity* parent;
} ET_8011E4BC;
typedef struct {
@ -959,55 +959,19 @@ typedef struct {
s16 unk80;
s16 unk82;
s16 unk84;
/* 0x86 */ s16 : 16;
/* 0x88 */ s32 : 32;
/* 0x8C */ struct Entity* parent;
/* 0x90 */ s32 : 32;
/* 0x94 */ s32 : 32;
/* 0x98 */ s32 : 32;
/* 0x9C */ s32 : 32;
/* 0xA0 */ s32 : 32;
/* 0xA4 */ s32 : 32;
/* 0xA8 */ s32 : 32;
/* 0xAC */ s32 : 32;
/* 0xB0 */ s16 subweaponId;
} ET_ReboundStone;
typedef struct {
s16 timer;
} ET_Vibhuti;
typedef struct {
/* 0x7C */ s16 unk7C;
/* 0x7E */ s16 unk7E;
/* 0x80 */ s16 pad[24];
/* 0xB0 */ s16 unkB0;
} ET_GiantSpinningCross;
typedef struct {
s16 unk7C;
s16 unk7E;
} ET_8017091C;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
s16 unk82;
s16 pad[0x16];
s16 unkB0;
} ET_80170F64;
typedef struct {
s16 timer;
s16 size;
} ET_stopwatchCircle;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
s16 unk82;
f32 unk84;
s32 unk88;
s32 unk8C;
s16 unk90;
s16 unk92;
s16 unk94;
s16 unk96;
struct Entity* unk98;
s32 pad[5];
s16 unkB0;
} ET_801719A4;
typedef struct {
s16 unk7C;
s16 unk7E;
@ -1015,16 +979,45 @@ typedef struct {
s16 unk82;
s16 unk84;
s16 unk86;
s32 unk88;
s32 unk8C;
s16 unk90;
s16 unk92;
s16 unk94;
s16 unk96;
struct Entity* unk98;
s32 pad[5];
s16 unkB0;
} ET_BibleSubwpn;
/* 0x88 */ s32 : 32;
/* 0x8C */ struct Entity* parent;
/* 0x90 */ s32 : 32;
/* 0x94 */ s32 : 32;
/* 0x98 */ s32 : 32;
/* 0x9C */ s32 : 32;
/* 0xA0 */ s32 : 32;
/* 0xA4 */ s32 : 32;
/* 0xA8 */ s32 : 32;
/* 0xAC */ s32 : 32;
/* 0xB0 */ s16 subweaponId;
} ET_ReboundStoneCrashExplosion;
typedef struct {
/* 0x7C */ s16 unk7C;
/* 0x7E */ s16 unk7E;
/* 0x80 */ s32 : 32;
/* 0x84 */ s32 : 32;
/* 0x88 */ s32 : 32;
/* 0x8C */ struct Entity* parent;
/* 0x90 */ s32 : 32;
/* 0x94 */ s32 : 32;
/* 0x98 */ s32 : 32;
/* 0x9C */ s32 : 32;
/* 0xA0 */ s32 : 32;
/* 0xA4 */ s32 : 32;
/* 0xA8 */ s32 : 32;
/* 0xAC */ s32 : 32;
/* 0xB0 */ s16 subweaponId;
} ET_GiantSpinningCross;
typedef struct {
s16 unk7C;
s16 unk7E;
/* 0x80 */ s32 : 32;
/* 0x84 */ s32 : 32;
/* 0x88 */ s32 : 32;
/* 0x8C */ struct Entity* parent;
} ET_8017091C;
typedef struct {
s16 unk7C;
@ -1033,14 +1026,132 @@ typedef struct {
s16 unk82;
s32 unk84;
s32 unk88;
struct Entity* parent1;
s32 pad[10];
/* 0x8C */ struct Entity* parent;
s32 : 32;
s32 : 32;
s32 : 32;
s32 : 32;
s32 : 32;
s32 : 32;
s32 : 32;
s32 : 32;
s16 subweaponId;
#ifndef VERSION_PC
s32 pad2;
#endif
struct Entity* parent2;
} ET_80128C2C;
} ET_Agunea;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
s16 unk82;
s32 : 32;
s32 : 32;
/* 0x8C */ struct Entity* parent;
s32 : 32;
s32 : 32;
s32 : 32;
s32 : 32;
s32 : 32;
s32 : 32;
s32 : 32;
s32 : 32;
s16 subweaponId;
} ET_AguneaCrash;
typedef struct {
s16 timer;
s16 size;
s32 : 32;
s32 : 32;
s32 : 32;
/* 0x8C */ struct Entity* parent;
} ET_stopwatchCircle;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
s16 unk82;
f32 unk84;
s32 unk88;
/* 0x8C */ struct Entity* parent;
s16 unk90;
s16 unk92;
s16 unk94;
s16 unk96;
struct Entity* unk98;
s32 : 32;
s32 : 32;
s32 : 32;
s32 : 32;
#ifndef VERSION_PC
s32 : 32;
#endif
s16 subweaponId;
} ET_StopWatch;
typedef struct {
s16 t;
s16 unk7E;
s16 unk80;
s16 unk82;
f32 unk84;
f32 unk88;
s16 unk8C;
s16 unk8E;
} ET_stopwatch;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
s16 unk82;
s16 unk84;
s16 unk86;
struct Primitive* unk88;
s16 unk8C;
s16 unk8E;
s16 unk90;
s16 unk92;
s16 unk94;
} ET_stopwatchSparkle;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
s16 unk82;
s16 unk84;
s16 unk86;
s32 unk88;
/* 0x8C */ struct Entity* parent;
s16 unk90;
s16 unk92;
s16 unk94;
s16 unk96;
struct Entity* unk98;
s32 : 32;
s32 : 32;
s32 : 32;
s32 : 32;
#ifndef VERSION_PC
s32 : 32;
#endif
s16 subweaponId;
} ET_BibleSubwpn;
typedef struct {
s16 unk7C; // TODO rename as timer
s16 unk7E;
/* 0x80 */ s32 : 32;
/* 0x84 */ s32 : 32;
/* 0x88 */ s32 : 32;
/* 0x8C */ struct Entity* parent;
/* 0x90 */ s32 : 32;
/* 0x94 */ s32 : 32;
/* 0x98 */ s32 : 32;
/* 0x9C */ s32 : 32;
/* 0xA0 */ s32 : 32;
/* 0xA4 */ s32 : 32;
/* 0xA8 */ s32 : 32;
/* 0xAC */ s32 : 32;
} ET_80161FF0;
typedef struct {
@ -1048,6 +1159,9 @@ typedef struct {
s16 unk7E;
s16 unk80;
s16 unk82;
/* 0x84 */ s32 : 32;
/* 0x88 */ s32 : 32;
/* 0x8C */ struct Entity* parent;
} ET_80162870;
typedef struct {
@ -1058,6 +1172,7 @@ typedef struct {
s16 unk84;
s16 unk86;
s32 unk88;
struct Entity* parent;
} ET_8016E9E4;
typedef struct {
@ -1069,32 +1184,6 @@ typedef struct {
s16 unk86;
} ET_801CC820;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
s16 unk82;
s16 unk84;
s16 unk86;
struct Primitive* unk88;
s16 unk8C;
s16 unk8E;
s16 unk90;
s16 unk92;
s16 unk94;
} ET_stopwatchSparkle;
typedef struct {
s16 t;
s16 unk7E;
s16 unk80;
s16 unk82;
f32 unk84;
f32 unk88;
s16 unk8C;
s16 unk8E;
} ET_stopwatch;
typedef struct {
s16 unk7C;
s16 unk7E;
@ -1104,6 +1193,7 @@ typedef struct {
s16 unk86;
s16 unk88;
s16 unk8A;
struct Entity* parent;
} ET_RichterPowerUpRing;
typedef struct {
@ -1122,6 +1212,9 @@ typedef struct {
s16 unk7E;
s16 unk80;
s16 unk82;
s32 : 32;
s32 : 32;
struct Entity* parent;
} ET_HitByIce;
typedef struct {
@ -1129,7 +1222,9 @@ typedef struct {
s16 pad7E;
s16 unk80;
s16 unk82;
byte pad84[12];
s32 : 32;
s32 : 32;
struct Entity* parent;
s16 unk90;
s16 unk92;
s16 unk94;
@ -1142,24 +1237,46 @@ typedef struct {
s32 unk80;
s32 unk84;
s32 unk88;
s32 unk8C;
struct Entity* parent;
s32 unk90;
} ET_Teleport;
typedef struct {
/* 0x7C */ s16 timer;
/* 0x7E */ s16 : 16;
/* 0x80 */ s32 : 32;
/* 0x84 */ s32 : 32;
/* 0x88 */ s32 : 32;
/* 0x8C */ struct Entity* parent;
/* 0x90 */ s32 : 32;
/* 0x94 */ s32 : 32;
/* 0x98 */ s32 : 32;
/* 0x9C */ s32 : 32;
/* 0xA0 */ s32 : 32;
/* 0xA4 */ s32 : 32;
/* 0xA8 */ s32 : 32;
/* 0xAC */ s32 : 32;
/* 0xB0 */ s16 subweaponId;
} ET_Subweapon;
typedef struct {
s16 timer;
s16 angle;
s16 unk80;
s16 unk82;
s16 hitboxState;
/* 0x86 */ s16 : 16;
/* 0x88 */ s32 : 32;
/* 0x8C */ struct Entity* parent;
/* 0x90 */ s32 : 32;
/* 0x94 */ s32 : 32;
/* 0x98 */ s32 : 32;
/* 0x9C */ s32 : 32;
/* 0xA0 */ s32 : 32;
/* 0xA4 */ s32 : 32;
/* 0xA8 */ s32 : 32;
/* 0xAC */ s32 : 32;
/* 0xB0 */ s16 subweaponId;
} ET_HolyWater;
typedef struct {
s16 timer;
s16 angle;
s16 unk80;
s16 unk82;
s16 unk84;
} ET_HolyWaterFlame;
typedef struct {
u16 unk7C;
u16 unk7E;
@ -1168,25 +1285,136 @@ typedef struct {
u8 unk82;
byte pad83;
s32 unk84;
/* 0x88 */ s32 : 32;
/* 0x8C */ struct Entity* parent;
/* 0x90 */ s32 : 32;
/* 0x94 */ s32 : 32;
/* 0x98 */ s32 : 32;
/* 0x9C */ s32 : 32;
/* 0xA0 */ s32 : 32;
/* 0xA4 */ s32 : 32;
/* 0xA8 */ s32 : 32;
/* 0xAC */ s32 : 32;
/* 0xB0 */ s16 subweaponId;
} ET_CrashCross;
typedef struct {
u16 unk7C;
u16 unk7E;
u8 unk80;
byte pad81;
u8 unk82;
byte pad83;
s32 unk84;
} ET_RicRevivalColumn; // Note this is the same as CrashCross
typedef struct {
s16 timer;
s16 unk7E;
u16 unk80;
u16 pad82;
Point16* unk84;
#ifndef VERSION_PC
/* 0x88 */ s32 : 32;
#endif
/* 0x8C */ struct Entity* parent;
/* 0x90 */ s32 : 32;
/* 0x94 */ s32 : 32;
/* 0x98 */ s32 : 32;
/* 0x9C */ s32 : 32;
/* 0xA0 */ s32 : 32;
/* 0xA4 */ s32 : 32;
/* 0xA8 */ s32 : 32;
/* 0xAC */ s32 : 32;
/* 0xB0 */ s16 subweaponId;
} ET_CrossBoomerang;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
s16 unk82;
s16 unk84;
s16 unk86;
s16 unk88;
s8 unk8A;
u8 unk8B[12];
s32 unk98;
/* 0x9C */ s32 : 32;
/* 0xA0 */ s32 : 32;
/* 0xA4 */ s32 : 32;
/* 0xA8 */ s32 : 32;
/* 0xAC */ s32 : 32;
#ifdef VERSION_PC
s32 : 32;
#endif
/* 0xB0 */ s16 subweaponId;
} ET_SubwpnAxe;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
s16 unk82;
s16 unk84;
s16 unk86;
s16 unk88;
s8 unk8A;
u8 unk8B[12];
s32 unk98;
s32 unk9C;
u16 unkA0;
u16 : 16;
/* 0xA4 */ s32 : 32;
/* 0xA8 */ s32 : 32;
/* 0xAC */ s32 : 32;
#ifdef VERSION_PC
s32 : 32;
#endif
/* 0xB0 */ s16 subweaponId;
} ET_AxeCrash;
typedef struct {
s16 timer;
u16 unk7E;
s16 unk80;
s16 pad82;
s32 unk84;
s32 unk88;
u16 unk8C;
} ET_VibhutiCrash;
typedef struct {
s16 unk7C;
s16 : 16;
s32 : 32;
s32 : 32;
s32 : 32;
struct Entity* parent;
/* 0x90 */ s32 : 32;
/* 0x94 */ s32 : 32;
/* 0x98 */ s32 : 32;
/* 0x9C */ s32 : 32;
/* 0xA0 */ s32 : 32;
/* 0xA4 */ s32 : 32;
/* 0xA8 */ s32 : 32;
/* 0xAC */ s32 : 32;
/* 0xB0 */ s16 subweaponId;
} ET_VibhutiCrashCloud;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
s16 : 16;
s32 : 32;
/* 0x88 */ s32 : 32;
struct Entity* parent;
/* 0x90 */ s32 : 32;
/* 0x94 */ s32 : 32;
/* 0x98 */ s32 : 32;
/* 0x9C */ s32 : 32;
/* 0xA0 */ s32 : 32;
/* 0xA4 */ s32 : 32;
/* 0xA8 */ s32 : 32;
/* 0xAC */ s32 : 32;
s16 subweaponId;
} ET_BibleBeam;
typedef struct {
u16 unk7C;
u16 unk7E;
u8 unk80;
byte pad81;
u8 unk82;
byte pad83;
s32 unk84;
struct Entity* parent;
} ET_RicRevivalColumn; // Note this is the same as CrashCross
typedef struct {
f32 unk7C;
@ -1208,38 +1436,12 @@ typedef struct {
s16 unkB0;
s32 unkB4;
s32 unkB8;
} ET_80166784;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
s16 unk82;
s16 unk84;
s16 unk86;
s16 unk88;
s8 unk8A;
u8 unk8B[12];
s32 unk98;
} ET_AguneaCrash;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
s16 unk82;
s16 unk84;
s16 unk86;
s16 unk88;
s8 unk8A;
u8 unk8B[12];
s32 unk98;
s32 unk9C;
u16 unkA0;
} ET_AxeCrash;
} ET_Whip;
typedef struct {
#ifndef VERSION_PC
s32 pad7c;
#endif
Primitive* unk80;
s16 unk84;
s16 unk86;
@ -1248,25 +1450,6 @@ typedef struct {
s16 unk90;
} ET_801291C4;
typedef struct {
s16 timer;
u16 unk7E;
s16 unk80;
s16 pad82;
s32 unk84;
s32 unk88;
u16 unk8C;
} ET_VibhutiCrash;
typedef struct {
s16 unk7C;
s16 : 16;
s32 : 32;
s32 : 32;
s32 : 32;
struct Entity* parent;
} ET_VibhutiCrashCloud;
typedef struct {
PrimLineG2* lines[4];
s16 unk8C;
@ -1274,23 +1457,6 @@ typedef struct {
s16 unk90;
} ET_8016D9C4;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
s16 unk82;
s16 unk84;
s16 unk86;
} ET_8016DF74;
typedef struct {
s16 unk7C;
s16 unk7E;
s16 unk80;
byte pad[46];
s16 unkB0;
} ET_8016E46C;
typedef struct {
struct Primitive* prim1;
struct Primitive* prim2;
@ -1298,6 +1464,7 @@ typedef struct {
struct Primitive* prim4;
s16 unk8C;
s16 unk8E;
u8 unk90;
} ET_801AF774;
typedef struct {
@ -1411,7 +1578,7 @@ typedef struct {
s32 un84;
s16 unk88;
s16 unk8A;
s32 unk8C;
struct Entity* parent;
s16 unk90;
s16 unk92;
s32 unk94;
@ -1531,6 +1698,10 @@ typedef struct {
/* 0x88 */ u8 unk88;
} ET_NZ0_311C0;
// ====== RIC ENTITIES ======
// ==========================
typedef union { // offset=0x7C
struct Primitive* prim;
char stub[0x40];
@ -1543,21 +1714,21 @@ typedef union { // offset=0x7C
ET_Entity13 ent13; // entityID 13
ET_8011E4BC et_8011E4BC;
ET_HellfireHandler hellfireHandler;
ET_ReboundStone reboundStone;
ET_8016D9C4 et_8016D9C4;
ET_8016E46C et_8016E46C;
ET_8016DF74 et_8016DF74;
ET_ReboundStoneCrashExplosion reboundStoneCrashExplosion;
ET_CrossBoomerang crossBoomerang;
ET_Vibhuti vibhuti;
ET_Subweapon subweapon;
ET_HolyWater holywater;
ET_HolyWaterFlame holywaterflame;
ET_CrashCross crashcross;
ET_AguneaCrash aguneaCrash;
ET_SubwpnAxe subwpnAxe;
ET_AxeCrash axeCrash;
ET_VibhutiCrash vibhutiCrash;
ET_VibhutiCrashCloud vibCrashCloud;
ET_RicRevivalColumn ricColumn;
ET_GiantSpinningCross giantcross;
ET_ReboundStone reboundStone;
ET_BibleBeam bibleBeam;
ET_BibleSubwpn et_BibleSubwpn;
ET_EquipItemDrop equipItemDrop;
ET_HeartDrop heartDrop;
ET_BloodDroplets bloodDroplets;
@ -1597,21 +1768,20 @@ typedef union { // offset=0x7C
ET_Merman merman;
ET_Merman_2 merman2;
ET_MermanWaterSplash mermanWaterSplash;
ET_80128C2C et_80128C2C;
ET_Agunea agunea;
ET_801291C4 et_801291C4;
ET_8017091C et_8017091C;
ET_80170F64 et_80170F64;
ET_AguneaCrash aguneaCrash;
ET_stopwatch stopwatch;
ET_StopWatch et_801719A4;
ET_stopwatchCircle et_stopwatchCircle;
ET_stopwatchSparkle et_stopWatchSparkle;
ET_stopwatch stopwatch;
ET_80161FF0 et_80161FF0;
ET_80162870 et_80162870;
ET_80166784 et_80166784;
ET_Whip whip;
ET_RichterPowerUpRing ricPowerRing;
ET_TransparentWhiteCircle whiteCircle;
ET_8016E9E4 et_8016E9E4;
ET_801719A4 et_801719A4;
ET_BibleSubwpn et_BibleSubwpn;
ET_801CF254 et_801CF254;
ET_GurkhaSword gurkhaSword;
ET_Dracula dracula;
@ -1668,17 +1838,62 @@ typedef union { // offset=0x7C
ET_NZ0_311C0 nz0311c0;
} Ext;
STATIC_ASSERT(OFF(ET_Player, anim) == OFF(ET_Weapon, anim));
STATIC_ASSERT(OFF(ET_Player, anim) == OFF(ET_WeaponUnk006, anim));
STATIC_ASSERT(OFF(ET_Player, anim) == OFF(ET_WeaponUnk012, anim));
STATIC_ASSERT(OFF(ET_Player, anim) == OFF(ET_WeaponUnk030, anim));
STATIC_ASSERT(OFF(ET_Player, anim) == OFF(ET_WeaponUnk046, anim));
STATIC_ASSERT(OFF(ET_Player, anim) == OFF(ET_KarmaCoin, anim));
STATIC_ASSERT(OFF(ET_Player, anim) == OFF(ET_Sword, anim));
STATIC_ASSERT(OFF(ET_Player, anim) == OFF(ET_HeavenSword, anim));
STATIC_ASSERT(OFF(ET_Player, anim) == OFF(ET_HeavenSword2, anim));
STATIC_ASSERT(OFF(ET_Player, anim) == OFF(ET_Shield, anim));
STATIC_ASSERT(OFF(ET_Player, anim) == OFF(ET_DarkShield, anim));
STATIC_ASSERT(OFF(ET_Player, anim) == OFF(ET_MedusaShieldLaser, anim));
STATIC_ASSERT(OFF(ET_Player, anim) == OFF(ET_ShamanShieldStar, anim));
STATIC_ASSERT(OFF(ET_Player, anim) == OFF(ET_HeraldShieldSwirlEffect, anim));
#define SYNC_FIELD(struct1, struct2, field_name) \
STATIC_ASSERT(OFF(struct1, field_name) == OFF(struct2, field_name))
SYNC_FIELD(ET_Player, ET_Weapon, anim);
SYNC_FIELD(ET_Player, ET_WeaponUnk006, anim);
SYNC_FIELD(ET_Player, ET_WeaponUnk012, anim);
SYNC_FIELD(ET_Player, ET_WeaponUnk030, anim);
SYNC_FIELD(ET_Player, ET_WeaponUnk046, anim);
SYNC_FIELD(ET_Player, ET_KarmaCoin, anim);
SYNC_FIELD(ET_Player, ET_Sword, anim);
SYNC_FIELD(ET_Player, ET_HeavenSword, anim);
SYNC_FIELD(ET_Player, ET_HeavenSword2, anim);
SYNC_FIELD(ET_Player, ET_Shield, anim);
SYNC_FIELD(ET_Player, ET_DarkShield, anim);
SYNC_FIELD(ET_Player, ET_MedusaShieldLaser, anim);
SYNC_FIELD(ET_Player, ET_ShamanShieldStar, anim);
SYNC_FIELD(ET_Player, ET_HeraldShieldSwirlEffect, anim);
SYNC_FIELD(ET_EntFactory, ET_Subweapon, parent);
SYNC_FIELD(ET_EntFactory, ET_CrossBoomerang, parent);
SYNC_FIELD(ET_EntFactory, ET_8011E4BC, parent);
SYNC_FIELD(ET_EntFactory, ET_HolyWater, parent);
SYNC_FIELD(ET_EntFactory, ET_GiantSpinningCross, parent);
SYNC_FIELD(ET_EntFactory, ET_CrashCross, parent);
SYNC_FIELD(ET_EntFactory, ET_RicRevivalColumn, parent);
SYNC_FIELD(ET_EntFactory, ET_80161FF0, parent);
SYNC_FIELD(ET_EntFactory, ET_80162870, parent);
SYNC_FIELD(ET_EntFactory, ET_PlayerBlink, parent);
SYNC_FIELD(ET_EntFactory, ET_RichterPowerUpRing, parent);
SYNC_FIELD(ET_EntFactory, ET_HitByIce, parent);
SYNC_FIELD(ET_EntFactory, ET_HitByLightning, parent);
SYNC_FIELD(ET_EntFactory, ET_ReboundStone, parent);
SYNC_FIELD(ET_EntFactory, ET_Agunea, parent);
SYNC_FIELD(ET_EntFactory, ET_801291C4, parent);
SYNC_FIELD(ET_EntFactory, ET_VibhutiCrashCloud, parent);
SYNC_FIELD(ET_EntFactory, ET_ReboundStoneCrashExplosion, parent);
SYNC_FIELD(ET_EntFactory, ET_8016E9E4, parent);
SYNC_FIELD(ET_EntFactory, ET_BibleBeam, parent);
SYNC_FIELD(ET_EntFactory, ET_BibleSubwpn, parent);
SYNC_FIELD(ET_EntFactory, ET_StopWatch, parent);
SYNC_FIELD(ET_EntFactory, ET_stopwatchCircle, parent);
SYNC_FIELD(ET_EntFactory, ET_AguneaCrash, parent);
SYNC_FIELD(ET_EntFactory, ET_8017091C, parent);
SYNC_FIELD(ET_EntFactory, ET_Teleport, parent);
SYNC_FIELD(ET_Subweapon, ET_HolyWater, subweaponId);
SYNC_FIELD(ET_Subweapon, ET_SubwpnAxe, subweaponId);
SYNC_FIELD(ET_Subweapon, ET_AxeCrash, subweaponId);
SYNC_FIELD(ET_Subweapon, ET_CrossBoomerang, subweaponId);
SYNC_FIELD(ET_Subweapon, ET_BibleSubwpn, subweaponId);
SYNC_FIELD(ET_Subweapon, ET_BibleBeam, subweaponId);
SYNC_FIELD(ET_Subweapon, ET_StopWatch, subweaponId);
SYNC_FIELD(ET_Subweapon, ET_ReboundStone, subweaponId);
SYNC_FIELD(ET_Subweapon, ET_ReboundStoneCrashExplosion, subweaponId);
SYNC_FIELD(ET_Subweapon, ET_VibhutiCrashCloud, subweaponId);
SYNC_FIELD(ET_Subweapon, ET_Agunea, subweaponId);
SYNC_FIELD(ET_Subweapon, ET_AguneaCrash, subweaponId);
SYNC_FIELD(ET_Subweapon, ET_GiantSpinningCross, subweaponId);
SYNC_FIELD(ET_Subweapon, ET_CrashCross, subweaponId);

View File

@ -82,7 +82,7 @@ typedef struct FakePrim {
// Not actually sure if this is for LineG2, but the only time LineG2
// is used is also the only time this struct is used, so we will call
// it this for now. That one use is in EntityHydroStorm.
// it this for now. That one use is in RicEntityCrashHydroStorm.
typedef struct PrimLineG2 {
struct PrimLineG2* next;
/* 0x04 */ u8 r0;

View File

@ -1320,7 +1320,7 @@ void RunMainEngine(void) {
g_PlOvl.D_8013C008();
} else {
EntityAlucard();
func_8011A4D0();
UpdatePlayerEntities();
}
g_api.o.UpdateRoomPosition();
g_api.o.Update();
@ -1809,7 +1809,7 @@ void RunMainEngine(void) {
} else {
if (g_unkGraphicsStruct.unk20 != 0xFF) {
func_8010DF70(g_unkGraphicsStruct.unk20);
func_8011A4D0();
UpdatePlayerEntities();
}
g_api.o.UpdateStageEntities();
func_80102D70();

View File

@ -73,8 +73,8 @@ PfnEntityUpdate g_DraEntityTbl[] = {
func_80124A8C,
func_8011A4C8};
// Corresponding RIC function is func_801603C4
void func_8011A4D0(void) {
// Corresponding RIC function is RicUpdatePlayerEntities
void UpdatePlayerEntities(void) {
Entity* entity;
s32 temp_s2;
s32 i;

View File

@ -311,8 +311,9 @@ void func_8011E4BC(Entity* self) {
tilePrim->posX.i.hi = (selfXPos + (rand() & 0xF)) - 7;
tilePrim->posY.i.hi = selfYPos - (rand() & 0x1F);
tilePrim->velocityY.val = 0xFFFF4000 - (rand() & 0x7FFF);
if (self->ext.et_8011E4BC.unk8C != NULL) {
tilePrim->velocityX.val = self->ext.et_8011E4BC.unk8C->unk8;
if (self->ext.et_8011E4BC.parent != NULL) {
tilePrim->velocityX.val =
self->ext.et_8011E4BC.parent->velocityX;
}
tilePrim->delay = ((i * 2) + 0xF);
break;
@ -934,7 +935,7 @@ void EntityHitByIce(Entity* self) {
// Transparent white circle closes over player
// Entity ID #38. Created by blueprint 53. No known callers.
// Near-duplicate of RIC EntityShrinkingPowerUpRing.
// Near-duplicate of RIC RicEntityShrinkingPowerUpRing.
void EntityTransparentWhiteCircle(Entity* self) {
s16 selfX;
s16 selfY;

View File

@ -469,7 +469,7 @@ void EntitySubwpnThrownDagger(Entity* self) {
}
// axe thrown when using subweapon
// near-duplicate of EntitySubwpnCrashAgunea
// near-duplicate of RicEntitySubwpnAxe
void EntitySubwpnThrownAxe(Entity* self) {
s32 sp10;
s32 sp18;
@ -981,14 +981,14 @@ void EntityHolyWaterFlame(Entity* self) {
self->hitboxWidth = 4;
self->posY.i.hi = self->posY.i.hi - 0xA;
CreateEntFactoryFromEntity(self, 0x70004U, 0);
self->ext.holywaterflame.timer = 0x50;
self->ext.holywater.timer = 0x50;
self->posY.i.hi = self->posY.i.hi + 0xA;
self->ext.holywaterflame.unk80 = (rand() & 0xF) + 0x12;
self->ext.holywater.unk80 = (rand() & 0xF) + 0x12;
self->step += 1;
return;
case 1:
angleTemp = self->ext.holywaterflame.angle;
self->ext.holywaterflame.angle += 0x180;
angleTemp = self->ext.holywater.angle;
self->ext.holywater.angle += 0x180;
angle = angleTemp;
for (i = 0; i < 4; i++) {
sp10[i] = self->posX.i.hi + (rsin(angle) >> 0xA);
@ -997,26 +997,26 @@ void EntityHolyWaterFlame(Entity* self) {
sp10[0] = self->posX.i.hi;
sp10[4] = self->posX.i.hi;
temp_v0_4 =
(rsin((s16)((self->ext.holywaterflame.timer * 64) + 0x800)) >> 8) +
self->ext.holywaterflame.unk80;
(rsin((s16)((self->ext.holywater.timer * 64) + 0x800)) >> 8) +
self->ext.holywater.unk80;
sp20[0] = self->posY.i.hi - temp_v0_4;
sp20[4] = self->posY.i.hi;
sp20[2] = (sp20[0] + sp20[4]) / 2;
sp20[1] = (sp20[0] + sp20[2]) / 2;
sp20[3] = (sp20[2] + sp20[4]) / 2;
prim = &g_PrimBuf[self->primIndex];
if (self->ext.holywaterflame.timer & 3) {
if (self->ext.holywater.timer & 3) {
self->hitboxState = 0;
} else {
self->hitboxState = 2;
}
if (--self->ext.holywaterflame.timer < 0x11) {
if (--self->ext.holywater.timer < 0x11) {
DestroyEntity(self);
return;
}
i = 0;
while (prim != NULL) {
if (self->ext.holywaterflame.timer < 0x29) {
if (self->ext.holywater.timer < 0x29) {
if (prim->g0 >= 17) {
prim->g0 -= 5;
}
@ -2016,7 +2016,7 @@ void EntitySubwpnThrownVibhuti(Entity* self) {
selfX = self->posX.i.hi;
selfY = self->posY.i.hi;
self->hitboxWidth = self->hitboxHeight = 4;
self->ext.vibhuti.timer = 0x80;
self->ext.subweapon.timer = 0x80;
fakeprim = (FakePrim*)&g_PrimBuf[self->primIndex];
fakeprimY = selfY - 8;
while (1) {
@ -2059,7 +2059,7 @@ void EntitySubwpnThrownVibhuti(Entity* self) {
collisionOffsetX = 2;
}
if (--self->ext.vibhuti.timer == 0) {
if (!--self->ext.subweapon.timer) {
DestroyEntity(self);
return;
}
@ -2098,7 +2098,7 @@ void EntitySubwpnThrownVibhuti(Entity* self) {
}
}
}
if ((self->ext.vibhuti.timer & 7) == i) {
if ((self->ext.subweapon.timer & 7) == i) {
self->posX.i.hi = fakeprim->posX.i.hi;
self->posY.i.hi = fakeprim->posY.i.hi;
if (fakeprim->drawMode & DRAW_HIDE) {
@ -2114,10 +2114,10 @@ void EntitySubwpnThrownVibhuti(Entity* self) {
}
}
if ((self->hitFlags != 0) &&
(((self->ext.vibhuti.timer + 1) & 7) == i)) {
(((self->ext.subweapon.timer + 1) & 7) == i)) {
fakeprim->drawMode = DRAW_HIDE;
}
if ((self->ext.vibhuti.timer - 1) == i) {
if ((self->ext.subweapon.timer - 1) == i) {
fakeprim->drawMode = DRAW_HIDE;
}
fakeprim->x0 = fakeprim->posX.i.hi;
@ -2181,9 +2181,9 @@ void EntitySubwpnAgunea(Entity* self) {
self->hitboxWidth = 4;
self->hitboxOffX = 4;
self->hitboxOffY = 0;
self->posY.i.hi = self->ext.et_80128C2C.unk82 =
self->posY.i.hi = self->ext.agunea.unk82 =
PLAYER.posY.i.hi + PLAYER.hitboxOffY - 8;
self->posX.i.hi = self->ext.et_80128C2C.unk80 = PLAYER.posX.i.hi;
self->posX.i.hi = self->ext.agunea.unk80 = PLAYER.posX.i.hi;
prim = &g_PrimBuf[self->primIndex];
prim->type = 2;
prim->priority = PLAYER.zPriority + 2;
@ -2207,13 +2207,13 @@ void EntitySubwpnAgunea(Entity* self) {
}
if (self->hitFlags != 0) {
self->step = 3;
self->ext.et_80128C2C.parent1 = self->ext.et_80128C2C.parent2;
self->ext.agunea.parent = self->ext.agunea.parent2;
}
break;
case 4:
self->posX.i.hi = self->ext.et_80128C2C.parent1->posX.i.hi;
self->posY.i.hi = self->ext.et_80128C2C.parent1->posY.i.hi;
if (++self->ext.et_80128C2C.unk7C >= 16) {
self->posX.i.hi = self->ext.agunea.parent->posX.i.hi;
self->posY.i.hi = self->ext.agunea.parent->posY.i.hi;
if (++self->ext.agunea.unk7C >= 16) {
if (g_PrimBuf[self->primIndex].r1 < 5) {
DestroyEntity(self);
return;
@ -2231,25 +2231,25 @@ void EntitySubwpnAgunea(Entity* self) {
(PAD_UP + PAD_SQUARE)) {
self->step = 4;
}
ent = self->ext.et_80128C2C.parent1;
ent = self->ext.agunea.parent;
if (ent->entityId == 0 ||
self->ext.et_80128C2C.unk7C != 0 &&
self->ext.agunea.unk7C != 0 &&
(ent->hitPoints > 0x7000 || ent->hitPoints == 0 ||
ent->flags & FLAG_DEAD)) {
self->step = 2;
return;
}
tempX = self->posX.i.hi = self->ext.et_80128C2C.parent1->posX.i.hi;
tempY = self->posY.i.hi = self->ext.et_80128C2C.parent1->posY.i.hi;
if ((self->ext.et_80128C2C.unk7C % 12) == 0) {
tempX = self->posX.i.hi = self->ext.agunea.parent->posX.i.hi;
tempY = self->posY.i.hi = self->ext.agunea.parent->posY.i.hi;
if ((self->ext.agunea.unk7C % 12) == 0) {
self->posX.i.hi += ((rand() & 0xF) - 8);
self->posY.i.hi += ((rand() & 0xF) - 8);
if (self->ext.et_80128C2C.unk84 == 0) {
if (self->ext.agunea.unk84 == 0) {
CreateEntFactoryFromEntity(self, FACTORY(0, 23), 0);
PlaySfx(SFX_THUNDER_B);
CreateEntFactoryFromEntity(self, FACTORY(0x200, 61), 0);
self->ext.et_80128C2C.unk84++;
self->ext.agunea.unk84++;
} else {
heartCost = 5;
// 0x4d is the item ID for the heart broach.
@ -2276,7 +2276,7 @@ void EntitySubwpnAgunea(Entity* self) {
}
self->posX.i.hi = tempX;
self->posY.i.hi = tempY;
self->ext.et_80128C2C.unk7C++;
self->ext.agunea.unk7C++;
break;
}
prim = &g_PrimBuf[self->primIndex];
@ -2293,8 +2293,8 @@ void EntitySubwpnAgunea(Entity* self) {
if (tempX < 5) {
prim->drawMode |= DRAW_HIDE;
}
prim->x0 = self->ext.et_80128C2C.unk80;
prim->y0 = self->ext.et_80128C2C.unk82;
prim->x0 = self->ext.agunea.unk80;
prim->y0 = self->ext.agunea.unk82;
prim->x1 = self->posX.i.hi;
prim->y1 = self->posY.i.hi;
return;

View File

@ -11,7 +11,7 @@
static TeleportCheck GetTeleportToOtherCastle(void) {
// Is player in the pose when pressing UP?
if (PLAYER.step != 0 || PLAYER.step_s != 1) {
if (PLAYER.step != PL_S_STAND || PLAYER.step_s != 1) {
return TELEPORT_CHECK_NONE;
}
@ -101,7 +101,7 @@ void RicInit(s16 initParam) {
g_Player.unk04 = 1;
g_Player.pl_vram_flag = 1;
RicSetStand(0);
PLAYER.anim = D_80155480;
PLAYER.anim = ric_anim_stand_relax;
g_Player.unk5C = initParam;
if (g_StageId == STAGE_ST0) {
g_IsPrologueStage = true;
@ -110,7 +110,7 @@ void RicInit(s16 initParam) {
}
g_PlayerDraw->enableColorBlend = 0;
RicDebugOff();
for (i = 0; i < 0x20; i++) {
for (i = 0; i < LEN(D_80175958); i++) {
radius = (rand() & 0x3FF) + 0x100;
intensity = (rand() & 0xFF) + 0x100;
val = rcos(radius) * 0x10;
@ -657,7 +657,8 @@ block_48:
if (PLAYER.anim == D_801556C4) {
PLAYER.palette = D_80154574[PLAYER.animFrameIdx];
}
if ((PLAYER.anim == ric_anim_stand_in_air) && (PLAYER.animFrameIdx == 4)) {
if ((PLAYER.anim == ric_ric_anim_stand_in_air) &&
(PLAYER.animFrameIdx == 4)) {
PLAYER.palette = D_80154594[PLAYER.animFrameDuration & 3];
}
if ((PLAYER.step == PL_S_DEAD) && (PLAYER.animFrameDuration < 0)) {

View File

@ -57,7 +57,7 @@ void RicHandleStand(void) {
case 0:
if (RicCheckFacing() == 0) {
if (g_Player.padPressed & PAD_UP) {
RicSetAnimation(D_80155394);
RicSetAnimation(ric_anim_press_up);
PLAYER.step_s = 1;
break;
}
@ -154,7 +154,7 @@ void RicHandleRun(void) {
RicSetStand(0);
if (g_Player.D_80072F00[PL_T_RUN] == 0) {
if (!(g_Player.pl_vram_flag & 0xC)) {
RicSetAnimation(D_8015539C);
RicSetAnimation(ric_anim_stop_run);
RicCreateEntFactoryFromEntity(
g_CurrentEntity, FACTORY(0, 0), 0);
}
@ -377,7 +377,7 @@ void RicHandleCrouch(void) {
if (PLAYER.animFrameDuration != -1) {
return;
}
RicSetAnimation(anim_crouch);
RicSetAnimation(ric_anim_crouch);
PLAYER.step_s = 0;
return;
case 0x2:
@ -394,7 +394,7 @@ void RicHandleCrouch(void) {
break;
case 0x3:
if (PLAYER.animFrameDuration < 0) {
RicSetAnimation(anim_crouch);
RicSetAnimation(ric_anim_crouch);
PLAYER.step_s = 0;
return;
}
@ -420,7 +420,7 @@ void RicHandleCrouch(void) {
}
g_Player.unk46 = 0;
PLAYER.step_s = 0;
RicSetAnimation(anim_crouch);
RicSetAnimation(ric_anim_crouch);
}
break;
case 0x41:
@ -428,7 +428,7 @@ void RicHandleCrouch(void) {
if (!(g_Player.padPressed & PAD_SQUARE)) {
g_Player.unk46 = 0;
PLAYER.step_s = 0;
RicSetAnimation(anim_crouch);
RicSetAnimation(ric_anim_crouch);
}
break;
}
@ -484,14 +484,15 @@ void func_80159C04(void) {
void RicHandleDead(
s32 damageEffects, s32 damageKind, s32 prevStep, s32 prevStepS);
static s32 ric_hit_stun_timer;
void RicHandleHit(s32 damageEffect, u32 damageKind, s16 prevStep) {
DamageParam damage;
s32 xShift;
s32 i;
bool step_s_zero = false;
if (D_80173B64 != 0) {
D_80173B64--;
if (ric_hit_stun_timer) {
ric_hit_stun_timer--;
}
switch (PLAYER.step_s) {
case 0:
@ -678,7 +679,7 @@ void RicHandleHit(s32 damageEffect, u32 damageKind, s16 prevStep) {
}
if (g_Player.pl_vram_flag & 2) {
func_80158B04(1);
D_80173B64 = 0x18;
ric_hit_stun_timer = 0x18;
PLAYER.velocityX /= 2;
PLAYER.velocityY = 0;
PLAYER.step_s = 5;
@ -734,7 +735,7 @@ void RicHandleHit(s32 damageEffect, u32 damageKind, s16 prevStep) {
break;
}
}
D_80173B64 = 8;
ric_hit_stun_timer = 8;
g_api.PlaySfx(SFX_WALL_DEBRIS_B);
PLAYER.velocityY = FIX(-2.5);
g_api.func_80102CD8(2);
@ -752,7 +753,7 @@ void RicHandleHit(s32 damageEffect, u32 damageKind, s16 prevStep) {
}
break;
case 3:
if (D_80173B64 == 0) {
if (!ric_hit_stun_timer) {
RicSetSpeedX(FIX(0.75));
if (RicCheckInput(
CHECK_80 | CHECK_GRAVITY_HIT | CHECK_GROUND_AFTER_HIT)) {
@ -762,7 +763,7 @@ void RicHandleHit(s32 damageEffect, u32 damageKind, s16 prevStep) {
break;
case 5:
RicDecelerateX(0x2000);
if (D_80173B64 != 0) {
if (ric_hit_stun_timer) {
if ((g_Player.pl_vram_flag & 2) && !(g_GameTimer & 3)) {
func_80158B04(0);
}
@ -863,13 +864,25 @@ void RicHandleBossGrab(void) {
}
// Compare to DRA func_80115394
enum DeathKind {
DEATH_GENERIC,
DEATH_BY_FIRE,
DEATH_BY_THUNDER,
DEATH_BY_ICE,
};
static u8 dead_dissolve_bmp[0x1400];
static s16 D_80174F68;
STATIC_PAD_BSS(2);
static s16 D_80174F6C;
STATIC_PAD_BSS(2);
static enum DeathKind death_kind;
void RicHandleDead(
s32 damageEffects, s32 damageKind, s32 prevStep, s32 prevStepS) {
s32 j;
s32 i;
u8* s2;
u8* imgPtr;
s32 alwaysZero = 0;
s32 disableColorChange = 0;
PlayerDraw* playerDraw = &g_PlayerDraw[0];
switch (PLAYER.step_s) {
@ -888,7 +901,7 @@ void RicHandleDead(
// RIC blueprint 53 has child 9, func_80161C2C
RicCreateEntFactoryFromEntity(
g_CurrentEntity, FACTORY(0x200, 53), 0);
D_80174F70 = 1;
death_kind = DEATH_BY_FIRE;
} else if (damageEffects & ELEMENT_THUNDER) {
func_8015FA5C(2);
// RIC blueprint 33 has child 31, EntityPlayerBlinkWhite
@ -899,7 +912,7 @@ void RicHandleDead(
g_CurrentEntity, FACTORY(0x100, 48), 0);
RicCreateEntFactoryFromEntity(
g_CurrentEntity, FACTORY(0x200, 48), 0);
D_80174F70 = 2;
death_kind = DEATH_BY_THUNDER;
} else if (damageEffects & ELEMENT_ICE) {
func_8015FA5C(3);
// RIC blueprint 33 has child 31, EntityPlayerBlinkWhite
@ -909,7 +922,7 @@ void RicHandleDead(
RicCreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0, 47), 0);
RicCreateEntFactoryFromEntity(
g_CurrentEntity, FACTORY(0x100, 47), 0);
D_80174F70 = 3;
death_kind = DEATH_BY_ICE;
PLAYER.drawMode = DRAW_TPAGE2 | DRAW_TPAGE;
} else {
func_8015FA5C(1);
@ -919,7 +932,7 @@ void RicHandleDead(
// RIC blueprint 11 has child 5, func_8016147C
RicCreateEntFactoryFromEntity(
g_CurrentEntity, FACTORY(0x500, 11), 0);
D_80174F70 = 0;
death_kind = DEATH_GENERIC;
}
playerDraw->r0 = playerDraw->b0 = playerDraw->g0 = playerDraw->r1 =
playerDraw->b1 = playerDraw->g1 = playerDraw->r2 = playerDraw->b2 =
@ -940,7 +953,7 @@ void RicHandleDead(
if (PLAYER.velocityY > FIX(1.0 / 16)) {
PLAYER.velocityY >>= 2;
PLAYER.velocityX >>= 3;
StoreImage(&D_801545A0, D_80173B68);
StoreImage(&D_801545A0, dead_dissolve_bmp);
D_80174F6C = 0;
D_80174F68 = 0x40;
PLAYER.step_s++;
@ -959,7 +972,7 @@ void RicHandleDead(
PLAYER.velocityY = 0;
}
for (i = 0; i < 4; i++) {
s2 = imgPtr = D_80173B68;
s2 = imgPtr = dead_dissolve_bmp;
s2 += ((D_80174F6C >> 1) & 7);
s2 += ((D_80174F6C & 0xFF) >> 4) << 6;
for (j = 0; j < 0x28; j++) {
@ -983,8 +996,8 @@ void RicHandleDead(
break;
}
// Always happens, kind of weird
if (alwaysZero == 0) {
if (D_80174F70 == 0) {
if (!disableColorChange) {
if (death_kind == DEATH_GENERIC) {
if (playerDraw->r0 < 0xF8) {
playerDraw->r0 += 2;
}
@ -997,7 +1010,7 @@ void RicHandleDead(
playerDraw->g2 = playerDraw->b3 = playerDraw->g3 =
playerDraw->g0;
}
if (D_80174F70 == 1 || D_80174F70 == 2) {
if (death_kind == DEATH_BY_FIRE || death_kind == DEATH_BY_THUNDER) {
if (playerDraw->g0 > 8) {
playerDraw->g0 -= 2;
}
@ -1006,7 +1019,7 @@ void RicHandleDead(
playerDraw->b2 = playerDraw->g2 = playerDraw->b3 =
playerDraw->g3 = playerDraw->g0;
}
if (D_80174F70 == 3) {
if (death_kind == DEATH_BY_ICE) {
if ((playerDraw->r0 > 8) && (g_Timer & 1)) {
playerDraw->r0 -= 1;
}
@ -1080,14 +1093,14 @@ void RicHandleGenericSubwpnCrash(void) {
}
}
static s32 throw_dagger_timer;
void RicHandleThrowDaggers(void) {
if (PLAYER.step_s == 0) {
D_80174F74 = 0x200;
throw_dagger_timer = 0x200;
PLAYER.step_s++;
} else {
RicCheckFacing();
D_80174F74--;
if (D_80174F74 == 0) {
if (!--throw_dagger_timer) {
g_Player.unk46 = 0;
RicSetStand(0);
g_Player.unk4E = 1;
@ -1097,17 +1110,18 @@ void RicHandleThrowDaggers(void) {
RicSetJump();
g_Player.unk46 = 0;
g_Player.unk4E = 1;
D_80174F74 = 0;
throw_dagger_timer = 0;
}
if (!(g_Player.pl_vram_flag & 1)) {
RicSetFall();
g_Player.unk46 = 0;
g_Player.unk4E = 1;
D_80174F74 = 0;
throw_dagger_timer = 0;
}
}
// This happens when he dies in prologue and gets saved by Maria.
static s32 dead_prologue_timer;
void RicHandleDeadPrologue(void) {
switch (PLAYER.step_s) {
case 0:
@ -1150,7 +1164,7 @@ void RicHandleDeadPrologue(void) {
RicCreateEntFactoryFromEntity(g_CurrentEntity, FACTORY(0, 22), 0);
g_DeadPrologueTimer = 0x30;
g_api.PlaySfx(0x6E2);
D_80174F78 = 0xA0;
dead_prologue_timer = 0xA0;
PLAYER.step_s++;
}
break;
@ -1172,8 +1186,8 @@ void RicHandleDeadPrologue(void) {
if (g_Status.hp < g_Status.hpMax) {
g_Status.hp++;
}
D_80174F78--;
if ((D_80174F78 >= 0) && (D_80174F78 % 20 == 0)) {
dead_prologue_timer--;
if ((dead_prologue_timer >= 0) && (dead_prologue_timer % 20 == 0)) {
g_api.PlaySfx(NA_SE_PL_RIC_UNK_6E2);
}
break;
@ -1185,8 +1199,8 @@ void RicHandleDeadPrologue(void) {
if (g_Status.hp < g_Status.hpMax) {
g_Status.hp++;
}
D_80174F78--;
if ((D_80174F78 >= 0) && (D_80174F78 % 20 == 0)) {
dead_prologue_timer--;
if ((dead_prologue_timer >= 0) && (dead_prologue_timer % 20 == 0)) {
g_api.PlaySfx(NA_SE_PL_RIC_UNK_6E2);
}
break;

View File

@ -130,19 +130,19 @@ void func_8015CC70(s16 arg0) {
void RicSetCrouch(s32 kind, s32 velocityX) {
RicSetStep(PL_S_CROUCH);
RicSetAnimation(anim_crouch);
RicSetAnimation(ric_anim_crouch);
PLAYER.velocityX = velocityX;
PLAYER.velocityY = 0;
if (kind == 1) {
PLAYER.anim = anim_land_strong_impact;
PLAYER.anim = ric_anim_crouch_from_stand2;
PLAYER.step_s = 4;
}
if (kind == 2) {
PLAYER.anim = anim_crouch_from_stand;
PLAYER.anim = ric_anim_crouch_from_stand;
PLAYER.step_s = 1;
}
if (kind == 3) {
PLAYER.anim = anim_land_from_run;
PLAYER.anim = ric_anim_land_from_air_run;
PLAYER.step_s = 4;
}
}
@ -153,7 +153,7 @@ void RicSetStand(s32 velocityX) {
PLAYER.velocityY = 0;
g_Player.unk44 = 0;
RicSetStep(PL_S_STAND);
RicSetAnimation(anim_stand);
RicSetAnimation(ric_anim_stand);
}
void RicSetWalk(s32 arg0) {

View File

@ -172,7 +172,7 @@ bool RicDoCrash(void) {
break;
case SUBWPN_AXE:
RicSetStep(PL_S_STAND_IN_AIR);
RicSetAnimation(ric_anim_stand_in_air);
RicSetAnimation(ric_ric_anim_stand_in_air);
PLAYER.velocityY = FIX(-4.6875);
if (g_Player.unk72) {
PLAYER.velocityY = 0;
@ -207,7 +207,7 @@ bool RicDoCrash(void) {
break;
case SUBWPN_CROSS:
RicSetStep(PL_S_STAND_IN_AIR);
RicSetAnimation(ric_anim_stand_in_air);
RicSetAnimation(ric_ric_anim_stand_in_air);
PLAYER.velocityY = FIX(-4.6875);
if (g_Player.unk72) {
PLAYER.velocityY = 0;
@ -461,10 +461,11 @@ bool RicCheckInput(s32 checks) {
return false;
}
static s32 debug_wait_info_timer;
static void DebugShowWaitInfo(const char* msg) {
g_CurrentBuffer = g_CurrentBuffer->next;
FntPrint(msg);
if (g_DebugWaitInfoTimer++ & 4) {
if (debug_wait_info_timer++ & 4) {
FntPrint("\no\n");
}
DrawSync(0);
@ -1070,7 +1071,8 @@ Entity* RicGetFreeEntityReverse(s16 start, s16 end) {
return NULL;
}
void func_8015F9F0(Entity* entity) {
static s32 D_80174F80[11];
static void func_8015F9F0(Entity* entity) {
s32 i;
s32 enemyId;
@ -1079,8 +1081,8 @@ void func_8015F9F0(Entity* entity) {
return;
}
for (i = 0;; ++i) {
for (enemyId = 2; enemyId < 11; ++enemyId) {
for (i = 0;; i++) {
for (enemyId = 2; enemyId < LEN(D_80174F80); ++enemyId) {
if (D_80174F80[enemyId] == i) {
++D_80174F80[enemyId];
entity->enemyId = enemyId;
@ -1090,6 +1092,14 @@ void func_8015F9F0(Entity* entity) {
}
}
static u8 D_80174FAC;
STATIC_PAD_BSS(3);
static u8 D_80174FB0;
STATIC_PAD_BSS(3);
static u8 D_80174FB4;
STATIC_PAD_BSS(3);
static u8 D_80174FB8;
STATIC_PAD_BSS(3);
void func_8015FA5C(s32 arg0) {
D_80174FAC = D_80154674[arg0][0];
D_80174FB0 = D_80154674[arg0][1];
@ -1099,7 +1109,7 @@ void func_8015FA5C(s32 arg0) {
void RicSetSubweaponParams(Entity* entity) {
u16 attack;
SubweaponDef* subwpn = &D_80154688[entity->ext.generic.unkB0];
SubweaponDef* subwpn = &D_80154688[entity->ext.subweapon.subweaponId];
if ((g_Player.D_80072F00[PL_T_INVINCIBLE]) != NULL) {
attack = subwpn->attack * 2;
@ -1201,6 +1211,7 @@ s32 func_8015FDB0(POLY_GT4* poly, s16 posX, s16 posY) {
}
// Corresponding DRA function is func_80119F70
static Point16 D_80174FBC[16];
void func_8015FEA8(Entity* entity) {
Primitive* prim;
s16 temp_xRand;
@ -1212,7 +1223,8 @@ void func_8015FEA8(Entity* entity) {
switch (entity->step) {
case 0:
entity->primIndex = (s16)g_api.AllocPrimitives(PRIM_GT4, 16);
entity->primIndex =
(s16)g_api.AllocPrimitives(PRIM_GT4, LEN(D_80174FBC));
if (entity->primIndex == -1) {
DestroyEntity(entity);
return;
@ -1221,7 +1233,7 @@ void func_8015FEA8(Entity* entity) {
hitboxX = PLAYER.posX.i.hi + PLAYER.hitboxOffX;
hitboxY = PLAYER.posY.i.hi + PLAYER.hitboxOffY;
prim = &g_PrimBuf[entity->primIndex];
for (i = 0; i < 16; i++) {
for (i = 0; i < LEN(D_80174FBC); i++) {
temp_xRand = hitboxX + rand() % 24 - 12;
temp_yRand = rand();
D_80174FBC[i].x = temp_xRand;
@ -1285,6 +1297,7 @@ static AnimationFrame anim_80154924[] = {
{2, FRAME(9, 0)}, {2, FRAME(10, 0)},
{2, FRAME(11, 0)}, {2, FRAME(12, 0)},
{2, FRAME(13, 0)}, A_END};
static s32 D_80174FFC;
void func_801601DC(Entity* entity) {
s16 posX;
s16 posY;
@ -1331,37 +1344,103 @@ void func_801601DC(Entity* entity) {
}
}
void func_801603B4(Entity* self) {}
static void RicEntityDummy(Entity* self) {}
void func_801603BC(void) {}
void RicEntityGiantSpinningCross(Entity*);
void RicEntityFactory(Entity* self);
void func_80160FC4(Entity* self);
void RicEntitySubwpnCross(Entity* self);
void func_80169C10(Entity* self);
void func_8016147C(Entity* self);
void RicEntitySubwpnCrossTrail(Entity* self);
void RicEntitySubwpnHolyWater(Entity* self);
void RicEntitySubwpnHolyWaterFlame(Entity* self);
void func_80161C2C(Entity* self);
void RicEntityWhip(Entity* self);
void RicEntityCrashHydroStorm(Entity* self);
void RicEntityCrashCrossBeam(Entity* self);
void RicEntitySubwpnCrashCross(Entity* self);
void func_80167A58(Entity* self);
void func_80167A60(Entity* self);
void func_8016779C(Entity* self);
void func_80167964(Entity* self);
void RicEntityDummy(Entity* self);
void func_80161EF8(Entity* self);
void func_80167A68(Entity* self);
void RicEntityRevivalColumn(Entity* self);
void func_80161FF0(Entity* self);
void func_80160C38(Entity* self);
void RicEntityBladeDash(Entity* self);
void func_801623E0(Entity* self);
void func_80162604(Entity* self);
void func_80162C84(Entity* self);
void func_80162870(Entity* self);
void func_80160F0C(Entity* self);
void func_80162C7C(Entity* self);
void RicEntityPlayerBlinkWhite(Entity* self);
void RicEntitySubwpnCrashCrossParticles(Entity* self);
void func_801641A0(Entity* self);
void RicEntityShrinkingPowerUpRing(Entity* self);
void func_80167A70(Entity* self);
void RicEntitySubwpnAxe(Entity* self);
void RicEntityCrashAxe(Entity* self);
void RicEntitySubwpnDagger(Entity* self);
void func_80160D2C(Entity* self);
void RicEntityHitByIce(Entity* self);
void RicEntityHitByLightning(Entity* self);
void RicEntitySubwpnReboundStone(Entity* self);
void RicEntitySubwpnThrownVibhuti(Entity* self);
void RicEntitySubwpnAgunea(Entity* self);
void RicEntityAguneaHitEnemy(Entity* self);
void RicEntityCrashVibhuti(Entity* self);
void RicEntityVibhutiCrashCloud(Entity* self);
void RicEntityCrashReboundStone(Entity* self);
void func_8016D9C4(Entity* self);
void func_8016DF74(Entity* self);
void RicEntityCrashBible(Entity* self);
void RicEntityCrashBibleBeam(Entity* self);
void RicEntitySubpwnBible(Entity* self);
void RicEntitySubpwnBibleTrail(Entity* self);
void RicEntitySubwpnStopwatch(Entity* self);
void RicEntitySubwpnStopwatchCircle(Entity* self);
void func_801705EC(Entity* self);
void func_8016F198(Entity* self);
void RicEntityAguneaCircle(Entity* self);
void RicEntityAguneaLightning(Entity* self);
void RicEntityCrashReboundStoneParticles(Entity* self);
void func_801601DC(Entity* self);
void func_8015FEA8(Entity* self);
void RicEntityCrashStopwatchDoneSparkle(Entity* self);
void func_80170548(Entity* self);
void RicEntityTeleport(Entity* self);
void RicEntityDummy(Entity* self);
PfnEntityUpdate g_RicEntityTbl[] = {
func_801603B4,
RicEntityEntFactory,
RicEntityDummy,
RicEntityFactory,
func_80160FC4,
EntityCrossBoomerang,
RicEntitySubwpnCross,
func_80169C10,
func_8016147C,
EntityCrossShadow,
RicEntityHolyWater,
RicEntityHolyWaterFlame,
RicEntitySubwpnCrossTrail,
RicEntitySubwpnHolyWater,
RicEntitySubwpnHolyWaterFlame,
func_80161C2C,
func_80166784,
EntityHydroStorm,
RicEntityGiantSpinningCross,
RicEntityWhip,
RicEntityCrashHydroStorm,
RicEntityCrashCrossBeam,
RicEntitySubwpnCrashCross,
func_80167A58,
func_80167A60,
func_8016779C,
func_80167964,
func_801603B4,
RicEntityDummy,
func_80161EF8,
func_80167A68,
EntityRichterRevivalColumn,
RicEntityRevivalColumn,
func_80161FF0,
func_80160C38,
BladeDashHelper,
RicEntityBladeDash,
func_801623E0,
func_80162604,
func_80162C84,
@ -1371,11 +1450,11 @@ PfnEntityUpdate g_RicEntityTbl[] = {
RicEntityPlayerBlinkWhite,
RicEntitySubwpnCrashCrossParticles,
func_801641A0,
EntityShrinkingPowerUpRing,
RicEntityShrinkingPowerUpRing,
func_80167A70,
EntitySubwpnCrashAgunea,
EntitySubwpnCrashAxe,
RicEntitySubwpnThrownDagger,
RicEntitySubwpnAxe,
RicEntityCrashAxe,
RicEntitySubwpnDagger,
func_80160D2C,
RicEntityHitByIce,
RicEntityHitByLightning,
@ -1383,31 +1462,31 @@ PfnEntityUpdate g_RicEntityTbl[] = {
RicEntitySubwpnThrownVibhuti,
RicEntitySubwpnAgunea,
RicEntityAguneaHitEnemy,
EntitySubwpnCrashVibhuti,
RicEntityCrashVibhuti,
RicEntityVibhutiCrashCloud,
func_8016E324,
RicEntityCrashReboundStone,
func_8016D9C4,
func_8016DF74,
EntityBiblePage,
EntityBiblePageBeam,
RicEntitySubwpnBible,
func_80172AE8,
EntityStopwatch,
EntityStopwatchCircle,
RicEntityCrashBible,
RicEntityCrashBibleBeam,
RicEntitySubpwnBible,
RicEntitySubpwnBibleTrail,
RicEntitySubwpnStopwatch,
RicEntitySubwpnStopwatchCircle,
func_801705EC,
func_8016F198,
EntityAguneaCircle,
EntityAguneaLightning,
func_8016D920,
RicEntityAguneaCircle,
RicEntityAguneaLightning,
RicEntityCrashReboundStoneParticles,
func_801601DC,
func_8015FEA8,
StopwatchCrashDoneSparkle,
RicEntityCrashStopwatchDoneSparkle,
func_80170548,
RicEntityTeleport,
func_801603B4};
RicEntityDummy};
// Corresponding DRA function is func_8011A4D0
void func_801603C4(void) {
// Corresponding DRA function is UpdatePlayerEntities
void RicUpdatePlayerEntities(void) {
SubweaponDef subwpn;
Entity* entity;
s32 i;

View File

@ -7,7 +7,7 @@ Entity* RicGetFreeEntityReverse(s16 start, s16 end);
static u8 entity_ranges[][2] = {
{0x30, 0x3F}, {0x20, 0x2F}, {0x10, 0x1E}, {0x10, 0x3F},
{0x1F, 0x1F}, {0x30, 0x30}, {0x10, 0x2F}, {0x00, 0x00}};
void RicEntityEntFactory(Entity* self) {
void RicEntityFactory(Entity* self) {
Entity* newEntity;
s16 unk96Copy;
s16 i;
@ -65,7 +65,7 @@ void RicEntityEntFactory(Entity* self) {
case 4:
self->posX.val = g_Entities->posX.val;
self->posY.val = PLAYER.posY.val;
if (PLAYER.step != 25) {
if (PLAYER.step != PL_S_RUN) {
self->entityId = 0;
return;
}
@ -81,7 +81,7 @@ void RicEntityEntFactory(Entity* self) {
case 7:
self->posX.val = g_Entities->posX.val;
self->posY.val = PLAYER.posY.val;
if (PLAYER.step != 10) {
if (PLAYER.step != PL_S_HIT) {
setIdZeroAndReturn:
self->entityId = 0;
return;
@ -157,7 +157,7 @@ void RicEntityEntFactory(Entity* self) {
}
void func_80160C38(Entity* entity) {
if (PLAYER.step != 23) {
if (PLAYER.step != PL_S_SLIDE) {
DestroyEntity(entity);
} else {
entity->posX.i.hi = PLAYER.posX.i.hi;
@ -169,12 +169,12 @@ void func_80160C38(Entity* entity) {
entity->hitboxOffY = 0xC;
entity->hitboxHeight = 9;
entity->hitboxWidth = 9;
entity->ext.generic.unkB0 = 0x12;
entity->ext.subweapon.subweaponId = PL_W_KICK;
RicSetSubweaponParams(entity);
entity->ext.generic.unk7C.s = entity->hitboxState;
entity->ext.subweapon.timer = entity->hitboxState;
entity->step++;
}
entity->hitboxState = entity->ext.generic.unk7C.s;
entity->hitboxState = entity->ext.subweapon.timer;
if (PLAYER.animFrameIdx < 2) {
entity->hitboxState = 0;
}
@ -185,20 +185,19 @@ void func_80160C38(Entity* entity) {
}
void func_80160D2C(Entity* self) {
if (PLAYER.step != 26) {
if (PLAYER.step != PL_S_SLIDE_KICK) {
DestroyEntity(self);
return;
}
self->posX.i.hi = PLAYER.posX.i.hi;
self->posY.i.hi = PLAYER.posY.i.hi;
self->facingLeft = PLAYER.facingLeft;
if (self->step == 0) {
self->flags = FLAG_UNK_20000 | FLAG_UNK_40000 | FLAG_UNK_04000000;
self->hitboxOffX = 0x14;
self->hitboxHeight = 9;
self->hitboxWidth = 9;
self->ext.generic.unkB0 = 0x17;
self->ext.subweapon.subweaponId = PL_W_23;
RicSetSubweaponParams(self);
self->step++;
}
@ -211,7 +210,7 @@ void func_80160D2C(Entity* self) {
self->hitboxOffY = 12;
}
if (self->hitFlags != 0) {
if (self->hitFlags) {
g_Player.unk44 |= 0x80;
} else {
g_Player.unk44 &= ~0x80;
@ -220,7 +219,7 @@ void func_80160D2C(Entity* self) {
}
// created from a blueprint, #24
void BladeDashHelper(Entity* self) {
void RicEntityBladeDash(Entity* self) {
if (PLAYER.step != PL_S_BLADEDASH) {
DestroyEntity(self);
} else {
@ -244,7 +243,7 @@ void BladeDashHelper(Entity* self) {
}
void func_80160F0C(Entity* self) {
if (PLAYER.step != 8) {
if (PLAYER.step != PL_S_HIGHJUMP) {
DestroyEntity(self);
return;
}
@ -515,7 +514,8 @@ void func_8016147C(Entity* self) {
tilePrim->posX.i.hi = ((selfXPos + (rand() & 0xF)) - 7);
tilePrim->posY.i.hi = selfYPos - (rand() & 0xF);
tilePrim->velocityY.val = (FIX(-0.75) - (rand() & 0x7FFF));
tilePrim->velocityX.val = self->ext.et_8011E4BC.unk8C->unk8;
tilePrim->velocityX.val =
self->ext.et_8011E4BC.parent->velocityX;
tilePrim->delay = ((rand() & 0xF) + 0x10);
break;
case 4:
@ -905,8 +905,8 @@ void func_801623E0(Entity* entity) {
DestroyEntity(entity);
return;
}
entity->ext.generic.unk7E.modeU16 = 32;
entity->ext.generic.unk7C.s = 32;
entity->ext.et_80161FF0.unk7E = 32;
entity->ext.et_80161FF0.unk7C = 32;
prim = &g_PrimBuf[entity->primIndex];
prim->u2 = 64;
prim->u0 = 64;
@ -926,9 +926,9 @@ void func_801623E0(Entity* entity) {
break;
case 1:
entity->ext.generic.unk7C.s++;
entity->ext.generic.unk7E.modeU16++;
if (entity->ext.generic.unk7C.s >= 45) {
entity->ext.et_80161FF0.unk7C++;
entity->ext.et_80161FF0.unk7E++;
if (entity->ext.et_80161FF0.unk7C >= 45) {
DestroyEntity(entity);
return;
}
@ -936,14 +936,14 @@ void func_801623E0(Entity* entity) {
}
prim = &g_PrimBuf[entity->primIndex];
prim->x0 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
prim->y0 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
prim->x1 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
prim->y1 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
prim->x2 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
prim->y2 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
prim->x3 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
prim->y3 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
prim->x0 = entity->posX.i.hi - entity->ext.et_80161FF0.unk7C;
prim->y0 = entity->posY.i.hi - entity->ext.et_80161FF0.unk7E;
prim->x1 = entity->posX.i.hi + entity->ext.et_80161FF0.unk7C;
prim->y1 = entity->posY.i.hi - entity->ext.et_80161FF0.unk7E;
prim->x2 = entity->posX.i.hi - entity->ext.et_80161FF0.unk7C;
prim->y2 = entity->posY.i.hi + entity->ext.et_80161FF0.unk7E;
prim->x3 = entity->posX.i.hi + entity->ext.et_80161FF0.unk7C;
prim->y3 = entity->posY.i.hi + entity->ext.et_80161FF0.unk7E;
prim->clut = (LOH(g_Timer) & 1) + 0x13E;
}
@ -958,8 +958,8 @@ void func_80162604(Entity* entity) {
primIndex = g_api.AllocPrimitives(PRIM_GT4, 1);
entity->primIndex = primIndex;
if (primIndex != -1) {
entity->ext.generic.unk7E.modeU16 = 0;
entity->ext.generic.unk7C.s = 0;
entity->ext.et_80161FF0.unk7E = 0;
entity->ext.et_80161FF0.unk7C = 0;
prim = &g_PrimBuf[entity->primIndex];
prim->v1 = 192;
prim->v0 = 192;
@ -1007,14 +1007,14 @@ void func_80162604(Entity* entity) {
def:
default:
prim = &g_PrimBuf[entity->primIndex];
prim->x0 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
prim->y0 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
prim->x1 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
prim->y1 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
prim->x2 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
prim->y2 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
prim->x3 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
prim->y3 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
prim->x0 = entity->posX.i.hi - entity->ext.et_80161FF0.unk7C;
prim->y0 = entity->posY.i.hi - entity->ext.et_80161FF0.unk7E;
prim->x1 = entity->posX.i.hi + entity->ext.et_80161FF0.unk7C;
prim->y1 = entity->posY.i.hi - entity->ext.et_80161FF0.unk7E;
prim->x2 = entity->posX.i.hi - entity->ext.et_80161FF0.unk7C;
prim->y2 = entity->posY.i.hi + entity->ext.et_80161FF0.unk7E;
prim->x3 = entity->posX.i.hi + entity->ext.et_80161FF0.unk7C;
prim->y3 = entity->posY.i.hi + entity->ext.et_80161FF0.unk7E;
break;
}
}
@ -1110,3 +1110,77 @@ void func_80162870(Entity* self) {
}
void func_80162C7C(Entity* self) {}
static AnimationFrame anim_80154ED4[] = {
{4, FRAME(1, 0)}, {4, FRAME(2, 0)}, {4, FRAME(3, 0)},
{4, FRAME(4, 0)}, {4, FRAME(5, 0)}, {4, FRAME(6, 0)},
{4, FRAME(7, 0)}, {4, FRAME(8, 0)}, A_LOOP_AT(0)};
static AnimationFrame anim_80154EF8[] = {
{0x08, FRAME(0x09, 0)}, {0x08, FRAME(0x0D, 0)}, {0x40, FRAME(0x0A, 0)},
{0x02, FRAME(0x0B, 0)}, {0x02, FRAME(0x0C, 0)}, {0x06, FRAME(0x0D, 0)},
{0x07, FRAME(0x0E, 0)}, {0x06, FRAME(0x0F, 0)}, {0x05, FRAME(0x0E, 0)},
{0x04, FRAME(0x0D, 0)}, {0x03, FRAME(0x0F, 0)}, {0x03, FRAME(0x0E, 0)},
{0x03, FRAME(0x0D, 0)}, {0x03, FRAME(0x0E, 0)}, {0x03, FRAME(0x0F, 0)},
{0x03, FRAME(0x0E, 0)}, {0x03, FRAME(0x0D, 0)}, {0x04, FRAME(0x0E, 0)},
{0x05, FRAME(0x0F, 0)}, {0x06, FRAME(0x0E, 0)}, {0x07, FRAME(0x0D, 0)},
{0x30, FRAME(0x0E, 0)}, {0x0C, FRAME(0x09, 0)}, {0x0D, FRAME(0x10, 0)},
{0x08, FRAME(0x11, 0)}, {0x0C, FRAME(0x12, 0)}, {0xB0, FRAME(0x13, 0)},
{0x0A, FRAME(0x14, 0)}, {0x0A, FRAME(0x15, 0)}, {0x0A, FRAME(0x16, 0)},
{0x30, FRAME(0x17, 0)}, {0xD0, FRAME(0x18, 0)}, A_END};
void func_80162C84(Entity* entity) {
switch (entity->step) {
case 0:
entity->flags = FLAG_UNK_100000 | FLAG_UNK_04000000 | FLAG_UNK_10000 |
FLAG_UNK_08000000;
entity->facingLeft = 1;
entity->unk5A = 0x66;
entity->zPriority = PLAYER.zPriority - 8;
entity->palette = PAL_OVL(0x149);
entity->animSet = ANIMSET_OVL(19);
RicSetAnimation(anim_80154ED4);
entity->velocityX = FIX(-1.75);
entity->posY.i.hi = 0xBB;
entity->posX.i.hi = 0x148;
entity->ext.et_80161FF0.unk7E = 0;
entity->step++;
break;
case 1:
if (entity->animFrameIdx == 0 && entity->animFrameDuration == 1) {
g_api.PlaySfx(0x882);
}
if (entity->animFrameIdx == 4 && entity->animFrameDuration == 1) {
g_api.PlaySfx(0x883);
}
entity->posX.val += entity->velocityX;
if (((s16)entity->ext.et_80161FF0.unk7E == 0) &&
(entity->posX.i.hi < 256)) {
g_api.PlaySfx(0x87D);
entity->ext.et_80161FF0.unk7E++;
}
if (entity->posX.i.hi < 0xE0) {
RicSetAnimation(anim_80154EF8);
entity->velocityX = 0;
entity->step++;
RicCreateEntFactoryFromEntity(entity, FACTORY(0x400, 0), 0);
}
break;
case 2:
if (entity->animFrameIdx == 16) {
g_api.PlaySfx(0x87E);
entity->ext.et_80161FF0.unk7C = 0x80;
entity->step++;
}
break;
case 3:
if (!--entity->ext.et_80161FF0.unk7C) {
RicCreateEntFactoryFromEntity(entity, FACTORY(0, 30), 0);
entity->step++;
}
break;
case 4:
break;
}
}
STATIC_PAD_RODATA(4);

View File

@ -1,84 +1,5 @@
#include "ric.h"
static AnimationFrame anim_80154ED4[] = {
{4, FRAME(1, 0)}, {4, FRAME(2, 0)}, {4, FRAME(3, 0)},
{4, FRAME(4, 0)}, {4, FRAME(5, 0)}, {4, FRAME(6, 0)},
{4, FRAME(7, 0)}, {4, FRAME(8, 0)}, A_LOOP_AT(0)};
static AnimationFrame anim_80154EF8[] = {
{0x08, FRAME(0x09, 0)}, {0x08, FRAME(0x0D, 0)}, {0x40, FRAME(0x0A, 0)},
{0x02, FRAME(0x0B, 0)}, {0x02, FRAME(0x0C, 0)}, {0x06, FRAME(0x0D, 0)},
{0x07, FRAME(0x0E, 0)}, {0x06, FRAME(0x0F, 0)}, {0x05, FRAME(0x0E, 0)},
{0x04, FRAME(0x0D, 0)}, {0x03, FRAME(0x0F, 0)}, {0x03, FRAME(0x0E, 0)},
{0x03, FRAME(0x0D, 0)}, {0x03, FRAME(0x0E, 0)}, {0x03, FRAME(0x0F, 0)},
{0x03, FRAME(0x0E, 0)}, {0x03, FRAME(0x0D, 0)}, {0x04, FRAME(0x0E, 0)},
{0x05, FRAME(0x0F, 0)}, {0x06, FRAME(0x0E, 0)}, {0x07, FRAME(0x0D, 0)},
{0x30, FRAME(0x0E, 0)}, {0x0C, FRAME(0x09, 0)}, {0x0D, FRAME(0x10, 0)},
{0x08, FRAME(0x11, 0)}, {0x0C, FRAME(0x12, 0)}, {0xB0, FRAME(0x13, 0)},
{0x0A, FRAME(0x14, 0)}, {0x0A, FRAME(0x15, 0)}, {0x0A, FRAME(0x16, 0)},
{0x30, FRAME(0x17, 0)}, {0xD0, FRAME(0x18, 0)}, A_END};
void func_80162C84(Entity* entity) {
switch (entity->step) {
case 0:
entity->flags = FLAG_UNK_100000 | FLAG_UNK_04000000 | FLAG_UNK_10000 |
FLAG_UNK_08000000;
entity->facingLeft = 1;
entity->unk5A = 0x66;
entity->zPriority = PLAYER.zPriority - 8;
entity->palette = PAL_OVL(0x149);
entity->animSet = ANIMSET_OVL(19);
RicSetAnimation(anim_80154ED4);
entity->velocityX = FIX(-1.75);
entity->posY.i.hi = 0xBB;
entity->posX.i.hi = 0x148;
entity->ext.generic.unk7E.modeU16 = 0;
entity->step++;
break;
case 1:
if (entity->animFrameIdx == 0 && entity->animFrameDuration == 1) {
g_api.PlaySfx(0x882);
}
if (entity->animFrameIdx == 4 && entity->animFrameDuration == 1) {
g_api.PlaySfx(0x883);
}
entity->posX.val += entity->velocityX;
if (((s16)entity->ext.generic.unk7E.modeU16 == 0) &&
(entity->posX.i.hi < 256)) {
g_api.PlaySfx(0x87D);
entity->ext.generic.unk7E.modeU16++;
}
if (entity->posX.i.hi < 0xE0) {
RicSetAnimation(anim_80154EF8);
entity->velocityX = 0;
entity->step++;
RicCreateEntFactoryFromEntity(entity, FACTORY(0x400, 0), 0);
}
break;
case 2:
if (entity->animFrameIdx == 16) {
g_api.PlaySfx(0x87E);
entity->ext.generic.unk7C.s = 0x80;
entity->step++;
}
break;
case 3:
entity->ext.generic.unk7C.s--;
if ((entity->ext.generic.unk7C.s) == 0) {
RicCreateEntFactoryFromEntity(entity, FACTORY(0, 30), 0);
entity->step++;
}
break;
case 4:
break;
}
}
const u32 rodataPadding_801569E4 = 0; // may indicate a file split
// same as DRA/func_8011BD48
bool func_80162E9C(Entity* entity) {
s32 i = 16;
@ -459,8 +380,8 @@ void func_801641A0(Entity* entity) {
primIndex = g_api.AllocPrimitives(PRIM_GT4, 1);
entity->primIndex = primIndex;
if (primIndex != -1) {
entity->ext.generic.unk7C.s = 16;
entity->ext.generic.unk7E.modeU16 = 12;
entity->ext.et_80161FF0.unk7C = 16;
entity->ext.et_80161FF0.unk7E = 12;
prim = &g_PrimBuf[entity->primIndex];
prim->u0 = prim->u2 = 64;
prim->v0 = prim->v1 = 192;
@ -482,9 +403,9 @@ void func_801641A0(Entity* entity) {
}
case 1:
entity->ext.generic.unk7C.s += 2;
entity->ext.generic.unk7E.modeU16 += 2;
if (entity->ext.generic.unk7C.s >= 57) {
entity->ext.et_80161FF0.unk7C += 2;
entity->ext.et_80161FF0.unk7E += 2;
if (entity->ext.et_80161FF0.unk7C >= 57) {
DestroyEntity(entity);
break;
}
@ -492,14 +413,14 @@ void func_801641A0(Entity* entity) {
default:
def:
prim = &g_PrimBuf[entity->primIndex];
prim->x0 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
prim->y0 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
prim->x1 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
prim->y1 = entity->posY.i.hi - entity->ext.generic.unk7E.modeU16;
prim->x2 = entity->posX.i.hi - entity->ext.generic.unk7C.s;
prim->y2 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
prim->x3 = entity->posX.i.hi + entity->ext.generic.unk7C.s;
prim->y3 = entity->posY.i.hi + entity->ext.generic.unk7E.modeU16;
prim->x0 = entity->posX.i.hi - entity->ext.et_80161FF0.unk7C;
prim->y0 = entity->posY.i.hi - entity->ext.et_80161FF0.unk7E;
prim->x1 = entity->posX.i.hi + entity->ext.et_80161FF0.unk7C;
prim->y1 = entity->posY.i.hi - entity->ext.et_80161FF0.unk7E;
prim->x2 = entity->posX.i.hi - entity->ext.et_80161FF0.unk7C;
prim->y2 = entity->posY.i.hi + entity->ext.et_80161FF0.unk7E;
prim->x3 = entity->posX.i.hi + entity->ext.et_80161FF0.unk7C;
prim->y3 = entity->posY.i.hi + entity->ext.et_80161FF0.unk7E;
if (prim->b3 >= 12) {
prim->b3 += 244;
}
@ -525,7 +446,7 @@ static s16 D_8015519C[][6] = {
{0x0000, 0x0000, 0x0100, 0x7100, 0x0100, 0x0400},
{0x0500, 0x0A00, 0x0100, 0x0100, 0x0100, 0x0100},
{0x0500, 0x0A00, 0x0100, 0x0200, 0x7100, 0x0100}};
void EntityShrinkingPowerUpRing(Entity* self) {
void RicEntityShrinkingPowerUpRing(Entity* self) {
s16 selfX;
s16 selfY;
s16 rScale;
@ -978,7 +899,7 @@ void RicEntityHitByLightning(Entity* self) {
if (++self->ext.hitbylightning.unk9C >= 0x91) {
var_s0 = true;
}
} else if (PLAYER.step != 10) {
} else if (PLAYER.step != PL_S_HIT) {
var_s0 = true;
}
switch (self->step) {
@ -1007,7 +928,7 @@ void RicEntityHitByLightning(Entity* self) {
prim->drawMode = 0x133;
prim = prim->next;
}
if ((PLAYER.velocityY != 0) && (PLAYER.step != 0x10)) {
if ((PLAYER.velocityY != 0) && (PLAYER.step != PL_S_DEAD)) {
self->ext.hitbylightning.unk92 = 1;
}
self->ext.hitbylightning.unk94 = 0x10;

View File

@ -4,6 +4,7 @@
// Entity ID 66. Made by blueprint 77 (the very last one).
// Created in 3 spots in 2 functions (total of 6 calls).
// DRA version is very similar.
static Point16 D_80175000[32];
void RicEntityTeleport(Entity* self) {
Primitive* prim;
s32 selfUnk7C;
@ -274,7 +275,9 @@ static s16 D_80155C78[] = {
0x000F, 0x000D, 0x000B, 0x0009, 0x0007, 0x0005, 0x0003, 0x00FF};
static u16 D_80155C98[] = {
0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15};
void func_80166784(Entity* self) {
static u32 D_80175080;
static s32 D_80175084;
void RicEntityWhip(Entity* self) {
byte stackpad[40];
s32 sp38;
s16 upperParams;
@ -313,8 +316,8 @@ void func_80166784(Entity* self) {
lowerParams = self->params & 0xFF;
upperParams = self->params & 0xFF00;
if (lowerParams == 0) {
if (self->ext.et_80166784.unkA6 != 0) {
self->ext.et_80166784.unkA6--;
if (self->ext.whip.unkA6 != 0) {
self->ext.whip.unkA6--;
}
}
playerUnk46 = g_Player.unk46;
@ -328,47 +331,47 @@ void func_80166784(Entity* self) {
self->velocityY = 0;
self->palette = 0x8148;
if (!PLAYER.facingLeft) {
self->ext.et_80166784.unk88 = playerUnk46;
self->ext.whip.unk88 = playerUnk46;
} else {
self->ext.et_80166784.unk88 = 3;
self->ext.whip.unk88 = 3;
}
self->ext.et_80166784.unk8C = 0x600;
self->ext.whip.unk8C = 0x600;
}
if (self->step != 0) {
xDiff = self->posX.val - self->ext.et_80166784.unk98;
yDiff = self->posY.val - self->ext.et_80166784.unk9C;
self->ext.et_80166784.unk7C.val += xDiff;
self->ext.et_80166784.unk80.val += yDiff;
xDiff = self->posX.val - self->ext.whip.unk98;
yDiff = self->posY.val - self->ext.whip.unk9C;
self->ext.whip.unk7C.val += xDiff;
self->ext.whip.unk80.val += yDiff;
}
directionsPressed = g_Player.padPressed & 0xF000;
if (directionsPressed == PAD_UP) {
var_s4 = D_80155B2C[0][self->ext.et_80166784.unk88];
var_s4 = D_80155B2C[0][self->ext.whip.unk88];
}
if (directionsPressed == PAD_DOWN) {
var_s4 = D_80155B2C[3][self->ext.et_80166784.unk88];
var_s4 = D_80155B2C[3][self->ext.whip.unk88];
}
if (directionsPressed == PAD_RIGHT) {
var_s4 = D_80155B2C[1][self->ext.et_80166784.unk88];
var_s4 = D_80155B2C[1][self->ext.whip.unk88];
}
if (directionsPressed == PAD_LEFT) {
var_s4 = D_80155B2C[2][self->ext.et_80166784.unk88];
var_s4 = D_80155B2C[2][self->ext.whip.unk88];
}
if (directionsPressed == (PAD_UP + PAD_RIGHT)) {
var_s4 = D_80155B2C[4][self->ext.et_80166784.unk88];
var_s4 = D_80155B2C[4][self->ext.whip.unk88];
}
if (directionsPressed == (PAD_UP + PAD_LEFT)) {
var_s4 = D_80155B2C[5][self->ext.et_80166784.unk88];
var_s4 = D_80155B2C[5][self->ext.whip.unk88];
}
if (directionsPressed == (PAD_DOWN + PAD_RIGHT)) {
var_s4 = D_80155B2C[6][self->ext.et_80166784.unk88];
var_s4 = D_80155B2C[6][self->ext.whip.unk88];
}
if (directionsPressed == (PAD_DOWN + PAD_LEFT)) {
var_s4 = D_80155B2C[7][self->ext.et_80166784.unk88];
var_s4 = D_80155B2C[7][self->ext.whip.unk88];
}
if (directionsPressed == 0) {
var_s4 = D_80155B2C[8][self->ext.et_80166784.unk88];
var_s4 = D_80155B2C[8][self->ext.whip.unk88];
}
self->ext.et_80166784.unk86 = 0;
self->ext.whip.unk86 = 0;
if (lowerParams == 0) {
if (self->step == 1) {
if (PLAYER.step == PL_S_CROUCH) {
@ -425,7 +428,7 @@ void func_80166784(Entity* self) {
self->hitboxHeight = 3;
self->hitboxOffX = 0;
self->hitboxOffY = 0;
self->ext.et_80166784.unkB0 = 0xE;
self->ext.whip.unkB0 = PL_W_WHIP;
RicSetSubweaponParams(self);
}
if (lowerParams == 0) {
@ -440,11 +443,11 @@ void func_80166784(Entity* self) {
self->posX.val = var_s3;
self->posY.val = var_s5;
self->flags = 0x04070000;
self->ext.et_80166784.unk8C = 0x500;
self->ext.et_80166784.unk7C.val = self->posX.val;
self->ext.et_80166784.unk80.val = self->posY.val;
self->ext.et_80166784.unk98 = self->ext.et_80166784.unk7C.val;
self->ext.et_80166784.unk9C = self->ext.et_80166784.unk80.val;
self->ext.whip.unk8C = 0x500;
self->ext.whip.unk7C.val = self->posX.val;
self->ext.whip.unk80.val = self->posY.val;
self->ext.whip.unk98 = self->ext.whip.unk7C.val;
self->ext.whip.unk9C = self->ext.whip.unk80.val;
self->primIndex = g_api.AllocPrimitives(PRIM_LINE_G2, 1);
if (self->primIndex != -1) {
self->flags |= 0x800000;
@ -455,26 +458,26 @@ void func_80166784(Entity* self) {
prim->drawMode = 0x35;
}
self->step = 2;
func_80166784(self);
RicEntityWhip(self);
break;
case 1:
if (upperParams == 0) {
if ((u16)(self->palette + 0x7EC0) < 8) {
if (self->ext.et_80166784.unkA4 != 0) {
self->ext.et_80166784.unkA4--;
if (self->ext.whip.unkA4 != 0) {
self->ext.whip.unkA4--;
} else {
self->palette++;
}
}
} else if (self->ext.et_80166784.unkA4 != 0) {
} else if (self->ext.whip.unkA4 != 0) {
if (!(lowerParams & 1)) {
RicCreateEntFactoryFromEntity(self, FACTORY(0, 20), 0);
self->ext.et_80166784.unkA4 = 0;
self->ext.whip.unkA4 = 0;
}
}
if (lowerParams < 8) {
if (self->ext.et_80166784.unk84 != 0) {
if (--self->ext.et_80166784.unk84 == 0) {
if (self->ext.whip.unk84 != 0) {
if (--self->ext.whip.unk84 == 0) {
if (self->velocityY < 0) {
self->velocityY = 0;
}
@ -483,7 +486,7 @@ void func_80166784(Entity* self) {
} else {
self->velocityX = self->velocityX * 3 / 4;
}
if (self->ext.et_80166784.unk88 == var_s4) {
if (self->ext.whip.unk88 == var_s4) {
break;
}
@ -498,9 +501,9 @@ void func_80166784(Entity* self) {
} else {
a0 = self;
}
if (self->ext.et_80166784.unkA6 == 0) {
if (self->ext.whip.unkA6 == 0) {
g_api.PlaySfx(SFX_RIC_WHIP_RATTLE_A);
self->ext.et_80166784.unkA6 = 0x20;
self->ext.whip.unkA6 = 0x20;
}
if (upperParams == 0) {
a0 = self;
@ -512,7 +515,7 @@ void func_80166784(Entity* self) {
RicCreateEntFactoryFromEntity(a0, a1, 0);
}
self->ext.et_80166784.unk84 = 6;
self->ext.whip.unk84 = 6;
if (var_s4 == 0) {
if (!PLAYER.facingLeft) {
xDiff = D_80155A08[0];
@ -536,7 +539,7 @@ void func_80166784(Entity* self) {
self->velocityY = D_80155AE4[var_s4].x;
self->velocityX = D_80155AE4[var_s4].y;
}
self->ext.et_80166784.unk88 = var_s4;
self->ext.whip.unk88 = var_s4;
}
break;
case 2:
@ -582,16 +585,16 @@ void func_80166784(Entity* self) {
randy = rand() | ~0x3FF;
self->velocityX = (rcos(randy) << 0xB) >> 4;
self->velocityY = -(rsin(randy) << 0xB) >> 3;
self->ext.et_80166784.unk8C = 0x600;
self->ext.whip.unk8C = 0x600;
break;
case 4:
self->ext.et_80166784.unk8C = 0x3C0;
self->ext.whip.unk8C = 0x3C0;
if (PLAYER.animFrameDuration == 1) {
self->velocityX = FIX(-8);
}
break;
case 5:
self->ext.et_80166784.unk8C += 0xC0;
self->ext.whip.unk8C += 0xC0;
if (self->flags & FLAG_HAS_PRIMS) {
g_api.FreePrimitives(self->primIndex);
self->flags &= ~FLAG_HAS_PRIMS;
@ -604,7 +607,7 @@ void func_80166784(Entity* self) {
}
}
if (lowerParams == (0x10 - PLAYER.animFrameDuration)) {
self->ext.et_80166784.unk8C = 0x600;
self->ext.whip.unk8C = 0x600;
}
// This very well might be a switch
if (PLAYER.animFrameDuration > 14) {
@ -639,7 +642,7 @@ void func_80166784(Entity* self) {
}
break;
}
temp_a2 = self->ext.et_80166784.unk8C;
temp_a2 = self->ext.whip.unk8C;
temp_s6 = self->posX.val;
sp38 = self->posY.val;
if (lowerParams == 0) {
@ -654,8 +657,8 @@ void func_80166784(Entity* self) {
var_s7 = (self - 7)->posY.val;
self->posY.val = (yDiff + var_s7) / 2;
} else {
temp_a3 = temp_s6 - self->ext.et_80166784.unk7C.val;
var_s7 = sp38 - self->ext.et_80166784.unk80.val;
temp_a3 = temp_s6 - self->ext.whip.unk7C.val;
var_s7 = sp38 - self->ext.whip.unk80.val;
if (self->step == 1) {
if (self->velocityY < FIX(0.5)) {
self->posX.val = temp_a3 + temp_s6;
@ -692,14 +695,14 @@ void func_80166784(Entity* self) {
self->posY.val = var_s5 + yDiff;
}
}
self->ext.et_80166784.unk7C.val = temp_s6;
self->ext.et_80166784.unk80.val = sp38;
self->ext.et_80166784.unkA0 = var_s7;
self->ext.et_80166784.unk98 = self->posX.val;
self->ext.et_80166784.unk9C = self->posY.val;
self->ext.whip.unk7C.val = temp_s6;
self->ext.whip.unk80.val = sp38;
self->ext.whip.unkA0 = var_s7;
self->ext.whip.unk98 = self->posX.val;
self->ext.whip.unk9C = self->posY.val;
if (lowerParams == 0) {
D_80175080 = var_s4;
D_80175084 = self->ext.et_80166784.unk88;
D_80175084 = self->ext.whip.unk88;
}
if ((self->primIndex != -1) && (self->flags & FLAG_HAS_PRIMS)) {
prim = &g_PrimBuf[self->primIndex];
@ -707,9 +710,9 @@ void func_80166784(Entity* self) {
prim->y0 = self->posY.i.hi;
// for some reason need this to make it use lh instead of lhu for x1 and
// y1.
dumb_temp = self->ext.et_80166784.unk7C;
dumb_temp = self->ext.whip.unk7C;
prim->x1 = dumb_temp.i.hi;
dumb_temp = self->ext.et_80166784.unk80;
dumb_temp = self->ext.whip.unk80;
prim->y1 = dumb_temp.i.hi;
if (PLAYER.animFrameIdx == 4) {
prim->priority = PLAYER.zPriority + 4;
@ -925,7 +928,7 @@ void func_80167A70(Entity* self) {
// Entity ID #11. Created by blueprint 12.
// This is blueprintNum for subweapon ID 16.
// That is the crash for subweapon 3. That's holy water!
void EntityHydroStorm(Entity* self) {
void RicEntityCrashHydroStorm(Entity* self) {
PrimLineG2* line;
s16 primcount;
s32 trigresult;
@ -944,7 +947,7 @@ void EntityHydroStorm(Entity* self) {
DestroyEntity(self);
return;
}
self->ext.factory.unkB0 = 0x10;
self->ext.subweapon.subweaponId = PL_W_HYDROSTORM;
RicSetSubweaponParams(self);
self->flags = FLAG_UNK_08000000 | FLAG_UNK_04000000 | FLAG_HAS_PRIMS |
FLAG_UNK_20000;
@ -985,7 +988,7 @@ void EntityHydroStorm(Entity* self) {
if (self->params == 1) {
g_api.func_801027C4(3);
}
self->ext.timer.t = 0x160;
self->ext.subweapon.timer = 0x160;
if ((self->params < 32) && !(self->params & 3)) {
g_api.PlaySfx(0x708);
}
@ -1022,7 +1025,7 @@ void EntityHydroStorm(Entity* self) {
}
line = line->next;
}
self->ext.timer.t++;
self->ext.subweapon.timer++;
break;
case 2:

View File

@ -6,7 +6,7 @@ static s16 D_80155D94[] = {16, 0, -1, 0};
// Entity ID #7. Made by blueprint 6. Comes from subweapon 3. Holy water!
// Not at all the same as DRA's.
void RicEntityHolyWater(Entity* self) {
void RicEntitySubwpnHolyWater(Entity* self) {
s16 argY;
s32 collision_result;
s32 tempXVel;
@ -39,7 +39,7 @@ void RicEntityHolyWater(Entity* self) {
trigtemp = trigresult * 16;
self->velocityY = -((trigresult * 32 + trigtemp) << 9) >> 8;
self->ext.factory.unkB0 = 3;
self->ext.holywater.subweaponId = PL_W_HOLYWATER;
RicSetSubweaponParams(self);
self->hitboxWidth = 4;
self->hitboxHeight = 4;
@ -161,7 +161,7 @@ void RicEntityHolyWater(Entity* self) {
// Entity ID #8. Blueprint 7.
static Point32 D_80155D9C[] = {{28, 0}, {28, 16}, {28, 32}, {28, 48},
{60, 0}, {60, 16}, {60, 32}, {60, 48}};
void RicEntityHolyWaterFlame(Entity* self) {
void RicEntitySubwpnHolyWaterFlame(Entity* self) {
s16 sp10[5];
s16 sp20[5];
s16 pad[2];
@ -212,22 +212,21 @@ void RicEntityHolyWaterFlame(Entity* self) {
i++;
}
self->flags = FLAG_UNK_08000000 | FLAG_HAS_PRIMS;
self->ext.timer.t = 1;
self->ext.holywater.timer = 1;
self->step += 1;
break;
case 1:
if (--self->ext.timer.t == 0) {
self->ext.factory.unkB0 = 0xB;
if (--self->ext.holywater.timer == 0) {
self->ext.holywater.subweaponId = PL_W_HOLYWATER_FLAMES;
RicSetSubweaponParams(self);
self->hitboxWidth = 4;
self->ext.factory.unk84 = (s16)self->hitboxState;
self->posY.i.hi = self->posY.i.hi - 0xA;
self->ext.holywater.hitboxState = self->hitboxState;
self->posY.i.hi = self->posY.i.hi - 10;
RicCreateEntFactoryFromEntity(self, 0x30004U, 0);
self->ext.timer.t = 0x50;
self->posY.i.hi = self->posY.i.hi + 0xA;
self->ext.holywaterflame.unk80 = (rand() & 0xF) + 0x12;
self->ext.holywaterflame.angle = rand() & 0xFFF;
self->ext.holywater.timer = 0x50;
self->posY.i.hi = self->posY.i.hi + 10;
self->ext.holywater.unk80 = (rand() & 0xF) + 0x12;
self->ext.holywater.angle = rand() & 0xFFF;
self->step += 1;
}
break;
@ -237,8 +236,8 @@ void RicEntityHolyWaterFlame(Entity* self) {
} else {
var_s4 = -1;
}
angleTemp = self->ext.holywaterflame.angle;
self->ext.holywaterflame.angle += 0xC0;
angleTemp = self->ext.holywater.angle;
self->ext.holywater.angle += 0xC0;
angle = angleTemp;
for (i = 0; i < 4; i++) {
sp10[i] = self->posX.i.hi + (rsin(angle) >> 0xA);
@ -246,8 +245,8 @@ void RicEntityHolyWaterFlame(Entity* self) {
}
sp10[4] = self->posX.i.hi;
sp10[0] = var_s4 + self->posX.i.hi;
temp_v0_2 = rsin((s16)((self->ext.timer.t * 64) + 0x800)) >> 8;
temp_v0_2 += self->ext.holywaterflame.unk80;
temp_v0_2 = rsin((s16)((self->ext.holywater.timer * 64) + 0x800)) >> 8;
temp_v0_2 += self->ext.holywater.unk80;
temp_v0_2 = temp_v0_2 * 3 >> 1;
sp20[0] = self->posY.i.hi - temp_v0_2;
sp20[4] = self->posY.i.hi;
@ -255,21 +254,21 @@ void RicEntityHolyWaterFlame(Entity* self) {
sp20[1] = (sp20[0] + sp20[2]) / 2;
sp20[3] = (sp20[2] + sp20[4]) / 2;
prim = &g_PrimBuf[self->primIndex];
if (--self->ext.timer.t < 0) {
if (--self->ext.holywater.timer < 0) {
DestroyEntity(self);
return;
}
if (self->ext.timer.t & 3) {
if (self->ext.holywater.timer & 3) {
self->hitboxState = 0;
} else {
self->hitboxState = self->ext.holywaterflame.unk84;
self->hitboxState = self->ext.holywater.hitboxState;
}
if (self->ext.timer.t < 0x15) {
if (self->ext.holywater.timer < 0x15) {
self->hitboxState = 0;
}
i = 0;
while (prim != NULL) {
if (upperParams * 2 + 0x18 >= self->ext.timer.t) {
if (upperParams * 2 + 0x18 >= self->ext.holywater.timer) {
if (prim->g0 >= 10) {
prim->g0 -= 5;
}
@ -342,7 +341,7 @@ void RicEntitySubwpnCrashCross(Entity* self) {
self->flags = FLAG_UNK_04000000 | FLAG_HAS_PRIMS | FLAG_UNK_20000;
self->ext.crashcross.unk80 = 1;
self->zPriority = 0xC2;
self->ext.factory.unkB0 = 0xC;
self->ext.crashcross.subweaponId = PL_W_CRASH_CROSS;
RicSetSubweaponParams(self);
LoadImage(&crash_cross_img_vram, crash_cross_img_data);
g_api.PlaySfx(0x6DF);
@ -435,12 +434,11 @@ void RicEntitySubwpnCrashCross(Entity* self) {
prim->drawMode = 0x31;
prim->priority = self->zPriority;
g_Player.D_80072F00[PL_T_3] = 2;
return;
}
// Entity ID #21. Blueprint 22. Called in RicHandleDeadPrologue.
// Creates the white column around Richter when he is revived in the Prologue.
void EntityRichterRevivalColumn(Entity* self) {
void RicEntityRevivalColumn(Entity* self) {
Primitive* prim;
u32 three = 3;
u32 one = 1;
@ -513,7 +511,9 @@ static AnimationFrame anim_cross_boomerang[] = {
{36, FRAME(1, 0)}, {1, FRAME(2, 0)}, {1, FRAME(3, 0)},
{1, FRAME(4, 0)}, {1, FRAME(5, 0)}, {1, FRAME(6, 0)},
{1, FRAME(7, 0)}, {1, FRAME(8, 0)}, A_LOOP_AT(0)};
void EntityCrossBoomerang(Entity* self) {
static Point16 D_80175088[4][128];
static s32 D_80175888;
void RicEntitySubwpnCross(Entity* self) {
s32 xAccel;
Point16* temp_a0;
s16 playerHitboxX;
@ -537,7 +537,7 @@ void EntityCrossBoomerang(Entity* self) {
RicSetSpeedX(FIX(3.5625));
self->drawFlags = 4;
self->rotZ = 0xC00;
self->ext.factory.unkB0 = 4;
self->ext.crossBoomerang.subweaponId = PL_W_CROSS;
RicSetSubweaponParams(self);
self->hitboxHeight = self->hitboxWidth = 8;
self->posY.i.hi -= 8;
@ -702,16 +702,16 @@ void func_80169C10(Entity* entity) {
}
}
// made by blueprint #5, see step 0 of EntityCrossBoomerang
// made by blueprint #5, see step 0 of RicEntitySubwpnCross
static s16 D_80155E68[] = {9, 10, 11, 12};
void EntityCrossShadow(Entity* self) {
void RicEntitySubwpnCrossTrail(Entity* self) {
s16* temp;
switch (self->step) {
case 0:
self->flags = FLAG_UNK_04000000 | FLAG_UNK_08000000;
// the parent pointer is set in RicEntityEntFactory.
// the value of unk84 is set in EntityCrossBoomerang
// the parent pointer is set in RicEntityFactory.
// the value of unk84 is set in RicEntitySubwpnCross
self->ext.crossBoomerang.unk84 =
self->ext.factory.parent->ext.crossBoomerang.unk84;
self->animSet = ANIMSET_OVL(17);
@ -858,7 +858,7 @@ static u8 D_80155E70[][4] = {
{0x3F, 0x3F, 0x5F, 0x00}, {0x3F, 0x3F, 0x5F, 0x00},
{0x2F, 0x2F, 0x6F, 0x00}, {0x2F, 0x2F, 0x6F, 0x00},
{0x1F, 0x1F, 0x7F, 0x00}, {0x1F, 0x1F, 0x7F, 0x00}};
void EntitySubwpnCrashAgunea(Entity* self) {
void RicEntitySubwpnAxe(Entity* self) {
s32 sp10;
s32 sp18;
Primitive* prevPrim;
@ -897,7 +897,7 @@ void EntitySubwpnCrashAgunea(Entity* self) {
RicSetSpeedX(FIX(-2));
self->velocityY = FIX(-6);
tempLeft = self->facingLeft;
self->ext.aguneaCrash.unk7C = tempLeft ? 0x400 : 0xC00;
self->ext.subwpnAxe.unk7C = tempLeft ? 0x400 : 0xC00;
sp10 = 0;
prim = &g_PrimBuf[self->primIndex];
self->posY.i.hi -= 0xC;
@ -914,21 +914,21 @@ void EntitySubwpnCrashAgunea(Entity* self) {
prim->priority = PLAYER.zPriority - 2;
if (sp10 != 0) {
prim->drawMode = 0x13D;
self->ext.aguneaCrash.unk8B[sp10] = 0;
self->ext.aguneaCrash.unk8B[sp10 + 4] = 0;
self->ext.aguneaCrash.unk8B[sp10 + 8] = 0;
self->ext.subwpnAxe.unk8B[sp10] = 0;
self->ext.subwpnAxe.unk8B[sp10 + 4] = 0;
self->ext.subwpnAxe.unk8B[sp10 + 8] = 0;
} else {
prim->drawMode = 0x100 | DRAW_HIDE;
}
prim = prim->next;
sp10++;
}
self->ext.factory.unkB0 = 2;
self->ext.factory.unkB0 = PL_W_AXE;
RicSetSubweaponParams(self);
self->hitboxWidth = 12;
self->hitboxHeight = 12;
g_api.PlaySfx(SFX_WEAPON_SWISH_C);
self->ext.aguneaCrash.unk98 = 0x7F;
self->ext.subwpnAxe.unk98 = 0x7F;
self->step++;
break;
case 1:
@ -937,13 +937,13 @@ void EntitySubwpnCrashAgunea(Entity* self) {
} else {
var_a1 = 0x80;
}
self->ext.aguneaCrash.unk7C = var_a1 + self->ext.aguneaCrash.unk7C;
if (!(self->ext.aguneaCrash.unk7C & 0x3FF)) {
self->ext.subwpnAxe.unk7C = var_a1 + self->ext.subwpnAxe.unk7C;
if (!(self->ext.subwpnAxe.unk7C & 0x3FF)) {
g_api.PlaySfxVolPan(
SFX_WEAPON_SWISH_C, self->ext.aguneaCrash.unk98, 0);
self->ext.aguneaCrash.unk98 -= 8;
if (self->ext.aguneaCrash.unk98 < 0) {
self->ext.aguneaCrash.unk98 = 0;
SFX_WEAPON_SWISH_C, self->ext.subwpnAxe.unk98, 0);
self->ext.subwpnAxe.unk98 -= 8;
if (self->ext.subwpnAxe.unk98 < 0) {
self->ext.subwpnAxe.unk98 = 0;
}
}
self->velocityY += FIX(34.0 / 128);
@ -969,7 +969,7 @@ void EntitySubwpnCrashAgunea(Entity* self) {
} else {
var_a1 = -0xC0;
}
self->ext.aguneaCrash.unk7C = var_a1 + self->ext.aguneaCrash.unk7C;
self->ext.subwpnAxe.unk7C = var_a1 + self->ext.subwpnAxe.unk7C;
self->velocityY += FIX(18.0 / 128);
if (self->velocityY > FIX(8)) {
self->velocityY = FIX(8);
@ -985,9 +985,9 @@ void EntitySubwpnCrashAgunea(Entity* self) {
if (self->animFrameDuration == 0) {
sp18 = self->animFrameIdx;
self->ext.aguneaCrash.unk8B[sp18 + 1] = 0;
self->ext.aguneaCrash.unk8B[sp18 + 5] = 1;
self->ext.aguneaCrash.unk8B[sp18 + 9] = 1;
self->ext.subwpnAxe.unk8B[sp18 + 1] = 0;
self->ext.subwpnAxe.unk8B[sp18 + 5] = 1;
self->ext.subwpnAxe.unk8B[sp18 + 9] = 1;
sp18++;
sp18 &= 3;
self->animFrameIdx = sp18;
@ -1013,7 +1013,7 @@ void EntitySubwpnCrashAgunea(Entity* self) {
var_s3 = 0xAA0;
var_s2 = 0xD60;
}
var_a1 = self->ext.aguneaCrash.unk7C;
var_a1 = self->ext.subwpnAxe.unk7C;
temp_s4 = self->posX.i.hi;
temp_s5 = self->posY.i.hi;
var_s0 += var_a1;
@ -1030,9 +1030,9 @@ void EntitySubwpnCrashAgunea(Entity* self) {
prim->x3 = temp_s4 + (((rcos(var_s3) << 4) * twentyone) >> 0x10);
prim->y3 = temp_s5 - (((rsin(var_s3) << 4) * twentyone) >> 0x10);
prim->drawMode &= ~DRAW_HIDE;
} else if (self->ext.aguneaCrash.unk8B[sp10 + 4] != 0) {
if (self->ext.aguneaCrash.unk8B[sp10 + 8] != 0) {
self->ext.aguneaCrash.unk8B[sp10 + 8] = 0;
} else if (self->ext.subwpnAxe.unk8B[sp10 + 4] != 0) {
if (self->ext.subwpnAxe.unk8B[sp10 + 8] != 0) {
self->ext.subwpnAxe.unk8B[sp10 + 8] = 0;
prim->x0 = prevPrim->x0;
prim->y0 = prevPrim->y0;
prim->x1 = prevPrim->x1;
@ -1042,8 +1042,8 @@ void EntitySubwpnCrashAgunea(Entity* self) {
prim->x3 = prevPrim->x3;
prim->y3 = prevPrim->y3;
}
temp_v0_4 = self->ext.aguneaCrash.unk8B[sp10];
self->ext.aguneaCrash.unk8B[sp10] = temp_v0_4 + 1;
temp_v0_4 = self->ext.subwpnAxe.unk8B[sp10];
self->ext.subwpnAxe.unk8B[sp10] = temp_v0_4 + 1;
temp_v1_3 = temp_v0_4 & 0xFF;
if ((temp_v1_3) < 0xA) {
// whyyyyyy
@ -1067,7 +1067,7 @@ void EntitySubwpnCrashAgunea(Entity* self) {
prim->b3 = bVal;
prim->drawMode &= ~DRAW_HIDE;
} else {
self->ext.aguneaCrash.unk8B[sp10 + 4] = 0;
self->ext.subwpnAxe.unk8B[sp10 + 4] = 0;
prim->drawMode |= DRAW_HIDE;
}
}
@ -1078,7 +1078,7 @@ void EntitySubwpnCrashAgunea(Entity* self) {
// RIC entity #37. Comes from blueprint 41. That's subweapon 20.
// Subweapon 20 is crash of subweapon 2, which is the axe.
void EntitySubwpnCrashAxe(Entity* self) {
void RicEntityCrashAxe(Entity* self) {
s32 sp10;
s32 sp18;
Primitive* prevPrim;
@ -1138,7 +1138,7 @@ void EntitySubwpnCrashAxe(Entity* self) {
sp10++;
} while (prim != NULL);
}
self->ext.factory.unkB0 = 2;
self->ext.axeCrash.subweaponId = PL_W_AXE;
RicSetSubweaponParams(self);
self->hitboxWidth = 12;
self->hitboxHeight = 12;
@ -1291,7 +1291,8 @@ void EntitySubwpnCrashAxe(Entity* self) {
// Applies to subweapon 1, and its crash, subweapon 21. Very neat!
// Not quite the same as the one in DRA, but close.
static s16 D_80155E98[] = {-5, -9, -3, -13, -5, 1, -7, -1};
void RicEntitySubwpnThrownDagger(Entity* self) {
static s32 D_8017588C;
void RicEntitySubwpnDagger(Entity* self) {
Collider collider;
Primitive* prim;
s16 offsetX;
@ -1319,7 +1320,7 @@ void RicEntitySubwpnThrownDagger(Entity* self) {
// Not sure what this unkB0 does, but it seems to be
// a standard part of the Ext, and may not be entity specific.
// This line is not in the DRA version of dagger.
self->ext.factory.unkB0 = 1;
self->ext.subweapon.subweaponId = PL_W_DAGGER;
RicSetSubweaponParams(self);
self->hitboxWidth = 4;
@ -1356,7 +1357,7 @@ void RicEntitySubwpnThrownDagger(Entity* self) {
self->step++;
return;
case 1:
self->ext.timer.t++;
self->ext.subweapon.timer++;
if (self->velocityX > 0) {
var_s1 = 8;
}
@ -1364,7 +1365,7 @@ void RicEntitySubwpnThrownDagger(Entity* self) {
var_s1 = -8;
}
if (self->hitFlags == 1) {
self->ext.timer.t = 4;
self->ext.subweapon.timer = 4;
self->step = 3;
self->hitboxState = 0;
return;
@ -1379,7 +1380,7 @@ void RicEntitySubwpnThrownDagger(Entity* self) {
g_api.CheckCollision(
self->posX.i.hi + var_s1, self->posY.i.hi, &collider, 0);
if ((self->hitFlags == 2) || (collider.effects & 3)) {
self->ext.timer.t = 64;
self->ext.subweapon.timer = 64;
self->velocityY = FIX(-2.5);
self->hitboxState = 0;
self->velocityX = -(self->velocityX >> 3);
@ -1414,7 +1415,7 @@ void RicEntitySubwpnThrownDagger(Entity* self) {
prim = prim->next;
prim->x0 = selfX - offsetY;
prim->y0 = selfY - 1;
prim->x1 = selfX - (offsetX * (self->ext.timer.t / 2));
prim->x1 = selfX - (offsetX * (self->ext.subweapon.timer / 2));
prim->y1 = selfY - 1;
prim->drawMode &= ~DRAW_HIDE;
if (self->step != 1) {
@ -1423,11 +1424,11 @@ void RicEntitySubwpnThrownDagger(Entity* self) {
break;
case 2:
prim = &g_PrimBuf[self->primIndex];
if (--self->ext.timer.t == 0) {
if (--self->ext.subweapon.timer == 0) {
DestroyEntity(self);
return;
}
if (self->ext.timer.t == 0x20) {
if (self->ext.subweapon.timer == 0x20) {
prim->drawMode |=
DRAW_TPAGE2 | DRAW_TPAGE | DRAW_COLORS | DRAW_TRANSP;
prim->r0 = prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1 =
@ -1482,7 +1483,7 @@ void RicEntitySubwpnThrownDagger(Entity* self) {
prim->y3 = selfY - sine;
// same deal here with g_GameTimer
prim->clut = ((g_GameTimer >> 1) & 1) + 0x1AB;
if (self->ext.timer.t < 0x21) {
if (self->ext.subweapon.timer < 0x21) {
prim->r0 -= 2;
prim->g0 = prim->b0 = prim->r1 = prim->g1 = prim->b1 = prim->r2 =
prim->g2 = prim->b2 = prim->r3 = prim->g3 = prim->b3 = prim->r0;
@ -1493,7 +1494,7 @@ void RicEntitySubwpnThrownDagger(Entity* self) {
return;
case 3:
if (--self->ext.timer.t == 0) {
if (--self->ext.subweapon.timer == 0) {
DestroyEntity(self);
return;
}
@ -1570,7 +1571,7 @@ void RicEntitySubwpnReboundStone(Entity* self) {
self->ext.reboundStone.stoneAngle += (rand() & 0x7F) - 0x40;
self->ext.reboundStone.lifeTimer = 0x40;
self->ext.factory.unkB0 = 7;
self->ext.reboundStone.subweaponId = PL_W_REBNDSTONE;
RicSetSubweaponParams(self);
self->hitboxWidth = 4;
self->hitboxHeight = 4;
@ -1821,13 +1822,13 @@ void RicEntitySubwpnThrownVibhuti(Entity* self) {
return;
}
self->flags = FLAG_UNK_08000000 | FLAG_HAS_PRIMS;
self->ext.factory.unkB0 = 8;
self->ext.subweapon.subweaponId = PL_W_VIBHUTI;
RicSetSubweaponParams(self);
self->hitboxWidth = self->hitboxHeight = 4;
self->posY.i.hi -= 15;
selfX = self->posX.i.hi;
selfY = self->posY.i.hi;
self->ext.vibhuti.timer = 0x80;
self->ext.subweapon.timer = 0x80;
fakeprim = (FakePrim*)&g_PrimBuf[self->primIndex];
if (PLAYER.facingLeft) {
self->posX.i.hi -= 13;
@ -1875,7 +1876,7 @@ void RicEntitySubwpnThrownVibhuti(Entity* self) {
collisionOffsetX = 2;
}
if (--self->ext.vibhuti.timer == 0) {
if (--self->ext.subweapon.timer == 0) {
DestroyEntity(self);
return;
}
@ -1914,7 +1915,7 @@ void RicEntitySubwpnThrownVibhuti(Entity* self) {
}
}
}
if ((self->ext.vibhuti.timer & 7) == i) {
if ((self->ext.subweapon.timer & 7) == i) {
self->posX.i.hi = fakeprim->posX.i.hi;
self->posY.i.hi = fakeprim->posY.i.hi;
if (fakeprim->drawMode & DRAW_HIDE) {
@ -1930,10 +1931,10 @@ void RicEntitySubwpnThrownVibhuti(Entity* self) {
}
}
if ((self->hitFlags != 0) &&
(((self->ext.vibhuti.timer + 1) & 7) == i)) {
(((self->ext.subweapon.timer + 1) & 7) == i)) {
fakeprim->drawMode = DRAW_HIDE;
}
if ((self->ext.vibhuti.timer - 1) == i) {
if ((self->ext.subweapon.timer - 1) == i) {
fakeprim->drawMode = DRAW_HIDE;
}
fakeprim->x0 = fakeprim->posX.i.hi;
@ -1992,15 +1993,15 @@ void RicEntitySubwpnAgunea(Entity* self) {
self->flags =
FLAG_UNK_08000000 | FLAG_UNK_04000000 | FLAG_HAS_PRIMS;
self->facingLeft = PLAYER.facingLeft;
self->ext.factory.unkB0 = 9;
self->ext.agunea.subweaponId = PL_W_AGUNEA;
RicSetSubweaponParams(self);
self->hitboxHeight = 4;
self->hitboxWidth = 4;
self->hitboxOffX = 4;
self->hitboxOffY = 0;
self->posY.i.hi = self->ext.et_80128C2C.unk82 =
self->posY.i.hi = self->ext.agunea.unk82 =
PLAYER.posY.i.hi + PLAYER.hitboxOffY - 8;
self->posX.i.hi = self->ext.et_80128C2C.unk80 = PLAYER.posX.i.hi;
self->posX.i.hi = self->ext.agunea.unk80 = PLAYER.posX.i.hi;
prim = &g_PrimBuf[self->primIndex];
prim->type = 2;
prim->priority = PLAYER.zPriority + 2;
@ -2021,13 +2022,13 @@ void RicEntitySubwpnAgunea(Entity* self) {
}
if (self->hitFlags != 0) {
self->step = 3;
self->ext.et_80128C2C.parent1 = self->ext.et_80128C2C.parent2;
self->ext.agunea.parent = self->ext.agunea.parent2;
}
break;
case 4:
self->posX.i.hi = self->ext.et_80128C2C.parent1->posX.i.hi;
self->posY.i.hi = self->ext.et_80128C2C.parent1->posY.i.hi;
if (++self->ext.et_80128C2C.unk7C >= 16) {
self->posX.i.hi = self->ext.agunea.parent->posX.i.hi;
self->posY.i.hi = self->ext.agunea.parent->posY.i.hi;
if (++self->ext.agunea.unk7C >= 16) {
if (g_PrimBuf[self->primIndex].r1 < 5) {
DestroyEntity(self);
return;
@ -2045,18 +2046,18 @@ void RicEntitySubwpnAgunea(Entity* self) {
(PAD_UP + PAD_SQUARE)) {
self->step = 4;
}
ent = self->ext.et_80128C2C.parent1;
ent = self->ext.agunea.parent;
if (ent->entityId == 0 ||
self->ext.et_80128C2C.unk7C != 0 &&
self->ext.agunea.unk7C != 0 &&
(ent->hitPoints > 0x7000 || ent->hitPoints == 0 ||
ent->hitboxState == 0)) {
self->step = 2;
return;
}
tempX = self->posX.i.hi = self->ext.et_80128C2C.parent1->posX.i.hi;
tempY = self->posY.i.hi = self->ext.et_80128C2C.parent1->posY.i.hi;
if ((self->ext.et_80128C2C.unk7C % 12) == 0) {
tempX = self->posX.i.hi = self->ext.agunea.parent->posX.i.hi;
tempY = self->posY.i.hi = self->ext.agunea.parent->posY.i.hi;
if ((self->ext.agunea.unk7C % 12) == 0) {
self->posX.i.hi += ((rand() & 0xF) - 8);
self->posY.i.hi += ((rand() & 0xF) - 8);
@ -2064,17 +2065,17 @@ void RicEntitySubwpnAgunea(Entity* self) {
g_Status.hearts -= 5;
RicCreateEntFactoryFromEntity(self, FACTORY(0, 52), 0);
g_api.PlaySfx(SFX_THUNDER_B);
} else if (self->ext.et_80128C2C.unk84 == 0) {
} else if (self->ext.agunea.unk84 == 0) {
RicCreateEntFactoryFromEntity(self, FACTORY(0, 52), 0);
g_api.PlaySfx(SFX_THUNDER_B);
self->ext.et_80128C2C.unk84++;
self->ext.agunea.unk84++;
} else {
self->step = 4;
}
}
self->posX.i.hi = tempX;
self->posY.i.hi = tempY;
self->ext.et_80128C2C.unk7C++;
self->ext.agunea.unk7C++;
break;
}
prim = &g_PrimBuf[self->primIndex];
@ -2091,8 +2092,8 @@ void RicEntitySubwpnAgunea(Entity* self) {
if (tempX < 5) {
prim->drawMode |= DRAW_HIDE;
}
prim->x0 = self->ext.et_80128C2C.unk80;
prim->y0 = self->ext.et_80128C2C.unk82;
prim->x0 = self->ext.agunea.unk80;
prim->y0 = self->ext.agunea.unk82;
prim->x1 = self->posX.i.hi;
prim->y1 = self->posY.i.hi;
return;
@ -2325,7 +2326,7 @@ void RicEntityVibhutiCrashCloud(Entity* entity) {
entity->ext.vibCrashCloud.parent->ext.vibhutiCrash.unk88;
entity->facingLeft =
entity->ext.vibCrashCloud.parent->ext.vibhutiCrash.unk8C;
entity->ext.factory.unkB0 = 0x18;
entity->ext.factory.unkB0 = PL_W_CRASH_VIBHUTI;
RicSetSubweaponParams(entity);
entity->unk5A = 0x79;
entity->animSet = ANIMSET_DRA(14);
@ -2357,7 +2358,8 @@ void RicEntityVibhutiCrashCloud(Entity* entity) {
}
}
void EntitySubwpnCrashVibhuti(Entity* self) {
static s32 crash_vibhuti_timer;
void RicEntityCrashVibhuti(Entity* self) {
FakePrim* prim;
s32 magnitude;
s32 angle;
@ -2381,7 +2383,7 @@ void EntitySubwpnCrashVibhuti(Entity* self) {
prim->drawMode = 0xA;
prim = prim->next;
}
D_80175890 = 0;
crash_vibhuti_timer = 0;
self->step++;
return;
case 1:
@ -2414,7 +2416,7 @@ void EntitySubwpnCrashVibhuti(Entity* self) {
}
/* fallthrough */
case 2:
if (!(++D_80175890 & 7)) {
if (!(++crash_vibhuti_timer & 7)) {
g_api.PlaySfx(SFX_NOISE_SWEEP_DOWN_A);
}
prim = &g_PrimBuf[self->primIndex];
@ -2449,19 +2451,18 @@ void EntitySubwpnCrashVibhuti(Entity* self) {
}
}
void func_8016D920(Entity* entity) {
void RicEntityCrashReboundStoneParticles(Entity* entity) {
switch (entity->step) {
case 0:
entity->flags = FLAG_UNK_04000000;
entity->ext.generic.unkB0 = 0x19;
entity->ext.subweapon.subweaponId = PL_W_CRASH_REBOUND_STONE;
RicSetSubweaponParams(entity);
entity->hitboxWidth = 4;
entity->hitboxHeight = 4;
entity->step++;
break;
case 1:
if (++entity->ext.generic.unk7C.s >= 4) {
if (++entity->ext.subweapon.timer >= 4) {
DestroyEntity(entity);
}
break;

View File

@ -1,11 +1,11 @@
#include "ric.h"
#include "sfx.h"
// RIC Entity # 49. Comes from blueprint 57. Factory call in func_8016E324.
// func_8016E324 is RIC Entity #48. Comes from blueprint 56. Blueprint 56 is
// subweapon 25. And subweapon 25 is the crash of subweapon 7.
// And subweapon 7 is the rebound stone. This is an entity spawned from the
// rebound stone crash.
// RIC Entity # 49. Comes from blueprint 57. Factory call in
// RicEntityCrashReboundStone. RicEntityCrashReboundStone is RIC Entity #48.
// Comes from blueprint 56. Blueprint 56 is subweapon 25. And subweapon 25 is
// the crash of subweapon 7. And subweapon 7 is the rebound stone. This is an
// entity spawned from the rebound stone crash.
static s32 angles_80155EE0[] = {0x00000F80, 0x00000100, 0x00000700, 0x00000880};
void func_8016D9C4(Entity* self) {
Primitive* prim;
@ -137,22 +137,8 @@ void func_8016D9C4(Entity* self) {
angleChange = -0x80;
}
primLine->angle = (primLine->angle - angleChange) & 0xFFF;
#ifdef VERSION_PC
#ifdef _MSC_VER
{
s32 temp_x = (rcos(primLine->angle) << 8);
s32 temp_y = (-(rsin(primLine->angle) << 8));
primLine->velocityX = *(f32*)&temp_x;
primLine->velocityY = *(f32*)&temp_y;
}
#else
primLine->velocityX = (f32)(rcos(primLine->angle) << 8);
primLine->velocityY = (f32) - (rsin(primLine->angle) << 8);
#endif
#else
primLine->velocityX = (rcos(primLine->angle) << 8);
primLine->velocityY = -(rsin(primLine->angle) << 8);
#endif
primLine->velocityX.val = (rcos(primLine->angle) << 8);
primLine->velocityY.val = -(rsin(primLine->angle) << 8);
primLine->preciseX.val += primLine->velocityX.val;
primLine->preciseY.val += primLine->velocityY.val;
self->posX.i.hi = primLine->preciseX.i.hi;
@ -200,18 +186,19 @@ void func_8016DF74(Entity* self) {
prim->y0 = prim->y1 = 0;
prim = prim->next;
}
self->ext.et_8016DF74.unk7C = 0x40;
self->ext.et_8016DF74.unk80 = 0x10;
self->ext.et_8016DF74.unk7E = 0;
self->ext.et_8016DF74.unk84 = 0;
self->ext.et_8016DF74.unk82 = 8;
self->ext.reboundStoneCrashExplosion.unk7C = 0x40;
self->ext.reboundStoneCrashExplosion.unk80 = 0x10;
self->ext.reboundStoneCrashExplosion.unk7E = 0;
self->ext.reboundStoneCrashExplosion.unk84 = 0;
self->ext.reboundStoneCrashExplosion.unk82 = 8;
g_api.PlaySfx(SFX_TELEPORT_BANG_B);
self->step++;
break;
case 1:
self->ext.et_8016DF74.unk84 += 0x20;
if (self->ext.et_8016DF74.unk84 > 0x120) {
self->ext.factory.unkB0 = 0x1D;
self->ext.reboundStoneCrashExplosion.unk84 += 0x20;
if (self->ext.reboundStoneCrashExplosion.unk84 > 0x120) {
self->ext.reboundStoneCrashExplosion.subweaponId =
PL_W_CRASH_REBOUND_EXPLOSION;
RicSetSubweaponParams(self);
self->posX.val = FIX(128.0);
self->posY.val = FIX(128.0);
@ -221,10 +208,10 @@ void func_8016DF74(Entity* self) {
}
break;
case 2:
if (++self->ext.et_8016DF74.unk86 == 5) {
self->ext.et_8016DF74.unk80 = -0x18;
} else if (self->ext.et_8016DF74.unk86 >= 0xF) {
self->ext.et_8016DF74.unk82 = -0x18;
if (++self->ext.reboundStoneCrashExplosion.unk86 == 5) {
self->ext.reboundStoneCrashExplosion.unk80 = -0x18;
} else if (self->ext.reboundStoneCrashExplosion.unk86 >= 0xF) {
self->ext.reboundStoneCrashExplosion.unk82 = -0x18;
self->step++;
}
break;
@ -234,54 +221,64 @@ void func_8016DF74(Entity* self) {
DestroyEntity(self);
return;
}
self->ext.et_8016DF74.unk7C += self->ext.et_8016DF74.unk80;
if (self->ext.et_8016DF74.unk7C >= 0x100) {
self->ext.et_8016DF74.unk7C = 0xFF;
self->ext.et_8016DF74.unk80 = 0;
} else if (self->ext.et_8016DF74.unk7C < 0) {
self->ext.et_8016DF74.unk80 = 0;
self->ext.et_8016DF74.unk7C = 0;
self->ext.reboundStoneCrashExplosion.unk7C +=
self->ext.reboundStoneCrashExplosion.unk80;
if (self->ext.reboundStoneCrashExplosion.unk7C >= 0x100) {
self->ext.reboundStoneCrashExplosion.unk7C = 0xFF;
self->ext.reboundStoneCrashExplosion.unk80 = 0;
} else if (self->ext.reboundStoneCrashExplosion.unk7C < 0) {
self->ext.reboundStoneCrashExplosion.unk80 = 0;
self->ext.reboundStoneCrashExplosion.unk7C = 0;
}
self->ext.et_8016DF74.unk7E += self->ext.et_8016DF74.unk82;
if (self->ext.et_8016DF74.unk7E >= 0x100) {
self->ext.et_8016DF74.unk7E = 0xFF;
self->ext.et_8016DF74.unk82 = 0;
} else if (self->ext.et_8016DF74.unk7E < 0) {
self->ext.et_8016DF74.unk82 = 0;
self->ext.et_8016DF74.unk7E = 0;
self->ext.reboundStoneCrashExplosion.unk7E +=
self->ext.reboundStoneCrashExplosion.unk82;
if (self->ext.reboundStoneCrashExplosion.unk7E >= 0x100) {
self->ext.reboundStoneCrashExplosion.unk7E = 0xFF;
self->ext.reboundStoneCrashExplosion.unk82 = 0;
} else if (self->ext.reboundStoneCrashExplosion.unk7E < 0) {
self->ext.reboundStoneCrashExplosion.unk82 = 0;
self->ext.reboundStoneCrashExplosion.unk7E = 0;
self->step += 1;
}
prim = &g_PrimBuf[self->primIndex];
for (i = 0; i < 16; i++) {
prim->b0 = prim->b1 = self->ext.et_8016DF74.unk7C;
prim->b2 = prim->b3 = self->ext.et_8016DF74.unk7E;
prim->r0 = prim->r1 = prim->g0 = prim->g1 = self->ext.et_8016DF74.unk7C;
prim->r2 = prim->r3 = prim->g2 = prim->g3 = self->ext.et_8016DF74.unk7E;
prim->b0 = prim->b1 = self->ext.reboundStoneCrashExplosion.unk7C;
prim->b2 = prim->b3 = self->ext.reboundStoneCrashExplosion.unk7E;
prim->r0 = prim->r1 = prim->g0 = prim->g1 =
self->ext.reboundStoneCrashExplosion.unk7C;
prim->r2 = prim->r3 = prim->g2 = prim->g3 =
self->ext.reboundStoneCrashExplosion.unk7E;
if (self->step < 2U) {
prim->x2 =
((rcos(i << 7) * self->ext.et_8016DF74.unk84) >> 0xC) + 0x80;
prim->x3 =
((rcos((i + 1) << 7) * self->ext.et_8016DF74.unk84) >> 0xC) +
((rcos(i << 7) * self->ext.reboundStoneCrashExplosion.unk84) >>
0xC) +
0x80;
prim->y2 = ((rsin(i << 7) * self->ext.et_8016DF74.unk84) >> 0xC);
prim->y3 =
((rsin((i + 1) << 7) * self->ext.et_8016DF74.unk84) >> 0xC);
prim->x3 = ((rcos((i + 1) << 7) *
self->ext.reboundStoneCrashExplosion.unk84) >>
0xC) +
0x80;
prim->y2 =
((rsin(i << 7) * self->ext.reboundStoneCrashExplosion.unk84) >>
0xC);
prim->y3 = ((rsin((i + 1) << 7) *
self->ext.reboundStoneCrashExplosion.unk84) >>
0xC);
}
prim = prim->next;
}
return;
}
void func_8016E324(Entity* entity) {
void RicEntityCrashReboundStone(Entity* entity) {
switch (entity->step) {
case 0:
entity->flags = FLAG_UNK_20000 | FLAG_UNK_04000000;
entity->ext.generic.unk7C.s = 0x14;
entity->ext.timer.t = 0x14;
entity->step++;
case 1:
entity->ext.generic.unk7C.s--;
if ((entity->ext.generic.unk7C.s) == 0) {
entity->ext.timer.t--;
if ((entity->ext.timer.t) == 0) {
case 3:
case 5:
RicCreateEntFactoryFromEntity(entity, FACTORY(0, 57), 0);
@ -289,9 +286,9 @@ void func_8016E324(Entity* entity) {
case 2:
case 4:
case 6:
entity->ext.generic.unk7C.s++;
if (entity->ext.generic.unk7C.s >= 11) {
entity->ext.generic.unk7C.s = 0;
entity->ext.timer.t++;
if (entity->ext.timer.t >= 11) {
entity->ext.timer.t = 0;
entity->posX.val = FIX(128.0);
entity->posY.val = 0;
RicCreateEntFactoryFromEntity(entity, FACTORY(0x100, 4), 0);
@ -301,8 +298,8 @@ void func_8016E324(Entity* entity) {
break;
case 7:
entity->ext.generic.unk7C.s++;
if (entity->ext.generic.unk7C.s >= 16) {
entity->ext.timer.t++;
if (entity->ext.timer.t >= 16) {
DestroyEntity(entity);
g_Player.unk4E = 1;
RicCreateEntFactoryFromEntity(entity, FACTORY(0, 58), 0);
@ -311,7 +308,9 @@ void func_8016E324(Entity* entity) {
}
}
void EntityBiblePageBeam(Entity* self) {
#define BIBLE_PAGE_COUNT 6
static Point16 bible_pages_pos[BIBLE_PAGE_COUNT];
void RicEntityCrashBibleBeam(Entity* self) {
Primitive* prim;
s16 var_s7;
s16 hitboxOffX;
@ -324,39 +323,38 @@ void EntityBiblePageBeam(Entity* self) {
switch (self->step) {
case 0:
self->primIndex = g_api.AllocPrimitives(PRIM_G4, 6);
self->primIndex = g_api.AllocPrimitives(PRIM_G4, BIBLE_PAGE_COUNT);
if (self->primIndex == -1) {
DestroyEntity(self);
return;
}
self->flags = FLAG_UNK_04000000 | FLAG_HAS_PRIMS | FLAG_UNK_20000;
if (self->facingLeft) {
self->ext.et_8016E46C.unk7C = -16;
self->ext.et_8016E46C.unk7E = -2;
self->ext.bibleBeam.unk7C = -16;
self->ext.bibleBeam.unk7E = -2;
} else {
self->ext.et_8016E46C.unk7C = 16;
self->ext.et_8016E46C.unk7E = 2;
self->ext.bibleBeam.unk7C = 16;
self->ext.bibleBeam.unk7E = 2;
}
prim = &g_PrimBuf[self->primIndex];
for (i = 0; i < 6; i++) {
for (i = 0; i < BIBLE_PAGE_COUNT; i++) {
var_s3 = i + 2;
if (var_s3 >= 6) {
if (var_s3 >= BIBLE_PAGE_COUNT) {
var_s3 = i - 4;
}
prim->x0 = prim->x1 = g_BiblePos[i].x;
prim->y0 = prim->y1 = g_BiblePos[i].y;
prim->x2 = prim->x3 = g_BiblePos[var_s3].x;
prim->y2 = prim->y3 = g_BiblePos[var_s3].y;
prim->x0 = prim->x1 = bible_pages_pos[i].x;
prim->y0 = prim->y1 = bible_pages_pos[i].y;
prim->x2 = prim->x3 = bible_pages_pos[var_s3].x;
prim->y2 = prim->y3 = bible_pages_pos[var_s3].y;
prim->priority = 0xC2;
prim->blendMode = 0x435;
prim = prim->next;
}
self->step++;
break;
case 1:
if (++self->ext.et_8016E46C.unk80 >= 0x3C) {
self->ext.et_8016E46C.unkB0 = 0x11;
if (++self->ext.bibleBeam.unk80 >= 0x3C) {
self->ext.bibleBeam.subweaponId = PL_W_BIBLE_BEAM;
RicSetSubweaponParams(self);
g_api.PlaySfx(SFX_WEAPON_APPEAR);
g_api.PlaySfx(SFX_TELEPORT_BANG_A);
@ -364,15 +362,15 @@ void EntityBiblePageBeam(Entity* self) {
}
break;
case 2:
self->ext.et_8016E46C.unk80++;
self->ext.et_8016E46C.unk7E += self->ext.et_8016E46C.unk7C;
var_s3 = g_BiblePos[1].x + self->ext.et_8016E46C.unk7E;
self->ext.bibleBeam.unk80++;
self->ext.bibleBeam.unk7E += self->ext.bibleBeam.unk7C;
var_s3 = bible_pages_pos[1].x + self->ext.bibleBeam.unk7E;
if (var_s3 < -0x50 || var_s3 > 0x150) {
self->step++;
}
break;
case 3:
if (++self->ext.et_8016E46C.unk80 >= 0x78) {
if (++self->ext.bibleBeam.unk80 >= 0x78) {
DestroyEntity(self);
return;
}
@ -380,43 +378,46 @@ void EntityBiblePageBeam(Entity* self) {
}
var_s7 = 0;
prim = &g_PrimBuf[self->primIndex];
for (i = 0; i < 6; i++) {
for (i = 0; i < BIBLE_PAGE_COUNT; i++) {
var_s3 = i + 2;
if (var_s3 >= 6) {
if (var_s3 >= BIBLE_PAGE_COUNT) {
var_s3 = i - 4;
}
temp_v1 = (rsin((self->ext.et_8016E46C.unk80 * 20) + (i << 8)) * 96);
temp_v1 = (rsin((self->ext.bibleBeam.unk80 * 20) + (i << 8)) * 96);
prim->r0 = prim->r1 = abs(temp_v1 >> 0xc);
temp_v1 = rsin((self->ext.et_8016E46C.unk80 * 15) + (i << 8)) * 96;
temp_v1 = rsin((self->ext.bibleBeam.unk80 * 15) + (i << 8)) * 96;
prim->g0 = prim->g1 = abs(temp_v1 >> 0xc);
temp_v1 = rsin((self->ext.et_8016E46C.unk80 * 10) + (i << 8)) * 96;
temp_v1 = rsin((self->ext.bibleBeam.unk80 * 10) + (i << 8)) * 96;
prim->b0 = prim->b1 = abs(temp_v1 >> 0xc);
temp_v1 = rsin((self->ext.et_8016E46C.unk80 * 15) + (var_s3 << 8)) * 96;
temp_v1 = rsin((self->ext.bibleBeam.unk80 * 15) + (var_s3 << 8)) * 96;
prim->r2 = prim->r3 = abs(temp_v1 >> 0xc);
temp_v1 = rsin((self->ext.et_8016E46C.unk80 * 10) + (var_s3 << 8)) * 96;
temp_v1 = rsin((self->ext.bibleBeam.unk80 * 10) + (var_s3 << 8)) * 96;
prim->g2 = prim->g3 = abs(temp_v1 >> 0xc);
temp_v1 = rsin((self->ext.et_8016E46C.unk80 * 20) + (var_s3 << 8)) * 96;
temp_v1 = rsin((self->ext.bibleBeam.unk80 * 20) + (var_s3 << 8)) * 96;
prim->b2 = prim->b3 = abs(temp_v1 >> 0xc);
prim->x1 = g_BiblePos[i].x;
prim->y0 = prim->y1 = g_BiblePos[i].y;
prim->x3 = g_BiblePos[var_s3].x;
prim->y2 = prim->y3 = g_BiblePos[var_s3].y;
prim->x0 = g_BiblePos[i].x + self->ext.et_8016E46C.unk7E;
prim->x2 = g_BiblePos[var_s3].x + self->ext.et_8016E46C.unk7E;
if (var_s7 < abs(g_BiblePos[i].y)) {
var_s7 = abs(g_BiblePos[i].y);
prim->x1 = bible_pages_pos[i].x;
prim->y0 = prim->y1 = bible_pages_pos[i].y;
prim->x3 = bible_pages_pos[var_s3].x;
prim->y2 = prim->y3 = bible_pages_pos[var_s3].y;
prim->x0 = bible_pages_pos[i].x + self->ext.bibleBeam.unk7E;
prim->x2 = bible_pages_pos[var_s3].x + self->ext.bibleBeam.unk7E;
if (var_s7 < abs(bible_pages_pos[i].y)) {
var_s7 = abs(bible_pages_pos[i].y);
}
prim = prim->next;
}
halfwidth = self->ext.et_8016E46C.unk7E / 2;
halfwidth = self->ext.bibleBeam.unk7E / 2;
hitboxOffX = !self->facingLeft ? halfwidth : -halfwidth;
self->hitboxOffX = hitboxOffX;
self->hitboxWidth = abs(hitboxOffX);
self->hitboxHeight = var_s7 - self->posY.i.hi;
}
static s16 D_80155EF0[] = {0x0400, 0x06AB, 0x0955, 0x0C00, 0x0EAB, 0x1155};
void EntityBiblePage(Entity* self) {
static s16 bible_page_angles[BIBLE_PAGE_COUNT] = {
0x0400, 0x06AB, 0x0955, 0x0C00, 0x0EAB, 0x1155,
};
static s32 bible_pages_volume;
void RicEntityCrashBible(Entity* self) {
Primitive* prim;
s16 temp_a1_3;
s16 temp_v0_6;
@ -431,7 +432,7 @@ void EntityBiblePage(Entity* self) {
switch (self->step) {
case 0:
self->primIndex = g_api.AllocPrimitives(PRIM_GT4, 7);
self->primIndex = g_api.AllocPrimitives(PRIM_GT4, 1 + BIBLE_PAGE_COUNT);
if (self->primIndex == -1) {
DestroyEntity(self);
g_Player.unk4E = 1;
@ -453,15 +454,14 @@ void EntityBiblePage(Entity* self) {
prim = &g_PrimBuf[self->primIndex];
prim->tpage = 0x1E;
prim->clut = 0x17F;
prim->u0 = prim->u2 = 0x98;
prim->v0 = prim->v1 = 0xD8;
prim->u1 = prim->u3 = 0xA8;
prim->v2 = prim->v3 = 0xF0;
prim->priority = 0xC2;
prim->drawMode = 8;
prim->drawMode = DRAW_HIDE;
prim = prim->next;
for (i = 0; i < 6; i++) {
for (i = 0; i < BIBLE_PAGE_COUNT; i++) {
prim->tpage = 0x1C;
prim->clut = 0x1AE;
prim->u0 = prim->u2 = 0x20;
@ -473,7 +473,7 @@ void EntityBiblePage(Entity* self) {
prim = prim->next;
}
self->ext.et_8016E9E4.unk84 = 0x40;
D_801758AC = 0x60;
bible_pages_volume = 0x60;
self->step++;
break;
case 1:
@ -496,7 +496,7 @@ void EntityBiblePage(Entity* self) {
prim->clut = 0x19F;
prim->drawMode |= 0x35;
prim = prim->next;
for (i = 0; i < 6; i++) {
for (i = 0; i < BIBLE_PAGE_COUNT; i++) {
prim->drawMode &= ~DRAW_HIDE;
prim = prim->next;
}
@ -557,12 +557,12 @@ void EntityBiblePage(Entity* self) {
(self->ext.et_8016E9E4.unk7C == 0x900) ||
(self->ext.et_8016E9E4.unk7C == 0xD00)) {
if (self->step < 9) {
g_api.PlaySfxVolPan(SFX_ARROW_SHOT_A, D_801758AC, 0);
g_api.PlaySfxVolPan(SFX_ARROW_SHOT_A, bible_pages_volume, 0);
if (self->step >= 5) {
D_801758AC -= 4;
bible_pages_volume -= 4;
}
if (D_801758AC < 0) {
D_801758AC = 0;
if (bible_pages_volume < 0) {
bible_pages_volume = 0;
}
}
}
@ -581,11 +581,11 @@ void EntityBiblePage(Entity* self) {
temp_s6 = rsin(self->ext.et_8016E9E4.unk7E);
temp_s5 = rcos(self->ext.et_8016E9E4.unk7E);
for (i = 0; i < 6; i++) {
temp_s0_2 = (rsin(self->ext.et_8016E9E4.unk7C + D_80155EF0[i]) *
for (i = 0; i < BIBLE_PAGE_COUNT; i++) {
temp_s0_2 = (rsin(self->ext.et_8016E9E4.unk7C + bible_page_angles[i]) *
self->ext.et_8016E9E4.unk80) >>
0xC;
temp_v0_4 = (rcos(self->ext.et_8016E9E4.unk7C + D_80155EF0[i]) *
temp_v0_4 = (rcos(self->ext.et_8016E9E4.unk7C + bible_page_angles[i]) *
self->ext.et_8016E9E4.unk80) >>
0xC;
temp_a1_3 =
@ -595,8 +595,8 @@ void EntityBiblePage(Entity* self) {
self->posY.i.hi +
((temp_s0_2 << 9) / (((temp_s5 * temp_v0_4) >> 0xC) + 0x200));
temp_v0_5 = ((temp_s5 * temp_v0_4) >> 0xC) + 0x200;
g_BiblePos[i].x = temp_a1_3;
g_BiblePos[i].y = temp_v0_6;
bible_pages_pos[i].x = temp_a1_3;
bible_pages_pos[i].y = temp_v0_6;
prim->x0 = prim->x2 = temp_a1_3 - 0x1000 / temp_v0_5;
prim->x1 = prim->x3 = temp_a1_3 + 0x1000 / temp_v0_5;
// FAKE, needed for reg match
@ -724,12 +724,12 @@ void func_8016F198(Entity* self) {
}
}
// Entity ID #64, created by blueprint #72. This call is in EntityStopwatch.
// When Richter has the stopwatch weapon, and uses it as a crash, it makes
// 4 floating stopwatches. When they are done they disappear in a spinning
// sparkle. This entity represents that sparkle. 4 copies of this entity
// are made when the crash is done.
void StopwatchCrashDoneSparkle(Entity* self) {
// Entity ID #64, created by blueprint #72. This call is in
// RicEntitySubwpnStopwatch. When Richter has the stopwatch weapon, and uses it
// as a crash, it makes 4 floating stopwatches. When they are done they
// disappear in a spinning sparkle. This entity represents that sparkle. 4
// copies of this entity are made when the crash is done.
void RicEntityCrashStopwatchDoneSparkle(Entity* self) {
Primitive* prim;
u32 selfX;
u32 selfY;
@ -1074,9 +1074,8 @@ void func_80170548(Entity* entity) {
entity->hitboxHeight = 8;
entity->step++;
break;
case 1:
if (++entity->ext.generic.unk7C.s >= 5) {
if (++entity->ext.timer.t >= 5) {
DestroyEntity(entity);
}
break;
@ -1089,36 +1088,33 @@ void func_801705EC(Entity* entity) {
switch (entity->step) {
case 0:
entity->flags = FLAG_UNK_04000000;
entity->ext.generic.unk7E.modeU16 = 0;
entity->ext.et_80161FF0.unk7E = 0;
entity->step++;
case 1:
case 3:
case 5:
case 7:
temp = entity->ext.generic.unk7E.modeU16 + 1;
entity->ext.generic.unk7E.modeU16 = temp;
temp = entity->ext.et_80161FF0.unk7E + 1;
entity->ext.et_80161FF0.unk7E = temp;
RicCreateEntFactoryFromEntity(entity, FACTORY(temp * 0x100, 63), 0);
entity->ext.generic.unk7C.s = 0;
entity->ext.et_80161FF0.unk7C = 0;
entity->step++;
break;
case 2:
case 4:
case 6:
entity->ext.generic.unk7C.s++;
if (entity->ext.generic.unk7C.s >= 16) {
entity->ext.et_80161FF0.unk7C++;
if (entity->ext.et_80161FF0.unk7C >= 16) {
entity->step++;
}
break;
case 8:
DestroyEntity(entity);
break;
}
}
s16 GetAguneaLightningAngle(u16* arg0, s16 arg1, s16 arg2, s16* arg3) {
static s16 GetAguneaLightningAngle(u16* arg0, s16 arg1, s16 arg2, s16* arg3) {
s16 temp_s3;
s16 s3_offset = 0x80;
s8 arg2_copy = arg2;
@ -1144,7 +1140,7 @@ s16 GetAguneaLightningAngle(u16* arg0, s16 arg1, s16 arg2, s16* arg3) {
}
}
void AguneaShuffleParams(s32 bufSize, s32* buf) {
static void AguneaShuffleParams(s32 bufSize, s32* buf) {
s32 i, idx, swapTemp;
for (i = bufSize - 1; i > 0; i--) {
@ -1158,8 +1154,8 @@ void AguneaShuffleParams(s32 bufSize, s32* buf) {
}
}
// Agunea item crash lightning, created by EntityAguneaCircle, blueprint 68
void EntityAguneaLightning(Entity* self) {
// Agunea item crash lightning, created by RicEntityAguneaCircle, blueprint 68
void RicEntityAguneaLightning(Entity* self) {
u16 sp10[4];
s16 sp18;
u16 sp20;
@ -1295,7 +1291,9 @@ void EntityAguneaLightning(Entity* self) {
}
}
void EntityAguneaCircle(Entity* self) {
#define LIGHTNING_COUNT 8
static s32 g_AguneaParams[LIGHTNING_COUNT];
void RicEntityAguneaCircle(Entity* self) {
Primitive* prim;
s16 rand_angle;
s16 xCoord;
@ -1350,27 +1348,27 @@ void EntityAguneaCircle(Entity* self) {
prim->drawMode = 0x200 | DRAW_HIDE;
prim = prim->next;
}
self->ext.et_80170F64.unkB0 = 0x1A;
self->ext.aguneaCrash.subweaponId = PL_W_CRASH_AGUNEA;
RicSetSubweaponParams(self);
self->step++;
break;
case 1:
prim = &g_PrimBuf[self->primIndex];
for (i = 0; i < self->ext.et_80170F64.unk7C; i++) {
for (i = 0; i < self->ext.aguneaCrash.unk7C; i++) {
prim = prim->next;
}
prim->drawMode &= ~DRAW_HIDE;
if (++self->ext.et_80170F64.unk7C >= 4) {
self->ext.et_80170F64.unk7C = 0;
if (++self->ext.aguneaCrash.unk7C >= 4) {
self->ext.aguneaCrash.unk7C = 0;
self->step++;
}
break;
case 2:
prim = &g_PrimBuf[self->primIndex];
for (i = 0; i < self->ext.et_80170F64.unk7C; i++) {
for (i = 0; i < self->ext.aguneaCrash.unk7C; i++) {
prim = prim->next;
}
if (self->ext.et_80170F64.unk7C == 0) {
if (self->ext.aguneaCrash.unk7C == 0) {
prim->drawMode = 0x235;
prim->tpage = 0x1A;
prim->clut = 0x19F;
@ -1381,20 +1379,20 @@ void EntityAguneaCircle(Entity* self) {
prim->r0 = prim->g0 = prim->r1 = prim->g1 = prim->r2 = prim->g2 =
prim->r3 = prim->g3 = 0x7F;
prim->b0 = prim->b1 = prim->b2 = prim->b3 = 0xFF;
self->ext.et_80170F64.unk7E = 1;
self->ext.et_80170F64.unk80 = 2;
self->ext.et_80170F64.unk82 = 0x64;
self->ext.aguneaCrash.unk7E = 1;
self->ext.aguneaCrash.unk80 = 2;
self->ext.aguneaCrash.unk82 = 0x64;
} else {
self->ext.et_80170F64.unk80 += 2;
self->ext.aguneaCrash.unk80 += 2;
prim->drawMode |= DRAW_HIDE;
}
if (++self->ext.et_80170F64.unk7C >= 4) {
if (++self->ext.aguneaCrash.unk7C >= 4) {
// think this loop has to count down since we assign to i
for (i = 7; i >= 0; i--) {
for (i = LIGHTNING_COUNT - 1; i >= 0; i--) {
g_AguneaParams[i] = i;
}
AguneaShuffleParams(8, &g_AguneaParams[0]);
self->ext.et_80170F64.unk7C = 0;
AguneaShuffleParams(LIGHTNING_COUNT, &g_AguneaParams[0]);
self->ext.aguneaCrash.unk7C = 0;
g_api.PlaySfx(SFX_THUNDER_B);
self->step++;
}
@ -1402,23 +1400,23 @@ void EntityAguneaCircle(Entity* self) {
case 3:
RicCreateEntFactoryFromEntity(
self,
FACTORY(g_AguneaParams[self->ext.et_80170F64.unk7C] * 0x100, 68),
FACTORY(g_AguneaParams[self->ext.aguneaCrash.unk7C] * 0x100, 68),
0);
if (++self->ext.et_80170F64.unk7C >= 8) {
if (++self->ext.aguneaCrash.unk7C >= LIGHTNING_COUNT) {
self->hitboxHeight = self->hitboxWidth = 0x80;
self->ext.et_80170F64.unk7C = 0;
self->ext.aguneaCrash.unk7C = 0;
self->step++;
}
break;
case 4:
if (++self->ext.et_80170F64.unk7C >= 9) {
if (++self->ext.aguneaCrash.unk7C >= LIGHTNING_COUNT + 1) {
self->step++;
}
break;
case 5:
self->ext.et_80170F64.unk80 += 2;
self->ext.et_80170F64.unk82 -= 10;
if (self->ext.et_80170F64.unk82 <= 0) {
self->ext.aguneaCrash.unk80 += 2;
self->ext.aguneaCrash.unk82 -= 10;
if (self->ext.aguneaCrash.unk82 <= 0) {
self->hitboxHeight = self->hitboxWidth = 0;
self->step++;
}
@ -1428,21 +1426,21 @@ void EntityAguneaCircle(Entity* self) {
DestroyEntity(self);
return;
}
if (self->ext.et_80170F64.unk7E != 0) {
if (self->ext.aguneaCrash.unk7E != 0) {
prim = &g_PrimBuf[self->primIndex];
prim->x0 = prim->x2 = self->posX.i.hi - self->ext.et_80170F64.unk80;
prim->x1 = prim->x3 = self->posX.i.hi + self->ext.et_80170F64.unk80;
prim->y0 = prim->y1 = self->posY.i.hi - self->ext.et_80170F64.unk80;
prim->y2 = prim->y3 = self->posY.i.hi + self->ext.et_80170F64.unk80;
prim->x0 = prim->x2 = self->posX.i.hi - self->ext.aguneaCrash.unk80;
prim->x1 = prim->x3 = self->posX.i.hi + self->ext.aguneaCrash.unk80;
prim->y0 = prim->y1 = self->posY.i.hi - self->ext.aguneaCrash.unk80;
prim->y2 = prim->y3 = self->posY.i.hi + self->ext.aguneaCrash.unk80;
prim->r0 = prim->g0 = prim->r1 = prim->g1 = prim->r2 = prim->g2 =
prim->r3 = prim->g3 = (self->ext.et_80170F64.unk82 * 0x7F) / 100;
prim->r3 = prim->g3 = (self->ext.aguneaCrash.unk82 * 0x7F) / 100;
prim->b0 = prim->b1 = prim->b2 = prim->b3 =
(self->ext.et_80170F64.unk82 * 0xFF) / 100;
(self->ext.aguneaCrash.unk82 * 0xFF) / 100;
}
return;
}
void EntityStopwatchCircle(Entity* self) {
void RicEntitySubwpnStopwatchCircle(Entity* self) {
Primitive* prim;
s16 temp_s0_4;
s32 sine;
@ -1511,7 +1509,10 @@ void EntityStopwatchCircle(Entity* self) {
return;
}
void EntityStopwatch(Entity* self) {
static u32 D_801758D0;
static Entity*
D_801758D4[3]; // used by RicEntitySubwpnStopwatch, should never underflow
void RicEntitySubwpnStopwatch(Entity* self) {
Primitive* prim;
s16 firstmult;
s16 secondmult;
@ -1582,17 +1583,17 @@ void EntityStopwatch(Entity* self) {
RicCreateEntFactoryFromEntity(self, FACTORY(0, 66), 0);
D_801758D0 = self->ext.et_801719A4.unk94 = self->params >> 8;
if (self->ext.et_801719A4.unk94 < 4) {
(&D_801758D0)[self->ext.et_801719A4.unk94] = (u32)self;
D_801758D4[self->ext.et_801719A4.unk94 - 1] = self;
}
if (self->ext.et_801719A4.unk94 >= 2) {
self->ext.et_801719A4.unk98 =
D_801758CC[self->ext.et_801719A4.unk94];
D_801758D4[self->ext.et_801719A4.unk94 - 2];
}
} else {
RicCreateEntFactoryFromEntity(self, FACTORY(0, 64), 0);
self->ext.et_801719A4.unk94 = 0;
}
self->ext.et_801719A4.unkB0 = 6;
self->ext.et_801719A4.subweaponId = PL_W_STOPWATCH;
RicSetSubweaponParams(self);
g_api.PlaySfx(0x6AD);
if (self->ext.et_801719A4.unk94 < 2) {
@ -1697,7 +1698,7 @@ void EntityStopwatch(Entity* self) {
g_unkGraphicsStruct.D_800973FC = 0;
}
if (self->ext.et_801719A4.unk94 != 0) {
(&D_801758D0)[self->ext.et_801719A4.unk94] = 0;
D_801758D4[self->ext.et_801719A4.unk94 - 1] = 0;
}
DestroyEntity(self);
return;
@ -1710,7 +1711,7 @@ void EntityStopwatch(Entity* self) {
if (self->ext.et_801719A4.unk94 < 2) {
var_s4 = PLAYER.posX.val + (PLAYER.facingLeft ? FIX(8) : FIX(-8));
var_s6 = PLAYER.posY.val + FIX(-16);
} else if (D_801758CC[self->ext.et_801719A4.unk94] != 0) {
} else if (D_801758D4[self->ext.et_801719A4.unk94 - 2] != NULL) {
var_s4 = self->ext.et_801719A4.unk98->posX.val +
(PLAYER.facingLeft ? FIX(16) : FIX(-16));
var_s6 = self->ext.et_801719A4.unk98->posY.val + FIX(-16);
@ -1734,7 +1735,7 @@ void EntityStopwatch(Entity* self) {
self->facingLeft = PLAYER.facingLeft;
}
}
} else if (D_801758CC[self->ext.et_801719A4.unk94] != 0) {
} else if (D_801758D4[self->ext.et_801719A4.unk94 - 2] != NULL) {
parent = self->ext.et_801719A4.unk98;
if (parent->facingLeft != self->facingLeft) {
if (abs(var_s4 - self->posX.val) >= FIX(1)) {
@ -1939,7 +1940,7 @@ void EntityStopwatch(Entity* self) {
}
}
void func_80172AE8(Entity* entity) {
void RicEntitySubpwnBibleTrail(Entity* entity) {
Primitive* prim;
s32 ret;
@ -1947,54 +1948,44 @@ void func_80172AE8(Entity* entity) {
case 0:
ret = g_api.AllocPrimitives(PRIM_GT4, 1);
entity->primIndex = ret;
if (entity->primIndex != -1) {
entity->flags = FLAG_UNK_20000 | FLAG_UNK_04000000 | FLAG_HAS_PRIMS;
prim = &g_PrimBuf[entity->primIndex];
prim->tpage = 0x1C;
prim->clut = 0x19D;
prim->u2 = 0x20;
prim->u0 = 0x20;
prim->u3 = 0x30;
prim->u1 = 0x30;
prim->v1 = 0;
prim->v0 = 0;
prim->v3 = 0x10;
prim->v2 = 0x10;
prim->x0 = prim->x2 = entity->posX.i.hi - 8;
prim->x1 = prim->x3 = entity->posX.i.hi + 8;
prim->y0 = prim->y1 = entity->posY.i.hi - 8;
prim->y2 = prim->y3 = entity->posY.i.hi + 8;
prim->priority = entity->zPriority;
prim->drawMode = 0x115;
entity->ext.generic.unk7E.modeU16 = 0x60U;
entity->step++;
} else {
if (entity->primIndex == -1) {
DestroyEntity(entity);
return;
}
entity->flags = FLAG_UNK_20000 | FLAG_UNK_04000000 | FLAG_HAS_PRIMS;
prim = &g_PrimBuf[entity->primIndex];
prim->tpage = 0x1C;
prim->clut = 0x19D;
prim->u0 = prim->u2 = 0x20;
prim->u1 = prim->u3 = 0x30;
prim->v0 = prim->v1 = 0;
prim->v2 = prim->v3 = 0x10;
prim->x0 = prim->x2 = entity->posX.i.hi - 8;
prim->x1 = prim->x3 = entity->posX.i.hi + 8;
prim->y0 = prim->y1 = entity->posY.i.hi - 8;
prim->y2 = prim->y3 = entity->posY.i.hi + 8;
prim->priority = entity->zPriority;
prim->drawMode = 0x115;
entity->ext.et_BibleSubwpn.unk7E = 0x60;
entity->step++;
break;
case 1:
if (++entity->ext.generic.unk7C.s > 5) {
if (++entity->ext.et_BibleSubwpn.unk7C > 5) {
entity->step++;
}
entity->ext.generic.unk7E.modeU16 -= 8;
entity->ext.et_BibleSubwpn.unk7E -= 8;
break;
case 2:
DestroyEntity(entity);
return;
default:
break;
}
prim = &g_PrimBuf[entity->primIndex];
prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 = prim->g2 =
prim->g3 = prim->b0 = prim->b1 = prim->b2 = prim->b3 =
entity->ext.generic.unk7E.modeU8.unk0;
entity->ext.et_BibleSubwpn.unk7E;
}
void RicEntitySubwpnBible(Entity* self) {
void RicEntitySubpwnBible(Entity* self) {
Primitive* prim;
s16 left;
s16 top;
@ -2036,7 +2027,7 @@ void RicEntitySubwpnBible(Entity* self) {
prim->priority = PLAYER.zPriority + 1;
prim->drawMode = 0x108;
self->ext.et_BibleSubwpn.unk84 = self->facingLeft ? 0x20 : -0x20;
self->ext.et_BibleSubwpn.unkB0 = 5;
self->ext.et_BibleSubwpn.subweaponId = PL_W_BIBLE;
RicSetSubweaponParams(self);
self->hitboxWidth = 6;
self->hitboxHeight = 6;

View File

@ -1,48 +1,11 @@
#include "common.h"
#include "game.h"
#include <game.h>
u32 D_80173B64;
u32 D_80173B68[1280];
u32 D_80174F68;
u32 D_80174F6C;
u32 D_80174F70;
u32 D_80174F74;
u32 D_80174F78;
static u32 g_DebugWaitInfoTimer;
u32 D_80174F80[11];
u8 D_80174FAC[4];
u8 D_80174FB0[4];
u8 D_80174FB4[4];
u8 D_80174FB8[4];
u16 D_80174FBC;
u16 D_80174FBE[31];
u16 D_80174FFC;
u16 D_80174FFE;
u16 D_80175000;
u16 D_80175002[63];
u32 D_80175080;
u32 D_80175084;
u32 D_80175088[512];
u32 D_80175888;
u32 D_8017588C;
u32 D_80175890;
Point16 g_BiblePos[6];
u32 D_801758AC;
#ifdef VERSION_PC
// D_801758CC is used in other places so unclear if this is a bug
// or data import error
u32 g_AguneaParams[8];
#else
u32 g_AguneaParams[7];
#endif
u32 D_801758CC;
u32 D_801758D0[4];
ButtonComboState g_bladeDashButtons;
ButtonComboState D_801758E4;
u16 D_801758E6[52];
STATIC_PAD_BSS(104);
u16 g_RicDebugCurFrame;
u16 g_RicDebugDrawFlags;
u16 g_RicDebugPalette;
u16 g_IsRicDebugEnter;
u32 D_80175958[32];
u32 D_801759D8[32];
s16 g_IsRicDebugEnter;
s32 D_80175958[32];
s32 D_801759D8[32];

View File

@ -112,7 +112,7 @@ static u8 D_8015635C[][5] = {
{0x50, 0x58, 0x18, 0x10, 0x0F}, {0x50, 0x58, 0x18, 0x10, 0x1F}};
static const SVECTOR D_80156C50 = {0, 0, 0};
static const SVECTOR D_80156C58 = {-96, 0, 0};
void RicEntityGiantSpinningCross(Entity* self) {
void RicEntityCrashCrossBeam(Entity* self) {
MATRIX m;
SVECTOR rot;
VECTOR trans1;
@ -142,7 +142,7 @@ void RicEntityGiantSpinningCross(Entity* self) {
prim->drawMode = 0x100 | DRAW_HIDE;
prim = prim->next;
}
self->ext.giantcross.unkB0 = 0xD;
self->ext.giantcross.subweaponId = PL_W_CRASH_CROSS_BEAM;
RicSetSubweaponParams(self);
self->hitboxHeight = 0x50;
self->hitboxWidth = 0xC;

View File

@ -1,12 +1,12 @@
#include "ric.h"
AnimationFrame* D_8015538C[] = {anim_stand, anim_stand};
AnimationFrame D_80155394[] = {{64, FRAME(38, 2)}, A_LOOP_AT(0)};
AnimationFrame D_8015539C[] = {
AnimationFrame* D_8015538C[] = {ric_anim_stand, ric_anim_stand};
AnimationFrame ric_anim_press_up[] = {{64, FRAME(38, 2)}, A_LOOP_AT(0)};
AnimationFrame ric_anim_stop_run[] = {
{2, FRAME(55, 2)}, {1, FRAME(144, 2)}, {2, FRAME(145, 2)},
{3, FRAME(144, 2)}, {4, FRAME(145, 2)}, {12, FRAME(144, 2)},
{4, FRAME(16, 2)}, A_JUMP_AT(1)};
AnimationFrame anim_stand[] = {
AnimationFrame ric_anim_stand[] = {
{7, FRAME(1, 2)},
{7, FRAME(2, 2)},
{7, FRAME(3, 2)},
@ -56,16 +56,16 @@ AnimationFrame anim_stand[] = {
{4, FRAME(6, 2)},
{64, FRAME(7, 2)},
A_END};
AnimationFrame D_80155480[] = {{64, FRAME(7, 2)}, A_LOOP_AT(0)};
AnimationFrame ric_anim_stand_relax[] = {{64, FRAME(7, 2)}, A_LOOP_AT(0)};
AnimationFrame ric_anim_walk[] = {
{3, FRAME(8, 2)}, {6, FRAME(9, 2)}, {5, FRAME(10, 2)}, {6, FRAME(11, 2)},
{7, FRAME(12, 2)}, {6, FRAME(13, 2)}, {5, FRAME(14, 2)}, {6, FRAME(15, 2)},
{4, FRAME(8, 2)}, A_LOOP_AT(0)};
AnimationFrame anim_land_strong_impact[] = {
AnimationFrame ric_anim_crouch_from_stand2[] = {
0x0001, 0x0410, 0x0001, 0x0611, 0x0010, 0x0612, A_END};
AnimationFrame anim_crouch[] = {{64, FRAME(18, 6)}, A_END};
AnimationFrame anim_land_from_run[] = {{16, FRAME(152, 6)}, A_END};
AnimationFrame anim_crouch_from_stand[] = {
AnimationFrame ric_anim_crouch[] = {{64, FRAME(18, 6)}, A_END};
AnimationFrame ric_anim_land_from_air_run[] = {{16, FRAME(152, 6)}, A_END};
AnimationFrame ric_anim_crouch_from_stand[] = {
0x0001, 0x0410, 0x0001, 0x0611, 0x0001, 0x0612, A_END};
AnimationFrame D_801554E0[] = {
0x0001, 0x0612, 0x0001, 0x0611, 0x0001, 0x0410, A_END};
@ -103,7 +103,7 @@ AnimationFrame ric_anim_throw_daggers[] = {
AnimationFrame D_80155638[] = {
0x0002, 0x0836, 0x0002, 0x0837, 0x0002, 0x0428, 0x0002, 0x0429,
0x0003, 0x042A, 0x0010, 0x042D, 0x0006, 0x042E, A_END};
AnimationFrame ric_anim_stand_in_air[] = {
AnimationFrame ric_ric_anim_stand_in_air[] = {
{5, FRAME(19, 0)}, {1, FRAME(26, 0)}, {1, FRAME(25, 0)},
{6, FRAME(125, 0)}, {32, FRAME(126, 0)}, A_LOOP_AT(4)};
AnimationFrame ric_anim_run[] = {

View File

@ -2,13 +2,13 @@
void RicMain(void);
void RicInit(s16 arg0);
void func_801603C4(void);
void RicUpdatePlayerEntities(void);
void func_8015E7B4(Unkstruct_8010BF64* arg0);
PlayerOvl RIC_player = {
RicMain,
RicInit,
func_801603C4,
RicUpdatePlayerEntities,
func_8015E7B4,
};

View File

@ -91,6 +91,39 @@ enum RicTimers {
PL_T_15,
};
enum RicSubweapons {
PL_W_NONE,
PL_W_DAGGER,
PL_W_AXE,
PL_W_HOLYWATER,
PL_W_CROSS,
PL_W_BIBLE,
PL_W_STOPWATCH,
PL_W_REBNDSTONE,
PL_W_VIBHUTI,
PL_W_AGUNEA,
PL_W_10,
PL_W_HOLYWATER_FLAMES,
PL_W_CRASH_CROSS,
PL_W_CRASH_CROSS_BEAM,
PL_W_WHIP,
PL_W_15,
PL_W_HYDROSTORM,
PL_W_BIBLE_BEAM,
PL_W_KICK,
PL_W_19,
PL_W_20,
PL_W_21,
PL_W_22,
PL_W_23,
PL_W_CRASH_VIBHUTI,
PL_W_CRASH_REBOUND_STONE,
PL_W_CRASH_AGUNEA,
PL_W_27,
PL_W_28,
PL_W_CRASH_REBOUND_EXPLOSION,
};
#define NO_AFTERIMAGE 0x08000000
extern s16* D_801530AC[];
@ -112,80 +145,11 @@ extern void RicSetWalk(s32);
extern void RicSetRun(void);
extern void RicSetFall(void);
extern bool RicCheckInput(s32 checks);
static void DebugShowWaitInfo(const char* str);
extern void func_8015F9F0(Entity* entity);
extern void RicSetSubweaponParams(Entity*);
extern s32 func_8015FDB0(POLY_GT4* poly, s16 posX, s16 posY);
extern Entity* RicCreateEntFactoryFromEntity(
Entity* entity, u32 arg1, s32 arg2);
// Forward declarations for all the entity updating functions
void func_801603B4(Entity* self);
void RicEntityEntFactory(Entity* self);
void func_80160FC4(Entity* self);
void EntityCrossBoomerang(Entity* self);
void func_80169C10(Entity* self);
void func_8016147C(Entity* self);
void EntityCrossShadow(Entity* self);
void RicEntityHolyWater(Entity* self);
void RicEntityHolyWaterFlame(Entity* self);
void func_80161C2C(Entity* self);
void func_80166784(Entity* self);
void EntityHydroStorm(Entity* self);
void RicEntitySubwpnCrashCross(Entity* self);
void func_80167A58(Entity* self);
void func_80167A60(Entity* self);
void func_8016779C(Entity* self);
void func_80167964(Entity* self);
void func_80161EF8(Entity* self);
void func_80167A68(Entity* self);
void EntityRichterRevivalColumn(Entity* self);
void func_80161FF0(Entity* self);
void func_80160C38(Entity* self);
void BladeDashHelper(Entity* self);
void func_801623E0(Entity* self);
void func_80162604(Entity* self);
void func_80162C84(Entity* self);
void func_80162870(Entity* self);
void func_80160F0C(Entity* self);
void func_80162C7C(Entity* self);
void RicEntityPlayerBlinkWhite(Entity* self);
void RicEntitySubwpnCrashCrossParticles(Entity* self);
void func_801641A0(Entity* self);
void EntityShrinkingPowerUpRing(Entity* self);
void func_80167A70(Entity* self);
void EntitySubwpnCrashAgunea(Entity* self);
void EntitySubwpnCrashAxe(Entity* self);
void RicEntitySubwpnThrownDagger(Entity* self);
void func_80160D2C(Entity* self);
void RicEntityHitByIce(Entity* self);
void RicEntityHitByLightning(Entity* self);
void RicEntitySubwpnReboundStone(Entity* self);
void RicEntitySubwpnThrownVibhuti(Entity* self);
void RicEntitySubwpnAgunea(Entity* self);
void RicEntityAguneaHitEnemy(Entity* self);
void EntitySubwpnCrashVibhuti(Entity* self);
void RicEntityVibhutiCrashCloud(Entity* self);
void func_8016E324(Entity* self);
void func_8016D9C4(Entity* self);
void func_8016DF74(Entity* self);
void EntityBiblePage(Entity* self);
void EntityBiblePageBeam(Entity* self);
void RicEntitySubwpnBible(Entity* self);
void func_80172AE8(Entity* self);
void EntityStopwatch(Entity* self);
void EntityStopwatchCircle(Entity* self);
void func_801705EC(Entity* self);
void func_8016F198(Entity* self);
void EntityAguneaCircle(Entity* self);
void EntityAguneaLightning(Entity* self);
void func_8016D920(Entity* self);
void func_801601DC(Entity* self);
void func_8015FEA8(Entity* self);
void StopwatchCrashDoneSparkle(Entity* self);
void func_80170548(Entity* self);
extern void RicEntityTeleport(Entity* self);
extern s32 func_8016840C(s16 x, s16 y);
extern s16 D_80154568[];
@ -215,17 +179,29 @@ extern SubweaponDef D_80154688[];
extern u8 D_801548F4[6][8];
extern FactoryBlueprint g_RicFactoryBlueprints[];
extern s8 D_80156A28;
extern s8 D_80156904;
extern ButtonComboState g_bladeDashButtons;
extern ButtonComboState D_801758E4;
extern u16 g_RicDebugCurFrame;
extern u16 g_RicDebugDrawFlags;
extern u16 g_RicDebugPalette;
extern s16 g_IsRicDebugEnter;
extern s32 D_80175958[32];
extern s32 D_801759D8[32];
// pl_anims.c
extern AnimationFrame* D_8015538C[];
extern AnimationFrame D_80155394[];
extern AnimationFrame D_8015539C[];
extern AnimationFrame anim_stand[];
extern AnimationFrame D_80155480[];
extern AnimationFrame ric_anim_press_up[];
extern AnimationFrame ric_anim_stop_run[];
extern AnimationFrame ric_anim_stand[];
extern AnimationFrame ric_anim_stand_relax[];
extern AnimationFrame ric_anim_walk[];
extern AnimationFrame anim_land_strong_impact[];
extern AnimationFrame anim_crouch[];
extern AnimationFrame anim_land_from_run[];
extern AnimationFrame anim_crouch_from_stand[];
extern AnimationFrame ric_anim_crouch_from_stand2[];
extern AnimationFrame ric_anim_crouch[];
extern AnimationFrame ric_anim_land_from_air_run[];
extern AnimationFrame ric_anim_crouch_from_stand[];
extern AnimationFrame D_801554E0[];
extern AnimationFrame D_801554F0[];
extern AnimationFrame D_8015550C[];
@ -239,7 +215,7 @@ extern AnimationFrame D_801555C8[];
extern AnimationFrame D_801555E8[];
extern AnimationFrame ric_anim_throw_daggers[];
extern AnimationFrame D_80155638[];
extern AnimationFrame ric_anim_stand_in_air[];
extern AnimationFrame ric_ric_anim_stand_in_air[];
extern AnimationFrame ric_anim_run[];
extern AnimationFrame ric_anim_stun[];
extern AnimationFrame D_8015569C[];
@ -264,41 +240,3 @@ extern AnimationFrame D_801558DC[];
extern AnimationFrame D_8015591C[];
extern AnimationFrame D_80155950[];
extern FrameProperty D_80155964[];
extern s8 D_80156A28;
extern s8 D_80156904;
extern s32 D_80173B64;
extern u8 D_80173B68[];
extern s16 D_80174F68;
extern s16 D_80174F6C;
extern s32 D_80174F70;
extern s32 D_80174F74;
extern s32 D_80174F78;
extern s32 g_DebugWaitInfoTimer;
extern s32 D_80174F80[];
extern u8 D_80174FAC;
extern u8 D_80174FB0;
extern u8 D_80174FB4;
extern u8 D_80174FB8;
extern Point16 D_80174FBC[];
extern s32 D_80174FFC;
extern Point16 D_80175000[32];
extern u32 D_80175080;
extern s32 D_80175084;
extern Point16 D_80175088[][128];
extern s32 D_80175888;
extern s32 D_8017588C;
extern s32 D_80175890;
extern Point16 g_BiblePos[];
extern s32 D_801758AC;
extern s32 g_AguneaParams[];
extern Entity* D_801758CC[];
extern u32 D_801758D0;
extern ButtonComboState g_bladeDashButtons;
extern ButtonComboState D_801758E4;
extern u16 g_RicDebugCurFrame;
extern u16 g_RicDebugDrawFlags;
extern u16 g_RicDebugPalette;
extern s16 g_IsRicDebugEnter;
extern s32 D_80175958[];
extern s32 D_801759D8[];

View File

@ -837,7 +837,7 @@ void func_801AF774(Entity* self) {
self->drawMode |= (DRAW_TPAGE | 0x20);
self->flags &= ~FLAG_UNK_08000000;
D_801C2578 = 1;
self->ext.aguneaCrash.unk8B[5] = 1;
self->ext.et_801AF774.unk90 = 1;
primIndex = g_api.AllocPrimitives(PRIM_GT4, 0x5C);
if (primIndex != -1) {
prim = &g_PrimBuf[primIndex];
@ -1032,9 +1032,9 @@ void func_801AF774(Entity* self) {
if (self->ext.et_801AF774.unk8E < 0) {
self->step = 4;
}
if ((self->ext.aguneaCrash.unk8B[5] != 0) &&
if ((self->ext.et_801AF774.unk90 != 0) &&
(self->ext.et_801AF774.unk8E < 0x10)) {
self->ext.aguneaCrash.unk8B[5] = 0;
self->ext.et_801AF774.unk90 = 0;
CreateEntityFromCurrentEntity(0x23, self + 1);
}
return;