documentation: core2/ba/physics

This commit is contained in:
Banjo Kazooie
2024-06-16 22:36:36 -05:00
parent 8fe5c3b4d1
commit 092de6aae3
208 changed files with 2342 additions and 2163 deletions

View File

@@ -2,11 +2,14 @@
#include "functions.h"
#include "variables.h"
#define AIRSCORE_COUNT (6)
#define FXAIRSCORE_SCALE (0.68f)
extern f32 func_802FB0E4(struct8s *);
/* .data */
BKSprite *D_8036A960 = NULL;
Gfx D_8036A968[] ={
static BKSprite *s_sprite = NULL;
static Gfx s_fxairscore_context[] ={
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),
gsSPSetGeometryMode(G_SHADE | G_TEXTURE_GEN_LINEAR | G_SHADING_SMOOTH),
@@ -18,12 +21,12 @@ Gfx D_8036A968[] ={
};
/* .bss */
s32 D_80381F50;
s32 s_freeze;
f32 D_80381F54;
f32 D_80381F58;
f32 D_80381F5C;
f32 D_80381F60;
f32 D_80381F68[6];
static f32 s_texture_scale;
static f32 s_active_count;
f32 D_80381F68[AIRSCORE_COUNT];
struct7s D_80381F80;
/* .code */
@@ -32,65 +35,67 @@ void func_803016F0(void) {
D_80381F58 = -272.0f;
D_80381F54 = 1.0f;
D_80381F50 = 0;
for(i = 0; i < 6; i++){
s_freeze = 0;
for(i = 0; i < AIRSCORE_COUNT; i++){
D_80381F68[i] = -64.0f;
}
}
void fxairscore_free(s32 arg0, struct8s *arg1) {
if (D_8036A960 != NULL) {
func_8033BD4C(D_8036A960);
D_8036A960 = NULL;
void fxairscore_free(s32 arg0, struct7s *arg1) {
if (s_sprite != NULL) {
func_8033BD4C(s_sprite);
s_sprite = NULL;
}
func_803016F0();
}
struct7s *fxairscore_new(s32 arg0) {
func_803016F0();
D_80381F5C = 0.68f;
s_texture_scale = FXAIRSCORE_SCALE;
return &D_80381F80;
}
void fxairscore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
f32 temp_f16;
f32 var_f14;
s32 spD4;
s32 spD0;
s32 var_s4;
f32 y;
f32 x;
s32 texture_width;
s32 texture_height;
s32 i_part;
s32 var_s6;
s32 var_v0;
s32 var_v1;
s32 v_x;
s32 v_y;
if (D_8036A960 != 0) {
gSPDisplayList((*gfx)++, D_8036A968);
func_80347FC0(gfx, D_8036A960, 0, 0, 0, 0, 0, 2, 2, &spD4, &spD0);
if (s_sprite != 0) {
gSPDisplayList((*gfx)++, s_fxairscore_context);
func_80347FC0(gfx, s_sprite, 0, 0, 0, 0, 0, 2, 2, &texture_width, &texture_height);
func_8024C7B8(gfx, mtx);
for(var_s4 = 0; var_s4 < 6; var_s4++){
if ((var_s4 != 0) && (var_s4 != 5)) {
var_s6 = (var_s4 & 1) ? var_s4 + 1 : var_s4 - 1;
//render all 6 air pieces
for(i_part = 0; i_part < AIRSCORE_COUNT; i_part++){
if ((i_part != 0) && (i_part != 5)) {
var_s6 = (i_part & 1) ? i_part + 1 : i_part - 1;
} else {
var_s6 = var_s4;
var_s6 = i_part;
}
gDPPipeSync((*gfx)++);
if ((f32) (5 - var_s4) < D_80381F60) {
if ((f32) (5 - i_part) < s_active_count) {
gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, 0xFF);
} else {
gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, 0x78);
}
temp_f16 = func_802FB0E4(arg1);
temp_f16 = (-40.0f + temp_f16);
var_f14 = (temp_f16 + D_80381F68[var_s6]) - ((f32) framebuffer_width / 2);
temp_f16 = (((var_s4 * 15.5) + 78.0) - ((f32) framebuffer_height / 2));
var_f14 = (var_s4 & 1) ? var_f14 + 5.0f : var_f14 - 5.0f;
x = func_802FB0E4(arg1);
x = ((-40 + x) + D_80381F68[var_s6]) - ((f32) framebuffer_width / 2);
y = ((78 + (i_part * 15.5)) - ((f32) framebuffer_height / 2));
//stagger x position
x = (i_part & 1) ? x + 5.0f : x - 5.0f;
gSPVertex((*gfx)++, *vtx, 4, 0);
for(var_v1 = 0; var_v1 < 2; var_v1++){
for(var_v0 = 0; var_v0 < 2; var_v0++){
(*vtx)->v.ob[0] = ((((spD4 * D_80381F5C) * (f32) var_v0) - ((spD4 * D_80381F5C) / 2)) + var_f14) * 4.0f;
(*vtx)->v.ob[1] = ((((spD0 * D_80381F5C) / 2) - ((spD0 * D_80381F5C) * ((f32)var_v1))) + temp_f16) * 4.0f;
for(v_y = 0; v_y < 2; v_y++){
for(v_x = 0; v_x < 2; v_x++){
(*vtx)->v.ob[0] = (x + (((texture_width * s_texture_scale) * v_x) - ((texture_width * s_texture_scale) / 2))) * 4.0f;
(*vtx)->v.ob[1] = (y + (((texture_height * s_texture_scale) / 2) - (texture_height * s_texture_scale) * v_y)) * 4.0f;
(*vtx)->v.ob[2] = -0x14;
(*vtx)->v.tc[0] = ((spD4 - 1) * var_v0) << 6;
(*vtx)->v.tc[1] = ((spD0 - 1) * var_v1) << 6;
(*vtx)->v.tc[0] = ((texture_width - 1) * v_x) << 6;
(*vtx)->v.tc[1] = ((texture_height - 1) * v_y) << 6;
(*vtx)++;
}
}
@@ -110,7 +115,7 @@ bool func_80301CE0(f32 arg0, s32 arg1, s32 arg2){
return arg0 < D_80381F68[arg1 + 1];
}
s32 func_80301D24(s32 time) {
s32 fxairscore_time_to_count(s32 time) {
s32 minutes;
s32 var_v0;
@@ -119,28 +124,28 @@ s32 func_80301D24(s32 time) {
return MIN(6, minutes);
}
s32 func_80301DBC(s32 minutes) {
return (s32) (minutes * 60 * 60) / 6;
s32 fxairscore_count_to_time(s32 count) {
return (s32) (count * 60 * 60) / 6;
}
void fxairscore_update(enum item_e arg0, struct7s *arg1) {
void fxairscore_update(enum item_e item_id, struct7s *arg1) {
s32 temp_s0;
s32 var_s0;
temp_s0 = func_802FB0D4(arg1);
if (D_80381F50 == 0) {
D_80381F60 = (f32) func_80301D24(itemPrint_getValue(arg0));
if (!s_freeze) {
s_active_count = (f32) fxairscore_time_to_count(itemPrint_getValue(item_id));
}
switch (temp_s0) {
case 2:
break;
case 1:
if (D_8036A960 == NULL) {
D_8036A960 = (BKSprite *)assetcache_get(ASSET_7E5_SPRITE_WATER_HONEYCOMB);
case 1: //load sprite
if (s_sprite == NULL) {
s_sprite = (BKSprite *)assetcache_get(ASSET_7E5_SPRITE_WATER_HONEYCOMB);
}
break;
case 0:
fxairscore_free(arg0, arg1);
fxairscore_free(item_id, arg1);
break;
}
if (temp_s0 != 0) {