numbers aren't magic (#2976)

* numbers aren't magic

* chest style matches contents

renamed everything except the cvar itself at this point
(waiting for versioned configs for that)

* tracker as part of names

* finish the tracker rename

---------

Co-authored-by: briaguya <briaguya@alice>
This commit is contained in:
briaguya
2023-06-09 17:22:25 -04:00
committed by GitHub
parent e46c60a7a1
commit d69c07cd75
28 changed files with 305 additions and 180 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "soh/Enhancements/enhancementTypes.h"
u16 sReactionTextIds[][PLAYER_MASK_MAX] = {
{ 0x0000, 0x7124, 0x7127, 0x7126, 0x7125, 0x7127, 0x7124, 0x7125, 0x7127 },
@@ -66,7 +67,7 @@ u16 sReactionTextIds[][PLAYER_MASK_MAX] = {
u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet) {
u8 currentMask = Player_GetMask(play);
if (CVarGetInteger("gMMBunnyHood", 0) && currentMask == PLAYER_MASK_BUNNY) {
if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && currentMask == PLAYER_MASK_BUNNY) {
return 0;
} else {
return sReactionTextIds[reactionSet][currentMask];
+4 -3
View File
@@ -7,6 +7,7 @@
#include "textures/parameter_static/parameter_static.h"
#include "textures/message_static/message_static.h"
#include "textures/message_texture_static/message_texture_static.h"
#include "soh/Enhancements/cosmetics/cosmeticsTypes.h"
s16 sTextFade = false; // original name: key_off_flag ?
@@ -97,7 +98,7 @@ void Message_ResetOcarinaNoteState(void) {
sOcarinaNoteCBtnEnv = (Color_RGB8){ 10, 10, 10 };
if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) {
sOcarinaNoteABtnPrim = CVarGetColor24("gCosmetics.Hud_AButton.Value", sOcarinaNoteABtnPrim);
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", 0)) {
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) {
sOcarinaNoteABtnPrim = (Color_RGB8){ 80, 255, 150 };
}
if (CVarGetInteger("gCosmetics.Hud_CButtons.Changed", 0)) {
@@ -465,7 +466,7 @@ void Message_DrawTextboxIcon(PlayState* play, Gfx** p, s16 x, s16 y) {
sIconPrimColors[0].b = (color.b / 255) * 95;
sIconPrimColors[1] = color;
sIconEnvColors[1] = color;
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", 0)) {
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) {
sIconPrimColors[0] = (Color_RGB8){ 0, 200, 80 };
sIconPrimColors[1] = (Color_RGB8){ 50, 255, 130 };
sIconEnvColors[1] = (Color_RGB8){ 50, 255, 130 };
@@ -2017,7 +2018,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
sOcarinaNoteAPrimColors[0].b = (color.b / 255) * 95;
sOcarinaNoteAPrimColors[1] = color;
sOcarinaNoteAEnvColors[1] = color;
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", 0)) {
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) {
sOcarinaNoteAPrimColors[0] = (Color_RGB8){ 80, 255, 150 };
sOcarinaNoteAPrimColors[1] = (Color_RGB8){ 100, 255, 200 };
sOcarinaNoteAEnvColors[1] = (Color_RGB8){ 50, 255, 50 };
+6 -4
View File
@@ -10,6 +10,8 @@
#include "soh/Enhancements/gameplaystats.h"
#include "soh/Enhancements/boss-rush/BossRushTypes.h"
#include "soh/Enhancements/custom-message/CustomMessageInterfaceAddon.h"
#include "soh/Enhancements/cosmetics/cosmeticsTypes.h"
#include "soh/Enhancements/enhancementTypes.h"
#ifdef _MSC_VER
#include <stdlib.h>
@@ -1127,7 +1129,7 @@ void func_80083108(PlayState* play) {
if (interfaceCtx->restrictions.tradeItems != 0) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((CVarGetInteger("gMMBunnyHood", 0) != 0)
if ((CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA)
&& (gSaveContext.equips.buttonItems[i] >= ITEM_MASK_KEATON)
&& (gSaveContext.equips.buttonItems[i] <= ITEM_MASK_TRUTH)) {
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED;
@@ -3704,7 +3706,7 @@ void Interface_DrawItemButtons(PlayState* play) {
Color_RGB8 bButtonColor = { 0, 150, 0 };
if (CVarGetInteger("gCosmetics.Hud_BButton.Changed", 0)) {
bButtonColor = CVarGetColor24("gCosmetics.Hud_BButton.Value", bButtonColor);
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", 0)) {
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) {
bButtonColor = (Color_RGB8){ 255, 30, 30 };
}
@@ -3732,7 +3734,7 @@ void Interface_DrawItemButtons(PlayState* play) {
Color_RGB8 startButtonColor = { 200, 0, 0 };
if (CVarGetInteger("gCosmetics.Hud_StartButton.Changed", 0)) {
startButtonColor = CVarGetColor24("gCosmetics.Hud_StartButton.Value", startButtonColor);
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", 0)) {
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) {
startButtonColor = (Color_RGB8){ 120, 120, 120 };
}
@@ -4828,7 +4830,7 @@ void Interface_Draw(PlayState* play) {
Color_RGB8 aButtonColor = { 90, 90, 255 };
if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) {
aButtonColor = CVarGetColor24("gCosmetics.Hud_AButton.Value", aButtonColor);
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", 0)) {
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) {
aButtonColor = (Color_RGB8){ 0, 200, 50 };
}
+4 -3
View File
@@ -9,6 +9,7 @@
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/randomizer/randomizer_entrance.h"
#include <overlays/actors/ovl_En_Niw/z_en_niw.h>
#include "soh/Enhancements/enhancementTypes.h"
#include <libultraship/libultraship.h>
@@ -644,7 +645,7 @@ void Play_Init(GameState* thisx) {
Fault_AddClient(&D_801614B8, ZeldaArena_Display, NULL, NULL);
// In order to keep bunny hood equipped on first load, we need to pre-set the age reqs for the item and slot
if (CVarGetInteger("gMMBunnyHood", 0) || CVarGetInteger("gTimelessEquipment", 0)) {
if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA || CVarGetInteger("gTimelessEquipment", 0)) {
gItemAgeReqs[ITEM_MASK_BUNNY] = 9;
if(INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY)
gSlotAgeReqs[SLOT_TRADE_CHILD] = 9;
@@ -1177,7 +1178,7 @@ void Play_Update(PlayState* play) {
gSaveContext.sohStats.sceneTimer++;
gSaveContext.sohStats.roomTimer++;
if (CVarGetInteger("gMMBunnyHood", 0) && Player_GetMask(play) == PLAYER_MASK_BUNNY) {
if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && Player_GetMask(play) == PLAYER_MASK_BUNNY) {
gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD]++;
}
}
@@ -2287,7 +2288,7 @@ void Play_PerformSave(PlayState* play) {
} else {
Save_SaveFile();
}
if (CVarGetInteger("gAutosave", 0)) {
if (CVarGetInteger("gAutosave", AUTOSAVE_OFF) != AUTOSAVE_OFF) {
Overlay_DisplayText(3.0f, "Game Saved");
}
}
@@ -2548,7 +2548,7 @@ void BossTw_DeathCSMsgSfx(BossTw* this, PlayState* play) {
Math_ApproachF(&this->workf[UNK_F18], 255.0f, 0.1f, 5.0f);
}
// Add seperate timings for the "beam" that opens and closes around the sisters
// Add separate timings for the "beam" that opens and closes around the sisters
// Needed because we skip ahead in cutscene timer value so it never gets called otherwise
if (gSaveContext.n64ddFlag || gSaveContext.isBossRush) {
if (this->work[CS_TIMER_2] < 900) {
@@ -1,6 +1,7 @@
#include "z_en_box.h"
#include "objects/object_box/object_box.h"
#include "soh_assets.h"
#include "soh/Enhancements/enhancementTypes.h"
#define FLAGS 0
@@ -632,11 +633,11 @@ void EnBox_Update(Actor* thisx, PlayState* play) {
void EnBox_UpdateSizeAndTexture(EnBox* this, PlayState* play) {
EnBox_CreateExtraChestTextures();
int cstmc = CVarGetInteger("gChestSizeAndTextureMatchesContents", 0);
int csmc = CVarGetInteger("gChestSizeAndTextureMatchesContents", CSMC_DISABLED);
int requiresStoneAgony = CVarGetInteger("gChestSizeDependsStoneOfAgony", 0);
GetItemCategory getItemCategory;
int isVanilla = cstmc == 0 || (requiresStoneAgony && !CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY)) ||
int isVanilla = csmc == CSMC_DISABLED || (requiresStoneAgony && !CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY)) ||
(play->sceneNum == SCENE_TAKARAYA && this->dyna.actor.room != 6); // Exclude treasure game chests except for the final room
if (!isVanilla) {
@@ -656,7 +657,7 @@ void EnBox_UpdateSizeAndTexture(EnBox* this, PlayState* play) {
}
// Change size
if (!isVanilla && (cstmc == 1 || cstmc == 3)) {
if (!isVanilla && (csmc == CSMC_BOTH || csmc == CSMC_SIZE)) {
switch (getItemCategory) {
case ITEM_CATEGORY_JUNK:
case ITEM_CATEGORY_SMALL_KEY:
@@ -685,7 +686,7 @@ void EnBox_UpdateSizeAndTexture(EnBox* this, PlayState* play) {
}
// Change texture
if (!isVanilla && (cstmc == 1 || cstmc == 2)) {
if (!isVanilla && (csmc == CSMC_BOTH || csmc == CSMC_TEXTURE)) {
switch (getItemCategory) {
case ITEM_CATEGORY_MAJOR:
this->boxBodyDL = gGoldTreasureChestChestFrontDL;
@@ -14,6 +14,7 @@
#include "objects/object_masterzoora/object_masterzoora.h"
#include "objects/object_masterkokirihead/object_masterkokirihead.h"
#include "soh/Enhancements/randomizer/randomizer_entrance.h"
#include "soh/Enhancements/cosmetics/cosmeticsTypes.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_WHILE_CULLED)
@@ -1939,7 +1940,7 @@ void EnOssan_UpdateCursorAnim(EnOssan* this) {
Color_RGB8 aButtonColor = { 0, 80, 255 };
if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) {
aButtonColor = CVarGetColor24("gCosmetics.Hud_AButton.Value", aButtonColor);
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", 0)) {
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) {
aButtonColor = (Color_RGB8){ 0, 255, 80 };
}
f32 t;
@@ -25,6 +25,7 @@
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/randomizer/randomizer_entrance.h"
#include <overlays/actors/ovl_En_Partner/z_en_partner.h>
#include "soh/Enhancements/enhancementTypes.h"
typedef enum {
/* 0x00 */ KNOB_ANIM_ADULT_L,
@@ -2049,7 +2050,7 @@ void func_80833DF8(Player* this, PlayState* play) {
s32 i;
if (this->currentMask != PLAYER_MASK_NONE) {
if (CVarGetInteger("gMMBunnyHood", 0) != 0) {
if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) {
s32 maskItem = this->currentMask - PLAYER_MASK_KEATON + ITEM_MASK_KEATON;
bool hasOnDpad = false;
if (CVarGetInteger("gDpadEquips", 0) != 0) {
@@ -6119,7 +6120,7 @@ void func_8083DFE0(Player* this, f32* arg1, s16* arg2) {
}
}
if (CVarGetInteger("gMMBunnyHood", 0) == 1 && this->currentMask == PLAYER_MASK_BUNNY) {
if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) == BUNNY_HOOD_FAST_AND_JUMP && this->currentMask == PLAYER_MASK_BUNNY) {
maxSpeed *= 1.5f;
}
@@ -7761,9 +7762,9 @@ void func_80842180(Player* this, PlayState* play) {
}
}
if (CVarGetInteger("gMMBunnyHood", 0) && this->currentMask == PLAYER_MASK_BUNNY) {
if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && this->currentMask == PLAYER_MASK_BUNNY) {
sp2C *= 1.5f;
}
}
if (CVarGetInteger("gEnableWalkModify", 0)) {
if (CVarGetInteger("gWalkSpeedToggle", 0)) {
@@ -9664,7 +9665,7 @@ void Player_Init(Actor* thisx, PlayState* play2) {
func_80835F44(play, this, ITEM_NONE);
Player_SetEquipmentData(play, this);
this->prevBoots = this->currentBoots;
if (CVarGetInteger("gMMBunnyHood", 0)) {
if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) {
if (INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_SOLD_OUT) {
sMaskMemory = PLAYER_MASK_NONE;
}
@@ -13,6 +13,7 @@
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/boss-rush/BossRush.h"
#include "soh/Enhancements/custom-message/CustomMessageTypes.h"
#include "soh/Enhancements/enhancementTypes.h"
#define MIN_QUEST (ResourceMgr_GameHasOriginal() ? FS_QUEST_NORMAL : FS_QUEST_MASTER)
#define MAX_QUEST FS_QUEST_BOSSRUSH
@@ -2497,15 +2498,15 @@ void FileChoose_Main(GameState* thisx) {
gSaveContext.skyboxTime += 0x10;
}
if (CVarGetInteger("gSkipLogoTitle", 0) && CVarGetInteger("gSaveFileID", 0) < 3 && !isFastFileIdIncompatible) {
if (Save_Exist(CVarGetInteger("gSaveFileID", 0)) && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(CVarGetInteger("gSaveFileID", 0)))) {
this->buttonIndex = CVarGetInteger("gSaveFileID", 0);
if (CVarGetInteger("gSkipLogoTitle", 0) && CVarGetInteger("gSaveFileID", FASTFILE_1) <= FASTFILE_3 && !isFastFileIdIncompatible) {
if (Save_Exist(CVarGetInteger("gSaveFileID", FASTFILE_1)) && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(CVarGetInteger("gSaveFileID", FASTFILE_1)))) {
this->buttonIndex = CVarGetInteger("gSaveFileID", FASTFILE_1);
this->menuMode = FS_MENU_MODE_SELECT;
this->selectMode = SM_LOAD_GAME;
} else {
isFastFileIdIncompatible = 1;
}
} else if (CVarGetInteger("gSkipLogoTitle", 0) && CVarGetInteger("gSaveFileID", 0) == 3) {
} else if (CVarGetInteger("gSkipLogoTitle", 0) && CVarGetInteger("gSaveFileID", FASTFILE_1) == FASTFILE_MAP_SELECT) {
this->buttonIndex = 0xFF;
this->menuMode = FS_MENU_MODE_SELECT;
this->selectMode = SM_LOAD_GAME;
@@ -1,6 +1,7 @@
#include "z_kaleido_scope.h"
#include "textures/parameter_static/parameter_static.h"
#include "textures/icon_item_static/icon_item_static.h"
#include "soh/Enhancements/cosmetics/cosmeticsTypes.h"
extern const char* digitTextures[];
@@ -8,7 +9,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
Color_RGB8 aButtonColor = { 80, 150, 255 };
if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) {
aButtonColor = CVarGetColor24("gCosmetics.Hud_AButton.Value", aButtonColor);
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", 0)) {
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) {
aButtonColor = (Color_RGB8){ 80, 255, 150 };
}
@@ -2,6 +2,7 @@
#include "textures/parameter_static/parameter_static.h"
#include "soh/Enhancements/randomizer/adult_trade_shuffle.h"
#include "soh/Enhancements/randomizer/randomizerTypes.h"
#include "soh/Enhancements/enhancementTypes.h"
u8 gAmmoItems[] = {
ITEM_STICK, ITEM_NUT, ITEM_BOMB, ITEM_BOW, ITEM_NONE, ITEM_NONE, ITEM_SLINGSHOT, ITEM_NONE,
@@ -401,7 +402,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
gSelectingMask = cursorSlot == SLOT_TRADE_CHILD;
gSlotAgeReqs[SLOT_TRADE_CHILD] = gItemAgeReqs[ITEM_MASK_BUNNY] =
((CVarGetInteger("gMMBunnyHood", 0) || CVarGetInteger("gTimelessEquipment", 0)) &&
((CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA || CVarGetInteger("gTimelessEquipment", 0)) &&
INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY)
? 9
: 1;
@@ -16,6 +16,7 @@
#include "soh/frame_interpolation.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/randomizer/randomizer_entrance.h"
#include "soh/Enhancements/cosmetics/cosmeticsTypes.h"
static void* sEquipmentFRATexs[] = {
gPauseEquipment00FRATex, gPauseEquipment01Tex, gPauseEquipment02Tex, gPauseEquipment03Tex, gPauseEquipment04Tex,
@@ -999,7 +1000,7 @@ void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex) {
if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) {
sCursorColors[2] = CVarGetColor24("gCosmetics.Hud_AButton.Value", sCursorColors[2]);
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", 0)) {
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) {
sCursorColors[2] = (Color_RGB8){ 0, 255, 50 };
}
@@ -1082,7 +1083,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
aButtonColor = CVarGetColor24("gCosmetics.Hud_AButton.Value", aButtonColor);
D_8082ACF4[8] = CVarGetColor24("gCosmetics.Hud_AButton.Value", D_8082ACF4[8]);
D_8082ACF4[11] = CVarGetColor24("gCosmetics.Hud_AButton.Value", D_8082ACF4[11]);
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", 0)) {
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) {
aButtonColor = (Color_RGB8){ 100, 255, 100 };
D_8082ACF4[8] = (Color_RGB8){ 0, 255, 50 };
D_8082ACF4[11] = (Color_RGB8){ 0, 255, 50 };
@@ -1540,7 +1541,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
Color_RGB8 aButtonColor = { 0, 100, 255 };
if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) {
aButtonColor = CVarGetColor24("gCosmetics.Hud_AButton.Value", aButtonColor);
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", 0)) {
} else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) {
aButtonColor = (Color_RGB8){ 0, 255, 100 };
}