mirror of
https://github.com/zeldaret/tww.git
synced 2026-08-21 14:07:29 -04:00
d_gameover (#663)
* dDlst_GameOverScrnDraw_c::animeOpen matching * dDlst_GameOverScrnDraw_c::animeClose matching * dDlst_GameOverScrnDraw_c::anime1 fakematch * dDlst_GameOverScrnDraw_c::anime2 matching * dDlst_GameOverScrnDraw_c::setRotate matching * d_gameover matching * dDlst_GameOverScrnDraw_c::anime1 cleanup * d_gameover rename fake inline * d_gameover non matching * PR fixes
This commit is contained in:
@@ -90,7 +90,13 @@ public:
|
||||
void getRotate() const {}
|
||||
void place(const JGeometry::TBox2<f32>&) {}
|
||||
void rotate(f32) {}
|
||||
void rotate(f32, f32, J2DRotateAxis, f32) {}
|
||||
void rotate(f32 offsetX, f32 offsetY, J2DRotateAxis axis, f32 angle) {
|
||||
mBasePosition.x = offsetX;
|
||||
mBasePosition.y = offsetY;
|
||||
mRotationAxis = axis;
|
||||
mRotation = angle;
|
||||
calcMtx();
|
||||
}
|
||||
void setInfluencedAlpha(bool) {}
|
||||
|
||||
public:
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
#ifndef D_GAMEOVER_H
|
||||
#define D_GAMEOVER_H
|
||||
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "d/d_menu_save.h"
|
||||
#include "f_op/f_op_msg_mng.h"
|
||||
#include "JSystem/JKernel/JKRExpHeap.h"
|
||||
#include "JSystem/J2DGraph/J2DPane.h"
|
||||
#include "JSystem/J2DGraph/J2DScreen.h"
|
||||
#include "SSystem/SComponent/c_phase.h"
|
||||
|
||||
|
||||
class dDlst_Gameover_CAPTURE_c : public dDlst_base_c {
|
||||
public:
|
||||
virtual ~dDlst_Gameover_CAPTURE_c() {}
|
||||
virtual void draw();
|
||||
};
|
||||
|
||||
class dDlst_GameOverScrnDraw_c : public dDlst_base_c {
|
||||
public:
|
||||
dDlst_GameOverScrnDraw_c() {
|
||||
field_0x338 = 0;
|
||||
field_0x33c = 0;
|
||||
field_0x330 = 0;
|
||||
field_0x334 = 0;
|
||||
|
||||
field_0x32c = 8;
|
||||
mAlpha = 0.0f;
|
||||
}
|
||||
|
||||
virtual ~dDlst_GameOverScrnDraw_c() {}
|
||||
void setScreen(const char*, JKRArchive*);
|
||||
void valueInit();
|
||||
BOOL animeOpen();
|
||||
BOOL animeClose();
|
||||
void setEmitter0(cXyz);
|
||||
void setEmitter1(cXyz);
|
||||
BOOL anime1(int);
|
||||
BOOL anime2(int);
|
||||
void setRotate(fopMsgM_pane_class*, f32);
|
||||
|
||||
virtual void draw();
|
||||
|
||||
public:
|
||||
/* 0x004 */ J2DScreen* scrn;
|
||||
/* 0x008 */ fopMsgM_pane_class letter[8];
|
||||
/* 0x1C8 */ u8 field_0x1c8[0x318 - 0x1c8];
|
||||
/* 0x318 */ fopMsgM_pane_alpha_class blak;
|
||||
/* 0x320 */ JPABaseEmitter* mpEmitter0;
|
||||
/* 0x324 */ JPABaseEmitter* mpEmitter1;
|
||||
/* 0x328 */ f32 mAlpha;
|
||||
/* 0x32C */ s32 field_0x32c;
|
||||
/* 0x330 */ s32 field_0x330;
|
||||
/* 0x334 */ u32 field_0x334;
|
||||
/* 0x338 */ u32 field_0x338;
|
||||
/* 0x33C */ u16 field_0x33c;
|
||||
/* 0x33E */ s16 mRotate[8];
|
||||
/* 0x34E */ u8 field_0x34e[0x410 - 0x34E];
|
||||
};
|
||||
|
||||
class dGameover_c : public msg_class {
|
||||
public:
|
||||
s32 _create();
|
||||
BOOL _execute();
|
||||
BOOL _draw();
|
||||
BOOL _delete();
|
||||
BOOL deleteCheck();
|
||||
|
||||
public:
|
||||
/* 0x0FC */ dMenu_save_c* dMs_c;
|
||||
/* 0x100 */ dDlst_GameOverScrnDraw_c* dgo_scrn_c;
|
||||
/* 0x104 */ dDlst_Gameover_CAPTURE_c* dgo_capture_c;
|
||||
/* 0x108 */ request_of_phase_process_class mPhs;
|
||||
/* 0x110 */ JKRExpHeap* mpHeap;
|
||||
/* 0x114 */ s16 field_0x114;
|
||||
/* 0x116 */ s16 field_0x116;
|
||||
/* 0x118 */ u8 mState;
|
||||
/* 0x119 */ u8 field_0x119;
|
||||
/* 0x11C */ u8 field_0x11c;
|
||||
};
|
||||
|
||||
#endif /* D_GAMEOVER_H */
|
||||
@@ -8,6 +8,7 @@ class fopMsgM_pane_class;
|
||||
|
||||
class dDlst_MenuSave_c : public dDlst_base_c {
|
||||
public:
|
||||
~dDlst_MenuSave_c() {}
|
||||
void draw();
|
||||
};
|
||||
|
||||
|
||||
+142
-93
@@ -3,89 +3,14 @@
|
||||
// Translation Unit: d_gameover.cpp
|
||||
//
|
||||
|
||||
#include "d/d_menu_save.h"
|
||||
#include "d/d_drawlist.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
#include "d/d_gameover.h"
|
||||
#include "d/d_meter.h"
|
||||
#include "d/d_procname.h"
|
||||
#include "f_op/f_op_msg_mng.h"
|
||||
#include "m_Do/m_Do_graphic.h"
|
||||
#include "m_Do/m_Do_mtx.h"
|
||||
#include "m_Do/m_Do_Reset.h"
|
||||
#include "JSystem/JKernel/JKRExpHeap.h"
|
||||
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
|
||||
#include "JSystem/J2DGraph/J2DPane.h"
|
||||
#include "JSystem/J2DGraph/J2DScreen.h"
|
||||
#include "SSystem/SComponent/c_phase.h"
|
||||
|
||||
class dDlst_Gameover_CAPTURE_c : public dDlst_base_c {
|
||||
public:
|
||||
virtual ~dDlst_Gameover_CAPTURE_c() {}
|
||||
virtual void draw();
|
||||
};
|
||||
|
||||
class dDlst_GameOverScrnDraw_c : public dDlst_base_c {
|
||||
public:
|
||||
dDlst_GameOverScrnDraw_c() {
|
||||
field_0x338 = 0;
|
||||
field_0x33c = 0;
|
||||
field_0x330 = 0;
|
||||
field_0x334 = 0;
|
||||
|
||||
field_0x32c = 8;
|
||||
mAlpha = 0.0f;
|
||||
}
|
||||
|
||||
virtual ~dDlst_GameOverScrnDraw_c() {}
|
||||
void setScreen(const char*, JKRArchive*);
|
||||
void valueInit();
|
||||
BOOL animeOpen();
|
||||
BOOL animeClose();
|
||||
void setEmitter0(cXyz);
|
||||
void setEmitter1(cXyz);
|
||||
BOOL anime1(int);
|
||||
void anime2(int);
|
||||
void setRotate(fopMsgM_pane_class*, f32);
|
||||
|
||||
virtual void draw();
|
||||
|
||||
public:
|
||||
/* 0x004 */ J2DScreen* scrn;
|
||||
/* 0x008 */ fopMsgM_pane_class letter[8];
|
||||
/* 0x1C8 */ u8 field_0x1c8[0x318 - 0x1c8];
|
||||
/* 0x318 */ fopMsgM_pane_alpha_class blak;
|
||||
/* 0x320 */ JPABaseEmitter* mpEmitter0;
|
||||
/* 0x324 */ JPABaseEmitter* mpEmitter1;
|
||||
/* 0x328 */ f32 mAlpha;
|
||||
/* 0x32C */ s32 field_0x32c;
|
||||
/* 0x330 */ u32 field_0x330;
|
||||
/* 0x334 */ u32 field_0x334;
|
||||
/* 0x338 */ u32 field_0x338;
|
||||
/* 0x33C */ u16 field_0x33c;
|
||||
/* 0x33E */ s16 mRotate[8];
|
||||
/* 0x34E */ u8 field_0x34e[0x410 - 0x34E];
|
||||
};
|
||||
|
||||
class dGameover_c : public msg_class {
|
||||
public:
|
||||
s32 _create();
|
||||
BOOL _execute();
|
||||
BOOL _draw();
|
||||
BOOL _delete();
|
||||
BOOL deleteCheck();
|
||||
|
||||
public:
|
||||
/* 0x0FC */ dMenu_save_c* dMs_c;
|
||||
/* 0x100 */ dDlst_GameOverScrnDraw_c* dgo_scrn_c;
|
||||
/* 0x104 */ dDlst_Gameover_CAPTURE_c* dgo_capture_c;
|
||||
/* 0x108 */ request_of_phase_process_class mPhs;
|
||||
/* 0x110 */ JKRExpHeap* mpHeap;
|
||||
/* 0x114 */ s16 field_0x114;
|
||||
/* 0x116 */ s16 field_0x116;
|
||||
/* 0x118 */ u8 mState;
|
||||
/* 0x119 */ u8 field_0x119;
|
||||
/* 0x11C */ u8 field_0x11c;
|
||||
};
|
||||
|
||||
/* 8018E1CC-8018E4B4 .text draw__24dDlst_Gameover_CAPTURE_cFv */
|
||||
void dDlst_Gameover_CAPTURE_c::draw() {
|
||||
@@ -299,12 +224,107 @@ void dDlst_GameOverScrnDraw_c::valueInit() {
|
||||
|
||||
/* 8018ECD8-8018EEC8 .text animeOpen__24dDlst_GameOverScrnDraw_cFv */
|
||||
BOOL dDlst_GameOverScrnDraw_c::animeOpen() {
|
||||
/* Nonmatching */
|
||||
const static f32 x[8] = {
|
||||
-175.0f, -130.0f, -80.0f, -30.0f,
|
||||
32.0f, 75.0f, 120.0f, 160.0f
|
||||
};
|
||||
|
||||
u8 var_r31 = 0;
|
||||
s16 var_r30 = -1;
|
||||
if (field_0x32c >= 0) {
|
||||
if (field_0x330 != 0) {
|
||||
field_0x330 -= 1;
|
||||
} else {
|
||||
s32 rand = cM_rndF(field_0x32c);
|
||||
if (rand >= field_0x32c - 1) {
|
||||
rand = field_0x32c - 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < dGover_tex_number; i++) {
|
||||
if (letter[i].mUserArea == 0) {
|
||||
if (rand == 0) {
|
||||
anime1(i);
|
||||
var_r30 = i;
|
||||
break;
|
||||
} else {
|
||||
rand -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
field_0x32c -= 1;
|
||||
field_0x330 = (field_0x32c * field_0x32c) / 5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < dGover_tex_number; i++) {
|
||||
s16 userArea = letter[i].mUserArea;
|
||||
|
||||
if (userArea >= 0 && userArea < 9) {
|
||||
if (userArea >= 1 && var_r30 != i) {
|
||||
anime1(i);
|
||||
if (letter[i].mUserArea == 5) {
|
||||
dComIfGp_particle_set2Dfore(0x2E, &cXyz(x[i], 50.0f, 0.0f));
|
||||
}
|
||||
}
|
||||
|
||||
var_r31 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return var_r31 == 0 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/* 8018EEC8-8018F05C .text animeClose__24dDlst_GameOverScrnDraw_cFv */
|
||||
BOOL dDlst_GameOverScrnDraw_c::animeClose() {
|
||||
/* Nonmatching */
|
||||
u8 var_r31 = 0;
|
||||
s16 var_r30 = -1;
|
||||
|
||||
if (field_0x32c >= 0) {
|
||||
if (field_0x330 != 0) {
|
||||
field_0x330 = 0;
|
||||
} else {
|
||||
s32 rand = cM_rndF(field_0x32c);
|
||||
if (rand >= field_0x32c - 1) {
|
||||
rand = field_0x32c - 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < dGover_tex_number; i++) {
|
||||
if (letter[i].mUserArea == 0) {
|
||||
if (rand == 0) {
|
||||
anime2(i);
|
||||
var_r30 = i;
|
||||
break;
|
||||
} else {
|
||||
rand -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
field_0x330 = (s32)cM_rndF(3.0f) + 1;
|
||||
|
||||
if (field_0x330 >= 3) {
|
||||
field_0x330 = 3;
|
||||
}
|
||||
|
||||
field_0x32c -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < dGover_tex_number; i++) {
|
||||
s16 userArea = letter[i].mUserArea;
|
||||
|
||||
if (userArea >= 0 && userArea < 7) {
|
||||
if (userArea >= 1 && var_r30 != i) {
|
||||
anime2(i);
|
||||
}
|
||||
|
||||
var_r31 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return var_r31 == 0 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/* 8018F05C-8018F0CC .text setEmitter0__24dDlst_GameOverScrnDraw_cF4cXyz */
|
||||
@@ -317,9 +337,15 @@ void dDlst_GameOverScrnDraw_c::setEmitter1(cXyz pos) {
|
||||
mpEmitter1 = dComIfGp_particle_set2DmenuFore(0x30, &pos);
|
||||
}
|
||||
|
||||
// Fake inline
|
||||
inline f32 divSquare(s16 y, f32 div) {
|
||||
return (f32)y * (f32)y / div;
|
||||
}
|
||||
|
||||
/* 8018F13C-8018F334 .text anime1__24dDlst_GameOverScrnDraw_cFi */
|
||||
BOOL dDlst_GameOverScrnDraw_c::anime1(int idx) {
|
||||
/* Nonmatching */
|
||||
/* Fakematch */
|
||||
|
||||
BOOL ret = FALSE;
|
||||
|
||||
if (letter[idx].mUserArea < 5) {
|
||||
@@ -327,16 +353,13 @@ BOOL dDlst_GameOverScrnDraw_c::anime1(int idx) {
|
||||
fopMsgM_setInitAlpha(&letter[idx]);
|
||||
|
||||
letter[idx].mUserArea++;
|
||||
f32 y = letter[idx].mUserArea;
|
||||
fopMsgM_paneTrans(&letter[idx], 0.0f, (1.0f - (y * y) / 25.0f) * -288.0f);
|
||||
fopMsgM_paneTrans(&letter[idx], 0.0f, (1.0f - divSquare(letter[idx].mUserArea, 25.0f)) * -288.0f);
|
||||
} else if (letter[idx].mUserArea < 7) {
|
||||
letter[idx].mUserArea++;
|
||||
f32 y = letter[idx].mUserArea - 5;
|
||||
fopMsgM_paneTrans(&letter[idx], 0.0f, ((y * y) / 4.0f) * -9.0f);
|
||||
fopMsgM_paneTrans(&letter[idx], 0.0f, (divSquare(letter[idx].mUserArea - 5, 4.0f)) * -9.0f);
|
||||
} else if (letter[idx].mUserArea < 9) {
|
||||
letter[idx].mUserArea++;
|
||||
f32 y = letter[idx].mUserArea - 7;
|
||||
fopMsgM_paneTrans(&letter[idx], 0.0f, (1.0f - (y * y) / 4.0f) * -9.0f);
|
||||
fopMsgM_paneTrans(&letter[idx], 0.0f, (1.0f - divSquare(letter[idx].mUserArea - 7, 4.0f)) * -9.0f);
|
||||
if (letter[idx].mUserArea == 9)
|
||||
mDoAud_seStart(JA_SE_EXIT_GAME_OVER);
|
||||
}
|
||||
@@ -348,18 +371,44 @@ BOOL dDlst_GameOverScrnDraw_c::anime1(int idx) {
|
||||
}
|
||||
|
||||
/* 8018F334-8018F4A8 .text anime2__24dDlst_GameOverScrnDraw_cFi */
|
||||
void dDlst_GameOverScrnDraw_c::anime2(int) {
|
||||
/* Nonmatching */
|
||||
BOOL dDlst_GameOverScrnDraw_c::anime2(int idx) {
|
||||
static const s16 rot[6] = {
|
||||
40, 30, 20,
|
||||
-20, -30, -40
|
||||
};
|
||||
|
||||
BOOL ret = FALSE;
|
||||
|
||||
if (letter[idx].mUserArea < 7) {
|
||||
if (letter[idx].mUserArea == 0) {
|
||||
s32 rand = cM_rndF(6.0f);
|
||||
|
||||
if (rand > 5) {
|
||||
rand = 5;
|
||||
}
|
||||
|
||||
mRotate[idx] = rot[rand];
|
||||
}
|
||||
|
||||
letter[idx].mUserArea += 1;
|
||||
|
||||
f32 y = letter[idx].mUserArea / 7.0f;
|
||||
f32 y2 = (f32)letter[idx].mUserArea * (f32)letter[idx].mUserArea / 49.0f;
|
||||
setRotate(&letter[idx], (f32)mRotate[idx] * (1.0f - y));
|
||||
fopMsgM_paneTrans(&letter[idx], 0.0f, y2 * 244.0f);
|
||||
}
|
||||
|
||||
if (letter[idx].mUserArea == 7) {
|
||||
fopMsgM_setNowAlphaZero(&letter[idx]);
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* 8018F4A8-8018F548 .text setRotate__24dDlst_GameOverScrnDraw_cFP18fopMsgM_pane_classf */
|
||||
void dDlst_GameOverScrnDraw_c::setRotate(fopMsgM_pane_class* pane, f32 angle) {
|
||||
/* Nonmatching */
|
||||
J2DPane* j2dpane = pane->pane;
|
||||
j2dpane->mBasePosition.set((s32)pane->mSize.x / 2.0f, (s32)pane->mSize.y / 2.0f);
|
||||
j2dpane->mRotationAxis = 'z';
|
||||
j2dpane->mRotation = angle;
|
||||
j2dpane->calcMtx();
|
||||
pane->pane->rotate((s32)(pane->mSize.x / 2), (s32)(pane->mSize.y / 2), ROTATE_Z, angle);
|
||||
}
|
||||
|
||||
/* 8018F548-8018F5EC .text draw__24dDlst_GameOverScrnDraw_cFv */
|
||||
|
||||
Reference in New Issue
Block a user