Documented health score
This commit is contained in:
@@ -10,8 +10,8 @@ extern s32 framebuffer_width;
|
||||
extern s32 framebuffer_height;
|
||||
|
||||
/* .data */
|
||||
BKSprite * D_8036A910 = NULL;
|
||||
BKSprite * D_8036A914 = NULL;
|
||||
BKSprite * gSpriteHealth = NULL;
|
||||
BKSprite * gSpriteRedHealth = NULL;
|
||||
Gfx D_8036A918[] = {
|
||||
gsDPPipeSync(),
|
||||
gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH),
|
||||
@@ -28,8 +28,8 @@ s32 D_80381EF0;
|
||||
f32 D_80381EF4;
|
||||
f32 D_80381EF8;
|
||||
f32 D_80381EFC;
|
||||
s32 D_80381F00;
|
||||
f32 D_80381F04;
|
||||
s32 gTotalHealth;
|
||||
f32 gHealth;
|
||||
f32 D_80381F08[8];
|
||||
f32 D_80381F28;
|
||||
f32 D_80381F2C;
|
||||
@@ -48,17 +48,16 @@ void func_80300C10(void) {
|
||||
}
|
||||
|
||||
void fxhealthscore_free(enum item_e item_id, struct8s *arg1){
|
||||
s32 temp_a0;
|
||||
s32 temp_a0_2;
|
||||
if (gSpriteHealth != NULL) {
|
||||
assetCache_free(gSpriteHealth);
|
||||
gSpriteHealth = NULL;
|
||||
}
|
||||
|
||||
if (D_8036A910 != 0) {
|
||||
func_8033BD4C(D_8036A910);
|
||||
D_8036A910 = 0;
|
||||
}
|
||||
if (D_8036A914 != 0) {
|
||||
func_8033BD4C(D_8036A914);
|
||||
D_8036A914 = 0;
|
||||
if (gSpriteRedHealth != NULL) {
|
||||
assetCache_free(gSpriteRedHealth);
|
||||
gSpriteRedHealth = NULL;
|
||||
}
|
||||
|
||||
func_80300C10();
|
||||
}
|
||||
|
||||
@@ -68,61 +67,72 @@ struct7s *fxhealthscore_new(enum item_e item_id){
|
||||
return &D_80381F30;
|
||||
}
|
||||
|
||||
void fxhealthscore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx){
|
||||
int i;
|
||||
void fxhealthscore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
|
||||
int i;
|
||||
int tmp_v1;
|
||||
s32 spEC;
|
||||
s32 spE8;
|
||||
s32 honeycomb_width;
|
||||
s32 honeycomb_height;
|
||||
int tmp_v0;
|
||||
f32 f18;
|
||||
f32 f14;
|
||||
f32 f20;
|
||||
s32 spD4 = 0;
|
||||
s32 is_red_health_initialized = FALSE;
|
||||
s32 s6;
|
||||
|
||||
if(D_8036A910 == NULL) return;
|
||||
if (gSpriteHealth == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
gSPDisplayList((*gfx)++, D_8036A918);
|
||||
func_80347FC0(gfx, D_8036A910, 0, 0, 0, 0, 0, 2, 2, &spEC, &spE8);
|
||||
func_80347FC0(gfx, gSpriteHealth, 0, 0, 0, 0, 0, 2, 2, &honeycomb_width, &honeycomb_height);
|
||||
viewport_setRenderViewportAndOrthoMatrix(gfx, mtx);
|
||||
|
||||
//loop over each honeycomb piece
|
||||
for(i = D_80381F00-1; i >= 0; i--){//L80300E40
|
||||
if(i != 0 && (i + 1 != D_80381F00 || D_80381F00 & 1)
|
||||
){
|
||||
for (i = gTotalHealth - 1; i >= 0; i--) {//L80300E40
|
||||
if (i != 0 && (i + 1 != gTotalHealth || gTotalHealth & 1)) {
|
||||
s6 = (i & 1) ? i + 1 : i - 1;
|
||||
}
|
||||
else{//L80300E84
|
||||
else {//L80300E84
|
||||
s6 = i;
|
||||
}
|
||||
|
||||
gDPPipeSync((*gfx)++);
|
||||
if(D_80381F04 > i){
|
||||
if((0 < D_80381F04 - 8.0f) && ((D_80381F04 - 8.0f) > i)){
|
||||
if(!spD4){
|
||||
func_80347FC0(gfx, D_8036A914, 0, 0, 0, 0, 0, 2, 2, &spEC, &spE8);
|
||||
spD4 = TRUE;
|
||||
|
||||
if (gHealth > i) {
|
||||
if (0 < (gHealth - 8.0f) && (gHealth - 8.0f) > i) {
|
||||
if (!is_red_health_initialized) {
|
||||
func_80347FC0(gfx, gSpriteRedHealth, 0, 0, 0, 0, 0, 2, 2, &honeycomb_width, &honeycomb_height);
|
||||
is_red_health_initialized = TRUE;
|
||||
}
|
||||
}//L80300F38
|
||||
|
||||
gDPSetPrimColor((*gfx)++, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
}
|
||||
else{//L80300F58
|
||||
gDPSetPrimColor((*gfx)++, 0, 0, 0xFF, 0xFF, 0xFF, 0x78);
|
||||
else {//L80300F58
|
||||
gDPSetPrimColor((*gfx)++, 0, 0, 0xFF, 0xFF, 0xFF, 0x78);
|
||||
}
|
||||
f20 = 96.0f - (f32)framebuffer_width/2 + (i*13);
|
||||
f14 = (f32)framebuffer_height/2 - func_802FB0E4(arg1) - D_80381F08[s6] - -48.0f;
|
||||
|
||||
f20 = 96.0f - (f32) framebuffer_width / 2 + (i * 13);
|
||||
f14 = (f32) framebuffer_height / 2 - func_802FB0E4(arg1) - D_80381F08[s6] - -48.0f;
|
||||
f14 = (i & 1) ? f14 + 5.75 : f14 - 5.75;
|
||||
|
||||
gSPVertex((*gfx)++, *vtx, 4, 0);
|
||||
for(tmp_v1 = 0; tmp_v1 < 2; tmp_v1++){//L8030101C
|
||||
for(tmp_v0 = 0; tmp_v0 < 2; tmp_v0++){//L80301030
|
||||
(*vtx)->v.ob[0] = (((spEC * D_80381EFC)*tmp_v0 - (spEC * D_80381EFC)/2) + f20)*4.0f;
|
||||
(*vtx)->v.ob[1] = (((spE8 * D_80381EFC)/2 - (spE8 * D_80381EFC)*tmp_v1) + f14) * 4.0f;
|
||||
|
||||
for (tmp_v1 = 0; tmp_v1 < 2; tmp_v1++) {//L8030101C
|
||||
for (tmp_v0 = 0; tmp_v0 < 2; tmp_v0++) {//L80301030
|
||||
(*vtx)->v.ob[0] = (((honeycomb_width * D_80381EFC) * tmp_v0 - (honeycomb_width * D_80381EFC) / 2) + f20) * 4.0f;
|
||||
(*vtx)->v.ob[1] = (((honeycomb_height * D_80381EFC) / 2 - (honeycomb_height * D_80381EFC) * tmp_v1) + f14) * 4.0f;
|
||||
(*vtx)->v.ob[2] = -0x14;
|
||||
(*vtx)->v.tc[0] = ((spEC - 1) *tmp_v0) << 6;
|
||||
(*vtx)->v.tc[1] = ((spE8 - 1) *tmp_v1) << 6;
|
||||
|
||||
(*vtx)->v.tc[0] = ((honeycomb_width - 1) * tmp_v0) << 6;
|
||||
(*vtx)->v.tc[1] = ((honeycomb_height - 1) * tmp_v1) << 6;
|
||||
(*vtx)++;
|
||||
}
|
||||
}
|
||||
|
||||
gSP1Quadrangle((*gfx)++, 0, 1, 3, 2, 0);
|
||||
}
|
||||
|
||||
gDPPipeSync((*gfx)++);
|
||||
gDPSetTextureLUT((*gfx)++, G_TT_NONE);
|
||||
gDPPipelineMode((*gfx)++, G_PM_NPRIMITIVE);
|
||||
@@ -140,7 +150,7 @@ void func_803012F8(void) {
|
||||
D_80381EF0 = 1;
|
||||
D_80381F28 = 0.0f;
|
||||
item_adjustByDiffWithHud(ITEM_14_HEALTH, 0);
|
||||
D_80381F04 = (f32) item_getCount(ITEM_14_HEALTH);
|
||||
gHealth = (f32) item_getCount(ITEM_14_HEALTH);
|
||||
}
|
||||
|
||||
|
||||
@@ -153,20 +163,20 @@ void fxhealthscore_update(enum item_e item_id, struct8s *arg1) {
|
||||
temp_f20 = time_getDelta();
|
||||
sp2C = func_802FB0D4(arg1);
|
||||
if (item_getCount(ITEM_15_HEALTH_TOTAL) >= 9) {
|
||||
D_80381F00 = 8;
|
||||
gTotalHealth = 8;
|
||||
} else {
|
||||
D_80381F00 = item_getCount(ITEM_15_HEALTH_TOTAL);
|
||||
gTotalHealth = item_getCount(ITEM_15_HEALTH_TOTAL);
|
||||
}
|
||||
|
||||
switch (D_80381EF0) {
|
||||
case 0:
|
||||
D_80381F04 = (f32) itemPrint_getValue(item_id);
|
||||
gHealth = (f32) itemPrint_getValue(item_id);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
D_80381F04 += temp_f20 * 10.0f;
|
||||
if (D_80381F00 <= D_80381F04) {
|
||||
D_80381F04 = D_80381F04 - D_80381F00;
|
||||
gHealth += temp_f20 * 10.0f;
|
||||
if (gTotalHealth <= gHealth) {
|
||||
gHealth = gHealth - gTotalHealth;
|
||||
}
|
||||
D_80381F28 += temp_f20;
|
||||
if (D_80381F28 > 2.5) {
|
||||
@@ -177,36 +187,38 @@ void fxhealthscore_update(enum item_e item_id, struct8s *arg1) {
|
||||
|
||||
case 2:
|
||||
if (sp2C != 1) {
|
||||
D_80381F04 += temp_f20 * 10.0f;
|
||||
if (D_80381F00 <= D_80381F04) {
|
||||
D_80381F04 = D_80381F04 - D_80381F00;
|
||||
gHealth += temp_f20 * 10.0f;
|
||||
if (gTotalHealth <= gHealth) {
|
||||
gHealth = gHealth - gTotalHealth;
|
||||
}
|
||||
}
|
||||
if (randf2(0.0f, 1.0f) < (1.0 / D_80381F00)) {
|
||||
if (D_80381F04 < 1.0f) {
|
||||
D_80381F04 =D_80381F04 + 1.0;
|
||||
if (randf2(0.0f, 1.0f) < (1.0 / gTotalHealth)) {
|
||||
if (gHealth < 1.0f) {
|
||||
gHealth =gHealth + 1.0;
|
||||
}
|
||||
if (item_getCount(ITEM_14_HEALTH) < D_80381F04) {
|
||||
if (item_getCount(ITEM_14_HEALTH) < gHealth) {
|
||||
func_8025A6EC(COMUSIC_2B_DING_B, 22000);
|
||||
}
|
||||
if (D_80381F04 < (f32) item_getCount(ITEM_14_HEALTH)) {
|
||||
if (gHealth < (f32) item_getCount(ITEM_14_HEALTH)) {
|
||||
func_8025A6EC(COMUSIC_2C_BUZZER, 22000);
|
||||
}
|
||||
item_set(ITEM_14_HEALTH, (s32) D_80381F04);
|
||||
item_set(ITEM_14_HEALTH, (s32) gHealth);
|
||||
D_80381EF0 = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch (sp2C) {
|
||||
case 2:
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (D_8036A910 == NULL) {
|
||||
D_8036A910 = assetcache_get(ASSET_7DD_SPRITE_HEALTH);
|
||||
if (gSpriteHealth == NULL) {
|
||||
gSpriteHealth = assetcache_get(ASSET_7DD_SPRITE_HEALTH);
|
||||
}
|
||||
if (D_8036A914 == NULL) {
|
||||
D_8036A914 = assetcache_get(0x7EA);
|
||||
|
||||
if (gSpriteRedHealth == NULL) {
|
||||
gSpriteRedHealth = assetcache_get(ASSET_7EA_SPRITE_RED_HEALTH);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -215,8 +227,8 @@ void fxhealthscore_update(enum item_e item_id, struct8s *arg1) {
|
||||
break;
|
||||
}
|
||||
if (sp2C) {
|
||||
for(var_s0 = 0; var_s0 < D_80381F00; var_s0++){
|
||||
if (func_803012B8(-15.0f, var_s0, D_80381F00)) {
|
||||
for(var_s0 = 0; var_s0 < gTotalHealth; var_s0++){
|
||||
if (func_803012B8(-15.0f, var_s0, gTotalHealth)) {
|
||||
D_80381F08[var_s0] = D_80381F08[var_s0] * 0.6;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user