mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2025-02-21 05:30:48 +00:00
Update for full PSP match on st0
e_collect
(#2076)
Updated with code sharing between PSX and PSP Was able to resolve some of the data loading inside `collect_heart` which on ST0/beta is just an inline array init I'm pretty sure I can bring in WRP PSP here too but I will do it in a separate PR
This commit is contained in:
parent
17e6aa40ef
commit
640ad9d47f
@ -91,7 +91,7 @@ $(BUILD_DIR)/dra.elf: $(BUILD_DIR)/dra.ld $(addprefix $(BUILD_DIR)/src/dra/,$(ad
|
||||
$(BUILD_DIR)/tt_%.elf: $(BUILD_DIR)/tt_%.ld $$(call list_o_files_psp,servant/tt_$$*) $(BUILD_DIR)/assets/servant/tt_%/mwo_header.bin.o
|
||||
$(call link_with_deadstrip,tt_$*,$@)
|
||||
|
||||
ST_ST0_MERGE = prologue_scroll title_card popup e_room_fg st_common collision e_lock_camera st_update e_red_door create_entity st_debug 2A218 e_particles
|
||||
ST_ST0_MERGE = prologue_scroll title_card popup e_room_fg st_common collision e_lock_camera st_update e_red_door create_entity st_debug 2A218 e_particles e_collect
|
||||
$(BUILD_DIR)/stst0.elf: $(BUILD_DIR)/stst0.ld $(addprefix $(BUILD_DIR)/src/st/st0/,$(addsuffix .c.o,$(ST_ST0_MERGE))) $$(call list_o_files_psp,st/st0_psp) $(BUILD_DIR)/assets/st/st0/mwo_header.bin.o
|
||||
$(call link_with_deadstrip,stst0,$@)
|
||||
ST_WRP_MERGE = st_update e_particles e_room_fg st_common st_debug e_breakable popup warp e_red_door create_entity
|
||||
|
@ -64,7 +64,7 @@ segments:
|
||||
- [0x131E8, c, st0_psp/e_particles_maria1]
|
||||
- [0x13770, c, st0_psp/e_particles_maria2]
|
||||
- [0x13C00, c, st0/e_particles]
|
||||
- [0x14160, c, st0_psp/e_collect]
|
||||
- [0x14160, c, st0/e_collect]
|
||||
- [0x15CC8, c, st0_psp/e_misc]
|
||||
- [0x16278, c, st0/collision]
|
||||
- [0x18000, c, st0/popup]
|
||||
@ -84,7 +84,8 @@ segments:
|
||||
- [0x41C08, .data, st0/e_red_door]
|
||||
- [0x41C20, .data, st0/st_update]
|
||||
- [0x41C50, .data, st0/e_particles]
|
||||
- [0x41CD0, data]
|
||||
- [0x41CD0, .data, st0/e_collect]
|
||||
- [0x41F48, data]
|
||||
- [0x41F98, .data, st0/collision]
|
||||
- [0x42308, data, e_room_fg]
|
||||
- [0x423A8, data]
|
||||
@ -96,9 +97,10 @@ segments:
|
||||
- [0x425D8, .rodata, st0_psp/3AB08]
|
||||
- [0x42610, .rodata, st0/2A218] # EntityCutscene
|
||||
- [0x42650, .rodata, st0/e_red_door]
|
||||
- [0x42668, .rodata, st0_psp/e_collect]
|
||||
- [0x42668, .rodata, st0/e_collect]
|
||||
- [0x426A0, .rodata, st0_psp/3D8F0]
|
||||
- [0x42700, bss, 42700]
|
||||
- [0x44460, .bss, st0/create_entity]
|
||||
- [0x44480, bss, 44480]
|
||||
- [0x44480, .bss, st0/e_collect]
|
||||
- [0x444C0, bss, 444C0]
|
||||
- [0x42700]
|
||||
|
@ -1,6 +1,5 @@
|
||||
g_EInit3DObject = 0x801805D4;
|
||||
g_collectVelocity = 0x80181E3C;
|
||||
c_HeartPrizes = 0x801A7C84;
|
||||
ST0_EntityCutscene = 0x801A9210;
|
||||
EntityCutscene = 0x801AA290;
|
||||
EntitySecretButton = 0x801AA8DC;
|
||||
|
@ -4,11 +4,8 @@
|
||||
// This function is messy, maybe there's a better way.
|
||||
void CollectHeart(u16 arg0) {
|
||||
#if defined VERSION_BETA || STAGE == STAGE_ST0
|
||||
s8 heartPrizes[2];
|
||||
s8 mad_unknown[2];
|
||||
|
||||
__builtin_memcpy(heartPrizes, c_HeartPrizes[0], 2);
|
||||
__builtin_memcpy(mad_unknown, c_HeartPrizes[2], 2);
|
||||
s8 heartPrizes[2] = {0x01, 0x05};
|
||||
s8 mad_unknown[2] = {0x01, 0x02};
|
||||
#else
|
||||
#define heartPrizes c_HeartPrizes
|
||||
#endif
|
||||
|
@ -100,14 +100,20 @@ u8* g_SubweaponAnimPrizeDrop[] = {
|
||||
};
|
||||
|
||||
static s16 D_80180EB8[] = {-6, 4, 0, -8};
|
||||
#if defined VERSION_BETA || STAGE == STAGE_ST0
|
||||
// This is weird, the values have to go in later.
|
||||
// Note that this array is in rodata. Other overlays have it in data.
|
||||
static const s8 c_HeartPrizes[4][2];
|
||||
#else
|
||||
#if !defined(VERSION_BETA) && STAGE != STAGE_ST0
|
||||
// Note that this array is in data. MAD/ST0 have it in rodata.
|
||||
s8 c_HeartPrizes[] = {1, 5};
|
||||
#endif
|
||||
|
||||
// from another file
|
||||
extern u16 g_EInitObtainable[];
|
||||
|
||||
#include "prize_drop_fall.h"
|
||||
|
||||
#include "prize_drop_fall2.h"
|
||||
|
||||
#include "collect_heart.h"
|
||||
|
||||
static s32 g_ExplosionYVelocities[] = {
|
||||
FIX(-1.0), FIX(-1.5), FIX(-1.5), FIX(-1.5), FIX(-3.0)};
|
||||
|
||||
@ -139,20 +145,6 @@ static u8* g_ExplosionAnimations[] = {
|
||||
D_80180ED8, g_bigRedFireballAnim, D_80180F08, D_80180F38, D_80180F6C,
|
||||
};
|
||||
|
||||
// from another file
|
||||
extern u16 g_EInitObtainable[];
|
||||
|
||||
#include "prize_drop_fall.h"
|
||||
|
||||
#include "prize_drop_fall2.h"
|
||||
|
||||
#include "collect_heart.h"
|
||||
|
||||
#if defined VERSION_BETA || STAGE == STAGE_ST0
|
||||
// For some reason need to declare the values AFTER the function.
|
||||
static const s8 c_HeartPrizes[][2] = {{1, 5}, {0, 0}, {1, 2}, {0, 0}};
|
||||
#endif
|
||||
|
||||
#include "collect_gold.h"
|
||||
|
||||
#if defined VERSION_BETA || STAGE == STAGE_ST0
|
||||
@ -173,7 +165,7 @@ static void CollectLifeVessel(void) {
|
||||
#endif
|
||||
|
||||
// MAD doesn't take an argument, others do
|
||||
#if defined VERSION_BETA || STAGE == STAGE_ST0
|
||||
#if defined VERSION_BETA || (STAGE == STAGE_ST0 && !defined(VERSION_PSP))
|
||||
static void CollectDummy(void) { DestroyEntity(g_CurrentEntity); }
|
||||
// Extra unused function, putting it in this same if-block.
|
||||
Entity* func_801939C4(void) {
|
||||
|
@ -8,7 +8,6 @@ void EntityEquipItemDrop(Entity* self) {
|
||||
s16 index;
|
||||
s32 primIndex;
|
||||
const char* name;
|
||||
s32 xPos, yPos; // only used in MAD
|
||||
|
||||
itemId = self->params & 0x7FFF;
|
||||
if (
|
||||
@ -83,10 +82,21 @@ void EntityEquipItemDrop(Entity* self) {
|
||||
prim = &g_PrimBuf[primIndex];
|
||||
prim->tpage = 0x1A;
|
||||
prim->clut = i + 464;
|
||||
|
||||
#ifdef VERSION_PSP
|
||||
prim->u0 = prim->u2 = (i & 7) * 0x10 + 1;
|
||||
#else
|
||||
prim->u0 = prim->u2 = (u8)(i & 7) * 0x10 + 1;
|
||||
#endif
|
||||
prim->u1 = prim->u3 = prim->u0 + 0xE;
|
||||
|
||||
#ifdef VERSION_PSP
|
||||
prim->v0 = prim->v1 = (i & 0x18) * 2 + 0x81;
|
||||
#else
|
||||
prim->v0 = prim->v1 = (u8)(i & 0x18) * 2 + 0x81;
|
||||
#endif
|
||||
prim->v2 = prim->v3 = prim->v0 + 0xE;
|
||||
|
||||
prim->priority = 0x80;
|
||||
prim->drawMode = DRAW_UNK02 | DRAW_COLORS;
|
||||
|
||||
@ -173,22 +183,20 @@ void EntityEquipItemDrop(Entity* self) {
|
||||
BlinkItem(self, self->ext.equipItemDrop.timer);
|
||||
#else
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
xPos = (u16)self->posX.i.hi;
|
||||
prim->x0 = prim->x2 = xPos - 7;
|
||||
prim->x1 = prim->x3 = xPos + 7;
|
||||
yPos = (u16)self->posY.i.hi;
|
||||
prim->y0 = prim->y1 = yPos - 7;
|
||||
prim->y2 = prim->y3 = yPos + 7;
|
||||
prim->x0 = prim->x2 = self->posX.i.hi - 7;
|
||||
prim->x1 = prim->x3 = prim->x0 + 0xE;
|
||||
prim->y0 = prim->y1 = self->posY.i.hi - 7;
|
||||
prim->y2 = prim->y3 = prim->y0 + 0xE;
|
||||
if (self->ext.equipItemDrop.timer) {
|
||||
self->ext.equipItemDrop.timer--;
|
||||
if (!(self->ext.equipItemDrop.timer & 2)) {
|
||||
prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 =
|
||||
prim->g1 = prim->g2 = prim->g3 = prim->b0 = prim->b1 =
|
||||
prim->b2 = prim->b3 = 0x80;
|
||||
} else {
|
||||
if (self->ext.equipItemDrop.timer & 2) {
|
||||
prim->r0 = prim->r1 = prim->r2 = prim->r3 = prim->g0 =
|
||||
prim->g1 = prim->g2 = prim->g3 = prim->b0 = prim->b1 =
|
||||
prim->b2 = prim->b3 = 0xFF;
|
||||
} 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 = 0x80;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1,26 +0,0 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
#include "../st0/st0.h"
|
||||
|
||||
extern u8* g_SubweaponAnimPrizeDrop[];
|
||||
extern u8* g_MariaSubweaponAnimPrizeDrop[];
|
||||
extern u16 aluric_subweapons_id[];
|
||||
extern u16 aluric_subweapons_idx[];
|
||||
extern u16 maria_subweapons_id[];
|
||||
extern s16 D_80180EB8[];
|
||||
extern s8 c_HeartPrizes[2];
|
||||
|
||||
#include "../prize_drop_fall.h"
|
||||
#include "../prize_drop_fall2.h"
|
||||
|
||||
void CollectHeart(u16 goldSize);
|
||||
INCLUDE_ASM("st/st0_psp/psp/st0_psp/e_collect", CollectHeart);
|
||||
|
||||
#include "../collect_gold.h"
|
||||
#include "../collect_subweapon.h"
|
||||
NOP;
|
||||
#include "../collect_dummy.h"
|
||||
#include "../entity_prize_drop.h"
|
||||
#include "../entity_explosion.h"
|
||||
#include "../blink_item.h"
|
||||
|
||||
INCLUDE_ASM("st/st0_psp/psp/st0_psp/e_collect", EntityEquipItemDrop);
|
Loading…
x
Reference in New Issue
Block a user