Fix typedefs for various things to be more C compliant (#929)

This commit is contained in:
Ethan Roseman 2023-02-02 02:48:25 +09:00 committed by GitHub
parent 2d3a608ce7
commit 76438a7198
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 25 additions and 54 deletions

View File

@ -11,7 +11,7 @@ struct Evt;
typedef ApiStatus(*ApiFunc)(struct Evt*, s32); typedef ApiStatus(*ApiFunc)(struct Evt*, s32);
typedef Bytecode EvtScript[0]; typedef Bytecode EvtScript[];
typedef void NoArgCallback(void*); typedef void NoArgCallback(void*);

View File

@ -142,10 +142,6 @@ enum EffectID {
EFFECT_86 = 0x86, EFFECT_86 = 0x86,
}; };
typedef struct Effect00FXData {
/* 0x00 */ char todo[0];
} Effect00FXData; // size = unknown
typedef struct BigSmokePuffFXData { typedef struct BigSmokePuffFXData {
/* 0x00 */ s16 unk_00; /* 0x00 */ s16 unk_00;
/* 0x02 */ s16 unk_02; /* 0x02 */ s16 unk_02;
@ -162,22 +158,6 @@ typedef struct BigSmokePuffFXData {
/* 0x28 */ char unk_28[0x4]; /* 0x28 */ char unk_28[0x4];
} BigSmokePuffFXData; // size = 0x2C } BigSmokePuffFXData; // size = 0x2C
typedef struct Effect02FXData {
/* 0x00 */ char todo[0];
} Effect02FXData; // size = unknown
typedef struct Effect03FXData {
/* 0x00 */ char todo[0];
} Effect03FXData; // size = unknown
typedef struct Effect04FXData {
/* 0x00 */ char todo[0];
} Effect04FXData; // size = unknown
typedef struct Effect05FXData {
/* 0x00 */ char todo[0];
} Effect05FXData; // size = unknown
typedef struct LandingDustFXData { typedef struct LandingDustFXData {
/* 0x00 */ u16 type; /* 0x00 */ u16 type;
/* 0x02 */ char unk_02[0x2]; /* 0x02 */ char unk_02[0x2];
@ -788,10 +768,6 @@ typedef struct SleepBubbleFXData {
/* 0xC8 */ f32 unk_C8; /* 0xC8 */ f32 unk_C8;
} SleepBubbleFXData; // size = 0xCC } SleepBubbleFXData; // size = 0xCC
typedef struct Unk2AFXData {
/* 0x00 */ char todo[0];
} Unk2AFXData; // size = unknown
typedef struct WindyLeavesFXData { typedef struct WindyLeavesFXData {
/* 0x00 */ s32 type; /* 0x00 */ s32 type;
/* 0x04 */ Vec3f unk_04; /* 0x04 */ Vec3f unk_04;
@ -2093,10 +2069,6 @@ typedef struct FloatingCloudPuffFXData {
/* 0x38 */ f32 unk_38; /* 0x38 */ f32 unk_38;
} FloatingCloudPuffFXData; // size = 0x3C } FloatingCloudPuffFXData; // size = 0x3C
typedef struct Effect6AFXData {
/* 0x00 */ char todo[0];
} Effect6AFXData; // size = unknown
typedef struct EnergyInOutFXData { typedef struct EnergyInOutFXData {
/* 0x00 */ s32 unk_00; /* 0x00 */ s32 unk_00;
/* 0x04 */ Vec3f pos; /* 0x04 */ Vec3f pos;
@ -2332,10 +2304,6 @@ typedef struct Effect75FXData {
/* 0x7C */ f32 unk_7C; /* 0x7C */ f32 unk_7C;
} Effect75FXData; // size = 0x80 } Effect75FXData; // size = 0x80
typedef struct Effect76FXData {
/* 0x00 */ char todo[0];
} Effect76FXData; // size = unknown
typedef struct FireworkRocketFXData { typedef struct FireworkRocketFXData {
/* 0x00 */ s32 variation; /* 0x00 */ s32 variation;
/* 0x04 */ Vec3f pos; /* 0x04 */ Vec3f pos;

View File

@ -3,8 +3,8 @@
#include "common.h" #include "common.h"
typedef s32 EntityScript[0]; typedef s32 EntityScript[];
typedef s32 EntityModelScript[0]; typedef s32 EntityModelScript[];
enum { enum {
ENTITY_SCRIPT_OP_End, ENTITY_SCRIPT_OP_End,
@ -64,8 +64,8 @@ enum {
#define BLOCK_GRID_SIZE 25 #define BLOCK_GRID_SIZE 25
#define TWEETSER_PATH_STOP 0x80000000 #define TWEESTER_PATH_STOP 0x80000000
#define TWEETSER_PATH_LOOP 0x80000001 #define TWEESTER_PATH_LOOP 0x80000001
typedef struct SaveBlockData { typedef struct SaveBlockData {
/* 0x000 */ char unk_0[4]; /* 0x000 */ char unk_0[4];

View File

@ -3,7 +3,7 @@
#include "common.h" #include "common.h"
typedef s32 ItemScript[0]; typedef s32 ItemScript[];
enum { enum {
ITEM_SCRIPT_OP_End, ITEM_SCRIPT_OP_End,

View File

@ -1,6 +1,6 @@
#include "common.h" #include "common.h"
typedef s32 SparkleScript[0]; typedef s32 SparkleScript[];
enum { enum {
SPARKLE_OP_End = 0, SPARKLE_OP_End = 0,

View File

@ -160,9 +160,9 @@ void entity_Tweester_select_target_point(Entity* entity) {
data->currentPath = paths[j]; data->currentPath = paths[j];
} }
pathPtr = &data->currentPath[pathOffset]; pathPtr = &data->currentPath[pathOffset];
if (*pathPtr != TWEETSER_PATH_STOP) { if (*pathPtr != TWEESTER_PATH_STOP) {
pathOffset += 3; pathOffset += 3;
if (*pathPtr == TWEETSER_PATH_LOOP){ if (*pathPtr == TWEESTER_PATH_LOOP){
pathOffset = 0; pathOffset = 0;
pathPtr = data->currentPath; pathPtr = data->currentPath;
data->targetX = *pathPtr++; data->targetX = *pathPtr++;

View File

@ -1,7 +1,10 @@
#include "common.h" #include "common.h"
#include "entity.h" #include "entity.h"
EntityModelScript D_8014C260[] = { {ems_End}, {ems_End }}; EntityModelScript D_8014C260 = {
ems_End
ems_End
};
Lights1 D_8014C268 = gdSPDefLights1(255, 255, 255, 0, 0, 0, 0, 0, 0); Lights1 D_8014C268 = gdSPDefLights1(255, 255, 255, 0, 0, 0, 0, 0, 0);
extern EntityModelList gWorldEntityModelList; extern EntityModelList gWorldEntityModelList;
@ -112,7 +115,7 @@ s32 load_entity_model(EntityModelScript* cmdList) {
newEntityModel->nextFrameTime = 1.0f; newEntityModel->nextFrameTime = 1.0f;
newEntityModel->timeScale = 1.0f; newEntityModel->timeScale = 1.0f;
if (cmdList == NULL) { if (cmdList == NULL) {
newEntityModel->cmdListReadPos = D_8014C260; newEntityModel->cmdListReadPos = &D_8014C260;
} }
newEntityModel->vertexArray = NULL; newEntityModel->vertexArray = NULL;
newEntityModel->fpSetupGfxCallback = NULL; newEntityModel->fpSetupGfxCallback = NULL;
@ -154,7 +157,7 @@ s32 ALT_load_entity_model(EntityModelScript* cmdList) {
newEntityModel->nextFrameTime = 1.0f; newEntityModel->nextFrameTime = 1.0f;
newEntityModel->timeScale = 1.0f; newEntityModel->timeScale = 1.0f;
if (cmdList == NULL) { if (cmdList == NULL) {
newEntityModel->cmdListReadPos = D_8014C260; newEntityModel->cmdListReadPos = &D_8014C260;
} }
newEntityModel->vertexArray = NULL; newEntityModel->vertexArray = NULL;
newEntityModel->fpSetupGfxCallback = NULL; newEntityModel->fpSetupGfxCallback = NULL;
@ -189,7 +192,7 @@ void exec_entity_model_commandlist(s32 idx) {
s32 step_entity_model_commandlist(EntityModel* entityModel) { s32 step_entity_model_commandlist(EntityModel* entityModel) {
SpriteRasterInfo* imageData; SpriteRasterInfo* imageData;
u32* curPos = entityModel->cmdListReadPos[0]; u32* curPos = *entityModel->cmdListReadPos;
switch (*curPos++) { switch (*curPos++) {
case 0: // kill model case 0: // kill model
free_entity_model_by_ref(entityModel); free_entity_model_by_ref(entityModel);
@ -719,7 +722,7 @@ void set_entity_model_render_command_list(s32 idx, EntityModelScript* cmdList) {
if (entityModel != NULL && entityModel->flags) { if (entityModel != NULL && entityModel->flags) {
if (cmdList == NULL) { if (cmdList == NULL) {
cmdList = D_8014C260; cmdList = &D_8014C260;
} }
entityModel->cmdListReadPos = cmdList; entityModel->cmdListReadPos = cmdList;
entityModel->cmdListSavedPos = cmdList; entityModel->cmdListSavedPos = cmdList;

View File

@ -6,7 +6,7 @@
#define HUD_ELEMENT_BATTLE_ID_MASK 0x800 #define HUD_ELEMENT_BATTLE_ID_MASK 0x800
typedef s32 HudScript[0]; typedef s32 HudScript[];
typedef s32 HudElemID; typedef s32 HudElemID;

View File

@ -6,7 +6,7 @@ TweesterPath N(D_80240440_936B20)[] = {
{ -262, 0, -64 }, { -262, 0, -64 },
{ 57, 0, -286 }, { 57, 0, -286 },
{ 327, 0, 8 }, { 327, 0, 8 },
{ TWEETSER_PATH_LOOP } { TWEESTER_PATH_LOOP }
}; };
TweesterPath* N(D_80240474_936B54)[] = { TweesterPath* N(D_80240474_936B54)[] = {

View File

@ -6,7 +6,7 @@ TweesterPath N(D_802403C0_93AB20)[] = {
{ -262, 0, -64 }, { -262, 0, -64 },
{ 57, 0, -286 }, { 57, 0, -286 },
{ 327, 0, 8 }, { 327, 0, 8 },
{ TWEETSER_PATH_LOOP } { TWEESTER_PATH_LOOP }
}; };
TweesterPath* N(D_802403F4_93AB54)[] = { TweesterPath* N(D_802403F4_93AB54)[] = {

View File

@ -6,7 +6,7 @@ TweesterPath N(DefaultTweesterPath)[] = {
{ -262, 0, -64 }, { -262, 0, -64 },
{ 57, 0, -286 }, { 57, 0, -286 },
{ 327, 0, 8 }, { 327, 0, 8 },
{ TWEETSER_PATH_LOOP } { TWEESTER_PATH_LOOP }
}; };
TweesterPath* N(TweesterPaths)[] = { TweesterPath* N(TweesterPaths)[] = {

View File

@ -6,7 +6,7 @@ TweesterPath N(DefaultTweesterPath)[] = {
{ -262, 0, -64 }, { -262, 0, -64 },
{ 57, 0, -286 }, { 57, 0, -286 },
{ 327, 0, 8 }, { 327, 0, 8 },
{ TWEETSER_PATH_LOOP } { TWEESTER_PATH_LOOP }
}; };
TweesterPath* N(TweesterPaths)[] = { TweesterPath* N(TweesterPaths)[] = {

View File

@ -6,7 +6,7 @@ TweesterPath N(TweesterPath1)[] = {
{ -262, 0, -64 }, { -262, 0, -64 },
{ 57, 0, -286 }, { 57, 0, -286 },
{ 327, 0, 8 }, { 327, 0, 8 },
{ TWEETSER_PATH_LOOP } { TWEESTER_PATH_LOOP }
}; };
TweesterPath* N(TweesterPaths)[] = { TweesterPath* N(TweesterPaths)[] = {

View File

@ -108,9 +108,9 @@ TweesterPath N(DefaultTweesterPath)[] = {
{ -262, 0, -64 }, { -262, 0, -64 },
{ 57, 0, -286 }, { 57, 0, -286 },
{ 327, 0, 8 }, { 327, 0, 8 },
{ TWEETSER_PATH_LOOP } { TWEESTER_PATH_LOOP }
}; };
TweesterPath* N(UnusedTweesterPaths)[] = { TweesterPath* N(UnusedTweesterPaths)[] = {
N(DefaultTweesterPath), N(DefaultTweesterPath),
N(DefaultTweesterPath), N(DefaultTweesterPath),