Skip to content

Commit 685180e

Browse files
committed
Art Attack Hitboxes - Implement varying line colors
1 parent 0dccf76 commit 685180e

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

ttyd-tools/rel/source/codes.cpp

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include <gc/gx.h>
1212
#include <ttyd/battle_unit.h>
13+
#include <ttyd/fontmgr.h>
1314
#include <ttyd/battle_disp.h>
1415
#include <ttyd/system.h>
1516
#include <ttyd/mario.h>
@@ -76,9 +77,12 @@ void displayArtAttackHitboxes()
7677
return;
7778
}
7879

79-
// Set the color of the lines of the hitbox
80-
uint32_t HitboxLineColor = 0x59000000;
81-
gc::gx::GXSetChanMatColor(gc::gx::GX_COLOR0A0, reinterpret_cast<uint8_t *>(&HitboxLineColor));
80+
// Set the initial color to use for the lines of the hitboxes
81+
uint8_t HSV[4]; // Extra slot at the end
82+
*reinterpret_cast<uint32_t *>(&HSV) = 0x00FFCCFF; // RGBA value is 0xCC0000FF
83+
84+
// Set up a variable to handle adjusting the hue for the lines of the hitboxes
85+
uint8_t HueAdjustment = 0;
8286

8387
// Get the address of the write gather pipe, and handle the value at the address as a float
8488
volatile float *WriteGatherPipe = reinterpret_cast<float *>(0xCC008000);
@@ -121,6 +125,16 @@ void displayArtAttackHitboxes()
121125
continue;
122126
}
123127

128+
// Adjust the hue for the lines of the current hitbox
129+
HSV[0] += HueAdjustment;
130+
HueAdjustment += 30;
131+
132+
// Get the RGB equivalent of the HSV value; Alpha is discarded
133+
uint32_t HitboxLineColor = ttyd::fontmgr::HSV2RGB(HSV);
134+
135+
// Set the color of the lines of the current hitbox
136+
gc::gx::GXSetChanMatColor(gc::gx::GX_COLOR0A0, reinterpret_cast<uint8_t *>(&HitboxLineColor));
137+
124138
uint32_t BattleUnitPtrUint = reinterpret_cast<uint32_t>(BattleUnitPtr);
125139

126140
// Check if the current actor is hanging from the ceiling
@@ -139,11 +153,11 @@ void displayArtAttackHitboxes()
139153
}
140154

141155
// Get the variables used to calculate the position of the hitbox
142-
float ActorHitboxWidth = *reinterpret_cast<float *>(BattleUnitPtrUint + 0xE4);
143-
float ActorHitboxHeight = *reinterpret_cast<float *>(BattleUnitPtrUint + 0xE8);
144-
float ActorHitboxPosOffsetX = *reinterpret_cast<float *>(BattleUnitPtrUint + 0xD8);
145-
float ActorHitboxPosOffsetY = *reinterpret_cast<float *>(BattleUnitPtrUint + 0xDC);
146-
float ActorSizeScale = *reinterpret_cast<float *>(BattleUnitPtrUint + 0x114);
156+
float ActorHitboxWidth = *reinterpret_cast<float *>(BattleUnitPtrUint + 0xE4);
157+
float ActorHitboxHeight = *reinterpret_cast<float *>(BattleUnitPtrUint + 0xE8);
158+
float ActorHitboxPosOffsetX = *reinterpret_cast<float *>(BattleUnitPtrUint + 0xD8);
159+
float ActorHitboxPosOffsetY = *reinterpret_cast<float *>(BattleUnitPtrUint + 0xDC);
160+
float ActorSizeScale = *reinterpret_cast<float *>(BattleUnitPtrUint + 0x114);
147161

148162
// Get the position of the current actor
149163
float ActorPos[3];

0 commit comments

Comments
 (0)