mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2025-02-17 03:30:02 +00:00
Merge branch 'master' into Decompile/no0/func_us_801D27C4
This commit is contained in:
commit
ba976d39b9
@ -126,6 +126,7 @@ int sprintf(char* dst, const char* fmt, ...);
|
||||
#define SP(x) (0x1F800000 + (x))
|
||||
#endif
|
||||
|
||||
#define CLAMP(x, min, max) x < min ? min : (x > max ? max : x)
|
||||
#define CLAMP_MIN(v, min) ((v) < (min) ? (min) : (v))
|
||||
#define CLAMP_MAX(v, max) ((v) > (max) ? (max) : (v))
|
||||
|
||||
|
@ -2113,17 +2113,21 @@ typedef struct {
|
||||
} ET_Skelerang;
|
||||
|
||||
typedef struct {
|
||||
/* 0x7C */ s32 : 32;
|
||||
/* 0x80 */ s32 : 32;
|
||||
/* 0x7C */ struct Entity* parent;
|
||||
/* 0x80 */ struct Entity* entity;
|
||||
/* 0x84 */ s32 : 32;
|
||||
/* 0x88 */ s32 : 32;
|
||||
/* 0x8C */ s32 : 32;
|
||||
/* 0x90 */ s32 : 32;
|
||||
/* 0x90 */ Point32* unk90;
|
||||
/* 0x94 */ s32 : 32;
|
||||
/* 0x98 */ u32 velocityY;
|
||||
/* 0x98 */ s32 velocityY;
|
||||
/* 0x9C */ s16 : 16;
|
||||
/* 0x9E */ u8 unk9E;
|
||||
/* 0x9F */ u8 unk9F;
|
||||
/* 0xA0 */ u32 : 32;
|
||||
/* 0xA4 */ s32 posX;
|
||||
/* 0xA8 */ s32 posY;
|
||||
/* 0xAC */ s32 unkAC;
|
||||
} ET_Diplocephalus;
|
||||
|
||||
typedef struct {
|
||||
|
@ -23,12 +23,6 @@ typedef struct {
|
||||
const char aIdSysCV1831995[] =
|
||||
"$Id: sys.c,v 1.83 1995/05/25 13:43:27 suzu Exp $";
|
||||
|
||||
extern const char D_800101FC[]; // "ResetGraph(%d)...\n"
|
||||
extern const char D_80010360[]; // "PutDispEnv(%08x)...\n"
|
||||
extern const char D_80010378[]; // "GPU_exeque: null func.\n"
|
||||
extern const char
|
||||
D_80010390[]; // "GPU timeout:que=%d,stat=%08x,chcr=%08x,madr=%08x\n"
|
||||
|
||||
s32 VSync(s32);
|
||||
|
||||
extern gpu* D_8002C260;
|
||||
@ -376,11 +370,33 @@ int get_mode(int dfe, int dtd, int tpage) {
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("main/nonmatchings/psxsdk/libgpu/sys", get_cs);
|
||||
u_long get_cs(short x, short y) {
|
||||
x = CLAMP(x, 0, 0x400 - 1);
|
||||
y = CLAMP(y, 0, (D_8002C26C ? 0x400 : 0x200) - 1);
|
||||
if (D_8002C26C) {
|
||||
return 0xE3000000 | ((y & 0xFFF) << 12) | (x & 0xFFF);
|
||||
} else {
|
||||
return 0xE3000000 | ((y & 0x3FF) << 10) | (x & 0x3FF);
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("main/nonmatchings/psxsdk/libgpu/sys", get_ce);
|
||||
u_long get_ce(short x, short y) {
|
||||
x = CLAMP(x, 0, 0x400 - 1);
|
||||
y = CLAMP(y, 0, (D_8002C26C ? 0x400 : 0x200) - 1);
|
||||
if (D_8002C26C) {
|
||||
return 0xE4000000 | ((y & 0xFFF) << 12) | (x & 0xFFF);
|
||||
} else {
|
||||
return 0xE4000000 | ((y & 0x1FF) << 10) | (x & 0x3FF);
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("main/nonmatchings/psxsdk/libgpu/sys", get_ofs);
|
||||
u_long get_ofs(short x, short y) {
|
||||
if (D_8002C26C) {
|
||||
return 0xE5000000 | ((y & 0xFFF) << 12) | (x & 0xFFF);
|
||||
} else {
|
||||
return 0xE5000000 | ((y & 0x7FF) << 11) | (x & 0x7FF);
|
||||
}
|
||||
}
|
||||
|
||||
u_long get_tw(RECT* arg0) {
|
||||
u32 pad[4];
|
||||
|
@ -68,7 +68,7 @@ void EntityDiplocephalusFoot(Entity* self) {
|
||||
self->animCurFrame++;
|
||||
if (self->ext.diplocephalus.unk9E < 3) {
|
||||
if (g_CurrentEntity->facingLeft ^
|
||||
(LOHU(self->ext.prim->x3) % 2)) {
|
||||
(self->ext.diplocephalus.parent->step % 2)) {
|
||||
EntityGreyPuffSpawner(self, 6, 3, 6, 16, 0, -4);
|
||||
} else {
|
||||
EntityGreyPuffSpawner(self, 6, 3, -6, 16, 0, 4);
|
||||
@ -86,15 +86,75 @@ void EntityDiplocephalusFoot(Entity* self) {
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/e_diplocephalus", func_us_801CF910);
|
||||
|
||||
// Main entity?
|
||||
INCLUDE_ASM("st/no0/nonmatchings/e_diplocephalus", func_us_801CFBE8);
|
||||
|
||||
INCLUDE_ASM("st/no0/nonmatchings/e_diplocephalus", func_us_801D0718);
|
||||
// Likely the torso entity that player can stand on top of
|
||||
void func_us_801D0718(Entity* self) {
|
||||
Entity* parent;
|
||||
Entity* player;
|
||||
s32 step;
|
||||
s32 collision;
|
||||
s32 posX;
|
||||
s32 posY;
|
||||
|
||||
if (!self->step) {
|
||||
InitializeEntity(g_EInitInteractable);
|
||||
self->ext.diplocephalus.posX = self->posX.i.hi + g_Tilemap.scrollX.i.hi;
|
||||
self->ext.diplocephalus.posY = self->posY.i.hi + g_Tilemap.scrollY.i.hi;
|
||||
}
|
||||
|
||||
player = &PLAYER;
|
||||
parent = self->ext.diplocephalus.parent;
|
||||
self->posX.i.hi = parent->posX.i.hi;
|
||||
self->posY.i.hi = parent->posY.i.hi;
|
||||
posX =
|
||||
self->posX.i.hi + g_Tilemap.scrollX.i.hi - self->ext.diplocephalus.posX;
|
||||
posY =
|
||||
self->posY.i.hi + g_Tilemap.scrollY.i.hi - self->ext.diplocephalus.posY;
|
||||
collision = 0;
|
||||
step = parent->step;
|
||||
if (step < 13) {
|
||||
collision = GetPlayerCollisionWith(self, 8, 18, 4) & 0xFF;
|
||||
if (collision) {
|
||||
player->posX.i.hi += posX;
|
||||
player->posY.i.hi += 2;
|
||||
D_80097488.x.i.hi += posX;
|
||||
D_80097488.y.i.hi += 2;
|
||||
}
|
||||
}
|
||||
self->ext.diplocephalus.posX = self->posX.i.hi + g_Tilemap.scrollX.i.hi;
|
||||
self->ext.diplocephalus.posY = self->posY.i.hi + g_Tilemap.scrollY.i.hi;
|
||||
|
||||
// Parent is func_us_801CFBE8 (self - 1)
|
||||
if (parent->entityId != 0x21) {
|
||||
DestroyEntity(self);
|
||||
}
|
||||
}
|
||||
|
||||
// Death explosion
|
||||
INCLUDE_ASM("st/no0/nonmatchings/e_diplocephalus", func_us_801D0898);
|
||||
void func_us_801D0898(Entity* self, s32 count) {
|
||||
Entity* newEntity;
|
||||
s32 i;
|
||||
s8 randomX;
|
||||
s8 randomY;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
randomX = (Random() & 0x3F) - 0x20;
|
||||
randomY = (Random() & 0x1F) - 0xF;
|
||||
newEntity = AllocEntity(&g_Entities[160], &g_Entities[192]);
|
||||
if (newEntity != NULL) {
|
||||
CreateEntityFromEntity(E_EXPLOSION, self, newEntity);
|
||||
newEntity->params = 1;
|
||||
newEntity->posX.i.hi += randomX;
|
||||
newEntity->posY.i.hi += randomY;
|
||||
newEntity->zPriority = self->zPriority + 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fireball
|
||||
INCLUDE_ASM("st/no0/nonmatchings/e_diplocephalus", func_us_801D0990);
|
||||
|
||||
// Main entity?
|
||||
// Tail entity
|
||||
INCLUDE_ASM("st/no0/nonmatchings/e_diplocephalus", func_us_801D0E7C);
|
||||
|
Loading…
x
Reference in New Issue
Block a user