start cleaning up ground lives header

This commit is contained in:
DizzyEggg 2025-10-21 10:42:13 +02:00
parent 436689e4a9
commit 5a7cc59e83
8 changed files with 135 additions and 144 deletions

View File

@ -4,11 +4,43 @@
#include "structs/str_position.h"
#include "structs/str_ground_script.h"
#include "structs/str_ground_lives.h"
#include "structs/str_pokemon.h"
#include "structs/str_dungeon_location.h"
// ground_lives.s
void AllocGroundLives(void);
void DeleteGroundLives(void);
void FreeGroundLives(void);
void GroundLives_Select(s32 scriptID, s32 group, s32 sector);
void GroundLives_Cancel(s32 scriptID, s32 sector);
void GroundLives_CancelBlank_1(void);
void GroundLives_CancelBlank_2(void);
s32 sub_80A7AE8(s16);
s32 sub_80A8FD8(s32 id_, PixelPos *pixelPos);
s32 sub_80A7DDC(s16 *a0, s16 *speciesDst);
void sub_80A86C8(s32 id_, u32 flags);
void sub_80A87AC(s32 id_, s32 a1);
bool8 sub_80A87E0(s32 id_, Pokemon *a1);
Action *sub_80A882C(s32 id_);
bool8 GroundLives_ExecuteScript(s32 id_, ActionUnkIds *a1, ScriptInfoSmall *scriptInfo);
bool8 GroundLives_ExecutePlayerScriptActionLives(s32 id1_, s32 id2_);
bool8 GroundLivesNotifyAll(s32 a0_);
bool8 GroundLivesCancelAll(void);
s32 sub_80A8BBC(s32 id_);
s32 sub_80A8BD8(s32 id_, u32 *a1);
s32 sub_80A8BFC(s32 id_);
s32 sub_80A8C2C(s32 a0);
s32 sub_80A8C4C(s32 id_, DungeonLocation *dungLoc);
bool8 GroundLives_IsStarterMon(s32 id_);
bool8 IsStarterMonster(s32 monsterId_);
bool8 sub_80A8D20(void);
Pokemon *sub_80A8D54(s32 a0);
Pokemon *sub_80A8E9C(s32 id_);
void sub_80A8EC0(u8 *buffer, s32 a1);
void sub_80A8F50(u8 *buffer, s32 a1_, s32 size);
s32 sub_80A8F9C(s32 id_, PixelPos *pixelPos);
s32 sub_80A8FD8(s32 id_, PixelPos *pixelPos);
s32 sub_80A9050(s32 id_, s8 *a1);
s32 sub_80A9090(s32 id_, s32 a1_);
s16 GetFriendAreaDialogueId(s32 id_);
s32 GetLivesCollision_80A92A0(s32 id_, u32 flags, PixelPos *pixelPos1, PixelPos *pixelPos2);
#endif // GUARD_GROUND_LIVES_H

View File

@ -6,6 +6,7 @@
#include "memory.h"
#include "other_random.h"
#include "ground_script.h"
#include "ground_lives.h"
struct unkStruct_20399E8
{
@ -188,7 +189,6 @@ u8 sub_809D248(PixelPos *r0)
}
// Todo: move these to appropriate header files
extern s32 sub_80A8FD8(s16 a0, PixelPos *a1);
extern s32 sub_80AC448(s16 a0, PixelPos *a1);
extern s32 sub_80AD360(s16 a0, PixelPos *a1);
extern bool8 sub_80A579C(PixelPos *a0, PixelPos *a1);
@ -205,7 +205,7 @@ void sub_809D25C(void)
switch (gUnknown_20399E8.unk0)
{
case 1:
val = sub_80A8FD8(gUnknown_20399E8.unk4, &gUnknown_20399E8.unk1C);
val = sub_80A8FD8((s16) gUnknown_20399E8.unk4, &gUnknown_20399E8.unk1C);
if (val == (u16) -1)
gUnknown_20399E8.unk0 = 0;
break;

View File

@ -2,6 +2,7 @@
#include "globaldata.h"
#include "ground_event.h"
#include "ground_script.h"
#include "ground_lives.h"
#include "debug.h"
#include "memory.h"
@ -19,8 +20,6 @@ typedef struct GroundEvent
IWRAM_INIT GroundEvent *gGroundEvents = NULL;
extern void GroundLives_CancelBlank_2(void);
void DeleteGroundEvents(void);
void GroundEvent_Delete(s32);
const struct GroundScriptHeader *GetGroundScript(s16 a0, const DebugLocation *);

View File

@ -1,9 +1,9 @@
#include "global.h"
#include "globaldata.h"
#include "ground_lives.h"
#include "ground_script.h"
#include "ground_sprite.h"
#include "ground_event.h"
#include "ground_lives.h"
#include "ground_main.h"
#include "memory.h"
#include "event_flag.h"
@ -101,7 +101,6 @@ struct GroundLiveTypeData
extern const struct GroundLiveTypeData gGroundLivesTypeData_811E63C[];
extern void DeleteGroundLives(void);
extern s32 sub_8002984(s32 _direction1, u32 caseID);
extern u8 sub_809D248(PixelPos *r0);
extern s16 HandleAction(Action *action, const DebugLocation *debug);
@ -137,6 +136,9 @@ extern void sub_809D170(s32 r0, s32 r1);
extern void sub_80A74E4(struct UnkGroundSpriteStruct *ptr);
extern const struct GroundScriptHeader *GetGroundScript(s16 a0, const DebugLocation *);
static s32 sub_80A7B94(s16 *a0);
static s32 GroundLives_Add(s32 id_, const GroundLivesData *ptr, s32 group_, s32 sector_);
static void GroundLives_Delete(s32 id_);
static s16 CallbackLivesGetIndex(void *livesPtr_);
static void CallbackLivesGetSize(void *livesPtr_, PixelPos *out);
static void CallbackLivesSetHitboxPos(void *livesPtr_, PixelPos *posOrNull);
@ -158,15 +160,12 @@ static void CallbackLivesClearFlags(void *livesPtr_, u32 flags);
static void CallbackLivesSpriteRelated_80AB238(void *livesPtr_, s32 a1);
static s32 CallbackLivesMoveRelative(void *livesPtr_, PixelPos *pos);
bool8 sub_80A9750(struct GroundLive *ptr, u16 a1);
void GroundLives_Delete(s32);
s32 GroundLives_Add(s32 id_, const GroundLivesData *ptr, s32 group_, s32 sector_);
void sub_80AB5A4(void);
s32 sub_80A9F20(struct GroundLive *livesPtr, PixelPos *pixelPos);
bool8 sub_80AA3F8(struct GroundLive *livesPtr, s32 a1);
void sub_80AB5D4(struct GroundLive *livesPtr);
s32 sub_80ABA00(s32);
void sub_80AAF68(struct GroundLive *livesPtr, u32 unused);
s32 sub_80A7B94(s16 *a0);
static const CallbackData gGroundLivesCallbacks = {
.maybeId = 1,
@ -404,7 +403,7 @@ UNUSED static s16 sub_80A7B40(s32 a0_)
return -1;
}
s32 sub_80A7B94(s16 *a0)
static s32 sub_80A7B94(s16 *a0)
{
s32 id = *a0;
const struct GroundLiveTypeData *dataPtr = &gGroundLivesTypeData_811E63C[id];
@ -706,7 +705,7 @@ s32 sub_80A7DDC(s16 *a0, s16 *speciesDst)
return ret;
}
s32 GroundLives_Add(s32 id_, const GroundLivesData *ptr, s32 group_, s32 sector_)
static s32 GroundLives_Add(s32 id_, const GroundLivesData *ptr, s32 group_, s32 sector_)
{
s32 id = (s16) id_;
s32 group = (s16) group_;
@ -945,7 +944,7 @@ s32 GroundLives_Add(s32 id_, const GroundLivesData *ptr, s32 group_, s32 sector_
return id;
}
void GroundLives_Delete(s32 id_)
static void GroundLives_Delete(s32 id_)
{
s32 id = (s16) id_;
struct GroundLive *livesPtr = &gGroundLives->array[id];
@ -982,7 +981,7 @@ void sub_80A86C8(s32 id_, u32 flags)
}
}
void sub_80A8750(s32 id_, u32 flags)
static void sub_80A8750(s32 id_, u32 flags)
{
s32 id = (s16) id_;
struct GroundLive *livesPtr = &gGroundLives->array[id];
@ -1121,7 +1120,7 @@ bool8 GroundLives_ExecutePlayerScriptActionLives(s32 id1_, s32 id2_)
return FALSE;
}
bool8 sub_80A8A5C(s32 id1_, s32 id2_)
static bool8 sub_80A8A5C(s32 id1_, s32 id2_)
{
s32 id1 = (s16) id1_;
s32 id2 = (s16) id2_;
@ -1143,7 +1142,7 @@ bool8 sub_80A8A5C(s32 id1_, s32 id2_)
return FALSE;
}
bool8 sub_80A8ACC(s32 id1_, s32 id2_)
static bool8 sub_80A8ACC(s32 id1_, s32 id2_)
{
s32 id1 = (s16) id1_;
s32 id2 = (s16) id2_;
@ -1363,7 +1362,7 @@ Pokemon *sub_80A8E9C(s32 id_)
return sub_80A8D54(livesPtr->unk2);
}
void sub_80A8EC0(u8 *buffer,s32 a1)
void sub_80A8EC0(u8 *buffer, s32 a1)
{
s16 sp = a1;
s16 species;

View File

@ -24,6 +24,7 @@
#include "script_item.h"
#include "unk_ds_only_feature.h"
#include "textbox.h"
#include "ground_lives.h"
EWRAM_DATA u32 gUnknown_20398A8 = {0};
EWRAM_DATA s32 gUnknown_20398AC = {0};
@ -70,7 +71,6 @@ extern bool8 sub_809AFAC(void);
extern bool8 sub_80048BC(void);
extern u8 sub_80023E4(u32);
extern bool8 sub_8099B94(void);
extern void FreeGroundLives(void);
extern void FreeGroundObjects(void);
extern void FreeGroundEffects(void);
extern void FreeGroundEvents(void);
@ -85,7 +85,6 @@ extern void sub_809D0AC(void);
extern void sub_809D490(void);
extern void sub_80A62F0(void);
extern void AllocGroundEvents(void);
extern void AllocGroundLives(void);
extern void AllocGroundObjects(void);
extern void AllocGroundEffects(void);
extern void nullsub_124(void);
@ -109,7 +108,6 @@ extern void sub_80A73EC(void);
extern void sub_8099750(void);
extern void sub_809D0BC(void);
extern void DeleteGroundEvents(void);
extern void DeleteGroundLives(void);
extern void DeleteGroundObjects(void);
extern void DeleteGroundEffects(void);
extern void nullsub_16(void);
@ -735,8 +733,6 @@ static inline bool8 sub_80990EC_sub(struct DungeonSetupInfo *iVar1, u32 iVar2)
return flag;
}
extern void sub_80A8EC0(u8 *, u32);
u8 sub_80990EC(struct DungeonSetupInfo *param_1, s16 param_2)
{
const DungeonInfo *iVar1;

View File

@ -107,7 +107,7 @@ static const CallbackData gGroundObjectCallbacks = {
};
const u8 gGroundObjectFileName[];
#define FAKE_FILENAME gGroundObjectFileName
@ -171,39 +171,39 @@ static const struct ScriptCommand gUnknown_8118350[] = {
};
const s16 gUnknown_81183A0[] = {
-1,
0x800,
0x801,
0x1000,
0x1001,
-1,
0x800,
0x801,
0x1000,
0x1001,
0x1002,
0x1003,
0x800,
0x801,
0x802,
0x800,
0x801,
0x802,
0x803,
0x804,
0x805,
0x806,
0x804,
0x805,
0x806,
0x807,
0x808,
0x809,
0x80A,
0x80B,
0x80C,
0x80D,
0x80E,
0x80F,
0x808,
0x809,
0x80A,
0x80B,
0x80C,
0x80D,
0x80E,
0x80F,
0};
void AllocGroundObjects(void)
void AllocGroundObjects(void)
{
GroundObject *ptr;
s32 index;
gGroundObjects = MemoryAlloc(sizeof(GroundObject) * NUM_GROUND_OBJECTS, 6);
for(index = 0, ptr = &gGroundObjects[index]; index < NUM_GROUND_OBJECTS; index = (s16)(index + 1), ptr++)
{
ptr->kind |= -1;
@ -215,7 +215,7 @@ void DeleteGroundObjects(void)
{
GroundObject *ptr;
s32 index;
ptr = &gGroundObjects[0];
for(index = 0; index < NUM_GROUND_OBJECTS; index = (s16)(index + 1), ptr++)
{
@ -327,7 +327,7 @@ s32 GroundObject_Add(s32 id_,const GroundObjectData *objectData,s32 group_,s32 s
{
s32 sVar3;
s32 sVar4;
int index;
s32 kind;
GroundObject *parent;
@ -336,13 +336,13 @@ s32 GroundObject_Add(s32 id_,const GroundObjectData *objectData,s32 group_,s32 s
register s32 sector;
bool8 bVar12;
struct GroundObjectTypeData *typeDataPtr;
id = (s16)id_;
group = (s16)group_;
sector = (s8)sector_;
kind = objectData->kind;
if (kind == 0x1a) {
if (GetScriptVarValue(NULL,BASE_LEVEL) < 2) {
@ -359,20 +359,20 @@ s32 GroundObject_Add(s32 id_,const GroundObjectData *objectData,s32 group_,s32 s
kind = (s16)sVar3;
}
}
typeDataPtr = &gGroundObjectTypes[kind];
if (id < 0) {
switch(kind)
{
case 0xD:
case 0xE:
id = GroundObject_Find(kind);
break;
}
if (id < 0) {
for(index = 0, parent = gGroundObjects; index < NUM_GROUND_OBJECTS; index = (s16)(index + 1), parent++)
{
@ -382,11 +382,11 @@ s32 GroundObject_Add(s32 id_,const GroundObjectData *objectData,s32 group_,s32 s
break;
}
}
}
if (id < 0) {
return -1;
}
}
}
parent = &gGroundObjects[id];
Log(0,"GroundObject Add id %3d kind %3d[%3d] type %3d group %3d sector %3d",id,kind,objectData->kind,typeDataPtr->unk0,group,sector);
@ -441,7 +441,7 @@ s32 GroundObject_Add(s32 id_,const GroundObjectData *objectData,s32 group_,s32 s
parent->flags = 0x2000185;
break;
}
if (typeDataPtr->unk2 == '\0') {
parent->unkC.x = objectData->width << 0xb;
parent->unkC.y = objectData->height << 0xb;
@ -450,13 +450,13 @@ s32 GroundObject_Add(s32 id_,const GroundObjectData *objectData,s32 group_,s32 s
parent->unkC.x = typeDataPtr->unk2 << 0xb;
parent->unkC.y = typeDataPtr->unk3 << 0xb;
}
parent->unk14.x = parent->unkC.x / 2;
parent->unk14.y = parent->unkC.y / 2;
parent->direction1 = objectData->unk1;
SetUnkInGroundEvent(&objectData->pos, &parent->unk20);
if (bVar12) {
parent->direction = parent->direction1;
parent->unk124.x = parent->unk20.x - parent->unk14.x;
@ -472,17 +472,17 @@ s32 GroundObject_Add(s32 id_,const GroundObjectData *objectData,s32 group_,s32 s
parent->unk140 = 0;
sub_80A75CC(&(parent->unk144),id,parent->kind, parent->flags);
}
InitActionWithParams(&parent->action,&gGroundObjectCallbacks,parent,group,sector);
// What an ugly way of coding that...
SetPredefinedScript(&parent->action,1, (objectData->scripts[1] != NULL) ? objectData->scripts[1]
SetPredefinedScript(&parent->action,1, (objectData->scripts[1] != NULL) ? objectData->scripts[1]
: (SpriteHasPokemonSize_80A66A4(&parent->unk144)) ? gUnknown_8118350 : gUnknown_81182F4);
SetPredefinedScript(&parent->action,2,(objectData->scripts[2] != NULL) ? objectData->scripts[2]
SetPredefinedScript(&parent->action,2,(objectData->scripts[2] != NULL) ? objectData->scripts[2]
: gFunctionScriptTable[4].script);
SetPredefinedScript(&parent->action,3,(objectData->scripts[3] != NULL) ? objectData->scripts[3]
SetPredefinedScript(&parent->action,3,(objectData->scripts[3] != NULL) ? objectData->scripts[3]
: gFunctionScriptTable[8].script);
if (objectData->scripts[0] != NULL) {
SetPredefinedScript(&parent->action,0,objectData->scripts[0]);
ExecutePredefinedScript(&parent->action,NULL,0,DEBUG_LOC_PTR(gGroundObjectFileName, 0x283, "GroundObject_Add"));
@ -493,10 +493,10 @@ s32 GroundObject_Add(s32 id_,const GroundObjectData *objectData,s32 group_,s32 s
void sub_80A6688(struct UnkGroundSpriteStruct *, s32);
void GroundObject_Delete(s32 index_) {
void GroundObject_Delete(s32 index_) {
s32 index = (s16)index_;
GroundObject *parent = &gGroundObjects[index];
GroundObject *parent = &gGroundObjects[index];
Log(0, "GroundObject Delete id %3d", index);
sub_80A7658(&parent->unk144);
InitAction2(&parent->action);
@ -577,7 +577,7 @@ bool8 GroundObjectsNotifyAll(s32 index_)
s32 counter;
GroundObject *parent = &gGroundObjects[0];
bool8 flag = FALSE;
for(counter = 0; counter < NUM_GROUND_OBJECTS; counter = (s16)(counter + 1), parent++)
{
if(parent->kind != -1)
@ -592,7 +592,7 @@ bool8 GroundObjectsCancelAll(void)
s32 counter;
GroundObject *parent = &gGroundObjects[0];
bool8 flag = FALSE;
for(counter = 0; counter < NUM_GROUND_OBJECTS; counter = (s16)(counter + 1), parent++)
{
if(parent->kind != -1)
@ -644,8 +644,8 @@ s16 sub_80AC448(s32 index_, PixelPos *pos)
pos->y = 0;
}
else {
pos->x = parent->unk124.x + parent->unk14.x;
pos->y = parent->unk124.y + parent->unk14.y;
pos->x = parent->unk124.x + parent->unk14.x;
pos->y = parent->unk124.y + parent->unk14.y;
}
return parent->kind;
@ -660,7 +660,7 @@ s16 sub_80AC49C(s32 index_, PixelPos *pos)
GroundObject *parent = &gGroundObjects[index];
TryMoveObjectRelative_80AC6AC(parent, pos);
return parent->kind;
}
@ -690,7 +690,7 @@ s32 sub_80AC554(s32 flag, PixelPos *param_2,PixelPos *param_3)
{
s32 i;
GroundObject *parent;
parent = &gGroundObjects[0];
for(i = 0; i < NUM_GROUND_OBJECTS; i = (s16)(i + 1), parent++) {
if ((parent->kind != -1))
@ -709,7 +709,6 @@ s32 sub_80AC554(s32 flag, PixelPos *param_2,PixelPos *param_3)
}
bool8 CheckMapCollision_80A585C(PixelPos *, PixelPos *);
s32 GetLivesCollision_80A92A0(s32 id, u32 flags, PixelPos *, PixelPos *);
s32 GetObjectCollision_80AC5F4(GroundObject *param_1, PixelPos *param_2, PixelPos *param_3)
{
@ -746,7 +745,7 @@ s32 TryMoveObjectRelative_80AC6AC(GroundObject *param_1,PixelPos *param_2)
s32 ret = GetObjectCollision_80AC5F4(param_1,&local_1c,&local_14);
if (ret == 0) {
(param_1->unk124) = local_1c;
param_1->unk12C = local_14;
param_1->unk12C = local_14;
return 0;
}
return ret;
@ -808,7 +807,7 @@ s32 TryMoveRelative_80AC720(GroundObject *param_1,PixelPos *param_2)
return ret;
}
static s16 CallbackObjectGetIndex(void *ptr)
static s16 CallbackObjectGetIndex(void *ptr)
{
struct GroundObject *groundObject = ptr;
return groundObject->id;
@ -1027,7 +1026,7 @@ void GroundObject_Action(void)
void sub_80A7664(struct UnkGroundSpriteStruct *ptr, PixelPos *pixelPos, s32 a2);
extern bool8 sub_80A66D4(struct UnkGroundSpriteStruct *ptr);
void sub_80ACAD4(void)
void sub_80ACAD4(void)
{
GroundObject *objectPtr;
int i;
@ -1038,7 +1037,7 @@ void sub_80ACAD4(void)
minus1 = (s16) minus1;
if (objectPtr->kind != (s16) minus1) {
PixelPos pos = {objectPtr->unk124.x + (objectPtr->unk14).x, objectPtr->unk124.y + (objectPtr->unk14).y};
s32 num = objectPtr->unk134.x + objectPtr->unk134.y;
s32 num = objectPtr->unk134.x + objectPtr->unk134.y;
if ((sub_80A66D4(&objectPtr->unk144))) {
objectPtr->directionRelated = 0;
sub_80A6EFC(&objectPtr->unk144,objectPtr->unk13E & 0x1f00,(s8)objectPtr->unk13E);

View File

@ -56,19 +56,15 @@ void GroundMap_SelectDungeon(s32, DungeonLocation*, u32);
void GroundMap_GetStationScript(ScriptInfoSmall *out, s16, s32, s32);
void GroundObject_ExecuteScript(s32, ActionUnkIds *, ScriptInfoSmall *);
void GroundEffect_ExecuteScript(s32, ActionUnkIds *, ScriptInfoSmall *);
void GroundLives_Select(s32, s32 group, s32 sector);
void GroundObject_Select(s32, s32 group, s32 sector);
void GroundEffect_Select(s32, s32 group, s32 sector);
void GroundEvent_Select(s32, s32 group, s32 sector);
void GroundLives_Cancel(s32 group, s32 sector);
void GroundObject_Cancel(s32 group, s32 sector);
void GroundEffect_Cancel(s32 group, s32 sector);
void GroundEvent_Cancel(s32 group, s32 sector);
void GroundLives_CancelBlank_1(void);
void GroundObject_CancelBlank(void);
void GroundEffect_CancelBlank(void);
void GroundWeather_Select(s16);
u32 GroundLives_ExecutePlayerScriptActionLives();
s16 GroundObject_Add(s16 id, GroundObjectData*, s16 group, s8 sector);
s16 GroundEffect_Add(s16 id, GroundEffectData*, s16 group, s8 sector);
@ -99,20 +95,11 @@ void sub_809D1E4(s32, s32, s32);
void sub_809D208(s32, PixelPos*, s32);
void sub_809D220(s32, s32, s32);
void GroundScriptLockJumpZero(s16);
void sub_80A87AC(s32, s32);
void sub_80A8BD8(s16, s32*);
u32 sub_80A8C2C();
u32 GroundLives_IsStarterMon();
Pokemon *sub_80A8D54(s16);
s16 sub_80A8F9C(s32, PixelPos*);
u32 sub_80A9050();
u32 sub_80A9090();
s16 sub_80AC448(s16, PixelPos*);
s32 sub_80AC49C(s16, PixelPos*);
s16 sub_80AD360(s16, PixelPos*);
s16 sub_80AD3B4(s16, PixelPos*);
void DeleteGroundEvents(void);
void DeleteGroundLives(void);
void DeleteGroundObjects(void);
void DeleteGroundEffects(void);
s32 ExecuteScriptCommand(Action *action);
@ -130,17 +117,13 @@ u8 sub_80990EC(struct DungeonSetupInfo *param_1, s32 param_2);
extern u8 GroundObjectsCancelAll(void);
extern u8 GroundEffectsCancelAll(void);
extern u8 GroundLivesCancelAll(void);
extern u8 IsTextboxOpen_809A750(void);
extern Action *sub_80A882C(s32);
extern Action *GroundObject_GetAction(s32);
extern Action *sub_80AD158(s32);
extern void sub_809AB4C(s32, s32);
extern void sub_809ABB4(s32, s32);
extern void sub_809AC18(s32, s32);
extern s16 sub_80A8BBC(s32 id_);
bool8 GroundLivesNotifyAll(s16);
bool8 GroundObjectsNotifyAll(s16);
bool8 GroundEffectsNotifyAll(s16);
@ -151,18 +134,11 @@ void ResetMailbox(void);
void sub_80963FC(void);
void sub_8096488(void);
bool8 sub_80964B4(void);
s16 sub_80A8C4C();
bool8 sub_8097640();
u8 sub_80964E4();
s32 sub_80A8E9C();
u8 sub_80A8D20();
bool8 sub_80A87E0();
s16 sub_80A8BFC(s16);
void sub_80A8F50(const u8 *buffer, s32, s32 size);
void sub_80A56A0(s32, s32);
void sub_80A56F0(PixelPos *);
void sub_80A5704(PixelPos *);
void sub_80A86C8(s16, s32);
void sub_80AC1B0(s16, s32);
void sub_80AD0C8(s16, s32);
s32 sub_80A5984();
@ -1172,7 +1148,7 @@ s16 HandleAction(Action *action, DebugLocation *debug)
if (val == 1) {
s32 id = (s16)cmd.arg1;
if (id != -1) {
Pokemon *mon = sub_80A8D54(id);
Pokemon *mon = sub_80A8D54((s16) id);
s32 i;
for (i = 0; i < POKEMON_NAME_LENGTH; i++) {
mon->name[i] = sPokeNameBuffer[i];
@ -1768,7 +1744,7 @@ s32 ExecuteScriptCommand(Action *action)
}
case 0x21: {
s32 ret;
s32 unk;
u32 unk;
PixelPos pos1;
PixelPos pos2;
PixelPos pos3;
@ -1985,7 +1961,7 @@ s32 ExecuteScriptCommand(Action *action)
case 0x3d: {
int i;
if ((s16)curCmd.arg1 != -1) {
Pokemon *mon = sub_80A8D54(curCmd.arg1);
Pokemon *mon = sub_80A8D54((s16) curCmd.arg1);
if (mon != NULL) {
for (i = 0; i < POKEMON_NAME_LENGTH; i++) {
sPokeNameBuffer[i] = mon->name[i];
@ -2760,19 +2736,19 @@ s32 ExecuteScriptCommand(Action *action)
}
case 0xbd: {
if (sub_80026CC(curCmd.arg1)) {
scriptData->script.ptr = FindLabel(action, (u8)curCmd.argByte);
scriptData->script.ptr = FindLabel(action, (u8)curCmd.argByte);
}
break;
}
case 0xbf: {
if (HasItemInInventory(curCmd.argShort) > 0) {
scriptData->script.ptr = FindLabel(action, (u8)curCmd.argByte);
scriptData->script.ptr = FindLabel(action, (u8)curCmd.argByte);
}
break;
}
case 0xbe: {
if (action->unk8.unk0 == 1) {
if ((s8)GroundLives_IsStarterMon(action->unk8.unk2)) {
if (GroundLives_IsStarterMon(action->unk8.unk2)) {
scriptData->script.ptr = FindLabel(action, (u8)curCmd.argByte);
}
}
@ -3129,7 +3105,7 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
{
u8 text[0x100];
DungeonLocation dungLocation;
s32 ret = sub_80A8C4C(action->unkC.unk2, &dungLocation);
s32 ret = (s16) sub_80A8C4C(action->unkC.unk2, &dungLocation);
if (ret != 0)
{
s32 dialogueId;
@ -3188,7 +3164,7 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
}
return 0;
case 0x11:
return sub_80A8D20() == 0 ? 0 : 1;
return sub_80A8D20() != FALSE;
case 0x12:
{
s32 held = gRealInputs.held;
@ -3200,10 +3176,8 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
case 0x13:
{
Pokemon *ptr;
ptr = sub_80A8D54(r2);
if(ptr)
Pokemon *ptr = sub_80A8D54((s16) r2);
if (ptr)
return PokemonFlag2(ptr);
}
return 0;
@ -3745,17 +3719,13 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
case 0x3C:
{
s32 index;
index = 0;
for(index = 0; index < 0x18; index = (s16)(index + 1))
{
for (index = 0; index < 0x18; index = (s16)(index + 1)) {
sub_80A86C8(index, 0x400000);
}
for (index = 0; index < 0x10; index = (s16)(index + 1))
{
for (index = 0; index < 0x10; index = (s16)(index + 1)) {
sub_80AC1B0(index, 0x400000);
}
for (index = 0; index < 0x10; index = (s16)(index + 1))
{
for (index = 0; index < 0x10; index = (s16)(index + 1)) {
sub_80AD0C8(index, 0x400000);
}
}
@ -3912,27 +3882,28 @@ void GroundScript_Unlock(void)
s32 index;
bool8 cond;
if(gAnyScriptLocked == 0) return;
if (gAnyScriptLocked == 0) return;
gAnyScriptLocked = 0;
index = 0;
for (index = 0; index < SCRIPT_LOCKS_ARR_COUNT; index++) {
if(gScriptLocks[index] != 0) {
if (gScriptLocks[index] != 0) {
Log(1, "GroundScript unlock %3d", index);
cond = GroundMapNotifyAll(index);
cond |= GroundLivesNotifyAll(index);
cond |= GroundObjectsNotifyAll(index);
cond |= GroundEffectsNotifyAll(index);
cond = GroundMapNotifyAll((s16) index);
cond |= GroundLivesNotifyAll((s16) index);
cond |= GroundObjectsNotifyAll((s16) index);
cond |= GroundEffectsNotifyAll((s16) index);
if(gScriptLockConds[index] != 0) {
if (gScriptLockConds[index] != 0) {
if (cond) {
GroundMapNotifyAll(index | 0x80);
GroundLivesNotifyAll(index | 0x80);
GroundObjectsNotifyAll(index | 0x80);
GroundEffectsNotifyAll(index | 0x80);
GroundMapNotifyAll((s16) (index | 0x80));
GroundLivesNotifyAll((s16) (index | 0x80));
GroundObjectsNotifyAll((s16) (index | 0x80));
GroundEffectsNotifyAll((s16) (index | 0x80));
gScriptLocks[index] = gScriptLockConds[index] = 0;
}
} else {
}
else {
gScriptLocks[index] = 0;
}
}
@ -4003,21 +3974,21 @@ static const ScriptCommand *ResolveJump(Action *action, s32 r1)
static void sub_80A2500(s32 param_1, ActionUnkIds *param_2)
{
if (param_2->unk0 == 1) {
sub_809AB4C((s16) param_1, sub_80A8BBC(param_2->unk2));
sub_809AB4C((s16) param_1, (s16) sub_80A8BBC(param_2->unk2));
}
}
static void sub_80A252C(s32 param_1, ActionUnkIds *param_2)
{
if (param_2->unk0 == 1) {
sub_809ABB4((s16) param_1, sub_80A8BBC(param_2->unk2));
sub_809ABB4((s16) param_1, (s16) sub_80A8BBC(param_2->unk2));
}
}
static void sub_80A2558(s32 param_1, ActionUnkIds *param_2)
{
if (param_2->unk0 == 1) {
sub_809AC18((s16) param_1, sub_80A8BBC(param_2->unk2));
sub_809AC18((s16) param_1, (s16) sub_80A8BBC(param_2->unk2));
}
}

View File

@ -115,11 +115,6 @@ static IWRAM_INIT struct Textbox *sTextbox = { NULL };
extern bool8 sub_802FCF0(void);
bool8 IsTextboxOpen_809B40C(struct TextboxText *);
extern void sub_80A8EC0(u8 *, u32);
Pokemon *sub_80A8D54(s16);
void sub_80A7DDC(s16 *, s16*);
u8 IsStarterMonster(s16);
s16 sub_80A8BFC(s32);
void sub_809B028(const MenuItem *, s32 a1_, s32 a2, s32 a3, s32 a4_, const char *text);
bool8 sub_809B18C(s32 *sp);
extern void GroundScriptLock(s16 index, s32 r1);