WRP PSP more functions (#1202)

This commit is contained in:
sozud 2024-05-28 11:57:19 -07:00 committed by GitHub
parent 82a41b260c
commit e04bb37a66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 174 additions and 5 deletions

View File

@ -76,6 +76,11 @@ c_GoldPrizes = 0x092464D0;
c_HeartPrizes = 0x09246500;
D_80180EC4 = 0x09246508;
D_80180F70 = 0x092465C8;
D_80180FF8 = 0x09246690;
D_80181008 = 0x092466A0;
D_80181020 = 0x092466B8;
D_80181038 = 0x092466D0;
D_8018103C = 0x092466D8;
D_80181420 = 0x09246AE0;
g_eRedDoorTiles = 0x09246E10;
g_eBreakableInit = 0x09246E90;

View File

@ -21,3 +21,6 @@ PfnEntityUpdates = 0x08C6BC30;
g_PlayableCharacter = 0x091CF020;
D_8018047C = 0x09246ED0;
g_ItemIconSlots = 0x0924BC20;
D_091CF020 = 0x091CF020;
D_091CF6DC = 0x091CF6DC;
D_091CF698 = 0x091CF698;

View File

@ -18,7 +18,44 @@ void func_8018CAB0(void) {
}
}
INCLUDE_ASM("st/wrp_psp/psp/wrp_psp/e_collect", func_8018CB34);
void func_8018CB34(u16 arg0) {
Collider collider;
if (g_CurrentEntity->velocityX < 0) {
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi - 7, &collider, 0);
if (collider.effects & EFFECT_NOTHROUGH) {
g_CurrentEntity->velocityY = 0;
}
}
g_api.CheckCollision(g_CurrentEntity->posX.i.hi,
g_CurrentEntity->posY.i.hi + 7, &collider, 0);
if (arg0) {
if (!(collider.effects & EFFECT_NOTHROUGH)) {
MoveEntity();
FallEntity();
return;
}
g_CurrentEntity->velocityX = 0;
g_CurrentEntity->velocityY = 0;
if (collider.effects & EFFECT_QUICKSAND) {
g_CurrentEntity->posY.val += FIX(0.125);
return;
}
g_CurrentEntity->posY.i.hi += collider.unk18;
return;
}
if (!(collider.effects & EFFECT_NOTHROUGH)) {
MoveEntity();
func_8018CAB0();
}
}
extern s8 c_HeartPrizes[];
void CollectHeart(u16 arg0) {
@ -54,7 +91,63 @@ void CollectGold(u16 goldSize) {
DestroyEntity(g_CurrentEntity);
}
INCLUDE_ASM("st/wrp_psp/psp/wrp_psp/e_collect", CollectSubweapon);
extern u16 D_80180DC4[];
extern u16 D_80180DF4[];
extern s32 D_091CF020;
extern u32 D_091CF6DC;
extern u32 D_091CF698;
extern u16 D_psp_09246370[];
extern u16 D_psp_092462E0[];
extern u16 D_psp_09246388[];
extern u16 D_psp_092462F8[];
void CollectSubweapon(u16 subWeaponIdx) {
Entity* player = &PLAYER;
u16 subWeapon;
g_api.PlaySfx(NA_SE_PL_IT_PICKUP);
if (D_091CF020 == 2) {
subWeapon = D_091CF6DC;
} else {
subWeapon = D_091CF698;
}
if (D_091CF020 == 2) {
D_091CF6DC = D_psp_09246370[subWeaponIdx - 0xe];
func_90E4C90();
} else {
D_091CF698 = D_psp_092462E0[subWeaponIdx - 0xe];
}
if (D_091CF020 != 2 && subWeapon == D_091CF698 ||
D_091CF020 == 2 && subWeapon == D_091CF6DC) {
subWeapon = 1;
g_CurrentEntity->unk6D[0] = 0x10;
} else {
if (D_091CF020 == 2) {
subWeapon = D_psp_09246388[subWeapon];
} else {
subWeapon = D_psp_092462F8[subWeapon];
}
g_CurrentEntity->unk6D[0] = 0x60;
}
if (subWeapon) {
g_CurrentEntity->params = subWeapon;
g_CurrentEntity->posY.i.hi = player->posY.i.hi + 12;
SetStep(7);
g_CurrentEntity->velocityY = FIX(-2.5);
g_CurrentEntity->animCurFrame = 0;
g_CurrentEntity->ext.generic.unk88.S16.unk2 = 5;
if (player->facingLeft ^ 1) {
g_CurrentEntity->velocityX = FIX(-2);
return;
}
g_CurrentEntity->velocityX = FIX(2);
return;
}
DestroyEntity(g_CurrentEntity);
}
void CollectHeartVessel(void) {
if (g_PlayableCharacter != PLAYER_ALUCARD) {
@ -109,6 +202,26 @@ void EntityExplosion(Entity* entity) {
}
}
INCLUDE_ASM("st/wrp_psp/psp/wrp_psp/e_collect", BlinkItem);
void BlinkItem(Entity* self, u16 renderFlags) {
Primitive* prim;
s32 temp;
prim = &g_PrimBuf[self->primIndex];
prim->x0 = prim->x2 = self->posX.i.hi - 7;
prim->x1 = prim->x3 = prim->x0 + 14;
prim->y0 = prim->y1 = self->posY.i.hi - 7;
prim->y2 = prim->y3 = prim->y0 + 14;
if (renderFlags & RENDERFLAGS_NOSHADOW) {
prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 =
prim->g2 = prim->g3 = prim->b0 = prim->b1 = prim->b2 = prim->b3 =
255;
} else {
prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 = prim->g1 =
prim->g2 = prim->g3 = prim->b0 = prim->b1 = prim->b2 = prim->b3 =
128;
}
}
INCLUDE_ASM("st/wrp_psp/psp/wrp_psp/e_collect", EntityEquipItemDrop);

View File

@ -68,9 +68,57 @@ void func_8018F510(Entity* entity) {
}
}
INCLUDE_ASM("st/wrp_psp/psp/wrp_psp/e_misc", func_8018F838);
extern s32 D_80181020[];
extern u8 D_80181038[];
extern u16 D_8018103C[];
INCLUDE_ASM("st/wrp_psp/psp/wrp_psp/e_misc", EntityUnkId15);
void func_8018F838(Entity* self) {
if (!self->step) {
self->velocityY = D_80181020[self->ext.generic.unk94];
self->flags = FLAG_UNK_2000 | FLAG_UNK_04000000 | FLAG_UNK_08000000;
self->palette = PAL_OVL(0x195);
self->animSet = ANIMSET_DRA(2);
self->animCurFrame = D_80181038[self->params];
self->drawMode = DRAW_TPAGE;
self->step++;
} else {
self->posY.val -= self->velocityY;
++self->animFrameDuration;
if (!(self->animFrameDuration % 2)) {
self->animCurFrame++;
}
if (self->animFrameDuration > D_8018103C[self->params]) {
DestroyEntity(self);
}
}
}
extern s16 D_80180FF8[];
extern s32 D_80181008[];
void EntityUnkId15(Entity* self) {
if (!self->step) {
self->flags = FLAG_UNK_2000 | FLAG_UNK_04000000 | FLAG_UNK_08000000;
self->palette = PAL_OVL(0x195);
self->animSet = ANIMSET_DRA(5);
self->animCurFrame = 1;
self->drawMode = DRAW_TPAGE;
self->drawFlags = FLAG_DRAW_ROTX | FLAG_DRAW_ROTY;
self->rotX = D_80180FF8[self->params];
self->rotY = self->rotX;
self->velocityY = D_80181008[self->params];
self->step++;
} else {
self->posY.val -= self->velocityY;
self->animFrameDuration++;
if (!(self->animFrameDuration % 2)) {
self->animCurFrame++;
}
if (self->animFrameDuration > 36) {
DestroyEntity(self);
}
}
}
extern u16 D_80180458[];
void EntityIntenseExplosion(Entity* self) {