General Cleanup (#155)

* minor fixes

* Consolidate into globalCtx

* fix error

* Fix Warnings

Co-authored-by: engineer124 <engineer124enginer124@gmail.com>
This commit is contained in:
engineer124
2021-05-21 11:24:47 +10:00
committed by GitHub
parent 8c62c102cf
commit f4687fbbe7
37 changed files with 1198 additions and 1195 deletions
+11 -11
View File
@@ -1,11 +1,11 @@
#include <ultra64.h>
#include <global.h>
void EffFootmark_Init(GlobalContext* ctxt) {
void EffFootmark_Init(GlobalContext* globalCtx) {
EffFootmark* footmark;
s32 i;
for (footmark = ctxt->footmarks, i = 0; i < 100; i++, footmark++) {
for (footmark = globalCtx->footmarks, i = 0; i < 100; i++, footmark++) {
footmark->actor = NULL;
footmark->location.x = 0;
footmark->location.y = 0;
@@ -17,7 +17,7 @@ void EffFootmark_Init(GlobalContext* ctxt) {
}
}
void EffFootmark_Add(GlobalContext* ctxt, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, u8 red,
void EffFootmark_Add(GlobalContext* globalCtx, MtxF* displayMatrix, Actor* actor, u8 id, Vec3f* location, u16 size, u8 red,
u8 green, u8 blue, u16 alpha, u16 alphaChange, u16 fadeoutDelay) {
s32 i;
EffFootmark* footmark;
@@ -25,7 +25,7 @@ void EffFootmark_Add(GlobalContext* ctxt, MtxF* displayMatrix, Actor* actor, u8
EffFootmark* oldest = NULL;
s32 isNew = 1;
for (footmark = ctxt->footmarks, i = 0; i < 100; i++, footmark++) {
for (footmark = globalCtx->footmarks, i = 0; i < 100; i++, footmark++) {
if (((actor == footmark->actor) && (footmark->id == id)) && ((footmark->flags & 1) == 0)) {
if (fabsf((footmark->location).x - location->x) <= 1) {
if (fabsf((footmark->location).z - location->z) <= 1) {
@@ -71,11 +71,11 @@ void EffFootmark_Add(GlobalContext* ctxt, MtxF* displayMatrix, Actor* actor, u8
}
}
void EffFootmark_Update(GlobalContext* ctxt) {
void EffFootmark_Update(GlobalContext* globalCtx) {
EffFootmark* footmark;
s32 i;
for (footmark = ctxt->footmarks, i = 0; i < 100; i++, footmark++) {
for (footmark = globalCtx->footmarks, i = 0; i < 100; i++, footmark++) {
if (footmark->actor != NULL) {
if ((footmark->flags & 1) == 1) {
if (footmark->age < 0xFFFFu) { // TODO replace with MAX_U16 or something
@@ -96,21 +96,21 @@ void EffFootmark_Update(GlobalContext* ctxt) {
}
}
void EffFootmark_Draw(GlobalContext* ctxt) {
void EffFootmark_Draw(GlobalContext* globalCtx) {
EffFootmark* footmark;
s32 i;
GraphicsContext* gfxCtx = ctxt->state.gfxCtx;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
func_8012C448(ctxt->state.gfxCtx);
func_8012C448(globalCtx->state.gfxCtx);
gSPDisplayList(gfxCtx->polyXlu.p++, D_801BC240);
for (footmark = ctxt->footmarks, i = 0; i < 100; i++, footmark++) {
for (footmark = globalCtx->footmarks, i = 0; i < 100; i++, footmark++) {
if (footmark->actor != NULL) {
Matrix_Put(&footmark->displayMatrix);
Matrix_Scale(footmark->size * 0.00390625f * 0.7f, 1, footmark->size * 0.00390625f, 1);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(ctxt->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, footmark->red, footmark->green, footmark->blue,
footmark->alpha >> 8);