Skip to content

Commit b618ab8

Browse files
authored
Rename scale and rotate fields in Entity (Xeeynamo#2630)
FLAG_DRAW_ROTX => FLAG_DRAW_SCALEX FLAG_DRAW_ROTY => FLAG_DRAW_SCALEY FLAG_DRAW_ROTZ => FLAG_DRAW_ROTATE rotX => scaleX rotY => scaleY rotZ => rotate
1 parent 9d1beb0 commit b618ab8

File tree

189 files changed

+1736
-1694
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+1736
-1694
lines changed

include/entity.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ typedef struct ET_CastleDoor {
785785
/* 0x7C */ struct Primitive* prim;
786786
/* 0x80 */ s16 timer;
787787
/* 0x82 */ char pad_82[0x2];
788-
/* 0x84 */ s16 rotZ;
788+
/* 0x84 */ s16 rotate;
789789
} ET_CastleDoor;
790790

791791
typedef struct {
@@ -849,7 +849,7 @@ typedef struct {
849849
/* 0x8D */ u8 unk8D;
850850
/* 0x8E */ u8 unk8E;
851851
/* 0x8E */ char pad_8E[13];
852-
/* 0x9C */ s16 rotZ;
852+
/* 0x9C */ s16 rotate;
853853
/* 0x9E */ s16 unk9E;
854854
/* 0xA0 */ struct Entity* parent;
855855
/* 0xA4 */ s16 unkA4;

include/game.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,9 @@ typedef enum {
303303
// Flags for entity->drawFlags
304304
typedef enum {
305305
FLAG_DRAW_DEFAULT = 0x00,
306-
FLAG_DRAW_ROTX = 0x01,
307-
FLAG_DRAW_ROTY = 0x02,
308-
FLAG_DRAW_ROTZ = 0x04,
306+
FLAG_DRAW_SCALEX = 0x01,
307+
FLAG_DRAW_SCALEY = 0x02,
308+
FLAG_DRAW_ROTATE = 0x04,
309309
FLAG_DRAW_OPACITY = 0x08,
310310
FLAG_DRAW_UNK10 = 0x10,
311311
FLAG_DRAW_UNK20 = 0x20,
@@ -817,9 +817,9 @@ typedef struct Entity {
817817
/* 0x16 */ u16 palette;
818818
/* 0x18 */ u8 drawMode;
819819
/* 0x19 */ u8 drawFlags;
820-
/* 0x1A */ s16 rotX;
821-
/* 0x1C */ s16 rotY;
822-
/* 0x1E */ s16 rotZ;
820+
/* 0x1A */ s16 scaleX; // 0x100 = 1.0
821+
/* 0x1C */ s16 scaleY; // 0x100 = 1.0
822+
/* 0x1E */ s16 rotate; // 0x1000 = 360 degrees
823823
/* 0x20 */ s16 rotPivotX;
824824
/* 0x22 */ s16 rotPivotY;
825825
/* 0x24 */ u16 zPriority;

src/boss/bo4/doors.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,19 @@ void func_us_801B5040(Entity* self) {
191191
switch (self->step) {
192192
case 0:
193193
InitializeEntity(D_us_80180458);
194-
self->drawFlags |= FLAG_DRAW_OPACITY | FLAG_DRAW_ROTZ | FLAG_DRAW_ROTY |
195-
FLAG_DRAW_ROTX;
194+
self->drawFlags |= FLAG_DRAW_OPACITY | FLAG_DRAW_ROTATE |
195+
FLAG_DRAW_SCALEY | FLAG_DRAW_SCALEX;
196196
if ((self->params & 0xF) > 1) {
197197
self->opacity = 0x20;
198198
} else {
199199
self->opacity = 0x80;
200200
}
201-
self->rotX = D_us_801805C0[self->params & 0xF];
202-
self->rotY = self->rotX;
201+
self->scaleX = D_us_801805C0[self->params & 0xF];
202+
self->scaleY = self->scaleX;
203203
if ((self->params & 0xF) % 2) {
204-
self->rotZ = -0x400;
204+
self->rotate = -0x400;
205205
} else {
206-
self->rotZ = 0;
206+
self->rotate = 0;
207207
}
208208
self->zPriority = (0x40 - self->params) & 0xF;
209209
if (self->params & 0x100) {
@@ -271,8 +271,8 @@ void func_us_801B5040(Entity* self) {
271271

272272
case 4:
273273
magnitude = self->ext.et_801BDA0C.unk80 / FIX(1);
274-
xOffset = (rcos(self->rotZ - 0x400) * magnitude) >> 0xC;
275-
yOffset = (rsin(self->rotZ - 0x400) * magnitude) >> 0xC;
274+
xOffset = (rcos(self->rotate - 0x400) * magnitude) >> 0xC;
275+
yOffset = (rsin(self->rotate - 0x400) * magnitude) >> 0xC;
276276
prim = self->ext.et_801BDA0C.unk7C;
277277
self->posX.i.hi = prim->x0 + xOffset;
278278
self->posY.i.hi = prim->y0 + yOffset;
@@ -309,8 +309,8 @@ void func_us_801B5040(Entity* self) {
309309
tempEntity->opacity += 2;
310310
}
311311
magnitude = self->ext.et_801BDA0C.unk80 / 0x10000;
312-
xOffset = (rcos(self->rotZ - 0x400) * magnitude) >> 0xC;
313-
yOffset = (rsin(self->rotZ - 0x400) * magnitude) >> 0xC;
312+
xOffset = (rcos(self->rotate - 0x400) * magnitude) >> 0xC;
313+
yOffset = (rsin(self->rotate - 0x400) * magnitude) >> 0xC;
314314
prim = self->ext.et_801BDA0C.unk7C;
315315
self->posX.i.hi = prim->x0 + xOffset;
316316
self->posY.i.hi = prim->y0 + yOffset;
@@ -319,7 +319,7 @@ void func_us_801B5040(Entity* self) {
319319
} else {
320320
AnimateEntity(D_us_801805DC, self);
321321
}
322-
self->rotZ += D_us_801805B4[self->params & 0xF];
322+
self->rotate += D_us_801805B4[self->params & 0xF];
323323
if (self->params & 0x100) {
324324
self->ext.et_801BDA0C.unk88 -= D_us_801805A8[self->params & 0xF];
325325
} else {
@@ -339,8 +339,8 @@ void func_us_801B55DC(Entity* self) {
339339
switch (self->step) {
340340
case 0:
341341
InitializeEntity(D_us_80180458);
342-
self->drawFlags |= FLAG_DRAW_ROTZ;
343-
self->rotZ = -0x400;
342+
self->drawFlags |= FLAG_DRAW_ROTATE;
343+
self->rotate = -0x400;
344344
if (self->params & 1) {
345345
self->animCurFrame = 0x64;
346346
self->velocityX = FIX(-0.5);

src/boss/bo4/doppleganger.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ void func_us_801C1A38(void) {
2727
}
2828

2929
DOPPLEGANGER.palette = PAL_OVL(0x200);
30-
DOPPLEGANGER.rotX = 0x100;
31-
DOPPLEGANGER.rotY = 0x100;
30+
DOPPLEGANGER.scaleX = 0x100;
31+
DOPPLEGANGER.scaleY = 0x100;
3232
DOPPLEGANGER.drawMode = DRAW_DEFAULT;
3333
DOPPLEGANGER.flags =
3434
FLAG_UNK_10000000 | FLAG_POS_CAMERA_LOCKED | FLAG_UNK_400000;
@@ -241,8 +241,8 @@ void EntityDoppleganger10(void) {
241241
D_us_801D4A1C = 12;
242242
}
243243
g_api.PlaySfx(SFX_TRANSFORM_LOW);
244-
if (DOPPLEGANGER.rotZ == FIX(1.0 / 32.0)) {
245-
DOPPLEGANGER.rotZ = 0;
244+
if (DOPPLEGANGER.rotate == FIX(1.0 / 32.0)) {
245+
DOPPLEGANGER.rotate = 0;
246246
DOPPLEGANGER.animCurFrame = 0x9D;
247247
DOPPLEGANGER.facingLeft++;
248248
DOPPLEGANGER.facingLeft &= 1;
@@ -258,8 +258,8 @@ void EntityDoppleganger10(void) {
258258
DOPPLEGANGER.step == Dop_Jump ||
259259
DOPPLEGANGER.step == Dop_HighJump ||
260260
DOPPLEGANGER.step == Dop_MorphBat)) {
261-
if (DOPPLEGANGER.rotZ == FIX(1.0 / 32.0)) {
262-
DOPPLEGANGER.rotZ = 0;
261+
if (DOPPLEGANGER.rotate == FIX(1.0 / 32.0)) {
262+
DOPPLEGANGER.rotate = 0;
263263
DOPPLEGANGER.animCurFrame = 0x9D;
264264
DOPPLEGANGER.facingLeft++;
265265
DOPPLEGANGER.facingLeft &= 1;

src/boss/bo4/st_debug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ extern ObjInit2 OVL_EXPORT(BackgroundBlockInit)[];
55
extern u16 g_EInitCommon[];
66

77
// params: Index of ObjInit to use
8-
// (== 1) Use a different hardcoded rotY and rotX value
8+
// (== 1) Use a different hardcoded scaleY and scaleX value
99
void OVL_EXPORT(EntityBackgroundBlock)(Entity* self) {
1010
ObjInit2* objInit = &OVL_EXPORT(BackgroundBlockInit)[self->params];
1111
if (!self->step) {

0 commit comments

Comments
 (0)