d_meter_HIO OK + misc (#2009)

This commit is contained in:
hatal175
2023-12-22 12:56:56 +02:00
committed by GitHub
parent e58b7390dd
commit ebf42d4949
27 changed files with 359 additions and 957 deletions
+181 -11
View File
@@ -9,6 +9,8 @@
#include "dol2asm.h"
#include "d/com/d_com_inf_game.h"
#include "f_op/f_op_msg_mng.h"
#include "JSystem/J2DGraph/J2DTextBox.h"
#include "JSystem/JUtility/JUTTexture.h"
//
// Forward References:
@@ -359,6 +361,170 @@ void COutFont_c::setPane(J2DPicture* p_pic) {
SECTION_SDATA2 static f64 lit_4397 = 4503599627370496.0 /* cast u32 to float */;
/* 80225EA8-80226CF8 2207E8 0E50+00 2/0 0/0 0/0 .text createPane__10COutFont_cFv */
#ifdef NONMATCHING
void COutFont_c::createPane() {
ResTIMG* local_30;
for (int iVar5 = 0; iVar5 < 70; iVar5++) {
if (iVar5 == 41) {
local_30 = (ResTIMG*)dComIfGp_getItemIconArchive()->getResource('TIMG', getBtiName(iVar5));
} else {
local_30 = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', getBtiName(iVar5));
}
mpPane[iVar5] = new J2DPicture(local_30);
switch (iVar5) {
case 0:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(255, 255, 255, 0), JUtility::TColor(98, 163, 46, 255));
break;
case 1:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(255, 255, 255, 0), JUtility::TColor(200, 39, 39, 255));
break;
case 2:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 200, 50, 255));
break;
case 3:
case 4:
case 5:
case 6:
case 8:
if (field_0x242 == 0x1) {
mpPane[iVar5]->setBlackWhite(JUtility::TColor(255, 255, 255, 0), JUtility::TColor(120, 120, 120, 255));
} else {
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(200, 200, 200, 255));
}
break;
case 7:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(255, 255, 255, 0), JUtility::TColor(80, 70, 165, 255));
break;
case 9:
case 0xe:
case 0xf:
case 0x10:
case 0x11:
case 0x12:
case 0x13:
local_30 = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "font_07_02.bti");
mpPane[iVar5]->append(local_30, 1.0f);
mpPane[iVar5]->setBlendRatio(1.0f, 0.0f);
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(200, 200, 200, 255));
break;
case 0x14:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(220, 50, 50, 255));
break;
case 0x15:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 200, 50, 255));
break;
case 0x16:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 100, 0, 255));
break;
case 0x17:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 255, 180, 255));
break;
case 0x18:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 255, 255, 255));
break;
case 0x19:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(170, 255, 255, 255));
break;
case 0x1a:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 255, 0), JUtility::TColor(30, 50, 120, 255));
break;
case 0x1b:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 50, 50, 255));
break;
case 0x1c:
case 0x2b:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 255, 255, 255));
break;
case 0x1d:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 255));
break;
case 0x1f:
case 0x20:
case 0x21:
case 0x22:
case 0x23:
case 0x24:
case 0x25:
case 0x26:
case 0x27:
case 0x28:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 80, 80, 255));
break;
case 0x1e:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 255, 255, 255));
field_0x1ac = (f32)local_30->width / (f32)local_30->height;
field_0x1b0 = 1.0f;
break;
case 0x29:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 255, 255, 255));
break;
case 0x2a:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 255, 255, 255));
break;
case 0x2c:
case 0x2d:
case 0x2e:
case 0x2f:
case 0x37:
case 0x38:
case 0x39:
case 0x3a:
case 0x3d:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 255, 255, 255));
break;
case 0x30:
local_30 = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "font_20.bti");
mpPane[iVar5]->append(local_30, 1.0f);
mpPane[iVar5]->setBlendRatio(1.0f, 0.0f);
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 255, 255, 255));
break;
case 0x31:
case 0x32:
case 0x41:
case 0x42:
case 0x43:
case 0x44:
local_30 = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "font_21.bti");
mpPane[iVar5]->append(local_30, 1.0f);
mpPane[iVar5]->setBlendRatio(1.0f, 0.0f);
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 255, 255, 255));
break;
case 0x33:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(190, 190, 190, 255));
break;
case 0x34:
case 0x35:
case 0x36:
case 0x3f:
case 0x40:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 255, 255, 255));
break;
case 0x3b:
local_30 = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "font_30.bti");
mpPane[iVar5]->append(local_30, 1.0f);
mpPane[iVar5]->setBlendRatio(1.0f, 0.0f);
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 255, 255, 255));
break;
case 0x3c:
local_30 = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "font_31.bti");
mpPane[iVar5]->append(local_30, 1.0f);
mpPane[iVar5]->setBlendRatio(1.0f, 0.0f);
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 255, 255, 255));
break;
case 0x3e:
local_30 = (ResTIMG*)dComIfGp_getMain2DArchive()->getResource('TIMG', "font_34.bti");
mpPane[iVar5]->append(local_30, 1.0f);
mpPane[iVar5]->setBlendRatio(1.0f, 0.0f);
mpPane[iVar5]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 255, 255, 255));
break;
case 0x45:
mpPane[iVar5]->setBlackWhite(JUtility::TColor(166, 12, 0, 0), JUtility::TColor(255, 255, 255, 255));
break;
}
}
field_0x240 = true;
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
@@ -367,6 +533,7 @@ asm void COutFont_c::createPane() {
#include "asm/d/msg/d_msg_out_font/createPane__10COutFont_cFv.s"
}
#pragma pop
#endif
/* 80226CF8-80226D4C 221638 0054+00 0/0 2/2 0/0 .text initialize__10COutFont_cFv */
void COutFont_c::initialize() {
@@ -435,6 +602,7 @@ SECTION_SDATA2 static f64 lit_5001 = 4503601774854144.0 /* cast s32 to float */;
/* 80226DB0-80228448 2216F0 1698+00 2/0 0/0 0/0 .text draw__10COutFont_cFP10J2DTextBoxfff
*/
// Matches with literals
#ifdef NONMATCHING
void COutFont_c::draw(J2DTextBox* p_textBox, f32 param_1, f32 param_2, f32 param_3) {
s16 sp256[70];
@@ -464,7 +632,7 @@ void COutFont_c::draw(J2DTextBox* p_textBox, f32 param_1, f32 param_2, f32 param
f32 sizeY = local_110 * mpOfs[i]->getSizeY();
if (mpPane[type] != NULL) {
mpPane[type]->setAlpha(mAlphaRatio * mpPane[i]->getAlpha());
mpPane[type]->setAlpha(mAlphaRatio * mpOfs[i]->getAlpha());
switch (type) {
case 10:
@@ -630,7 +798,7 @@ void COutFont_c::draw(J2DTextBox* p_textBox, f32 param_1, f32 param_2, f32 param
field_0x1b4[type] = 0;
}
mpPane[type]->rotate(0.5f * posX, 0.5f * posY, ROTATE_Z, (360.0f * (f32)field_0x1b4[type]) / 28.0f);
mpPane[type]->rotate(0.5f * sizeX, 0.5f * sizeY, ROTATE_Z, (360.0f * (f32)field_0x1b4[type]) / 28.0f);
mpPane[type]->draw(posX, posY, sizeX, sizeY, false, false, false);
break;
case 25: // some issues in here, 2020
@@ -644,15 +812,17 @@ void COutFont_c::draw(J2DTextBox* p_textBox, f32 param_1, f32 param_2, f32 param
f32 alpha;
if (field_0x1b4[type] < 9) {
alpha = field_0x1b4[type];
alpha = 50.0f + 205.0f * (field_0x1b4[type] / 9.0f);
} else {
alpha = 18.0f - field_0x1b4[type];
alpha = 50.0f + 205.0f * ((18.0f - field_0x1b4[type]) / 9.0f);
}
mpPane[26]->setAlpha(((alpha / 9.0f) * 205.0f + 50.0f) * mAlphaRatio);
f32 tmpX = 0.5f * (g_MsgObject_HIO_c.mPortalIconScale - 1.0f) * sizeX;
f32 tmpY = 0.5f * (g_MsgObject_HIO_c.mPortalIconScale - 1.0f) * sizeY;
mpPane[26]->draw(posX - tmpX, posY - tmpY, g_MsgObject_HIO_c.mPortalIconScale * sizeX, g_MsgObject_HIO_c.mPortalIconScale * sizeY, false, false, false);
mpPane[26]->setAlpha(alpha * mAlphaRatio);
mpPane[26]->draw(
posX - 0.5f * ((g_MsgObject_HIO_c.mPortalIconScale - 1.0f) * sizeX),
posY - 0.5f * ((g_MsgObject_HIO_c.mPortalIconScale - 1.0f) * sizeY),
sizeX * g_MsgObject_HIO_c.mPortalIconScale,
sizeY * g_MsgObject_HIO_c.mPortalIconScale, false, false, false);
mpPane[type]->draw(posX, posY, sizeX, sizeY, false, false, false);
break;
case 26:
@@ -660,7 +830,7 @@ void COutFont_c::draw(J2DTextBox* p_textBox, f32 param_1, f32 param_2, f32 param
break;
case 30:
mpPane[type]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 255, 255, 255));
mpPane[type]->draw(posX + (0.5f * (sizeX * (field_0x1ac - 1.0f))), posY + (0.5f * (sizeY * (field_0x1b0 - 1.0f))), sizeX * field_0x1ac, sizeY * field_0x1b0, false, false, false);
mpPane[type]->draw(posX + (0.5f * (sizeX * (1.0f - field_0x1ac))), posY + (0.5f * (sizeY * (1.0f - field_0x1b0))), sizeX * field_0x1ac, sizeY * field_0x1b0, false, false, false);
break;
case 31:
case 32:
@@ -682,8 +852,8 @@ void COutFont_c::draw(J2DTextBox* p_textBox, f32 param_1, f32 param_2, f32 param
mpPane[type]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(0, 0, 0, 255));
mpPane[type]->draw(2.0f + posX, 2.0f + ((posY + -3.0f) - 4.0f), sizeX, sizeY * 1.25f, false, false, false);
mpPane[type]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), mpOfs[i]->getColor());
mpPane[type]->draw(posX, posY, sizeX, sizeY, false, false, false);
mpPane[type]->setBlackWhite(JUtility::TColor(0, 0, 0, 0), JUtility::TColor(255, 255, 255, 255));
mpPane[type]->draw(posX, (posY + -3.0f) - 4.0f, sizeX, sizeY * 1.25f, false, false, false);
break;
case 45:
mpPane[type]->draw(posX, (posY + -3.0f) - 4.0f, sizeX, sizeY * 1.25f, false, false, false);
+80
View File
@@ -72,6 +72,85 @@ SECTION_SDATA2 static f32 lit_3704[1 + 1 /* padding */] = {
SECTION_SDATA2 static f64 lit_3707 = 4503601774854144.0 /* cast s32 to float */;
/* 80238CEC-8023907C 23362C 0390+00 0/0 5/5 0/0 .text setTag__10dMsgUnit_cFiiPcb */
// regalloc + mulli issue
#ifdef NONMATCHING
void dMsgUnit_c::setTag(int param_1, int param_2, char* param_3, bool param_4) {
*param_3 = 0;
if (param_1 == 0x10000) {
sprintf(param_3, "%d", param_2);
} else if (param_1 == 0x10001) {
sprintf(param_3, "%d-%d", param_2 / 10, param_2 % 10);
} else if (param_1 == 4 && param_4 == true) {
int r6 = param_2 / 1000;
int r5 = r6 / 60;
r6 %= 60;
if (r5 > 99) {
r5 = 99;
r6 = 59;
}
if (r5 != 0 || r6 != 0) {
sprintf(param_3, "%d:%02d", r5, r6);
}
} else if (param_1 == 3 && param_4 == true) {
f32 dayTime = g_env_light.getDaytime();
f32 iVar8 = 1000000.0f * dayTime;
iVar8 = ((s32)iVar8 % 15000000) / 1000000.0f;
iVar8 = 60.0f * (iVar8 / 15.0f);
sprintf(param_3, "%d:%02d", (s32)(dayTime / 15.0f), (s32)iVar8);
} else {
if (param_1 == 9 && param_4 == true) {
sprintf(param_3, "%d", param_2);
}
bmg_header_t* iVar9 = (bmg_header_t*)dMeter2Info_getMsgUnitResource();
inf1_section_t* inf1 = NULL;
str1_section_t* str1 = NULL;
int local_114 = sizeof(bmg_header_t);
u32 size = iVar9->size;
bmg_section_t* piVar12 = iVar9->section;
for (; local_114 < size; local_114 += piVar12->size) {
switch(piVar12->msgType) {
case 'FLW1':
break;
case 'FLI1':
break;
case 'DAT1':
break;
case 'INF1':
inf1 = (inf1_section_t*)piVar12;
break;
case 'STR1':
str1 = (str1_section_t*)piVar12;
break;
}
piVar12 = (bmg_section_t*)((u8*)piVar12 + piVar12->size);
}
u32 uVar1 = inf1->entries[param_1].startFrame;
u32 uVar2 = inf1->entries[param_1].endFrame;
const char* uVar5;
if (param_2 == 1) {
uVar5 = str1->entries->str + uVar1;
} else {
uVar5 = str1->entries->str + uVar2;
}
if (strcmp(uVar5, "") == 0) {
sprintf(param_3, "%d%s", param_2, uVar5);
} else {
sprintf(param_3, "%d %s", param_2, uVar5);
}
if (param_1 == 3 && param_4 == true) {
char acStack_d8[20];
setTag(4, 0, acStack_d8, false);
strcat(param_3, acStack_d8);
}
if (param_1 == 4 && param_4 == true) {
char acStack_ec[20];
setTag(5, param_2, acStack_ec, false);
strcat(param_3, acStack_ec);
}
}
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
@@ -80,6 +159,7 @@ asm void dMsgUnit_c::setTag(int param_0, int param_1, char* param_2, bool param_
#include "asm/d/msg/d_msg_unit/setTag__10dMsgUnit_cFiiPcb.s"
}
#pragma pop
#endif
/* 804510D0-804510D8 0005D0 0004+04 1/1 5/5 0/0 .sbss g_msg_unit */
dMsgUnit_c g_msg_unit;