Color_RGBAu32 (#253)

* Renamed deprecated RGB5A1 to RGBA16

* Cleanup shopkeeper structs with Color_RGBAu32 and Vec3f

* Rename functions with RGB5A1 in them

* BSS fix
This commit is contained in:
Derek Hensley 2021-08-15 07:56:20 -07:00 committed by GitHub
parent 5dc98392e0
commit f90e3ee739
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 349 additions and 245 deletions

View File

@ -28,6 +28,10 @@ typedef struct {
f32 r, g, b, a;
} Color_RGBAf;
typedef struct {
u32 r, g, b, a;
} Color_RGBAu32;
typedef union {
struct {
u16 r : 5;
@ -36,6 +40,6 @@ typedef union {
u16 a : 1;
};
u16 rgba;
} Color_RGB5A1;
} Color_RGBA16;
#endif

View File

@ -3409,10 +3409,10 @@ s32 func_80178A94(s32 param_1, s32 param_2);
// void func_80178DAC(void);
// void func_80178E3C(void);
// void func_80178E7C(void);
void Check_WriteRGB5A1Pixel(u16* buffer, u32 x, u32 y, u16 value);
void Check_WriteRGBA16Pixel(u16* buffer, u32 x, u32 y, u16 value);
void Check_WriteI4Pixel(u16* buffer, u32 x, u32 y, u32 value);
void Check_DrawI4Texture(u16* buffer, u32 x, u32 y, u32 width, u32 height, u8* texture);
void Check_ClearRGB5A1(s16* buffer);
void Check_ClearRGBA16(s16* buffer);
// void Check_DrawExpansionPakErrorMessage(void);
// void Check_DrawRegionLockErrorMessage(void);
// void Check_ExpansionPak(void);

View File

@ -0,0 +1,83 @@
#ifndef PREVENT_BSS_REORDERING_H
#define PREVENT_BSS_REORDERING_H
/**
* To determine variable order for .bss, the compiler sorts variables by their
* "name index" mod 256, where name index is something that, with -g, gets
* incremented by struct and variable declarations, typedefs, and file markers,
* among else. (Without -g, only variable declarations affects the index.)
* This file contains enough dummy declarations to bump the index by 128.
* Including it, or removing the include, should fix bss reordering problems
* for a file, assuming the name index distance between its first and last bss
* variable is at most 128.
* Note that if a variable is declared "extern" within a header file, the name
* index is taken at that point of the extern declaration. Thus, this include
* must come before any such header.
*/
struct Dummy0 { int x; };
struct Dummy1 { int x; };
struct Dummy2 { int x; };
struct Dummy3 { int x; };
struct Dummy4 { int x; };
struct Dummy5 { int x; };
struct Dummy6 { int x; };
struct Dummy7 { int x; };
struct Dummy8 { int x; };
struct Dummy9 { int x; };
struct Dummy10 { int x; };
struct Dummy11 { int x; };
struct Dummy12 { int x; };
struct Dummy13 { int x; };
struct Dummy14 { int x; };
struct Dummy15 { int x; };
struct Dummy16 { int x; };
struct Dummy17 { int x; };
struct Dummy18 { int x; };
struct Dummy19 { int x; };
struct Dummy20 { int x; };
struct Dummy21 { int x; };
struct Dummy22 { int x; };
struct Dummy23 { int x; };
struct Dummy24 { int x; };
struct Dummy25 { int x; };
struct Dummy26 { int x; };
struct Dummy27 { int x; };
struct Dummy28 { int x; };
struct Dummy29 { int x; };
struct Dummy30 { int x; };
struct Dummy31 { int x; };
struct Dummy32 { int x; };
struct Dummy33 { int x; };
struct Dummy34 { int x; };
struct Dummy35 { int x; };
struct Dummy36 { int x; };
struct Dummy37 { int x; };
struct Dummy38 { int x; };
struct Dummy39 { int x; };
struct Dummy40 { int x; };
struct Dummy41 { int x; };
struct Dummy42 { int x; };
struct Dummy43 { int x; };
struct Dummy44 { int x; };
struct Dummy45 { int x; };
struct Dummy46 { int x; };
struct Dummy47 { int x; };
struct Dummy48 { int x; };
struct Dummy49 { int x; };
struct Dummy50 { int x; };
struct Dummy51 { int x; };
struct Dummy52 { int x; };
struct Dummy53 { int x; };
struct Dummy54 { int x; };
struct Dummy55 { int x; };
struct Dummy56 { int x; };
struct Dummy57 { int x; };
struct Dummy58 { int x; };
struct Dummy59 { int x; };
struct Dummy60 { int x; };
struct Dummy61 { int x; };
struct Dummy62 { int x; };
typedef int Dummy63;
#endif

View File

@ -283,8 +283,8 @@ void PreRender_AntiAliasAlgorithm(PreRender* this, s32 x, s32 y) {
s32 pxR2;
s32 pxG2;
s32 pxB2;
Color_RGB5A1 pxIn;
Color_RGB5A1 pxOut;
Color_RGBA16 pxIn;
Color_RGBA16 pxOut;
u32 pxR3;
u32 pxG3;
u32 pxB3;

View File

@ -1,12 +1,12 @@
#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_initial_check/Check_WriteRGB5A1Pixel.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_initial_check/Check_WriteRGBA16Pixel.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_initial_check/Check_WriteI4Pixel.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_initial_check/Check_DrawI4Texture.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_initial_check/Check_ClearRGB5A1.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_initial_check/Check_ClearRGBA16.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_initial_check/Check_DrawExpansionPakErrorMessage.s")

View File

@ -1,8 +1,9 @@
#include "prevent_bss_reordering.h"
#include "global.h"
static s32 sMatAnimStep;
static u32 sMatAnimFlags;
static f32 sMatAnimAlphaRatio;
s32 sMatAnimStep;
u32 sMatAnimFlags;
f32 sMatAnimAlphaRatio;
// Default displaylist that sets a valid displaylist into all of the segments.
static Gfx sSceneDrawDefaultDL[] = {

View File

@ -416,9 +416,9 @@ void EnFsn_UpdateCursorPos(EnFsn* this, GlobalContext* globalCtx) {
f32 yOffset = 17.0f;
func_800B8898(globalCtx, &this->items[this->cursorIdx]->actor, &sp2E, &sp2C);
this->cursorX = sp2E + xOffset;
this->cursorY = sp2C + yOffset;
this->cursorZ = 1.2f;
this->cursorPos.x = sp2E + xOffset;
this->cursorPos.y = sp2C + yOffset;
this->cursorPos.z = 1.2f;
}
s32 EnFsn_FacingShopkeeperDialogResult(EnFsn* this, GlobalContext* globalCtx) {
@ -579,10 +579,10 @@ void EnFsn_UpdateCursorAnim(EnFsn* this) {
this->cursorAnimState = 0;
}
}
this->cursorColorR = COL_CHAN_MIX(0, 0.0f, t);
this->cursorColorG = COL_CHAN_MIX(80, 80.0f, t);
this->cursorColorB = COL_CHAN_MIX(255, 0.0f, t);
this->cursorColorA = COL_CHAN_MIX(255, 0.0f, t);
this->cursorColor.r = COL_CHAN_MIX(0, 0.0f, t);
this->cursorColor.g = COL_CHAN_MIX(80, 80.0f, t);
this->cursorColor.b = COL_CHAN_MIX(255, 0.0f, t);
this->cursorColor.a = COL_CHAN_MIX(255, 0.0f, t);
this->cursorAnimTween = t;
}
@ -622,15 +622,15 @@ void EnFsn_UpdateStickDirectionPromptAnim(EnFsn* this) {
this->stickAnimTween = stickAnimTween;
this->stickLeftPrompt.arrowColorR = COL_CHAN_MIX(255, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColorG = COL_CHAN_MIX(maxColor, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColorB = COL_CHAN_MIX(0, -100, arrowAnimTween);
this->stickLeftPrompt.arrowColorA = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColor.r = COL_CHAN_MIX(255, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColor.g = COL_CHAN_MIX(maxColor, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColor.b = COL_CHAN_MIX(0, -100, arrowAnimTween);
this->stickLeftPrompt.arrowColor.a = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickRightPrompt.arrowColorR = (maxColor - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColorG = (255 - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColorB = COL_CHAN_MIX(0, -100.0f, arrowAnimTween);
this->stickRightPrompt.arrowColorA = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickRightPrompt.arrowColor.r = (maxColor - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColor.g = (255 - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColor.b = COL_CHAN_MIX(0, -100.0f, arrowAnimTween);
this->stickRightPrompt.arrowColor.a = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickRightPrompt.arrowTexX = 290.0f;
this->stickLeftPrompt.arrowTexX = 33.0f;
@ -652,45 +652,45 @@ void EnFsn_InitShop(EnFsn* this, GlobalContext* globalCtx) {
EnFsn_SpawnShopItems(this, globalCtx);
this2 = this;
this2->cursorX = 100.0f;
this2->cursorY = 100.0f;
this2->cursorPos.x = 100.0f;
this2->cursorPos.y = 100.0f;
this2->stickAccumY = 0;
this2->stickAccumX = 0;
this->cursorZ = 1.2f;
this->cursorColorR = 0;
this->cursorColorG = 80;
this->cursorColorB = maxColor;
this->cursorColorA = maxColor;
this->cursorPos.z = 1.2f;
this->cursorColor.r = 0;
this->cursorColor.g = 80;
this->cursorColor.b = maxColor;
this->cursorColor.a = maxColor;
this->cursorAnimState = 0;
this->drawCursor = 0;
this->cursorAnimTween = 0.0f;
this->stickLeftPrompt.stickColorR = 200;
this->stickLeftPrompt.stickColorG = 200;
this->stickLeftPrompt.stickColorB = 200;
this->stickLeftPrompt.stickColorA = 180;
this->stickLeftPrompt.stickColor.r = 200;
this->stickLeftPrompt.stickColor.g = 200;
this->stickLeftPrompt.stickColor.b = 200;
this->stickLeftPrompt.stickColor.a = 180;
this->stickLeftPrompt.stickTexX = 49.0f;
this->stickLeftPrompt.stickTexY = 95.0f;
this->stickLeftPrompt.arrowColorR = maxColor;
this->stickLeftPrompt.arrowColorG = maxColor;
this->stickLeftPrompt.arrowColorB = 0;
this->stickLeftPrompt.arrowColorA = 200;
this->stickLeftPrompt.arrowColor.r = maxColor;
this->stickLeftPrompt.arrowColor.g = maxColor;
this->stickLeftPrompt.arrowColor.b = 0;
this->stickLeftPrompt.arrowColor.a = 200;
this->stickLeftPrompt.arrowTexX = 33.0f;
this->stickLeftPrompt.arrowTexY = 91.0f;
this->stickLeftPrompt.texZ = 1.0f;
this->stickLeftPrompt.isEnabled = 0;
this->stickRightPrompt.stickColorR = 200;
this->stickRightPrompt.stickColorG = 200;
this->stickRightPrompt.stickColorB = 200;
this->stickRightPrompt.stickColorA = 180;
this->stickRightPrompt.stickColor.r = 200;
this->stickRightPrompt.stickColor.g = 200;
this->stickRightPrompt.stickColor.b = 200;
this->stickRightPrompt.stickColor.a = 180;
this->stickRightPrompt.stickTexX = 274.0f;
this->stickRightPrompt.stickTexY = 95.0f;
this->stickRightPrompt.arrowColorR = maxColor;
this->stickRightPrompt.arrowColorG = 0;
this->stickRightPrompt.arrowColorB = 0;
this->stickRightPrompt.arrowColorA = 200;
this->stickRightPrompt.arrowColor.r = maxColor;
this->stickRightPrompt.arrowColor.g = 0;
this->stickRightPrompt.arrowColor.b = 0;
this->stickRightPrompt.arrowColor.a = 200;
this->stickRightPrompt.arrowTexX = 290.0f;
this->stickRightPrompt.arrowTexY = 91.0f;
this->stickRightPrompt.texZ = 1.0f;
@ -1460,8 +1460,8 @@ void EnFsn_DrawCursor(EnFsn* this, GlobalContext* globalCtx, f32 x, f32 y, f32 z
OPEN_DISPS(globalCtx->state.gfxCtx);
if (drawCursor != 0) {
func_8012C654(globalCtx->state.gfxCtx);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColorR, this->cursorColorG, this->cursorColorB,
this->cursorColorA);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b,
this->cursorColor.a);
gDPLoadTextureBlock_4b(OVERLAY_DISP++, &D_0401F740, G_IM_FMT_IA, 16, 16, 0, G_TX_MIRROR | G_TX_WRAP,
G_TX_MIRROR | G_TX_WRAP, 4, 4, G_TX_NOLOD, G_TX_NOLOD);
w = 16.0f * z;
@ -1520,14 +1520,14 @@ void EnFsn_DrawStickDirectionPrompts(EnFsn* this, GlobalContext* globalCtx) {
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOLOD);
gDPSetTileSize(OVERLAY_DISP++, G_TX_RENDERTILE, 0, 0, 15 * 4, 23 * 4);
if (drawStickRightPrompt) {
EnFsn_DrawTextRec(globalCtx, this->stickLeftPrompt.arrowColorR, this->stickLeftPrompt.arrowColorG,
this->stickLeftPrompt.arrowColorB, this->stickLeftPrompt.arrowColorA,
EnFsn_DrawTextRec(globalCtx, this->stickLeftPrompt.arrowColor.r, this->stickLeftPrompt.arrowColor.g,
this->stickLeftPrompt.arrowColor.b, this->stickLeftPrompt.arrowColor.a,
this->stickLeftPrompt.arrowTexX, this->stickLeftPrompt.arrowTexY,
this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f);
}
if (drawStickLeftPrompt) {
EnFsn_DrawTextRec(globalCtx, this->stickRightPrompt.arrowColorR, this->stickRightPrompt.arrowColorG,
this->stickRightPrompt.arrowColorB, this->stickRightPrompt.arrowColorA,
EnFsn_DrawTextRec(globalCtx, this->stickRightPrompt.arrowColor.r, this->stickRightPrompt.arrowColor.g,
this->stickRightPrompt.arrowColor.b, this->stickRightPrompt.arrowColor.a,
this->stickRightPrompt.arrowTexX, this->stickRightPrompt.arrowTexY,
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
@ -1541,14 +1541,14 @@ void EnFsn_DrawStickDirectionPrompts(EnFsn* this, GlobalContext* globalCtx) {
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOLOD);
gDPSetTileSize(OVERLAY_DISP++, G_TX_RENDERTILE, 0, 0, 15 * 4, 15 * 4);
if (drawStickRightPrompt) {
EnFsn_DrawTextRec(globalCtx, this->stickLeftPrompt.stickColorR, this->stickLeftPrompt.stickColorG,
this->stickLeftPrompt.stickColorB, this->stickLeftPrompt.stickColorA,
EnFsn_DrawTextRec(globalCtx, this->stickLeftPrompt.stickColor.r, this->stickLeftPrompt.stickColor.g,
this->stickLeftPrompt.stickColor.b, this->stickLeftPrompt.stickColor.a,
this->stickLeftPrompt.stickTexX, this->stickLeftPrompt.stickTexY,
this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f);
}
if (drawStickLeftPrompt) {
EnFsn_DrawTextRec(globalCtx, this->stickRightPrompt.stickColorR, this->stickRightPrompt.stickColorG,
this->stickRightPrompt.stickColorB, this->stickRightPrompt.stickColorA,
EnFsn_DrawTextRec(globalCtx, this->stickRightPrompt.stickColor.r, this->stickRightPrompt.stickColor.g,
this->stickRightPrompt.stickColor.b, this->stickRightPrompt.stickColor.a,
this->stickRightPrompt.stickTexX, this->stickRightPrompt.stickTexY,
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
@ -1626,7 +1626,7 @@ void EnFsn_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->items[i]->actor.scale.z = 0.2f;
}
EnFsn_DrawCursor(this, globalCtx, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor);
EnFsn_DrawCursor(this, globalCtx, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnFsn_DrawStickDirectionPrompts(this, globalCtx);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}

View File

@ -51,13 +51,8 @@ typedef struct EnFsn {
/* 0x39C */ s16 delayTimer;
/* 0x3A0 */ s32 stickAccumX;
/* 0x3A4 */ s32 stickAccumY;
/* 0x3A8 */ f32 cursorX;
/* 0x3AC */ f32 cursorY;
/* 0x3B0 */ f32 cursorZ;
/* 0x3B4 */ s32 cursorColorR;
/* 0x3B8 */ s32 cursorColorG;
/* 0x3BC */ s32 cursorColorB;
/* 0x3C0 */ s32 cursorColorA;
/* 0x3A8 */ Vec3f cursorPos;
/* 0x3B4 */ Color_RGBAu32 cursorColor;
/* 0x3C4 */ f32 cursorAnimTween;
/* 0x3C8 */ u8 cursorAnimState;
/* 0x3C9 */ u8 drawCursor;

View File

@ -115,16 +115,10 @@ extern const ActorInit En_GirlA_InitVars;
#define COL_CHAN_MIX(c1, c2, m) (c1 - (s32)(c2 * m)) & 0xFF
typedef struct {
/* 0x00 */ u32 stickColorR;
/* 0x04 */ u32 stickColorG;
/* 0x08 */ u32 stickColorB;
/* 0x0C */ u32 stickColorA;
/* 0x00 */ Color_RGBAu32 stickColor;
/* 0x10 */ f32 stickTexX;
/* 0x14 */ f32 stickTexY;
/* 0x18 */ u32 arrowColorR;
/* 0x1C */ u32 arrowColorG;
/* 0x20 */ u32 arrowColorB;
/* 0x24 */ u32 arrowColorA;
/* 0x18 */ Color_RGBAu32 arrowColor;
/* 0x28 */ f32 arrowTexX;
/* 0x2C */ f32 arrowTexY;
/* 0x30 */ f32 texZ; // Used for both stickTexZ and arrowTexZ

View File

@ -257,8 +257,8 @@ void EnOssan_UpdateCursorPos(GlobalContext* globalCtx, EnOssan* this) {
s16 y;
func_800B8898(globalCtx, &this->items[this->cursorIdx]->actor, &x, &y);
this->cursorX = x;
this->cursorY = y;
this->cursorPos.x = x;
this->cursorPos.y = y;
}
void EnOssan_EndInteraction(GlobalContext* globalCtx, EnOssan* this) {
@ -1232,10 +1232,10 @@ void EnOssan_UpdateCursorAnim(EnOssan* this) {
this->cursorAnimState = 0;
}
}
this->cursorColorR = COL_CHAN_MIX(0, 0.0f, t);
this->cursorColorG = COL_CHAN_MIX(80, 80.0f, t);
this->cursorColorB = COL_CHAN_MIX(255, 0.0f, t);
this->cursorColorA = COL_CHAN_MIX(255, 0.0f, t);
this->cursorColor.r = COL_CHAN_MIX(0, 0.0f, t);
this->cursorColor.g = COL_CHAN_MIX(80, 80.0f, t);
this->cursorColor.b = COL_CHAN_MIX(255, 0.0f, t);
this->cursorColor.a = COL_CHAN_MIX(255, 0.0f, t);
this->cursorAnimTween = t;
}
@ -1277,15 +1277,15 @@ void EnOssan_UpdateStickDirectionPromptAnim(EnOssan* this) {
this->stickAnimTween = stickAnimTween;
this->stickLeftPrompt.arrowColorR = COL_CHAN_MIX(255, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColorG = COL_CHAN_MIX(maxColor, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColorB = COL_CHAN_MIX(0, -100, arrowAnimTween);
this->stickLeftPrompt.arrowColorA = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColor.r = COL_CHAN_MIX(255, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColor.g = COL_CHAN_MIX(maxColor, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColor.b = COL_CHAN_MIX(0, -100, arrowAnimTween);
this->stickLeftPrompt.arrowColor.a = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickRightPrompt.arrowColorR = (maxColor - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColorG = (255 - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColorB = COL_CHAN_MIX(0, -100.0f, arrowAnimTween);
this->stickRightPrompt.arrowColorA = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickRightPrompt.arrowColor.r = (maxColor - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColor.g = (255 - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColor.b = COL_CHAN_MIX(0, -100.0f, arrowAnimTween);
this->stickRightPrompt.arrowColor.a = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickRightPrompt.arrowTexX = 290.0f;
this->stickLeftPrompt.arrowTexX = 33.0f;
@ -1438,7 +1438,7 @@ void EnOssan_InitShop(EnOssan* this, GlobalContext* globalCtx) {
this->textId = sWelcomeHumanTextIds[this->actor.params];
EnOssan_GetCutscenes(this, globalCtx);
this->cursorY = this->cursorX = 100.0f;
this->cursorPos.y = this->cursorPos.x = 100.0f;
this->cutsceneState = ENOSSAN_CUTSCENESTATE_STOPPED;
this->cutscene = this->lookToShopkeeperCutscene;
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
@ -1446,40 +1446,40 @@ void EnOssan_InitShop(EnOssan* this, GlobalContext* globalCtx) {
this->stickAccumX = this->stickAccumY = 0;
this->cursorIdx = 0;
this->cursorZ = 1.5f;
this->cursorColorR = 0;
this->cursorColorG = 80;
this->cursorColorB = 255;
this->cursorColorA = 255;
this->cursorPos.z = 1.5f;
this->cursorColor.r = 0;
this->cursorColor.g = 80;
this->cursorColor.b = 255;
this->cursorColor.a = 255;
this->cursorAnimTween = 0.0f;
this->cursorAnimState = 0;
this->drawCursor = 0;
this->stickLeftPrompt.stickColorR = 200;
this->stickLeftPrompt.stickColorG = 200;
this->stickLeftPrompt.stickColorB = 200;
this->stickLeftPrompt.stickColorA = 180;
this->stickLeftPrompt.stickColor.r = 200;
this->stickLeftPrompt.stickColor.g = 200;
this->stickLeftPrompt.stickColor.b = 200;
this->stickLeftPrompt.stickColor.a = 180;
this->stickLeftPrompt.stickTexX = 49.0f;
this->stickLeftPrompt.stickTexY = 95.0f;
this->stickLeftPrompt.arrowColorR = 255;
this->stickLeftPrompt.arrowColorG = 255;
this->stickLeftPrompt.arrowColorB = 0;
this->stickLeftPrompt.arrowColorA = 200;
this->stickLeftPrompt.arrowColor.r = 255;
this->stickLeftPrompt.arrowColor.g = 255;
this->stickLeftPrompt.arrowColor.b = 0;
this->stickLeftPrompt.arrowColor.a = 200;
this->stickLeftPrompt.arrowTexX = 33.0f;
this->stickLeftPrompt.arrowTexY = 91.0f;
this->stickLeftPrompt.texZ = 1.0f;
this->stickLeftPrompt.isEnabled = false;
this->stickRightPrompt.stickColorR = 200;
this->stickRightPrompt.stickColorG = 200;
this->stickRightPrompt.stickColorB = 200;
this->stickRightPrompt.stickColorA = 180;
this->stickRightPrompt.stickColor.r = 200;
this->stickRightPrompt.stickColor.g = 200;
this->stickRightPrompt.stickColor.b = 200;
this->stickRightPrompt.stickColor.a = 180;
this->stickRightPrompt.stickTexX = 274.0f;
this->stickRightPrompt.stickTexY = 95.0f;
this->stickRightPrompt.arrowColorR = 255;
this->stickRightPrompt.arrowColorG = 255;
this->stickRightPrompt.arrowColorB = 0;
this->stickRightPrompt.arrowColorA = 200;
this->stickRightPrompt.arrowColor.r = 255;
this->stickRightPrompt.arrowColor.g = 255;
this->stickRightPrompt.arrowColor.b = 0;
this->stickRightPrompt.arrowColor.a = 200;
this->stickRightPrompt.arrowTexX = 290.0f;
this->stickRightPrompt.arrowTexY = 91.0f;
this->stickRightPrompt.texZ = 1.0f;
@ -1537,8 +1537,8 @@ void EnOssan_DrawCursor(GlobalContext* globalCtx, EnOssan* this, f32 x, f32 y, f
OPEN_DISPS(globalCtx->state.gfxCtx);
if (drawCursor != 0) {
func_8012C654(globalCtx->state.gfxCtx);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColorR, this->cursorColorG, this->cursorColorB,
this->cursorColorA);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b,
this->cursorColor.a);
gDPLoadTextureBlock_4b(OVERLAY_DISP++, &D_0401F740, G_IM_FMT_IA, 16, 16, 0, G_TX_MIRROR | G_TX_WRAP,
G_TX_MIRROR | G_TX_WRAP, 4, 4, G_TX_NOLOD, G_TX_NOLOD);
w = 16.0f * z;
@ -1601,14 +1601,14 @@ void EnOssan_DrawStickDirectionPrompts(GlobalContext* globalCtx, EnOssan* this)
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOLOD);
gDPSetTileSize(OVERLAY_DISP++, G_TX_RENDERTILE, 0, 0, 15 * 4, 23 * 4);
if (drawStickRightPrompt) {
EnOssan_DrawTextRec(globalCtx, this->stickLeftPrompt.arrowColorR, this->stickLeftPrompt.arrowColorG,
this->stickLeftPrompt.arrowColorB, this->stickLeftPrompt.arrowColorA,
EnOssan_DrawTextRec(globalCtx, this->stickLeftPrompt.arrowColor.r, this->stickLeftPrompt.arrowColor.g,
this->stickLeftPrompt.arrowColor.b, this->stickLeftPrompt.arrowColor.a,
this->stickLeftPrompt.arrowTexX, this->stickLeftPrompt.arrowTexY,
this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f);
}
if (drawStickLeftPrompt) {
EnOssan_DrawTextRec(globalCtx, this->stickRightPrompt.arrowColorR, this->stickRightPrompt.arrowColorG,
this->stickRightPrompt.arrowColorB, this->stickRightPrompt.arrowColorA,
EnOssan_DrawTextRec(globalCtx, this->stickRightPrompt.arrowColor.r, this->stickRightPrompt.arrowColor.g,
this->stickRightPrompt.arrowColor.b, this->stickRightPrompt.arrowColor.a,
this->stickRightPrompt.arrowTexX, this->stickRightPrompt.arrowTexY,
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
@ -1622,14 +1622,14 @@ void EnOssan_DrawStickDirectionPrompts(GlobalContext* globalCtx, EnOssan* this)
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOLOD);
gDPSetTileSize(OVERLAY_DISP++, G_TX_RENDERTILE, 0, 0, 15 * 4, 15 * 4);
if (drawStickRightPrompt) {
EnOssan_DrawTextRec(globalCtx, this->stickLeftPrompt.stickColorR, this->stickLeftPrompt.stickColorG,
this->stickLeftPrompt.stickColorB, this->stickLeftPrompt.stickColorA,
EnOssan_DrawTextRec(globalCtx, this->stickLeftPrompt.stickColor.r, this->stickLeftPrompt.stickColor.g,
this->stickLeftPrompt.stickColor.b, this->stickLeftPrompt.stickColor.a,
this->stickLeftPrompt.stickTexX, this->stickLeftPrompt.stickTexY,
this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f);
}
if (drawStickLeftPrompt) {
EnOssan_DrawTextRec(globalCtx, this->stickRightPrompt.stickColorR, this->stickRightPrompt.stickColorG,
this->stickRightPrompt.stickColorB, this->stickRightPrompt.stickColorA,
EnOssan_DrawTextRec(globalCtx, this->stickRightPrompt.stickColor.r, this->stickRightPrompt.stickColor.g,
this->stickRightPrompt.stickColor.b, this->stickRightPrompt.stickColor.a,
this->stickRightPrompt.stickTexX, this->stickRightPrompt.stickTexY,
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
@ -1688,7 +1688,7 @@ void EnOssan_DrawCuriosityShopMan(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
EnOssan_OverrideLimbDrawCuriosityShopMan, EnOssan_PostLimbDrawCuriosityShopMan, &this->actor);
EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor);
EnOssan_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnOssan_DrawStickDirectionPrompts(globalCtx, this);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
@ -1703,7 +1703,7 @@ void EnOssan_DrawPartTimeWorker(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
EnOssan_OverrideLimbDrawPartTimeWorker, EnOssan_PostLimbDrawPartTimeWorker, &this->actor);
EnOssan_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor);
EnOssan_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnOssan_DrawStickDirectionPrompts(globalCtx, this);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}

View File

@ -26,13 +26,8 @@ typedef struct EnOssan {
/* 0x20C */ s32 stickAccumY;
/* 0x210 */ u8 moveHorizontal;
/* 0x211 */ u8 moveVertical;
/* 0x214 */ f32 cursorX;
/* 0x218 */ f32 cursorY;
/* 0x21C */ f32 cursorZ;
/* 0x220 */ u32 cursorColorR;
/* 0x224 */ u32 cursorColorG;
/* 0x228 */ u32 cursorColorB;
/* 0x22C */ u32 cursorColorA;
/* 0x214 */ Vec3f cursorPos;
/* 0x220 */ Color_RGBAu32 cursorColor;
/* 0x230 */ f32 cursorAnimTween;
/* 0x234 */ u8 cursorAnimState;
/* 0x235 */ u8 drawCursor;

View File

@ -437,9 +437,9 @@ void EnSob1_UpdateCursorPos(GlobalContext* globalCtx, EnSob1* this) {
f32 yOffset = 17.0f;
func_800B8898(globalCtx, &this->items[this->cursorIdx]->actor, &x, &y);
this->cursorX = x + xOffset;
this->cursorY = y + yOffset;
this->cursorZ = 1.2f;
this->cursorPos.x = x + xOffset;
this->cursorPos.y = y + yOffset;
this->cursorPos.z = 1.2f;
}
void EnSob1_EndInteraction(GlobalContext* globalCtx, EnSob1* this) {
@ -1196,10 +1196,10 @@ void EnSob1_UpdateCursorAnim(EnSob1* this) {
this->cursorAnimState = 0;
}
}
this->cursorColorR = COL_CHAN_MIX(0, 0.0f, t);
this->cursorColorG = COL_CHAN_MIX(80, 80.0f, t);
this->cursorColorB = COL_CHAN_MIX(255, 0.0f, t);
this->cursorColorA = COL_CHAN_MIX(255, 0.0f, t);
this->cursorColor.r = COL_CHAN_MIX(0, 0.0f, t);
this->cursorColor.g = COL_CHAN_MIX(80, 80.0f, t);
this->cursorColor.b = COL_CHAN_MIX(255, 0.0f, t);
this->cursorColor.a = COL_CHAN_MIX(255, 0.0f, t);
this->cursorAnimTween = t;
}
@ -1241,15 +1241,15 @@ void EnSob1_UpdateStickDirectionPromptAnim(EnSob1* this) {
this->stickAnimTween = stickAnimTween;
this->stickLeftPrompt.arrowColorR = COL_CHAN_MIX(255, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColorG = COL_CHAN_MIX(maxColor, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColorB = COL_CHAN_MIX(0, -100, arrowAnimTween);
this->stickLeftPrompt.arrowColorA = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColor.r = COL_CHAN_MIX(255, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColor.g = COL_CHAN_MIX(maxColor, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColor.b = COL_CHAN_MIX(0, -100, arrowAnimTween);
this->stickLeftPrompt.arrowColor.a = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickRightPrompt.arrowColorR = (maxColor - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColorG = (255 - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColorB = COL_CHAN_MIX(0, -100.0f, arrowAnimTween);
this->stickRightPrompt.arrowColorA = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickRightPrompt.arrowColor.r = (maxColor - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColor.g = (255 - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColor.b = COL_CHAN_MIX(0, -100.0f, arrowAnimTween);
this->stickRightPrompt.arrowColor.a = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickRightPrompt.arrowTexX = 290.0f;
this->stickLeftPrompt.arrowTexX = 33.0f;
@ -1402,30 +1402,30 @@ void EnSob1_InitShop(EnSob1* this, GlobalContext* globalCtx) {
EnSob1_SetupAction(this, EnSob1_Idle);
}
this->cursorY = (this->cursorX = 100.0f);
this->cursorPos.y = (this->cursorPos.x = 100.0f);
this->stickAccumX = (this->stickAccumY = 0);
this->cursorIdx = 0;
this->cursorZ = 1.2f;
this->cursorColorR = 0;
this->cursorColorG = 80;
this->cursorColorB = maxColor;
this->cursorColorA = maxColor;
this->cursorPos.z = 1.2f;
this->cursorColor.r = 0;
this->cursorColor.g = 80;
this->cursorColor.b = maxColor;
this->cursorColor.a = maxColor;
this->cursorAnimTween = 0.0f;
this->cursorAnimState = 0;
this->drawCursor = 0;
this2 = this;
this2->stickLeftPrompt.stickColorR = 200;
this2->stickLeftPrompt.stickColorG = 200;
this2->stickLeftPrompt.stickColorB = 200;
this2->stickLeftPrompt.stickColorA = 180;
this2->stickLeftPrompt.stickColor.r = 200;
this2->stickLeftPrompt.stickColor.g = 200;
this2->stickLeftPrompt.stickColor.b = 200;
this2->stickLeftPrompt.stickColor.a = 180;
this2->stickLeftPrompt.stickTexX = 49.0f;
this2->stickLeftPrompt.stickTexY = 95.0f;
this2->stickLeftPrompt.arrowColorR = maxColor;
this2->stickLeftPrompt.arrowColorG = maxColor;
this2->stickLeftPrompt.arrowColorB = 0;
this2->stickLeftPrompt.arrowColorA = 200;
this2->stickLeftPrompt.arrowColor.r = maxColor;
this2->stickLeftPrompt.arrowColor.g = maxColor;
this2->stickLeftPrompt.arrowColor.b = 0;
this2->stickLeftPrompt.arrowColor.a = 200;
this2->stickLeftPrompt.arrowTexX = 33.0f;
this2->stickLeftPrompt.arrowTexY = 91.0f;
this2->stickLeftPrompt.texZ = 1.0f;
@ -1433,16 +1433,16 @@ void EnSob1_InitShop(EnSob1* this, GlobalContext* globalCtx) {
if (1) {}
this2->stickRightPrompt.stickColorR = 200;
this2->stickRightPrompt.stickColorG = 200;
this2->stickRightPrompt.stickColorB = 200;
this2->stickRightPrompt.stickColorA = 180;
this2->stickRightPrompt.stickColor.r = 200;
this2->stickRightPrompt.stickColor.g = 200;
this2->stickRightPrompt.stickColor.b = 200;
this2->stickRightPrompt.stickColor.a = 180;
this2->stickRightPrompt.stickTexX = 274.0f;
this2->stickRightPrompt.stickTexY = 95.0f;
this2->stickRightPrompt.arrowColorR = maxColor;
this2->stickRightPrompt.arrowColorG = 0;
this2->stickRightPrompt.arrowColorB = 0;
this2->stickRightPrompt.arrowColorA = 200;
this2->stickRightPrompt.arrowColor.r = maxColor;
this2->stickRightPrompt.arrowColor.g = 0;
this2->stickRightPrompt.arrowColor.b = 0;
this2->stickRightPrompt.arrowColor.a = 200;
this2->stickRightPrompt.arrowTexX = 290.0f;
this2->stickRightPrompt.arrowTexY = 91.0f;
this2->stickRightPrompt.texZ = 1.0f;
@ -1498,8 +1498,8 @@ void EnSob1_DrawCursor(GlobalContext* globalCtx, EnSob1* this, f32 x, f32 y, f32
OPEN_DISPS(globalCtx->state.gfxCtx);
if (drawCursor != 0) {
func_8012C654(globalCtx->state.gfxCtx);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColorR, this->cursorColorG, this->cursorColorB,
this->cursorColorA);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b,
this->cursorColor.a);
gDPLoadTextureBlock_4b(OVERLAY_DISP++, &D_0401F740, G_IM_FMT_IA, 16, 16, 0, G_TX_MIRROR | G_TX_WRAP,
G_TX_MIRROR | G_TX_WRAP, 4, 4, G_TX_NOLOD, G_TX_NOLOD);
w = 16.0f * z;
@ -1562,14 +1562,14 @@ void EnSob1_DrawStickDirectionPrompt(GlobalContext* globalCtx, EnSob1* this) {
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOLOD);
gDPSetTileSize(OVERLAY_DISP++, G_TX_RENDERTILE, 0, 0, 15 * 4, 23 * 4);
if (drawStickRightPrompt) {
EnSob1_DrawTextRec(globalCtx, this->stickLeftPrompt.arrowColorR, this->stickLeftPrompt.arrowColorG,
this->stickLeftPrompt.arrowColorB, this->stickLeftPrompt.arrowColorA,
EnSob1_DrawTextRec(globalCtx, this->stickLeftPrompt.arrowColor.r, this->stickLeftPrompt.arrowColor.g,
this->stickLeftPrompt.arrowColor.b, this->stickLeftPrompt.arrowColor.a,
this->stickLeftPrompt.arrowTexX, this->stickLeftPrompt.arrowTexY,
this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f);
}
if (drawStickLeftPrompt) {
EnSob1_DrawTextRec(globalCtx, this->stickRightPrompt.arrowColorR, this->stickRightPrompt.arrowColorG,
this->stickRightPrompt.arrowColorB, this->stickRightPrompt.arrowColorA,
EnSob1_DrawTextRec(globalCtx, this->stickRightPrompt.arrowColor.r, this->stickRightPrompt.arrowColor.g,
this->stickRightPrompt.arrowColor.b, this->stickRightPrompt.arrowColor.a,
this->stickRightPrompt.arrowTexX, this->stickRightPrompt.arrowTexY,
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
@ -1583,14 +1583,14 @@ void EnSob1_DrawStickDirectionPrompt(GlobalContext* globalCtx, EnSob1* this) {
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOLOD);
gDPSetTileSize(OVERLAY_DISP++, G_TX_RENDERTILE, 0, 0, 15 * 4, 15 * 4);
if (drawStickRightPrompt) {
EnSob1_DrawTextRec(globalCtx, this->stickLeftPrompt.stickColorR, this->stickLeftPrompt.stickColorG,
this->stickLeftPrompt.stickColorB, this->stickLeftPrompt.stickColorA,
EnSob1_DrawTextRec(globalCtx, this->stickLeftPrompt.stickColor.r, this->stickLeftPrompt.stickColor.g,
this->stickLeftPrompt.stickColor.b, this->stickLeftPrompt.stickColor.a,
this->stickLeftPrompt.stickTexX, this->stickLeftPrompt.stickTexY,
this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f);
}
if (drawStickLeftPrompt) {
EnSob1_DrawTextRec(globalCtx, this->stickRightPrompt.stickColorR, this->stickRightPrompt.stickColorG,
this->stickRightPrompt.stickColorB, this->stickRightPrompt.stickColorA,
EnSob1_DrawTextRec(globalCtx, this->stickRightPrompt.stickColor.r, this->stickRightPrompt.stickColor.g,
this->stickRightPrompt.stickColor.b, this->stickRightPrompt.stickColor.a,
this->stickRightPrompt.stickTexX, this->stickRightPrompt.stickTexY,
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
@ -1654,7 +1654,7 @@ void EnSob1_DrawZoraShopkeeper(Actor* thisx, GlobalContext* globalCtx) {
this->items[i]->actor.scale.y = 0.2f;
this->items[i]->actor.scale.z = 0.2f;
}
EnSob1_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor);
EnSob1_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnSob1_DrawStickDirectionPrompt(globalCtx, this);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
@ -1675,7 +1675,7 @@ void EnSob1_DrawGoronShopkeeper(Actor* thisx, GlobalContext* globalCtx) {
this->items[i]->actor.scale.y = 0.2f;
this->items[i]->actor.scale.z = 0.2f;
}
EnSob1_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor);
EnSob1_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnSob1_DrawStickDirectionPrompt(globalCtx, this);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
@ -1696,7 +1696,7 @@ void EnSob1_DrawBombShopkeeper(Actor* thisx, GlobalContext* globalCtx) {
this->items[i]->actor.scale.y = 0.2f;
this->items[i]->actor.scale.z = 0.2f;
}
EnSob1_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor);
EnSob1_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnSob1_DrawStickDirectionPrompt(globalCtx, this);
frames = globalCtx->gameplayFrames;
func_8012C2DC(globalCtx->state.gfxCtx);

View File

@ -40,13 +40,8 @@ typedef struct EnSob1 {
/* 0x2EC */ EnGirlA* items[3]; // Items on shelf are indexed as: /* 2 1 0 */
/* 0x2F8 */ s32 stickAccumX;
/* 0x2FC */ s32 stickAccumY;
/* 0x300 */ f32 cursorX;
/* 0x304 */ f32 cursorY;
/* 0x308 */ f32 cursorZ;
/* 0x30C */ s32 cursorColorR;
/* 0x310 */ s32 cursorColorG;
/* 0x314 */ s32 cursorColorB;
/* 0x318 */ s32 cursorColorA;
/* 0x300 */ Vec3f cursorPos;
/* 0x30C */ Color_RGBAu32 cursorColor;
/* 0x31C */ f32 cursorAnimTween;
/* 0x320 */ u8 cursorAnimState;
/* 0x321 */ u8 drawCursor;

View File

@ -160,9 +160,9 @@ void EnTrt_UpdateCursorPos(GlobalContext* globalCtx, EnTrt* this) {
f32 yOffset = 17.0f;
func_800B8898(globalCtx, &this->items[this->cursorIdx]->actor, &x, &y);
this->cursorX = x + xOffset;
this->cursorY = y + yOffset;
this->cursorZ = 1.2f;
this->cursorPos.x = x + xOffset;
this->cursorPos.y = y + yOffset;
this->cursorPos.z = 1.2f;
}
void EnTrt_SetupGetMushroomCutscene(EnTrt* this) {
@ -1221,10 +1221,10 @@ void EnTrt_UpdateCursorAnim(EnTrt* this) {
this->cursorAnimState = 0;
}
}
this->cursorColorR = COL_CHAN_MIX(0, 0.0f, t);
this->cursorColorG = COL_CHAN_MIX(80, 80.0f, t);
this->cursorColorB = COL_CHAN_MIX(255, 0.0f, t);
this->cursorColorA = COL_CHAN_MIX(255, 0.0f, t);
this->cursorColor.r = COL_CHAN_MIX(0, 0.0f, t);
this->cursorColor.g = COL_CHAN_MIX(80, 80.0f, t);
this->cursorColor.b = COL_CHAN_MIX(255, 0.0f, t);
this->cursorColor.a = COL_CHAN_MIX(255, 0.0f, t);
this->cursorAnimTween = t;
}
@ -1266,15 +1266,15 @@ void EnTrt_UpdateStickDirectionPromptAnim(EnTrt* this) {
this->stickAnimTween = stickAnimTween;
this->stickLeftPrompt.arrowColorR = COL_CHAN_MIX(255, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColorG = COL_CHAN_MIX(maxColor, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColorB = COL_CHAN_MIX(0, -100, arrowAnimTween);
this->stickLeftPrompt.arrowColorA = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColor.r = COL_CHAN_MIX(255, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColor.g = COL_CHAN_MIX(maxColor, 155.0f, arrowAnimTween);
this->stickLeftPrompt.arrowColor.b = COL_CHAN_MIX(0, -100, arrowAnimTween);
this->stickLeftPrompt.arrowColor.a = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickRightPrompt.arrowColorR = (maxColor - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColorG = (255 - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColorB = COL_CHAN_MIX(0, -100.0f, arrowAnimTween);
this->stickRightPrompt.arrowColorA = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickRightPrompt.arrowColor.r = (maxColor - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColor.g = (255 - ((s32)tmp)) & 0xFF;
this->stickRightPrompt.arrowColor.b = COL_CHAN_MIX(0, -100.0f, arrowAnimTween);
this->stickRightPrompt.arrowColor.a = COL_CHAN_MIX(200, 50.0f, arrowAnimTween);
this->stickRightPrompt.arrowTexX = 290.0f;
this->stickLeftPrompt.arrowTexX = 33.0f;
@ -1483,28 +1483,28 @@ void EnTrt_InitShop(EnTrt* this, GlobalContext* globalCtx) {
this->stickAccumY = 0;
this->stickAccumX = 0;
this->cursorIdx = 0;
this->cursorY = this->cursorX = 100.0f;
this->cursorZ = 1.2f;
this->cursorColorR = 0;
this->cursorColorG = 80;
this->cursorColorB = maxcolor;
this->cursorColorA = maxcolor;
this->cursorPos.y = this->cursorPos.x = 100.0f;
this->cursorPos.z = 1.2f;
this->cursorColor.r = 0;
this->cursorColor.g = 80;
this->cursorColor.b = maxcolor;
this->cursorColor.a = maxcolor;
this->cursorAnimTween = 0.0f;
this->cursorAnimState = 0;
this->drawCursor = 0;
this2 = this;
this->stickLeftPrompt.stickColorR = 200;
this2->stickLeftPrompt.stickColorG = 200;
this2->stickLeftPrompt.stickColorB = 200;
this2->stickLeftPrompt.stickColorA = 180;
this->stickLeftPrompt.stickColor.r = 200;
this2->stickLeftPrompt.stickColor.g = 200;
this2->stickLeftPrompt.stickColor.b = 200;
this2->stickLeftPrompt.stickColor.a = 180;
this2->stickLeftPrompt.stickTexX = 49.0f;
this2->stickLeftPrompt.stickTexY = 95.0f;
this2->stickLeftPrompt.arrowColorR = maxcolor;
this2->stickLeftPrompt.arrowColorG = maxcolor;
this2->stickLeftPrompt.arrowColorB = 0;
this2->stickLeftPrompt.arrowColorA = 200;
this2->stickLeftPrompt.arrowColor.r = maxcolor;
this2->stickLeftPrompt.arrowColor.g = maxcolor;
this2->stickLeftPrompt.arrowColor.b = 0;
this2->stickLeftPrompt.arrowColor.a = 200;
this2->stickLeftPrompt.arrowTexX = 33.0f;
this2->stickLeftPrompt.arrowTexY = 91.0f;
this2->stickLeftPrompt.texZ = 1.0f;
@ -1512,16 +1512,16 @@ void EnTrt_InitShop(EnTrt* this, GlobalContext* globalCtx) {
if (1) {}
this2->stickRightPrompt.stickColorR = 200;
this2->stickRightPrompt.stickColorG = 200;
this2->stickRightPrompt.stickColorB = 200;
this2->stickRightPrompt.stickColorA = 180;
this2->stickRightPrompt.stickColor.r = 200;
this2->stickRightPrompt.stickColor.g = 200;
this2->stickRightPrompt.stickColor.b = 200;
this2->stickRightPrompt.stickColor.a = 180;
this2->stickRightPrompt.stickTexX = 274.0f;
this2->stickRightPrompt.stickTexY = 95.0f;
this2->stickRightPrompt.arrowColorR = maxcolor;
this2->stickRightPrompt.arrowColorG = 0;
this2->stickRightPrompt.arrowColorB = 0;
this2->stickRightPrompt.arrowColorA = 200;
this2->stickRightPrompt.arrowColor.r = maxcolor;
this2->stickRightPrompt.arrowColor.g = 0;
this2->stickRightPrompt.arrowColor.b = 0;
this2->stickRightPrompt.arrowColor.a = 200;
this2->stickRightPrompt.arrowTexX = 290.0f;
this2->stickRightPrompt.arrowTexY = 91.0f;
this2->stickRightPrompt.texZ = 1.0f;
@ -1562,8 +1562,8 @@ void EnTrt_DrawCursor(GlobalContext* globalCtx, EnTrt* this, f32 x, f32 y, f32 z
OPEN_DISPS(globalCtx->state.gfxCtx);
if (drawCursor != 0) {
func_8012C654(globalCtx->state.gfxCtx);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColorR, this->cursorColorG, this->cursorColorB,
this->cursorColorA);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, this->cursorColor.r, this->cursorColor.g, this->cursorColor.b,
this->cursorColor.a);
gDPLoadTextureBlock_4b(OVERLAY_DISP++, &D_0401F740, G_IM_FMT_IA, 16, 16, 0, G_TX_MIRROR | G_TX_WRAP,
G_TX_MIRROR | G_TX_WRAP, 4, 4, G_TX_NOLOD, G_TX_NOLOD);
w = 16.0f * z;
@ -1626,14 +1626,14 @@ void EnTrt_DrawStickDirectionPrompt(GlobalContext* globalCtx, EnTrt* this) {
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOLOD);
gDPSetTileSize(OVERLAY_DISP++, G_TX_RENDERTILE, 0, 0, 15 * 4, 23 * 4);
if (drawStickRightPrompt) {
EnTrt_DrawTextRec(globalCtx, this->stickLeftPrompt.arrowColorR, this->stickLeftPrompt.arrowColorG,
this->stickLeftPrompt.arrowColorB, this->stickLeftPrompt.arrowColorA,
EnTrt_DrawTextRec(globalCtx, this->stickLeftPrompt.arrowColor.r, this->stickLeftPrompt.arrowColor.g,
this->stickLeftPrompt.arrowColor.b, this->stickLeftPrompt.arrowColor.a,
this->stickLeftPrompt.arrowTexX, this->stickLeftPrompt.arrowTexY,
this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f);
}
if (drawStickLeftPrompt) {
EnTrt_DrawTextRec(globalCtx, this->stickRightPrompt.arrowColorR, this->stickRightPrompt.arrowColorG,
this->stickRightPrompt.arrowColorB, this->stickRightPrompt.arrowColorA,
EnTrt_DrawTextRec(globalCtx, this->stickRightPrompt.arrowColor.r, this->stickRightPrompt.arrowColor.g,
this->stickRightPrompt.arrowColor.b, this->stickRightPrompt.arrowColor.a,
this->stickRightPrompt.arrowTexX, this->stickRightPrompt.arrowTexY,
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
@ -1647,14 +1647,14 @@ void EnTrt_DrawStickDirectionPrompt(GlobalContext* globalCtx, EnTrt* this) {
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOLOD);
gDPSetTileSize(OVERLAY_DISP++, G_TX_RENDERTILE, 0, 0, 15 * 4, 15 * 4);
if (drawStickRightPrompt) {
EnTrt_DrawTextRec(globalCtx, this->stickLeftPrompt.stickColorR, this->stickLeftPrompt.stickColorG,
this->stickLeftPrompt.stickColorB, this->stickLeftPrompt.stickColorA,
EnTrt_DrawTextRec(globalCtx, this->stickLeftPrompt.stickColor.r, this->stickLeftPrompt.stickColor.g,
this->stickLeftPrompt.stickColor.b, this->stickLeftPrompt.stickColor.a,
this->stickLeftPrompt.stickTexX, this->stickLeftPrompt.stickTexY,
this->stickLeftPrompt.texZ, 0, 0, -1.0f, 1.0f);
}
if (drawStickLeftPrompt) {
EnTrt_DrawTextRec(globalCtx, this->stickRightPrompt.stickColorR, this->stickRightPrompt.stickColorG,
this->stickRightPrompt.stickColorB, this->stickRightPrompt.stickColorA,
EnTrt_DrawTextRec(globalCtx, this->stickRightPrompt.stickColor.r, this->stickRightPrompt.stickColor.g,
this->stickRightPrompt.stickColor.b, this->stickRightPrompt.stickColor.a,
this->stickRightPrompt.stickTexX, this->stickRightPrompt.stickTexY,
this->stickRightPrompt.texZ, 0, 0, 1.0f, 1.0f);
}
@ -1791,7 +1791,7 @@ void EnTrt_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTextureIdx]));
func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
EnTrt_OverrideLimbDraw, EnTrt_PostLimbDraw, EnTrt_UnkActorDraw, &this->actor);
EnTrt_DrawCursor(globalCtx, this, this->cursorX, this->cursorY, this->cursorZ, this->drawCursor);
EnTrt_DrawCursor(globalCtx, this, this->cursorPos.x, this->cursorPos.y, this->cursorPos.z, this->drawCursor);
EnTrt_DrawStickDirectionPrompt(globalCtx, this);
CLOSE_DISPS(globalCtx->state.gfxCtx);

View File

@ -37,13 +37,8 @@ typedef struct EnTrt {
/* 0x3DC */ EnTrtBlinkFunc blinkFunc;
/* 0x3E0 */ s16 cutscene;
/* 0x3E2 */ s16 tmpGetMushroomCutscene;
/* 0x3E4 */ f32 cursorX;
/* 0x3E8 */ f32 cursorY;
/* 0x3EC */ f32 cursorZ;
/* 0x3F0 */ s32 cursorColorR;
/* 0x3F4 */ s32 cursorColorG;
/* 0x3F8 */ s32 cursorColorB;
/* 0x3FC */ s32 cursorColorA;
/* 0x3E4 */ Vec3f cursorPos;
/* 0x3F0 */ Color_RGBAu32 cursorColor;
/* 0x400 */ u8 drawCursor;
/* 0x402 */ s16 timer;
/* 0x404 */ s16 animationIdx;

42
tools/calc_bss.sh Normal file
View File

@ -0,0 +1,42 @@
#!/bin/bash
# Given a list of header files, compute the bss index that results from
# including them. (See prevent_bss_reordering.h for more information.)
TEMPC=$(mktemp -t bss.XXXXXXX.c)
TEMPO=$(mktemp -t bss.XXXXXXX.o)
trap "rm -f $TEMPC $TEMPO" EXIT
set -e
if [[ $# = 0 ]]; then
echo "Usage: ./tools/calc_bss.sh file1.h file2.h ..." >&2
exit 1
fi
if [ -z "$CROSS" ]; then
CROSS=mips-linux-gnu-
fi
# bss indexing starts at 3
for I in {3..255}; do
echo "char bss$I;" >> $TEMPC
done
for I in {0..2}; do
echo "char bss$I;" >> $TEMPC
done
while [[ $# -gt 0 ]]; do
echo "#include \"$1\"" >> $TEMPC
shift
done
echo "char measurement;" >> $TEMPC
$(pwd)/tools/ido_recomp/linux/7.1/cc -G 0 -non_shared \
-Xfullwarn -Xcpluscomm -O2 -g3 -Xcpluscomm -mips2 \
-I $(pwd)/include/ -I $(pwd)/src/ -I $(pwd)/assets/ -I $(pwd)/build/ \
-Wab,-r4300_mul -woff 624,649,838,712 -c $TEMPC -o $TEMPO
LINE=$(${CROSS}objdump -t $TEMPO | grep measurement | cut -d' ' -f1)
NUM=$((0x$LINE - 1))
echo "bss index: $NUM"

View File

@ -3240,10 +3240,10 @@
0x80178DAC:("func_80178DAC",),
0x80178E3C:("func_80178E3C",),
0x80178E7C:("func_80178E7C",),
0x80178F30:("Check_WriteRGB5A1Pixel",),
0x80178F30:("Check_WriteRGBA16Pixel",),
0x80178F60:("Check_WriteI4Pixel",),
0x80178FA0:("Check_DrawI4Texture",),
0x80179090:("Check_ClearRGB5A1",),
0x80179090:("Check_ClearRGBA16",),
0x8017910C:("Check_DrawExpansionPakErrorMessage",),
0x801791CC:("Check_DrawRegionLockErrorMessage",),
0x80179260:("Check_ExpansionPak",),

View File

@ -2754,10 +2754,10 @@ asm/non_matchings/code/sys_cmpdma/func_80178D7C.s,func_80178D7C,0x80178D7C,0xC
asm/non_matchings/code/sys_cmpdma/func_80178DAC.s,func_80178DAC,0x80178DAC,0x24
asm/non_matchings/code/sys_cmpdma/func_80178E3C.s,func_80178E3C,0x80178E3C,0x10
asm/non_matchings/code/sys_cmpdma/func_80178E7C.s,func_80178E7C,0x80178E7C,0x2D
asm/non_matchings/code/sys_initial_check/Check_WriteRGB5A1Pixel.s,Check_WriteRGB5A1Pixel,0x80178F30,0xC
asm/non_matchings/code/sys_initial_check/Check_WriteRGBA16Pixel.s,Check_WriteRGBA16Pixel,0x80178F30,0xC
asm/non_matchings/code/sys_initial_check/Check_WriteI4Pixel.s,Check_WriteI4Pixel,0x80178F60,0x10
asm/non_matchings/code/sys_initial_check/Check_DrawI4Texture.s,Check_DrawI4Texture,0x80178FA0,0x3C
asm/non_matchings/code/sys_initial_check/Check_ClearRGB5A1.s,Check_ClearRGB5A1,0x80179090,0x1F
asm/non_matchings/code/sys_initial_check/Check_ClearRGBA16.s,Check_ClearRGBA16,0x80179090,0x1F
asm/non_matchings/code/sys_initial_check/Check_DrawExpansionPakErrorMessage.s,Check_DrawExpansionPakErrorMessage,0x8017910C,0x30
asm/non_matchings/code/sys_initial_check/Check_DrawRegionLockErrorMessage.s,Check_DrawRegionLockErrorMessage,0x801791CC,0x25
asm/non_matchings/code/sys_initial_check/Check_ExpansionPak.s,Check_ExpansionPak,0x80179260,0x11

1 asm/non_matchings/code/z_en_a_keep/EnAObj_Init.s EnAObj_Init 0x800A5AC0 0x2B
2754 asm/non_matchings/code/sys_cmpdma/func_80178DAC.s func_80178DAC 0x80178DAC 0x24
2755 asm/non_matchings/code/sys_cmpdma/func_80178E3C.s func_80178E3C 0x80178E3C 0x10
2756 asm/non_matchings/code/sys_cmpdma/func_80178E7C.s func_80178E7C 0x80178E7C 0x2D
2757 asm/non_matchings/code/sys_initial_check/Check_WriteRGB5A1Pixel.s asm/non_matchings/code/sys_initial_check/Check_WriteRGBA16Pixel.s Check_WriteRGB5A1Pixel Check_WriteRGBA16Pixel 0x80178F30 0xC
2758 asm/non_matchings/code/sys_initial_check/Check_WriteI4Pixel.s Check_WriteI4Pixel 0x80178F60 0x10
2759 asm/non_matchings/code/sys_initial_check/Check_DrawI4Texture.s Check_DrawI4Texture 0x80178FA0 0x3C
2760 asm/non_matchings/code/sys_initial_check/Check_ClearRGB5A1.s asm/non_matchings/code/sys_initial_check/Check_ClearRGBA16.s Check_ClearRGB5A1 Check_ClearRGBA16 0x80179090 0x1F
2761 asm/non_matchings/code/sys_initial_check/Check_DrawExpansionPakErrorMessage.s Check_DrawExpansionPakErrorMessage 0x8017910C 0x30
2762 asm/non_matchings/code/sys_initial_check/Check_DrawRegionLockErrorMessage.s Check_DrawRegionLockErrorMessage 0x801791CC 0x25
2763 asm/non_matchings/code/sys_initial_check/Check_ExpansionPak.s Check_ExpansionPak 0x80179260 0x11