diff --git a/include/game/disp.h b/include/game/disp.h new file mode 100644 index 00000000..11fd19e3 --- /dev/null +++ b/include/game/disp.h @@ -0,0 +1,18 @@ +#ifndef _GAME_DISP_H +#define _GAME_DISP_H + +#define HU_DISP_WIDTH 576 +#define HU_DISP_WIDTHF ((float)HU_DISP_WIDTH) +#define HU_DISP_HEIGHT 480 +#define HU_DISP_HEIGHTF ((float)HU_DISP_HEIGHT) +#define HU_DISP_ASPECT (HU_DISP_WIDTHF/HU_DISP_HEIGHTF) + +#define HU_DISP_CENTERXI (HU_DISP_WIDTH/2) +#define HU_DISP_CENTERX (HU_DISP_WIDTHF/2) +#define HU_DISP_CENTERYI (HU_DISP_HEIGHT/2) +#define HU_DISP_CENTERY (HU_DISP_HEIGHTF/2) + +#define HU_FB_WIDTH 640 +#define HU_FB_HEIGHT 480 + +#endif \ No newline at end of file diff --git a/orig/GMPE01_00 - Copy/.gitkeep b/orig/GMPE01_00 - Copy/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/src/game/board/main.c b/src/game/board/main.c index 446e91dc..1d77b332 100644 --- a/src/game/board/main.c +++ b/src/game/board/main.c @@ -19,6 +19,7 @@ #include "game/board/tutorial.h" #include "game/board/ui.h" #include "game/pad.h" +#include "game/disp.h" #include "game/msm.h" typedef struct camera_view { @@ -1135,7 +1136,7 @@ void BoardCameraInit(void) camera->fov = 25; camera->near = 100; camera->far = 13000; - camera->aspect = 1.2; + camera->aspect = HU_DISP_ASPECT; camera->viewport_x = 0; camera->viewport_y = 0; camera->viewport_h = 480; @@ -1638,9 +1639,9 @@ static void DrawFilter(ModelData *model, Mtx matrix) } work = OM_GET_WORK_PTR(filterObj, FilterWork); x1 = 0.0f; - x2 = 640.0f; + x2 = HU_FB_WIDTH; y1 = 0.0f; - y2 = 480.0f; + y2 = HU_FB_HEIGHT; MTXOrtho(proj, y1, y2, x1, x2, 0, 10); GXSetProjection(proj, GX_ORTHOGRAPHIC); MTXIdentity(modelview); @@ -2003,7 +2004,7 @@ void BoardLast5GfxInit(void) HuSprAttrSet(work->group, 1, HUSPR_ATTR_NOANIM); object->trans.x = 0.0f; HuSprGrpTPLvlSet(work->group, object->trans.x); - HuSprGrpPosSet(work->group, 288, 72); + HuSprGrpPosSet(work->group, HU_DISP_CENTERX, 72); HuAudFXPlay(838); work->time = 0; } diff --git a/src/game/board/player.c b/src/game/board/player.c index 5972e41b..792a65af 100644 --- a/src/game/board/player.c +++ b/src/game/board/player.c @@ -16,6 +16,8 @@ #include "game/hsfman.h" #include "game/objsub.h" #include "game/pad.h" +#include "game/disp.h" + #include "math.h" #include "stdlib.h" @@ -2084,7 +2086,7 @@ void BoardRollCreate(s32 arg0, s32 arg1) for (var_r30 = 0; var_r30 < 2; var_r30++) { BoardSpriteCreate(DATA_MAKE_NUM(DATADIR_BOARD, 0x2B), 0x4B0, 0, &temp_r31->unk_06[var_r30]); HuSprGrpMemberSet(temp_r31->unk_04, var_r30, temp_r31->unk_06[var_r30]); - HuSprPosSet(temp_r31->unk_04, var_r30, 288.0f, 240.0f); + HuSprPosSet(temp_r31->unk_04, var_r30, HU_DISP_CENTERX, HU_DISP_CENTERY); HuSprAttrSet(temp_r31->unk_04, var_r30, 4); } rollObj = temp_r3; @@ -2131,7 +2133,7 @@ static void UpdateRollSprite(omObjData *arg0) { Vec sp1C; s32 sp14[2]; - f32 spC[2] = { 320.0f, 256.0f }; + f32 spC[2] = { HU_DISP_CENTERX+32, HU_DISP_CENTERX-32 }; s32 var_r30; s32 temp_r29; bitcopy3 *temp_r31; @@ -2152,12 +2154,11 @@ static void UpdateRollSprite(omObjData *arg0) } else { if ((sp14[1] == 0) && (var_r30 == 0)) { - sp1C.x = 288.0f; - } - else { + sp1C.x = HU_DISP_CENTERX; + } else { sp1C.x = spC[var_r30]; } - sp1C.y = 176.0f; + sp1C.y = (HU_DISP_HEIGHTF*176)/480; HuSprAttrReset(temp_r31->unk_04, var_r30, 4); HuSprBankSet(temp_r31->unk_04, var_r30, sp14[var_r30]); HuSprPosSet(temp_r31->unk_04, var_r30, sp1C.x, sp1C.y); diff --git a/src/game/board/roll.c b/src/game/board/roll.c index b233ffab..f2c80503 100755 --- a/src/game/board/roll.c +++ b/src/game/board/roll.c @@ -4,6 +4,7 @@ #include "game/hsfanim.h" #include "game/object.h" #include "game/pad.h" +#include "game/disp.h" #include "game/process.h" #include "game/window.h" #include "game/board/main.h" @@ -239,10 +240,10 @@ static void RollMain(void) { var_f31 = -10000.0f; break; case 1: - var_f31 = 288.0f - (sp8[0] / 2 - 16.0f); + var_f31 = HU_DISP_CENTERX- (sp8[0] / 2 - 16.0f); break; } - var_f30 = 304.0f; + var_f30 = HU_DISP_HEIGHT-176; rollWin = HuWinCreate(var_f31, var_f30, sp8[0], sp8[1], 0); HuWinBGTPLvlSet(rollWin, 0.0f); HuWinMesSpeedSet(rollWin, 0); @@ -735,17 +736,17 @@ static void DiceDigitMove(DiceDigitWork *arg0, s32 arg1) { Vec sp30; Vec sp24; Vec sp54[2]; - Vec sp18 = { 288.0f, 155.0f, 240.0f }; + Vec sp18 = { (HU_DISP_WIDTH/2), (HU_DISP_HEIGHT*155)/480, 240.0f }; Vec sp3C[2] = { - { 144.0f, 155.0f, 240.0f }, - { 432.0f, 155.0f, 240.0f } + { (HU_DISP_WIDTH*1)/4, (HU_DISP_HEIGHT*155)/480, 240.0f }, + { (HU_DISP_WIDTH*3)/4, (HU_DISP_HEIGHT*155)/480, 240.0f } }; Vec sp6C[3] = { - { 144.0f, 155.0f, 240.0f }, - { 432.0f, 155.0f, 240.0f }, - { 288.0f, 155.0f, 240.0f } + { (HU_DISP_WIDTH*1)/4, (HU_DISP_HEIGHT*155)/480, 240.0f }, + { (HU_DISP_WIDTH*3)/4, (HU_DISP_HEIGHT*155)/480, 240.0f }, + { (HU_DISP_WIDTH/2), (HU_DISP_HEIGHT*155)/480, 240.0f } }; - Vec spC = { 288.0f, 176.0f, 240.0f }; + Vec spC = { (HU_DISP_WIDTH/2), (HU_DISP_HEIGHT*176)/480, 240.0f }; Vec *var_r29; float var_f31; s16 var_r27; diff --git a/src/game/board/shop.c b/src/game/board/shop.c index f3dad21c..92198602 100755 --- a/src/game/board/shop.c +++ b/src/game/board/shop.c @@ -4,6 +4,7 @@ #include "game/gamework_data.h" #include "game/object.h" #include "game/objsub.h" +#include "game/disp.h" #include "game/pad.h" #include "game/process.h" #include "game/sprite.h" @@ -472,12 +473,12 @@ static void CreateShopWin(void) { var_r30->unk01 = 0xC; var_r30->unk04 = 0; shopWinObj = var_r31; - var_r30->unk06 = HuWinCreate(36.0f, 344.0f, 0x1F8, 0x60, 0); + var_r30->unk06 = HuWinCreate(36.0f, HU_DISP_HEIGHT-136, 0x1F8, 0x60, 0); HuWinMesSpeedSet(var_r30->unk06, 0); HuWinDrawNoSet(var_r30->unk06, 0x40); HuWinExAnimIn(var_r30->unk06); sp8.x = 84.0f; - sp8.y = 392.0f; + sp8.y = HU_DISP_HEIGHT-88; sp8.z = 400.0f; var_r31->scale.x = var_r31->scale.y = var_r31->scale.z = 0.25f; Hu3D2Dto3D(&sp8, 1, &sp8); diff --git a/src/game/board/star.c b/src/game/board/star.c index ecdc6d88..f4579aa8 100755 --- a/src/game/board/star.c +++ b/src/game/board/star.c @@ -1,6 +1,8 @@ #include "game/board/star.h" #include "game/audio.h" #include "game/data.h" +#include "game/disp.h" + #include "game/flag.h" #include "game/gamework.h" #include "game/gamework_data.h" @@ -708,7 +710,7 @@ void BoardStarShowNext(s32 arg0) { } BoardViewMoveStart(&sp38, &sp50, var_r27); showNextObj->trans.x = 68.0f; - showNextObj->trans.y = 430.0f; + showNextObj->trans.y = HU_DISP_HEIGHT-50; showNextObj->trans.z = 100.0f; sp44.x = showNextObj->trans.x; sp44.y = showNextObj->trans.y; diff --git a/src/game/board/ui.c b/src/game/board/ui.c index 0dd58fbf..d8f89499 100755 --- a/src/game/board/ui.c +++ b/src/game/board/ui.c @@ -17,6 +17,7 @@ #include "game/board/model.h" #include "game/board/player.h" #include "game/board/tutorial.h" +#include "game/disp.h" #include "ext_math.h" @@ -189,9 +190,9 @@ static float statusHideOfsTbl[4] = { static float statusPosTbl[4][2] = { { 114.0f, 84.0f }, - { 462.0f, 84.0f }, - { 114.0f, 396.0f }, - { 462.0f, 396.0f } + { HU_DISP_WIDTH-114, 84.0f }, + { 114.0f, HU_DISP_HEIGHT-84 }, + { HU_DISP_WIDTH-114, HU_DISP_HEIGHT-84 } }; static u8 statusColTbl[4][4] = { @@ -248,8 +249,8 @@ static s32 itemMdlTbl[14] = { }; static Vec teamItemStatusPosTbl[2] = { - { 190.0f, 116.0f, 0.0f }, - { 386.0f, 116.0f, 0.0f } + { HU_DISP_CENTERX-98, 116.0f, 0.0f }, + { HU_DISP_CENTERX+98, 116.0f, 0.0f } }; s32 BoardItemModelGet(s32 arg0) { @@ -923,7 +924,7 @@ void BoardYourTurnExec(s32 arg0) { HuSprAttrSet(yourTurnSprGrp, 0, 1); HuSprScaleSet(yourTurnSprGrp, 0, 0.001f, 0.001f); HuSprAttrSet(yourTurnSprGrp, 0, 8); - HuSprGrpPosSet(yourTurnSprGrp, 288.0f, 240.0f); + HuSprGrpPosSet(yourTurnSprGrp, HU_DISP_CENTERX, HU_DISP_CENTERY); HuAudFXPlay(0x307); while (yourTurnObj) { HuPrcVSleep(); @@ -1476,9 +1477,9 @@ static void SetItemUIStatus(s32 arg0) { var_f31 = statusPosTbl[i][0]; var_f30 = statusPosTbl[i][1]; for (j = 0; j < 6; j++) { - (temp_r28 + 4)[i][j].x = statusSprPosTbl[j + 0xB][0]; - (temp_r28 + 4)[i][j].y = statusSprPosTbl[j + 0xB][1]; - if (j + 0xB >= 0xD && j + 0xB <= 0xF) { + (temp_r28 + 4)[i][j].x = statusSprPosTbl[j + 11][0]; + (temp_r28 + 4)[i][j].y = statusSprPosTbl[j + 11][1]; + if (j + 11 >= 13 && j + 11 <= 15) { (temp_r28 + 4)[i][j].x += var_f31; (temp_r28 + 4)[i][j].y += var_f30; } @@ -1815,8 +1816,8 @@ static void CreateItemWindow(s32 arg0, s32 arg1) { = temp_r31->unk06[i] = temp_r31->unk00[i] = -1; } else { temp_r31->unk00[i] = temp_r28; - temp_r31->unk74[i].x = i * 576.0f + 36.0f; - temp_r31->unk74[i].y = var_f30 + 240.0f; + temp_r31->unk74[i].x = i * HU_DISP_WIDTHF + 36.0f; + temp_r31->unk74[i].y = var_f30 + HU_DISP_CENTERY; temp_r31->unk74[i].z = 0.0f; temp_r31->unk2C[i] = temp_r31->unk74[i]; temp_r31->unk12[i] = HuWinCreate(temp_r31->unk2C[i].x, temp_r31->unk2C[i].y, 0x1F8, 0x60, 0); @@ -1970,7 +1971,7 @@ static void CreatePickerWindow(UnkUiWork01 *arg0, s32 arg1) { } HuWinMesMaxSizeGet(1, spC, var_r30); var_f30 = -10000.0f; - var_f29 = var_f31 + 352.0f; + var_f29 = var_f31 + (HU_DISP_HEIGHT-128); arg0->unk06 = HuWinCreate(var_f30, var_f29, spC[0], spC[1], 0); HuWinBGTPLvlSet(arg0->unk06, 0.0f); HuWinMesSpeedSet(arg0->unk06, 0); diff --git a/src/game/board/view.c b/src/game/board/view.c index 4e4de23a..369f16f7 100755 --- a/src/game/board/view.c +++ b/src/game/board/view.c @@ -7,6 +7,8 @@ #include "game/pad.h" #include "game/sprite.h" #include "game/wipe.h" +#include "game/disp.h" + #include "game/board/main.h" #include "game/board/model.h" #include "game/board/player.h" @@ -52,10 +54,10 @@ static s16 focusMdl = -1; static float overhead2DPos[][2] = { { 48.0f, 72.0f }, - { 528.0f, 72.0f }, - { 48.0f, 408.0f }, - { 528.0f, 408.0f }, - { 288.0f, 72.0f } + { HU_DISP_WIDTH-48, 72.0f }, + { 48.0f, HU_DISP_HEIGHT-72 }, + { HU_DISP_WIDTH-48, HU_DISP_HEIGHT-72 }, + { HU_DISP_CENTERX, 72.0f } }; static float mapViewMinZ[] = { @@ -534,7 +536,7 @@ static void UpdateOverheadView(omObjData *arg0) { } for (i = 0; i < 5; i++) { var_r29 = overhead2DPos[i]; - sp20.x = var_r29[0] - 288.0f; + sp20.x = var_r29[0] - HU_DISP_CENTERX; sp20.y = var_r29[1] - 240.0f; sp20.z = 1000.0f; if (i != 4) { @@ -545,7 +547,7 @@ static void UpdateOverheadView(omObjData *arg0) { BoardSpacePosGet(0, BoardSpaceStarGetCurr(), &sp14); } Hu3D3Dto2D(&sp14, 1, &sp14); - sp14.x -= 288.0f; + sp14.x -= HU_DISP_CENTERX; sp14.y -= 240.0f; VECSubtract(&sp20, &sp14, &sp8); sp8.z = 0.0f; diff --git a/src/game/board/warp.c b/src/game/board/warp.c index 24099ae8..ddc92315 100644 --- a/src/game/board/warp.c +++ b/src/game/board/warp.c @@ -10,6 +10,8 @@ #include "game/hsfdraw.h" #include "game/hsfex.h" #include "game/objsub.h" +#include "game/disp.h" + #include "math.h" static void WarpInit(s32); @@ -212,8 +214,8 @@ static void WarpImpact(s32 player) { f32 angle; s16 i; - pos.x = 288.0f; - pos.y = 240.0f; + pos.x = HU_DISP_CENTERX; + pos.y = HU_DISP_CENTERY; pos.z = 700.0f; Hu3D2Dto3D(&pos, 1, &pos); BoardModelPosSetV(warpImpactMdl, &pos); diff --git a/src/game/board/window.c b/src/game/board/window.c index 1481738c..447f45e0 100644 --- a/src/game/board/window.c +++ b/src/game/board/window.c @@ -1,6 +1,8 @@ #include "game/board/window.h" #include "game/board/main.h" #include "game/board/player.h" +#include "game/disp.h" + #include "game/gamework_data.h" static s8 winChoice; @@ -82,9 +84,9 @@ static void ExecBoardWindow(void) { {432.0f, 96.0f}, }; f32 pos_all[7][2] = { - {96.0f, 328.0f}, {72.0f, 128.0f}, - {36.0f, 344.0f}, {128.0f, 312.0f}, - {144.0f, 144.0f}, {128.0f, 264.0f}, + {96.0f, HU_DISP_HEIGHT-152}, {72.0f, 128.0f}, + {36.0f, HU_DISP_HEIGHT-136}, {128.0f, HU_DISP_HEIGHT-168}, + {144.0f, HU_DISP_CENTERY-96 }, {128.0f, HU_DISP_HEIGHT-216}, {128.0f, 75.0f}, }; diff --git a/src/game/hsfdraw.c b/src/game/hsfdraw.c index 42d4a217..6ea8b724 100755 --- a/src/game/hsfdraw.c +++ b/src/game/hsfdraw.c @@ -3,6 +3,7 @@ #include "game/hsfformat.h" #include "game/hsfload.h" #include "game/sprite.h" +#include "game/disp.h" #include "ext_math.h" #include "string.h" @@ -396,7 +397,7 @@ s32 ObjCullCheck(HsfData *arg0, HsfObject *arg1, Mtx arg2) { } sp24 = sind(temp_r30->fov * 0.5) / cosd(temp_r30->fov * 0.5); temp_f27 = sp24 * temp_f18; - temp_f24 = 1.2f * temp_f27; + temp_f24 = HU_DISP_ASPECT * temp_f27; temp_f24 = temp_f21 + ABS(temp_f24); temp_f27 = temp_f21 + ABS(temp_f27); if (ABS(temp_f20) < temp_f24 && ABS(temp_f19) < temp_f27) { diff --git a/src/game/hsfex.c b/src/game/hsfex.c index acf7f822..63f3745e 100644 --- a/src/game/hsfex.c +++ b/src/game/hsfex.c @@ -1,9 +1,13 @@ #include "game/hsfex.h" #include "game/hsfman.h" #include "game/hsfmotion.h" +#include "game/disp.h" #include "math.h" +#define DISP_HALF_W (HU_DISP_WIDTH/2.0f) +#define DISP_HALF_H (HU_DISP_HEIGHT/2.0f) + typedef struct { /* 0x00 */ float unk00; /* 0x04 */ float unk04; @@ -430,9 +434,9 @@ void Hu3D2Dto3D(Vec *arg0, s16 arg1, Vec *arg2) { temp_r31 = &Hu3DCamera[i]; temp_f30 = sin((temp_r31->fov / 2) * M_PI / 180.0) / cos((temp_r31->fov / 2) * M_PI / 180.0); temp_f31 = temp_f30 * arg0->z * 2.0f; - temp_f29 = temp_f31 * 1.2f; - temp_f28 = arg0->x / 576.0f; - temp_f27 = arg0->y / 480.0f; + temp_f29 = temp_f31 * HU_DISP_ASPECT; + temp_f28 = arg0->x / HU_DISP_WIDTH; + temp_f27 = arg0->y / HU_DISP_HEIGHT; arg2->x = (temp_f28 - 0.5) * temp_f29; arg2->y = -(temp_f27 - 0.5) * temp_f31; arg2->z = -arg0->z; @@ -457,10 +461,10 @@ void Hu3D3Dto2D(Vec *arg0, s16 arg1, Vec *arg2) { temp_r31 = &Hu3DCamera[i]; C_MTXLookAt(sp1C, &temp_r31->pos, &temp_r31->up, &temp_r31->target); PSMTXMultVec(sp1C, arg0, &sp10); - temp_f31 = (sin((temp_r31->fov / 2) * M_PI / 180.0) / cos((temp_r31->fov / 2) * M_PI / 180.0)) * sp10.z * 1.2f; + temp_f31 = (sin((temp_r31->fov / 2) * M_PI / 180.0) / cos((temp_r31->fov / 2) * M_PI / 180.0)) * sp10.z * HU_DISP_ASPECT; temp_f30 = (sin((temp_r31->fov / 2) * M_PI / 180.0) / cos((temp_r31->fov / 2) * M_PI / 180.0)) * sp10.z; - arg2->x = 288.0f + sp10.x * (288.0f / -temp_f31); - arg2->y = 240.0f + sp10.y * (240.0f / temp_f30); + arg2->x = DISP_HALF_W + sp10.x * (DISP_HALF_W / -temp_f31); + arg2->y = DISP_HALF_H + sp10.y * (DISP_HALF_H / temp_f30); arg2->z = 0.0f; } diff --git a/src/game/hsfman.c b/src/game/hsfman.c index a9c2d84f..e02c8edb 100644 --- a/src/game/hsfman.c +++ b/src/game/hsfman.c @@ -10,6 +10,8 @@ #include "game/perf.h" #include "game/ShapeExec.h" #include "game/sprite.h" +#include "game/disp.h" + #include "dolphin/gx/GXVert.h" #include "math.h" @@ -1083,12 +1085,12 @@ CameraData defCamera = { 20.0f, 5000.0f, 0.0f, - 1.2f, + HU_DISP_ASPECT, {0.0f, 0.0f, 100.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, - 0, 0, 640, 480, - 0.0f, 0.0f, 640.0f, 480.0f, + 0, 0, HU_FB_WIDTH, HU_FB_HEIGHT, + 0.0f, 0.0f, HU_FB_WIDTH, HU_FB_HEIGHT, 0.0f, 1.0f }; @@ -1289,7 +1291,7 @@ BOOL Hu3DModelCameraInfoSet(s16 arg0, u16 arg1) { sp8.x, sp8.y, sp8.z, obj_copy->camera.pos.x, obj_copy->camera.pos.y, obj_copy->camera.pos.z); - Hu3DCameraPerspectiveSet(arg1, obj_copy->camera.fov, obj_copy->camera.near, obj_copy->camera.far, 1.2f); + Hu3DCameraPerspectiveSet(arg1, obj_copy->camera.fov, obj_copy->camera.near, obj_copy->camera.far, HU_DISP_ASPECT); temp_r28->unk_01 = arg1; temp_r24 = &Hu3DData[arg0]; @@ -1886,7 +1888,7 @@ void Hu3DShadowCreate(f32 arg8, f32 arg9, f32 argA) { Hu3DShadowData.unk_2C.x = -1.0f; Hu3DShadowData.unk_2C.y = 1.0f; Hu3DShadowData.unk_2C.z = 0.0f; - C_MTXLightPerspective(Hu3DShadowData.unk_68, arg8, 1.2f, 0.5f, -0.5f, 0.5f, 0.5f); + C_MTXLightPerspective(Hu3DShadowData.unk_68, arg8, HU_DISP_ASPECT, 0.5f, -0.5f, 0.5f, 0.5f); VECNormalize(&Hu3DShadowData.unk_2C, &Hu3DShadowData.unk_2C); Hu3DShadowData.unk_00 = 0x80; Hu3DShadowF = 1; @@ -1923,7 +1925,7 @@ void Hu3DShadowExec(void) { Hu3DDrawPreInit(); GXSetCopyClear(sp14, 0xFFFFFF); - C_MTXPerspective(sp18, Hu3DShadowData.unk_08.x, 1.2f, Hu3DShadowData.unk_08.y, Hu3DShadowData.unk_08.z); + C_MTXPerspective(sp18, Hu3DShadowData.unk_08.x, HU_DISP_ASPECT, Hu3DShadowData.unk_08.y, Hu3DShadowData.unk_08.z); GXSetProjection(sp18, GX_PERSPECTIVE); if (Hu3DShadowData.unk_02 <= 0xF0) { GXSetScissor(2, 2, Hu3DShadowData.unk_02 * 2 - 4, Hu3DShadowData.unk_02 * 2 - 4); @@ -2054,7 +2056,7 @@ s16 Hu3DProjectionCreate(void *arg0, f32 arg8, f32 arg9, f32 argA) { var_r31->unk_2C.x = -1.0f; var_r31->unk_2C.y = 1.0f; var_r31->unk_2C.z = 0.0f; - C_MTXLightPerspective(var_r31->unk_68, arg8, 1.2f, 0.5f, -0.5f, 0.5f, 0.5f); + C_MTXLightPerspective(var_r31->unk_68, arg8, HU_DISP_ASPECT, 0.5f, -0.5f, 0.5f, 0.5f); VECNormalize(&var_r31->unk_2C, &var_r31->unk_2C); var_r31->unk_00 = 0x80; Hu3DProjectionNum++; diff --git a/src/game/minigame_seq.c b/src/game/minigame_seq.c index 6d687b5c..c2f02421 100644 --- a/src/game/minigame_seq.c +++ b/src/game/minigame_seq.c @@ -8,6 +8,8 @@ #include "game/window.h" #include "game/wipe.h" #include "game/pad.h" +#include "game/disp.h" + #include "game/minigame_seq.h" #include "math.h" @@ -59,23 +61,23 @@ static s32 SeqUpdateFlip(SeqWork *work); OverlayID mgSeqOvlPrev = OVL_INVALID; static SeqInfo seqInfoTbl[] = { - { NULL, NULL, 292.0f, 240.0f, 1.0f, 1.0f, 60 }, - { SeqInitTimer, SeqUpdateTimer, 292.0f, 64.0f, 1.0f, 1.0f, 60 }, - { SeqInitType2, SeqUpdateType2, 292.0f, 240.0f, 0.5f, 0.5f, 60 }, - { SeqInitMGBasic, SeqUpdateMGBasic, 292.0f, 240.0f, 1.0f, 1.0f, 180 }, - { SeqInitMGCommon, SeqUpdateMG1vs3, 292.0f, 240.0f, 1.0f, 1.0f, 180 }, - { SeqInitWin, SeqUpdateWin, 292.0f, 240.0f, 1.0f, 1.0f, 180 }, - { SeqInitMGCommon, SeqUpdateMGBattle, 292.0f, 240.0f, 1.0f, 1.0f, 180 }, - { SeqInitMGCommon, SeqUpdateMGStory, 292.0f, 240.0f, 1.0f, 1.0f, 180 }, - { SeqInitMGBasic, SeqUpdateMGBasic, 292.0f, 240.0f, 1.0f, 1.0f, 180 }, - { SeqInitMGCommon, SeqUpdateMG2vs2, 292.0f, 240.0f, 1.0f, 1.0f, 180 }, - { SeqInitFlip, SeqUpdateFlip, 292.0f, 240.0f, 1.0f, 1.0f, 180 }, - { SeqInitMGCommon, SeqUpdateMGBowser, 292.0f, 240.0f, 1.0f, 1.0f, 180 }, - { SeqInitWin, SeqUpdateWin, 292.0f, 240.0f, 1.0f, 1.0f, 180 }, - { SeqInitDraw, SeqUpdateDraw, 292.0f, 240.0f, 1.0f, 1.0f, 60 }, - { SeqInitRecord, SeqUpdateRecord, 292.0f, 240.0f, 1.0f, 1.0f, 180 }, - { NULL, NULL, 292.0f, 240.0f, 1.0f, 1.0f, 60 }, - { NULL, NULL, 292.0f, 240.0f, 1.0f, 1.0f, 60 }, + { NULL, NULL, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 60 }, + { SeqInitTimer, SeqUpdateTimer, HU_DISP_CENTERX+4, 64.0f, 1.0f, 1.0f, 60 }, + { SeqInitType2, SeqUpdateType2, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 0.5f, 0.5f, 60 }, + { SeqInitMGBasic, SeqUpdateMGBasic, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 180 }, + { SeqInitMGCommon, SeqUpdateMG1vs3, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 180 }, + { SeqInitWin, SeqUpdateWin, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 180 }, + { SeqInitMGCommon, SeqUpdateMGBattle, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 180 }, + { SeqInitMGCommon, SeqUpdateMGStory, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 180 }, + { SeqInitMGBasic, SeqUpdateMGBasic, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 180 }, + { SeqInitMGCommon, SeqUpdateMG2vs2, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 180 }, + { SeqInitFlip, SeqUpdateFlip, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 180 }, + { SeqInitMGCommon, SeqUpdateMGBowser, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 180 }, + { SeqInitWin, SeqUpdateWin, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 180 }, + { SeqInitDraw, SeqUpdateDraw, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 60 }, + { SeqInitRecord, SeqUpdateRecord, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 180 }, + { NULL, NULL, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 60 }, + { NULL, NULL, HU_DISP_CENTERX+4, HU_DISP_CENTERY, 1.0f, 1.0f, 60 }, }; static s32 seqType2SprTbl[6] = { @@ -956,7 +958,7 @@ static s32 SeqInitMGBasic(SeqWork *work, va_list params) for(i=0; iword_len; i++) { HuSprTPLvlSet(work->spr_grp[word_grp], i, 1.0f); - HuSprPosSet(work->spr_grp[word_grp], i, -100.0f, 240.0f); + HuSprPosSet(work->spr_grp[word_grp], i, -100.0f, HU_DISP_CENTERY); } if(seqPauseF) { work->type = 2; @@ -1185,7 +1187,7 @@ static s32 SeqInitMGCommon(SeqWork *work, va_list params) HuSprGrpPosSet(work->spr_grp[word_grp], 0.0f, 0.0f); for(j=0; jword_len; j++) { HuSprTPLvlSet(work->spr_grp[word_grp], j, tp_lvl); - HuSprPosSet(work->spr_grp[word_grp], j, -100.0f, 240.0f); + HuSprPosSet(work->spr_grp[word_grp], j, -100.0f, HU_DISP_CENTERY); HuSprPriSet(work->spr_grp[word_grp], j, i+5); HuSprAttrSet(work->spr_grp[word_grp], i, HUSPR_ATTR_LINEAR); } @@ -1299,11 +1301,11 @@ static s32 SeqUpdateMGBattle(SeqWork *work) discard_cnt = 0; scale_ang = 0.0f; for(idx=0; idx<40.0f-time; idx++) { - if(x+ofs_x > 576 || x+ofs_x < 0) { + if(x+ofs_x > HU_DISP_WIDTH || x+ofs_x < 0) { ofs_x = -ofs_x; discard_cnt++; } - if(y+ofs_y > 480 || y+ofs_y < 0) { + if(y+ofs_y > HU_DISP_HEIGHT || y+ofs_y < 0) { ofs_y = -ofs_y; discard_cnt++; } @@ -1376,12 +1378,12 @@ static s32 SeqUpdateMGBattle(SeqWork *work) time = work->time-80; for(j=0; jword_len; j++) { pos_x = (28.0f+(work->x-(0.5f*(work->word_len*56))))+(j*56); - HuSprPosSet(work->spr_grp[0], j, pos_x+((288.0f-pos_x)*(1.0-cos((M_PI*(time*6.0))/180.0))), work->y); + HuSprPosSet(work->spr_grp[0], j, pos_x+((HU_DISP_CENTERX-pos_x)*(1.0-cos((M_PI*(time*6.0))/180.0))), work->y); } if(time == 15.0f) { for(j=0; jword_len; j++) { HuSprAttrReset(work->spr_grp[1], j, HUSPR_ATTR_DISPOFF); - HuSprPosSet(work->spr_grp[1], j, 288.0f, work->y); + HuSprPosSet(work->spr_grp[1], j, HU_DISP_CENTERX, work->y); HuSprTPLvlSet(work->spr_grp[1], j, 1.0f); } } @@ -1397,9 +1399,9 @@ static s32 SeqUpdateMGBattle(SeqWork *work) if(scale < 0.0f) { scale = 0.0f; } - HuSprPosSet(work->spr_grp[0], j, 288.0f, work->y+((-100.0f-work->y)*(time/20.0f))); + HuSprPosSet(work->spr_grp[0], j, HU_DISP_CENTERX, work->y+((-100.0f-work->y)*(time/20.0f))); HuSprTPLvlSet(work->spr_grp[0], j, scale); - HuSprPosSet(work->spr_grp[1], j, 288.0f, work->y+((580.0f-work->y)*(time/20.0f))); + HuSprPosSet(work->spr_grp[1], j, HU_DISP_CENTERX, work->y+((580.0f-work->y)*(time/20.0f))); HuSprTPLvlSet(work->spr_grp[1], j, scale); } } @@ -1601,11 +1603,11 @@ static s32 SeqUpdateMG1vs3(SeqWork *work) if(time <= 20) { float pos_base = (28.0f+(work->x-(0.5f*(work->word_len*56))))+(j*56); pos_x = (28.0f+(work->x-(0.5f*(work->word_len*56))))+((work->word_len-j-1)*56); - HuSprPosSet(work->spr_grp[i], j, pos_base+((time/20.0f)*(pos_x-pos_base)), work->y+((440.0f-work->y)*(time/20.0f))); + HuSprPosSet(work->spr_grp[i], j, pos_base+((time/20.0f)*(pos_x-pos_base)), work->y+(((HU_DISP_HEIGHT-40)-work->y)*(time/20.0f))); } else { time -= 20.0f; pos_x = (28.0f+(work->x-(0.5f*(work->word_len*56))))+((work->word_len-j-1)*56); - pos_y = 440.0f; + pos_y = HU_DISP_HEIGHT-40; HuSprPosSet(work->spr_grp[i], j, pos_x, pos_y+((-40.0f-pos_y)*(time/20.0f))); } } @@ -1708,11 +1710,11 @@ static s32 SeqUpdateMGStory(SeqWork *work) continue; } pos_x = -50.0f; - HuSprPosSet(work->spr_grp[0], idx, pos_x+((288.0f-pos_x)*(time/15.0f)), work->y); + HuSprPosSet(work->spr_grp[0], idx, pos_x+((HU_DISP_CENTERX-pos_x)*(time/15.0f)), work->y); HuSprTPLvlSet(work->spr_grp[0], idx, 1.0f); HuSprZRotSet(work->spr_grp[0], idx, (1.0-(time/15.0f))*180.0); - pos_x = 626.0f; - HuSprPosSet(work->spr_grp[1], idx, pos_x+((288.0f-pos_x)*(time/15.0f)), work->y); + pos_x = HU_DISP_WIDTH+50; + HuSprPosSet(work->spr_grp[1], idx, pos_x+((HU_DISP_CENTERX-pos_x)*(time/15.0f)), work->y); HuSprTPLvlSet(work->spr_grp[1], idx, 1.0f); HuSprZRotSet(work->spr_grp[1], idx, (1.0-(time/15.0f))*-180.0); } @@ -1726,7 +1728,7 @@ static s32 SeqUpdateMGStory(SeqWork *work) time = work->time-35; for(idx=0; idxword_len; idx++) { pos_x = (work->x-(0.5f*(work->word_len*56)))+28.0f+(idx*56); - HuSprPosSet(work->spr_grp[0], idx, 288.0f+((pos_x-288.0f)*(time/10.0f)), work->y); + HuSprPosSet(work->spr_grp[0], idx, HU_DISP_CENTERX+((pos_x-HU_DISP_CENTERX)*(time/10.0f)), work->y); } } else { if(work->time > 55) { @@ -2358,7 +2360,7 @@ static s32 SeqUpdateMGBowser(SeqWork *work) pos_x = (28.0f+(0.5f*-(work->word_len*56)))+(idx*56); angle = 180.0*(atan2(pos_x, center_x)/M_PI); pos_x = work->x+(center_x*sin(M_PI*(angle+time_angle)/180.0)); - pos_y = work->y-(240.0*(1.0-(time/50.0f))); + pos_y = work->y-(HU_DISP_CENTERY*(1.0-(time/50.0f))); HuSprPosSet(work->spr_grp[0], idx, pos_x, pos_y); temp_f25 = 0.9+(0.1*cos(M_PI*(angle+time_angle)/180.0)); HuSprScaleSet(work->spr_grp[0], idx, temp_f25*cos(M_PI*(angle+time_angle)/180.0), temp_f25); @@ -2439,12 +2441,12 @@ static s32 SeqUpdateMGBowser(SeqWork *work) if(work->time > 80 && work->time <= 125) { static float letterOfs[] = { -30, -30, - 606, -30, - 340, 510, - 606, 510, - -30, 450, - 606, 120, - 450, -30, + HU_DISP_WIDTH+30, -30, + HU_DISP_CENTERX+52, HU_DISP_HEIGHT+30, + HU_DISP_WIDTH+30, HU_DISP_HEIGHT+30, + -30, HU_DISP_HEIGHT-30, + HU_DISP_WIDTH+30, 120, + HU_DISP_CENTERX+162, -30, }; for(i=0; i<4; i++) { time = work->time-80-i; @@ -2524,7 +2526,7 @@ static s32 SeqInitDraw(SeqWork *work, va_list params) word_grp = SeqMakeWord(work, wordMgTbl[2+word_ofs], word_flag); } - HuSprGrpPosSet(work->spr_grp[word_grp], 288.0f, 240.0f); + HuSprGrpPosSet(work->spr_grp[word_grp], HU_DISP_CENTERX, HU_DISP_CENTERY); work->param[0] = 3; return 1; } @@ -2790,27 +2792,27 @@ static s32 SeqInitWin(SeqWork *work, va_list params) if(num_winners == 1) { word_x = 32.0f+((float)winnerNameW[0]+(winnerNameW[1]*work->win_scale)); if(j == 0) { - word_x = (((576.0f-word_x)/2.0f)+(word_x-(winnerNameW[0]/2)))-288.0f; + word_x = (((HU_DISP_WIDTH-word_x)/2.0f)+(word_x-(winnerNameW[0]/2)))-HU_DISP_CENTERX; } else { - word_x = (((576.0f-word_x)/2.0f)+(winnerNameW[1]/2))-288.0f; + word_x = (((HU_DISP_WIDTH-word_x)/2.0f)+(winnerNameW[1]/2))-HU_DISP_CENTERX; } } else { - if(abs(winPosOfs[num_winners-1][j][0]) == 144.0f) { - if(winnerNameW[j]+32 < 288.0f) { - word_x = 176.0f; + if(abs(winPosOfs[num_winners-1][j][0]) == (HU_DISP_WIDTHF/4)) { + if(winnerNameW[j]+32 < HU_DISP_CENTERX) { + word_x = (HU_DISP_WIDTHF/4)+32.0f; } else { word_x = 32.0f+((winnerNameW[j]*work->win_scale)/2.0f); } if(winPosOfs[num_winners-1][j][0] < 0) { - word_x = -(288.0f-word_x); + word_x = -(HU_DISP_CENTERX-word_x); } else { - word_x = (576.0f-word_x)-288.0f; + word_x = (HU_DISP_WIDTH-word_x)-HU_DISP_CENTERX; } } else { word_x = winPosOfs[num_winners-1][j][0]; } } - HuSprGrpPosSet(work->spr_grp[j], 288.0f+word_x, 240.0f+winPosOfs[num_winners-1][j][1]); + HuSprGrpPosSet(work->spr_grp[j], HU_DISP_CENTERX+word_x, HU_DISP_CENTERY+winPosOfs[num_winners-1][j][1]); } if(seqPauseF) { work->type = 1; @@ -2896,24 +2898,24 @@ static s32 SeqUpdateWin(SeqWork *work) } if(work->word_len == 2) { pos_x = winnerNameW[1]+winnerNameW[0]+32; - pos_x = (((576.0f-pos_x)/2.0f)+(winnerNameW[1]/2))-288.0f; + pos_x = (((HU_DISP_WIDTH-pos_x)/2.0f)+(winnerNameW[1]/2))-HU_DISP_CENTERX; } else { - if(abs(winPosOfs[work->word_len-2][idx][0]) == 144.0f) { - if(winnerNameW[idx]+32 < 288.0f) { - pos_x = 176.0f; + if(abs(winPosOfs[work->word_len-2][idx][0]) == (HU_DISP_WIDTHF/4)) { + if(winnerNameW[idx]+32 < HU_DISP_CENTERX) { + pos_x = (HU_DISP_WIDTHF/4)+32; } else { pos_x = 32.0f+((winnerNameW[idx]*work->win_scale)/2.0f); } if(winPosOfs[work->word_len-2][idx][0] < 0) { - pos_x = -(288.0f-pos_x); + pos_x = -(HU_DISP_CENTERX-pos_x); } else { - pos_x = (576.0f-pos_x)-288.0f; + pos_x = (HU_DISP_WIDTH-pos_x)-HU_DISP_CENTERX; } } else { pos_x = winPosOfs[work->word_len-2][idx][0]; } } - HuSprGrpPosSet(work->spr_grp[idx], (288.0f+pos_x)+ofs[0], ofs[1]+(240.0f+winPosOfs[work->word_len-2][idx][1])); + HuSprGrpPosSet(work->spr_grp[idx], (HU_DISP_CENTERX+pos_x)+ofs[0], ofs[1]+(HU_DISP_CENTERY+winPosOfs[work->word_len-2][idx][1])); } } if(work->time == 125) { @@ -3058,7 +3060,7 @@ static s32 SeqInitRecord(SeqWork *work, va_list params) } } } - HuSprGrpPosSet(spr_grp, 288.0f, 240.0f); + HuSprGrpPosSet(spr_grp, HU_DISP_CENTERX, HU_DISP_CENTERY); work->param[0] = 3; return 1; } @@ -3159,6 +3161,10 @@ void MGSeqPauseInit(void) pauseWaitF = 0; } +#define PAUSE_WIN_X (HU_DISP_CENTERX-206) +#define PAUSE_WIN_DIST (HU_DISP_CENTERX+112) +#define PAUSE_EXIT_Y (HU_DISP_HEIGHT-80) + static void PauseProc(void) { s16 mg; @@ -3195,12 +3201,12 @@ static void PauseProc(void) if(mgInfoTbl[mg].inst_mess[1] == 0 && mgInfoTbl[mg].inst_mess[2] == 0) { for(i=1; i<=20; i++) { ratio = sin(M_PI*(i*4.5f)/180.0); - HuSprGrpPosSet(work.spr_grp[0], 288.0f, (ratio*290)-50.0f); + HuSprGrpPosSet(work.spr_grp[0], HU_DISP_CENTERX, (ratio*290)-50.0f); HuPrcVSleep(); } } else { if(mgPracticeEnableF && !_CheckFlag(FLAG_ID_MAKE(1, 12))) { - window[2] = HuWinExCreateStyled(-10000.0f, 400.0f, 412, 42, -1, 0); + window[2] = HuWinExCreateStyled(-10000.0f, PAUSE_EXIT_Y, 412, 42, -1, 0); HuWinPriSet(window[2], 0); HuWinDispOn(window[2]); HuWinMesSpeedSet(window[2], 0); @@ -3209,12 +3215,12 @@ static void PauseProc(void) } if(mgInfoTbl[mg].inst_mess[2]) { s16 insert_idx; - window[0] = HuWinExCreateStyled(-10000.0f, 140.0f, 412, 120, -1, 0); + window[0] = HuWinExCreateStyled(-10000.0f, HU_DISP_CENTERY-100, 412, 120, -1, 0); HuWinPriSet(window[0], 0); HuWinDispOn(window[0]); HuWinMesSpeedSet(window[0], 0); HuWinMesSet(window[0], mgInfoTbl[mg].inst_mess[1]); - window[1] = HuWinExCreateStyled(-10000.0f, 276.0f, 412, 120, -1, 0); + window[1] = HuWinExCreateStyled(-10000.0f, HU_DISP_CENTERY+36, 412, 120, -1, 0); HuWinPriSet(window[1], 0); HuWinDispOn(window[1]); HuWinMesSpeedSet(window[1], 0); @@ -3228,26 +3234,26 @@ static void PauseProc(void) } for(i=1; i<=20; i++) { ratio = sin(M_PI*(i*4.5f)/180.0); - HuSprGrpPosSet(work.spr_grp[0], 288.0f, (ratio*150)-50.0f); - HuWinPosSet(window[0], (482*ratio)-400, 140); - HuWinPosSet(window[1], 400+(ratio*-318), 272); + HuSprGrpPosSet(work.spr_grp[0], HU_DISP_CENTERX, (ratio*150)-50.0f); + HuWinPosSet(window[0], (PAUSE_WIN_DIST+PAUSE_WIN_X)*ratio-PAUSE_WIN_DIST, HU_DISP_CENTERY-100); + HuWinPosSet(window[1], -(PAUSE_WIN_DIST-PAUSE_WIN_X)*ratio+PAUSE_WIN_DIST, HU_DISP_CENTERY+32); if(window[2] != -1) { - HuWinPosSet(window[2], 82, 404+(100*(1.0-ratio))); + HuWinPosSet(window[2], PAUSE_WIN_X, (PAUSE_EXIT_Y+4)+(100*(1.0-ratio))); } HuPrcVSleep(); } } else { - window[0] = HuWinExCreateStyled(-10000.0f, 170.0f, 412, 120, -1, 0); + window[0] = HuWinExCreateStyled(-10000.0f, HU_DISP_CENTERY-70, 412, 120, -1, 0); HuWinPriSet(window[0], 0); HuWinDispOn(window[0]); HuWinMesSpeedSet(window[0], 0); HuWinMesSet(window[0], mgInfoTbl[mg].inst_mess[1]); for(i=1; i<=20; i++) { ratio = sin(M_PI*(i*4.5f)/180.0); - HuSprGrpPosSet(work.spr_grp[0], 288.0f, (ratio*150)-50.0f); - HuWinPosSet(window[0], (482*ratio)-400, 170); + HuSprGrpPosSet(work.spr_grp[0], HU_DISP_CENTERX, (ratio*150)-50.0f); + HuWinPosSet(window[0], (PAUSE_WIN_DIST+PAUSE_WIN_X)*ratio-PAUSE_WIN_DIST, HU_DISP_CENTERY-70); if(window[2] != -1) { - HuWinPosSet(window[2], 400+(ratio*-318), 404); + HuWinPosSet(window[2], -(PAUSE_WIN_DIST-PAUSE_WIN_X)*ratio+PAUSE_WIN_DIST, PAUSE_EXIT_Y+4); } HuPrcVSleep(); } @@ -3262,28 +3268,28 @@ static void PauseProc(void) if(window[0] == -1 && window[1] == -1) { for(i=1; i<=10; i++) { ratio = cos(M_PI*(i*9.0f)/180.0); - HuSprGrpPosSet(work.spr_grp[0], 288.0f, (ratio*290)-50.0f); + HuSprGrpPosSet(work.spr_grp[0], HU_DISP_CENTERX, (ratio*290)-50.0f); HuPrcVSleep(); } } else { if(window[1] != -1) { for(i=1; i<=10; i++) { ratio = cos(M_PI*(i*9.0f)/180.0); - HuSprGrpPosSet(work.spr_grp[0], 288.0f, (ratio*150)-50.0f); - HuWinPosSet(window[0], (482*ratio)-400, 140); - HuWinPosSet(window[1], 400+(ratio*-318), 272); + HuSprGrpPosSet(work.spr_grp[0], HU_DISP_CENTERX, (ratio*150)-50.0f); + HuWinPosSet(window[0], (PAUSE_WIN_DIST+PAUSE_WIN_X)*ratio-PAUSE_WIN_DIST, HU_DISP_CENTERY-100); + HuWinPosSet(window[1], -(PAUSE_WIN_DIST-PAUSE_WIN_X)*ratio+PAUSE_WIN_DIST, HU_DISP_CENTERY+32); if(window[2] != -1) { - HuWinPosSet(window[2], 82, 404+(100*(1.0-ratio))); + HuWinPosSet(window[2], PAUSE_WIN_X, (PAUSE_EXIT_Y+4)+(100*(1.0-ratio))); } HuPrcVSleep(); } } else { for(i=1; i<=10; i++) { ratio = cos(M_PI*(i*9.0f)/180.0); - HuSprGrpPosSet(work.spr_grp[0], 288.0f, (ratio*150)-50.0f); - HuWinPosSet(window[0], (482*ratio)-400, 170); + HuSprGrpPosSet(work.spr_grp[0], HU_DISP_CENTERX, (ratio*150)-50.0f); + HuWinPosSet(window[0], (PAUSE_WIN_DIST+PAUSE_WIN_X)*ratio-PAUSE_WIN_DIST, HU_DISP_CENTERY-70); if(window[2] != -1) { - HuWinPosSet(window[2], 400+(ratio*-318), 404); + HuWinPosSet(window[2], -(PAUSE_WIN_DIST-PAUSE_WIN_X)*ratio+PAUSE_WIN_DIST, PAUSE_EXIT_Y+4); } HuPrcVSleep(); } @@ -3398,8 +3404,8 @@ static void PracticeProc(void) float time; static float yPosTbl[] = { 53, - 424, - 240 + HU_DISP_HEIGHT-56, + HU_DISP_CENTERY }; time = 0.0f; for(i=0; practiceTbl[i][0] != OVL_INVALID; i++) { @@ -3413,7 +3419,7 @@ static void PracticeProc(void) anim = HuSprAnimRead(SeqReadFile(DATA_MAKE_NUM(DATADIR_GAMEMES, 5))); sprite = HuSprCreate(anim, 1, 0); HuSprGrpMemberSet(group, 0, sprite); - HuSprPosSet(group, 0, 288.0f, yPosTbl[practice[1]]); + HuSprPosSet(group, 0, HU_DISP_CENTERX, yPosTbl[practice[1]]); do { if(!wipeFadeInF || WipeStatGet()) { HuSprAttrSet(group, 0, HUSPR_ATTR_DISPOFF); diff --git a/src/game/printfunc.c b/src/game/printfunc.c index b1924299..4f85f5a9 100644 --- a/src/game/printfunc.c +++ b/src/game/printfunc.c @@ -1,6 +1,8 @@ #include "dolphin.h" #include "game/printfunc.h" #include "game/init.h" +#include "game/disp.h" + #include "stdio.h" #include "stdarg.h" @@ -140,7 +142,7 @@ void pfDrawFonts(void) if(saftyFrameF) { WireDraw(); } - MTXOrtho(proj, 0, 480, 0, 640, 0, 10); + MTXOrtho(proj, 0, HU_FB_HEIGHT, 0, HU_FB_WIDTH, 0, 10); GXSetProjection(proj, GX_ORTHOGRAPHIC); MTXIdentity(modelview); GXLoadPosMtxImm(modelview, GX_PNMTX0); @@ -289,7 +291,7 @@ void pfDrawFonts(void) GXEnd(); } x += char_w; - if(x > 640) { + if(x > HU_FB_WIDTH) { x = 0; y += char_h; } @@ -301,18 +303,21 @@ void pfDrawFonts(void) } } +#define SAFETY_W 16 +#define SAFETY_H 40 + static void WireDraw(void) { Mtx44 proj; Mtx modelview; - MTXOrtho(proj, 0, 480, 0, 576, 0, 10); + MTXOrtho(proj, 0, HU_DISP_HEIGHT, 0, HU_DISP_WIDTH, 0, 10); GXSetProjection(proj, GX_ORTHOGRAPHIC); if(RenderMode->field_rendering) { - GXSetViewportJitter(0, 0, 640, 480, 0, 1, VIGetNextField()); + GXSetViewportJitter(0, 0, HU_FB_WIDTH, HU_FB_HEIGHT, 0, 1, VIGetNextField()); } else { - GXSetViewport(0, 0, 640, 480, 0, 1); + GXSetViewport(0, 0, HU_FB_WIDTH, HU_FB_HEIGHT, 0, 1); } - GXSetScissor(0, 0, 640, 480); + GXSetScissor(0, 0, HU_FB_WIDTH, HU_FB_HEIGHT); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XY, GX_F32, 0); @@ -331,21 +336,21 @@ static void WireDraw(void) MTXIdentity(modelview); GXLoadPosMtxImm(modelview, GX_PNMTX0); GXBegin(GX_LINES, 0, 8); - GXPosition2f32(16, 40); + GXPosition2f32(SAFETY_W, SAFETY_H); GXColor3u8(255, 0, 0); - GXPosition2f32(16, 440); + GXPosition2f32(SAFETY_W, HU_DISP_HEIGHT-SAFETY_H); GXColor3u8(255, 0, 0); - GXPosition2f32(16, 40); + GXPosition2f32(SAFETY_W, SAFETY_H); GXColor3u8(255, 0, 0); - GXPosition2f32(560, 40); + GXPosition2f32(HU_DISP_WIDTH-SAFETY_W, SAFETY_H); GXColor3u8(255, 0, 0); - GXPosition2f32(560, 440); + GXPosition2f32(HU_DISP_WIDTH-SAFETY_W, HU_DISP_HEIGHT-SAFETY_H); GXColor3u8(255, 0, 0); - GXPosition2f32(560, 40); + GXPosition2f32(HU_DISP_WIDTH-SAFETY_W, SAFETY_H); GXColor3u8(255, 0, 0); - GXPosition2f32(560, 440); + GXPosition2f32(HU_DISP_WIDTH-SAFETY_W, HU_DISP_HEIGHT-SAFETY_H); GXColor3u8(255, 0, 0); - GXPosition2f32(16, 440); + GXPosition2f32(SAFETY_W, HU_DISP_HEIGHT-SAFETY_H); GXColor3u8(255, 0, 0); GXEnd(); } diff --git a/src/game/sprput.c b/src/game/sprput.c index c3e50f2b..c2b061b1 100644 --- a/src/game/sprput.c +++ b/src/game/sprput.c @@ -1,6 +1,7 @@ #include "game/sprite.h" #include "game/hsfman.h" #include "game/init.h" +#include "game/disp.h" #include "dolphin/mtx.h" #include "dolphin/gx.h" #include "dolphin/vi.h" @@ -23,14 +24,14 @@ void HuSprDispInit(void) } bmpCCIdx = 0; GXInvalidateTexAll(); - MTXOrtho(proj, 0, 480, 0, 576, 0, 10); + MTXOrtho(proj, 0, HU_DISP_HEIGHT, 0, HU_DISP_WIDTH, 0, 10); GXSetProjection(proj, GX_ORTHOGRAPHIC); if(RenderMode->field_rendering) { - GXSetViewportJitter(0, 0, 640, 480, 0, 1, VIGetNextField()); + GXSetViewportJitter(0, 0, HU_FB_WIDTH, HU_FB_HEIGHT, 0, 1, VIGetNextField()); } else { - GXSetViewport(0, 0, 640, 480, 0, 1); + GXSetViewport(0, 0, HU_FB_WIDTH, HU_FB_HEIGHT, 0, 1); } - GXSetScissor(0, 0, 640, 480); + GXSetScissor(0, 0, HU_FB_WIDTH, HU_FB_HEIGHT); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); diff --git a/src/game/window.c b/src/game/window.c index 29f63d17..a2018b5d 100644 --- a/src/game/window.c +++ b/src/game/window.c @@ -9,6 +9,7 @@ #include "game/pad.h" #include "game/armem.h" #include "game/audio.h" +#include "game/disp.h" #include "ext_math.h" #include "stdarg.h" @@ -274,12 +275,12 @@ s16 HuWinCreate(float x, float y, s16 w, s16 h, s16 frame) { w = (w + 15) & 0xFFF0; h = (h + 15) & 0xFFF0; if (x == -10000.0f) { - window->pos_x = (576.0f - w) / 2; + window->pos_x = (HU_DISP_WIDTHF - w) / 2; } else { window->pos_x = x; } if (y == -10000.0f) { - window->pos_y = (480.0f - h) / 2; + window->pos_y = (HU_DISP_HEIGHTF - h) / 2; } else { window->pos_y = y; } @@ -427,7 +428,7 @@ static void MesDispFunc(HuSprite *sprite) { if (window->num_chars != 0) { group = &HuSprGrpData[window->group]; GXInvalidateTexAll(); - C_MTXOrtho(proj, 0.0f, 480.0f, 0.0f, 576.0f, 0.0f, 10.0f); + C_MTXOrtho(proj, 0.0f, HU_DISP_HEIGHTF, 0.0f, HU_DISP_WIDTHF, 0.0f, 10.0f); GXSetProjection(proj, GX_ORTHOGRAPHIC); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); @@ -1819,7 +1820,7 @@ s16 HuWinExCreateStyled(float x, float y, s16 w, s16 h, s16 portrait, s16 frame) s16 window; if (portrait >= 0) { - h = (h < 0x54) ? 0x54 : h; + h = (h < 84) ? 84 : h; } window = HuWinCreate(x, y, w, h, frame); window_ptr = &winData[window];