mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-10-07 02:24:01 +00:00
WRP PSP merge st_common with PSX (#1197)
This commit is contained in:
parent
7fdb064715
commit
9b39bb764a
@ -74,6 +74,6 @@ $(PSP_BUILD_DIR)/tt_%.ld: $(CONFIG_DIR)/splat.pspeu.tt_%.yaml $(PSX_BASE_SYMS) $
|
||||
$(PSP_BUILD_DIR)/tt_%.elf: $(PSP_BUILD_DIR)/tt_%.ld $$(call list_o_files_psp,servant/tt_$$*) $(PSP_BUILD_DIR)/assets/servant/tt_%/mwo_header.bin.o
|
||||
$(call link,tt_$*,$@)
|
||||
|
||||
ST_WRP_MERGE = st_update st_debug e_breakable
|
||||
ST_WRP_MERGE = st_update st_common st_debug e_breakable
|
||||
$(PSP_BUILD_DIR)/stwrp.elf: $(PSP_BUILD_DIR)/stwrp.ld $(addprefix $(PSP_BUILD_DIR)/src/st/wrp/,$(addsuffix .c.o,$(ST_WRP_MERGE))) $$(call list_o_files_psp,st/wrp_psp) $(PSP_BUILD_DIR)/assets/st/wrp/mwo_header.bin.o
|
||||
$(call link,stwrp,$@)
|
||||
|
@ -52,7 +52,7 @@ segments:
|
||||
- [0x95D0, c, wrp_psp/collision]
|
||||
- [0xB7A8, c, wrp_psp/popup]
|
||||
- [0xBDA0, c, wrp_psp/e_room_fg]
|
||||
- [0xBEB8, c, wrp_psp/st_common]
|
||||
- [0xBEB8, c, wrp/st_common]
|
||||
- [0xC9A0, c, wrp_psp/stage_name_new]
|
||||
- [0xCEA0, c, wrp_psp/prim_helpers]
|
||||
- [0xD0E0, c, wrp_psp/st_init_wrp]
|
||||
|
@ -4,11 +4,16 @@
|
||||
* 1 = Player is on the left side
|
||||
* 2 = Player is above
|
||||
*/
|
||||
s32 GetSideToPlayer(void) {
|
||||
s16 var_a0 = g_CurrentEntity->posX.i.hi > PLAYER.posX.i.hi;
|
||||
u8 GetSideToPlayer() {
|
||||
u8 side = 0;
|
||||
Entity* player = &PLAYER;
|
||||
|
||||
if (g_CurrentEntity->posY.i.hi > PLAYER.posY.i.hi) {
|
||||
var_a0 |= 2;
|
||||
if (g_CurrentEntity->posX.i.hi > player->posX.i.hi) {
|
||||
side |= 1;
|
||||
}
|
||||
return var_a0;
|
||||
|
||||
if (g_CurrentEntity->posY.i.hi > player->posY.i.hi) {
|
||||
side |= 2;
|
||||
}
|
||||
return side;
|
||||
}
|
@ -1,8 +1,7 @@
|
||||
void PreventEntityFromRespawning(Entity* entity) {
|
||||
if (entity->entityRoomIndex) {
|
||||
u32 value = (entity->entityRoomIndex - 1);
|
||||
u16 index = value / 32;
|
||||
u16 bit = value % 32;
|
||||
g_entityDestroyed[index] |= 1 << bit;
|
||||
u16 index = entity->entityRoomIndex - 1 >> 5;
|
||||
g_unkGraphicsStruct.D_80097428[index] |=
|
||||
1 << ((entity->entityRoomIndex - 1) & 0x1F);
|
||||
}
|
||||
}
|
||||
|
@ -196,12 +196,12 @@ s32 func_8018BC88(s16* posX) {
|
||||
|
||||
Entity* AllocEntity(Entity* start, Entity* end) {
|
||||
Entity* current = start;
|
||||
|
||||
while (current < end) {
|
||||
if (current->entityId == E_NONE) {
|
||||
if (!current->entityId) {
|
||||
DestroyEntity(current);
|
||||
return current;
|
||||
}
|
||||
|
||||
current++;
|
||||
}
|
||||
return NULL;
|
||||
@ -254,18 +254,18 @@ u16 func_8018C198(s32 x, s32 y) {
|
||||
}
|
||||
#endif
|
||||
|
||||
u16 func_8018C1E0(u16 arg0, s16 arg1, s16 arg2) {
|
||||
u16 var_v0 = arg1;
|
||||
u16 temp_a2 = arg2 - arg1;
|
||||
u16 var_v0_2;
|
||||
u16 func_8018C1E0(u16 arg0, u16 arg1, u16 arg2) {
|
||||
u16 temp_a2;
|
||||
u16 var_v0;
|
||||
|
||||
temp_a2 = (s16)(arg2 - arg1);
|
||||
if (temp_a2 & 0x800) {
|
||||
var_v0_2 = (0x800 - temp_a2) & 0x7FF;
|
||||
var_v0 = (0x800 - temp_a2) & 0x7FF;
|
||||
} else {
|
||||
var_v0_2 = temp_a2;
|
||||
var_v0 = temp_a2;
|
||||
}
|
||||
|
||||
if (var_v0_2 > arg0) {
|
||||
if (var_v0 > arg0) {
|
||||
if (temp_a2 & 0x800) {
|
||||
var_v0 = arg1 - arg0;
|
||||
} else {
|
||||
@ -273,9 +273,9 @@ u16 func_8018C1E0(u16 arg0, s16 arg1, s16 arg2) {
|
||||
}
|
||||
|
||||
return var_v0;
|
||||
}
|
||||
|
||||
} else {
|
||||
return arg2;
|
||||
}
|
||||
}
|
||||
|
||||
void SetStep(u8 step) {
|
||||
@ -345,7 +345,7 @@ void InitializeEntity(u16 arg0[]) {
|
||||
}
|
||||
|
||||
void EntityDummy(Entity* arg0) {
|
||||
if (arg0->step == 0) {
|
||||
if (!arg0->step) {
|
||||
arg0->step++;
|
||||
}
|
||||
}
|
||||
|
@ -1,163 +0,0 @@
|
||||
#include "../wrp/wrp.h"
|
||||
|
||||
#include "../../destroy_entity.h"
|
||||
|
||||
void PreventEntityFromRespawning(Entity* entity) {
|
||||
if (entity->entityRoomIndex) {
|
||||
u16 index = entity->entityRoomIndex - 1 >> 5;
|
||||
g_unkGraphicsStruct.D_80097428[index] |=
|
||||
1 << ((entity->entityRoomIndex - 1) & 0x1F);
|
||||
}
|
||||
}
|
||||
|
||||
#include "../animate_entity.h"
|
||||
|
||||
u8 GetSideToPlayer() {
|
||||
u8 side = 0;
|
||||
Entity* player = &PLAYER;
|
||||
|
||||
if (g_CurrentEntity->posX.i.hi > player->posX.i.hi) {
|
||||
side |= 1;
|
||||
}
|
||||
|
||||
if (g_CurrentEntity->posY.i.hi > player->posY.i.hi) {
|
||||
side |= 2;
|
||||
}
|
||||
return side;
|
||||
}
|
||||
|
||||
void MoveEntity() {
|
||||
g_CurrentEntity->posX.val += g_CurrentEntity->velocityX;
|
||||
g_CurrentEntity->posY.val += g_CurrentEntity->velocityY;
|
||||
}
|
||||
|
||||
void FallEntity(void) {
|
||||
if (g_CurrentEntity->velocityY < FALL_TERMINAL_VELOCITY) {
|
||||
g_CurrentEntity->velocityY += FALL_GRAVITY;
|
||||
}
|
||||
}
|
||||
|
||||
Entity* AllocEntity(Entity* start, Entity* end) {
|
||||
Entity* current = start;
|
||||
|
||||
while (current < end) {
|
||||
if (!current->entityId) {
|
||||
DestroyEntity(current);
|
||||
return current;
|
||||
}
|
||||
current++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void UnkEntityFunc0(u16 slope, s16 speed) {
|
||||
g_CurrentEntity->velocityX = rcos(slope) * speed / 16;
|
||||
g_CurrentEntity->velocityY = rsin(slope) * speed / 16;
|
||||
}
|
||||
|
||||
u16 func_8018C160(Entity* a, Entity* b) {
|
||||
s32 diffX = b->posX.i.hi - a->posX.i.hi;
|
||||
s32 diffY = b->posY.i.hi - a->posY.i.hi;
|
||||
return ratan2(diffY, diffX);
|
||||
}
|
||||
|
||||
u16 func_8018C1E0(u16 arg0, u16 arg1, u16 arg2) {
|
||||
u16 temp_a2 = (s16)(arg2 - arg1);
|
||||
u16 var_v0;
|
||||
|
||||
if (temp_a2 & 0x800) {
|
||||
var_v0 = (0x800 - temp_a2) & 0x7FF;
|
||||
} else {
|
||||
var_v0 = temp_a2;
|
||||
}
|
||||
|
||||
if (var_v0 > arg0) {
|
||||
if (temp_a2 & 0x800) {
|
||||
var_v0 = arg1 - arg0;
|
||||
} else {
|
||||
var_v0 = arg1 + arg0;
|
||||
}
|
||||
|
||||
return var_v0;
|
||||
}
|
||||
|
||||
return arg2;
|
||||
}
|
||||
|
||||
void SetStep(u8 step) {
|
||||
g_CurrentEntity->step = step;
|
||||
g_CurrentEntity->step_s = 0;
|
||||
g_CurrentEntity->animFrameIdx = 0;
|
||||
g_CurrentEntity->animFrameDuration = 0;
|
||||
}
|
||||
|
||||
void InitializeEntity(u16 arg0[]) {
|
||||
u16 enemyId;
|
||||
EnemyDef* enemyDef;
|
||||
|
||||
g_CurrentEntity->animSet = *arg0++;
|
||||
g_CurrentEntity->animCurFrame = *arg0++;
|
||||
g_CurrentEntity->unk5A = *arg0++;
|
||||
g_CurrentEntity->palette = *arg0++;
|
||||
|
||||
enemyId = g_CurrentEntity->enemyId = *arg0++;
|
||||
enemyDef = &g_api.enemyDefs[enemyId];
|
||||
g_CurrentEntity->hitPoints = enemyDef->hitPoints;
|
||||
g_CurrentEntity->attack = enemyDef->attack;
|
||||
g_CurrentEntity->attackElement = enemyDef->attackElement;
|
||||
g_CurrentEntity->hitboxState = enemyDef->hitboxState;
|
||||
g_CurrentEntity->hitboxWidth = enemyDef->hitboxWidth;
|
||||
g_CurrentEntity->hitboxHeight = enemyDef->hitboxHeight;
|
||||
g_CurrentEntity->flags = enemyDef->flags;
|
||||
g_CurrentEntity->hitboxOffX = 0;
|
||||
g_CurrentEntity->hitboxOffY = 0;
|
||||
g_CurrentEntity->step++;
|
||||
g_CurrentEntity->step_s = 0;
|
||||
if (!g_CurrentEntity->zPriority) {
|
||||
g_CurrentEntity->zPriority =
|
||||
g_unkGraphicsStruct.g_zEntityCenter.unk - 0xC;
|
||||
}
|
||||
}
|
||||
|
||||
void EntityDummy(Entity* arg0) {
|
||||
if (!arg0->step) {
|
||||
arg0->step++;
|
||||
}
|
||||
}
|
||||
|
||||
void func_8018C55C(s16* hitSensors, s16 sensorCount) {
|
||||
Collider collider;
|
||||
s32 velocityX;
|
||||
s16 i;
|
||||
s16 x;
|
||||
s16 y;
|
||||
|
||||
velocityX = g_CurrentEntity->velocityX;
|
||||
if (velocityX == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
x = g_CurrentEntity->posX.i.hi;
|
||||
y = g_CurrentEntity->posY.i.hi;
|
||||
for (i = 0; i < sensorCount; i++) {
|
||||
if (velocityX < 0) {
|
||||
x += *hitSensors++;
|
||||
} else {
|
||||
x -= *hitSensors++;
|
||||
}
|
||||
|
||||
y += *hitSensors++;
|
||||
g_api.CheckCollision(x, y, &collider, 0);
|
||||
if (collider.effects & EFFECT_UNK_0002 &&
|
||||
(!(collider.effects & EFFECT_UNK_8000) || i)) {
|
||||
if (velocityX < 0) {
|
||||
g_CurrentEntity->posX.i.hi += collider.unk1C;
|
||||
} else {
|
||||
g_CurrentEntity->posX.i.hi += collider.unk14;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "../replace_breakable_with_item_drop.h"
|
Loading…
Reference in New Issue
Block a user