Use PlayState instead of GlobalContext (#1927)
* Use PlayState instead of GlobalContext - GlobalContext -> PlayState - globalCtx -> play - GlobalCtx -> PlayState - globalContext -> playState * Find and replace Gameplay_ with Play_ * Correct some misnamed argument cases
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
EffectSsInfo sEffectSsInfo = { 0 }; // "EffectSS2Info"
|
||||
|
||||
void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) {
|
||||
void EffectSs_InitInfo(PlayState* play, s32 tableSize) {
|
||||
u32 i;
|
||||
EffectSs* effectSs;
|
||||
EffectSsOverlay* overlay;
|
||||
@@ -17,7 +17,7 @@ void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) {
|
||||
}
|
||||
|
||||
sEffectSsInfo.table =
|
||||
GAMESTATE_ALLOC_MC(&globalCtx->state, tableSize * sizeof(EffectSs));
|
||||
GAMESTATE_ALLOC_MC(&play->state, tableSize * sizeof(EffectSs));
|
||||
ASSERT(sEffectSsInfo.table != NULL);
|
||||
|
||||
sEffectSsInfo.searchStartIndex = 0;
|
||||
@@ -34,7 +34,7 @@ void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) {
|
||||
}
|
||||
}
|
||||
|
||||
void EffectSs_ClearAll(GlobalContext* globalCtx) {
|
||||
void EffectSs_ClearAll(PlayState* play) {
|
||||
u32 i;
|
||||
EffectSs* effectSs;
|
||||
EffectSsOverlay* overlay;
|
||||
@@ -155,10 +155,10 @@ s32 EffectSs_FindSlot(s32 priority, s32* pIndex) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EffectSs_Insert(GlobalContext* globalCtx, EffectSs* effectSs) {
|
||||
void EffectSs_Insert(PlayState* play, EffectSs* effectSs) {
|
||||
s32 index;
|
||||
|
||||
if (FrameAdvance_IsEnabled(globalCtx) != true) {
|
||||
if (FrameAdvance_IsEnabled(play) != true) {
|
||||
if (EffectSs_FindSlot(effectSs->priority, &index) == 0) {
|
||||
sEffectSsInfo.searchStartIndex = index + 1;
|
||||
sEffectSsInfo.table[index] = *effectSs;
|
||||
@@ -167,7 +167,7 @@ void EffectSs_Insert(GlobalContext* globalCtx, EffectSs* effectSs) {
|
||||
}
|
||||
|
||||
// original name: "EffectSoftSprite2_makeEffect"
|
||||
void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* initParams) {
|
||||
void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) {
|
||||
s32 index;
|
||||
u32 overlaySize;
|
||||
EffectSsOverlay* overlayEntry;
|
||||
@@ -237,7 +237,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init
|
||||
sEffectSsInfo.table[index].priority = priority;
|
||||
sEffectSsInfo.table[index].epoch++;
|
||||
|
||||
if (initInfo->init(globalCtx, index, &sEffectSsInfo.table[index], initParams) == 0) {
|
||||
if (initInfo->init(play, index, &sEffectSsInfo.table[index], initParams) == 0) {
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
// "Construction failed for some reason. The constructor returned an error.
|
||||
// Ceasing effect addition."
|
||||
@@ -249,7 +249,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init
|
||||
}
|
||||
}
|
||||
|
||||
void EffectSs_Update(GlobalContext* globalCtx, s32 index) {
|
||||
void EffectSs_Update(PlayState* play, s32 index) {
|
||||
EffectSs* effectSs = &sEffectSsInfo.table[index];
|
||||
|
||||
if (effectSs->update != NULL) {
|
||||
@@ -261,11 +261,11 @@ void EffectSs_Update(GlobalContext* globalCtx, s32 index) {
|
||||
effectSs->pos.y += effectSs->velocity.y;
|
||||
effectSs->pos.z += effectSs->velocity.z;
|
||||
|
||||
effectSs->update(globalCtx, index, effectSs);
|
||||
effectSs->update(play, index, effectSs);
|
||||
}
|
||||
}
|
||||
|
||||
void EffectSs_UpdateAll(GlobalContext* globalCtx) {
|
||||
void EffectSs_UpdateAll(PlayState* play) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < sEffectSsInfo.tableSize; i++) {
|
||||
@@ -278,28 +278,28 @@ void EffectSs_UpdateAll(GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
if (sEffectSsInfo.table[i].life > -1) {
|
||||
EffectSs_Update(globalCtx, i);
|
||||
EffectSs_Update(play, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EffectSs_Draw(GlobalContext* globalCtx, s32 index) {
|
||||
void EffectSs_Draw(PlayState* play, s32 index) {
|
||||
EffectSs* effectSs = &sEffectSsInfo.table[index];
|
||||
|
||||
if (effectSs->draw != NULL) {
|
||||
FrameInterpolation_RecordOpenChild(effectSs, effectSs->epoch);
|
||||
effectSs->draw(globalCtx, index, effectSs);
|
||||
effectSs->draw(play, index, effectSs);
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
}
|
||||
}
|
||||
|
||||
// original name: "EffectSoftSprite2_disp"
|
||||
void EffectSs_DrawAll(GlobalContext* globalCtx) {
|
||||
Lights* lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx);
|
||||
void EffectSs_DrawAll(PlayState* play) {
|
||||
Lights* lights = LightContext_NewLights(&play->lightCtx, play->state.gfxCtx);
|
||||
s32 i;
|
||||
|
||||
Lights_BindAll(lights, globalCtx->lightCtx.listHead, NULL);
|
||||
Lights_Draw(lights, globalCtx->state.gfxCtx);
|
||||
Lights_BindAll(lights, play->lightCtx.listHead, NULL);
|
||||
Lights_Draw(lights, play->state.gfxCtx);
|
||||
|
||||
for (i = 0; i < sEffectSsInfo.tableSize; i++) {
|
||||
if (sEffectSsInfo.table[i].life > -1) {
|
||||
@@ -322,7 +322,7 @@ void EffectSs_DrawAll(GlobalContext* globalCtx) {
|
||||
|
||||
EffectSs_Delete(&sEffectSsInfo.table[i]);
|
||||
} else {
|
||||
EffectSs_Draw(globalCtx, i);
|
||||
EffectSs_Draw(play, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user