mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-08-10 19:36:46 -04:00
WIP Compilation
This commit is contained in:
+36
-55
@@ -1,12 +1,11 @@
|
||||
#include <ultra64.h>
|
||||
#include <libultraship.h>
|
||||
#include <macros.h>
|
||||
#include <PR/os.h>
|
||||
#include <mk64.h>
|
||||
#include <sounds.h>
|
||||
#include <common_structs.h>
|
||||
#include <actor_types.h>
|
||||
#include <defines.h>
|
||||
#include <PR/gbi.h>
|
||||
#include <libultra/gbi.h>
|
||||
|
||||
#include "code_800029B0.h"
|
||||
#include "main.h"
|
||||
@@ -396,7 +395,7 @@ void func_802977E4(Player *arg0) {
|
||||
// Invert green and red on green shell texture
|
||||
void init_red_shell_texture(void) {
|
||||
s16 *red_shell_texture = (s16 *) &gTLUTRedShell[0];
|
||||
s16 *green_shell_texture = (s16 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[SEGMENT_NUMBER2(common_tlut_green_shell)] + SEGMENT_OFFSET(common_tlut_green_shell));
|
||||
s16 *green_shell_texture = (s16 *) common_tlut_green_shell;
|
||||
s16 color_pixel, red_color, green_color, blue_color, alpha_color;
|
||||
s32 i;
|
||||
for (i = 0; i < 256; i++) {
|
||||
@@ -469,10 +468,8 @@ void render_cows(Camera *camera, Mat4 arg1, UNUSED struct Actor *actor) {
|
||||
struct ActorSpawnData *var_s5;
|
||||
Vec3f sp88;
|
||||
u32 soundThing = SOUND_ARG_LOAD(0x19, 0x01, 0x90, 0x4D);
|
||||
s32 segment = SEGMENT_NUMBER2(d_course_moo_moo_farm_cow_spawn);
|
||||
s32 offset = SEGMENT_OFFSET(d_course_moo_moo_farm_cow_spawn);
|
||||
|
||||
var_t1 = (struct ActorSpawnData*)VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
var_t1 = d_course_moo_moo_farm_cow_spawn;
|
||||
D_8015F704 = 6.4e7f;
|
||||
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
|
||||
@@ -537,9 +534,7 @@ void render_cows(Camera *camera, Mat4 arg1, UNUSED struct Actor *actor) {
|
||||
|
||||
void evaluate_collision_player_palm_trees(Player *player) {
|
||||
Vec3f pos;
|
||||
s32 segment = SEGMENT_NUMBER2(d_course_dks_jungle_parkway_tree_spawn);
|
||||
s32 offset = SEGMENT_OFFSET(d_course_dks_jungle_parkway_tree_spawn);
|
||||
struct UnkActorSpawnData *data = (struct UnkActorSpawnData *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
struct UnkActorSpawnData *data = d_course_dks_jungle_parkway_tree_spawn;
|
||||
|
||||
while (data->pos[0] != END_OF_SPAWN_DATA) {
|
||||
pos[0] = data->pos[0] * gCourseDirection;
|
||||
@@ -572,9 +567,7 @@ void evaluate_collision_players_palm_trees(void) {
|
||||
}
|
||||
|
||||
void func_80298D10(void) {
|
||||
s32 segment = SEGMENT_NUMBER2(d_course_dks_jungle_parkway_tree_spawn);
|
||||
s32 offset = SEGMENT_OFFSET(d_course_dks_jungle_parkway_tree_spawn);
|
||||
struct UnkActorSpawnData *temp_v1 = (struct UnkActorSpawnData *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
struct UnkActorSpawnData *temp_v1 = d_course_dks_jungle_parkway_tree_spawn;
|
||||
|
||||
while (temp_v1->pos[0] != END_OF_SPAWN_DATA) {
|
||||
temp_v1->pos[1] = temp_v1->unk8;
|
||||
@@ -584,9 +577,7 @@ void func_80298D10(void) {
|
||||
}
|
||||
|
||||
void render_palm_trees(Camera *camera, Mat4 arg1, UNUSED struct Actor *actor) {
|
||||
s32 segment = SEGMENT_NUMBER2(d_course_dks_jungle_parkway_tree_spawn);
|
||||
s32 offset = SEGMENT_OFFSET(d_course_dks_jungle_parkway_tree_spawn);
|
||||
struct UnkActorSpawnData *var_s1 = (struct UnkActorSpawnData *)VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
struct UnkActorSpawnData *var_s1 = d_course_dks_jungle_parkway_tree_spawn;
|
||||
UNUSED s32 pad;
|
||||
Vec3f spD4;
|
||||
f32 var_f22;
|
||||
@@ -803,9 +794,7 @@ UNUSED void func_8029AE14() {
|
||||
#include "actors/falling_rock/render.inc.c"
|
||||
|
||||
void spawn_piranha_plants(struct ActorSpawnData *spawnData) {
|
||||
s32 segment = SEGMENT_NUMBER2(spawnData);
|
||||
s32 offset = SEGMENT_OFFSET(spawnData);
|
||||
struct ActorSpawnData *temp_s0 = (struct ActorSpawnData *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
struct ActorSpawnData *temp_s0 = spawnData;
|
||||
struct PiranhaPlant *temp_v1;
|
||||
UNUSED s32 pad;
|
||||
Vec3f startingPos;
|
||||
@@ -835,9 +824,7 @@ void spawn_piranha_plants(struct ActorSpawnData *spawnData) {
|
||||
}
|
||||
|
||||
void spawn_palm_trees(struct ActorSpawnData *spawnData) {
|
||||
s32 segment = SEGMENT_NUMBER2(spawnData);
|
||||
s32 offset = SEGMENT_OFFSET(spawnData);
|
||||
struct ActorSpawnData *temp_s0 = (struct ActorSpawnData *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
struct ActorSpawnData *temp_s0 = spawnData;
|
||||
struct PalmTree *temp_v1;
|
||||
Vec3f startingPos;
|
||||
Vec3f startingVelocity;
|
||||
@@ -873,10 +860,8 @@ void spawn_foliage(struct ActorSpawnData *arg0) {
|
||||
s16 actorType;
|
||||
struct Actor *temp_s0;
|
||||
struct ActorSpawnData *var_s3;
|
||||
s32 segment = SEGMENT_NUMBER2(arg0);
|
||||
s32 offset = SEGMENT_OFFSET(arg0);
|
||||
|
||||
var_s3 = (struct ActorSpawnData *)VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
var_s3 = arg0;
|
||||
vec3f_set(velocity, 0.0f, 0.0f, 0.0f);
|
||||
rotation[0] = 0x4000;
|
||||
rotation[1] = 0;
|
||||
@@ -946,14 +931,12 @@ void spawn_foliage(struct ActorSpawnData *arg0) {
|
||||
}
|
||||
|
||||
void spawn_all_item_boxes(struct ActorSpawnData *spawnData) {
|
||||
s32 segment = SEGMENT_NUMBER2(spawnData);
|
||||
s32 offset = SEGMENT_OFFSET(spawnData);
|
||||
s16 temp_s1;
|
||||
f32 temp_f0;
|
||||
Vec3f startingPos;
|
||||
Vec3f startingVelocity;
|
||||
Vec3s startingRot;
|
||||
struct ActorSpawnData *temp_s0 = (struct ActorSpawnData *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
struct ActorSpawnData *temp_s0 = spawnData;
|
||||
//struct ItemBox *itemBox;
|
||||
|
||||
if ((gModeSelection == TIME_TRIALS) || (gPlaceItemBoxes == 0)) { return; }
|
||||
@@ -1157,7 +1140,7 @@ void spawn_course_actors(void) {
|
||||
/**
|
||||
* @brief Loads actor textures, course specific actor textures.
|
||||
* Calls to init_course_vehicles and place_course_actors
|
||||
*
|
||||
*
|
||||
*/
|
||||
void init_actors_and_load_textures(void) {
|
||||
set_segment_base_addr(3, (void *) gNextFreeMemoryAddress);
|
||||
@@ -1448,10 +1431,8 @@ struct test {
|
||||
UNUSED void prototype_actor_spawn_data(Player *player, uintptr_t arg1) {
|
||||
Vec3f sp64;
|
||||
struct test *var_s0;
|
||||
s32 segment = SEGMENT_NUMBER2(arg1);
|
||||
s32 offset = SEGMENT_OFFSET(arg1);
|
||||
|
||||
var_s0 = (struct test *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
var_s0 = (struct test *) arg1;
|
||||
while (var_s0->thing[0] != END_OF_SPAWN_DATA) {
|
||||
sp64[0] = var_s0->thing[0] * gCourseDirection;
|
||||
sp64[1] = var_s0->thing[1];
|
||||
@@ -1555,9 +1536,9 @@ bool collision_mario_sign(Player *player, struct Actor *marioRacewaySign) {
|
||||
func_800C9060(player - gPlayerOne, SOUND_ARG_LOAD(0x19, 0x00, 0x70, 0x1A));
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool collision_piranha_plant(Player *player, struct PiranhaPlant *plant) {
|
||||
@@ -1571,9 +1552,9 @@ bool collision_piranha_plant(Player *player, struct PiranhaPlant *plant) {
|
||||
func_800C9060(player - gPlayerOne, SOUND_ARG_LOAD(0x19, 0x00, 0xA0, 0x52));
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool collision_yoshi_egg(Player *player, struct YoshiValleyEgg *egg) {
|
||||
@@ -1588,34 +1569,34 @@ bool collision_yoshi_egg(Player *player, struct YoshiValleyEgg *egg) {
|
||||
|
||||
x_dist = egg->pos[0] - player->pos[0];
|
||||
if ((x_dist < minDist) && (x_dist < -maxDist)) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if (x_dist > maxDist) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
z_dist = egg->pos[2] - player->pos[2];
|
||||
if ((z_dist < minDist) && (z_dist < -maxDist)) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if (z_dist > maxDist) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
xz_dist = sqrtf((x_dist * x_dist) + (z_dist * z_dist));
|
||||
if (xz_dist > maxDist) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
func_802977B0(player);
|
||||
|
||||
y_dist = player->pos[1] - egg->pos[1];
|
||||
if (y_dist < minDist) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
totalBox = player->boundingBoxSize + egg->boundingBoxSize;
|
||||
if (totalBox < xz_dist) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((player->type & PLAYER_HUMAN) != 0) {
|
||||
@@ -1634,7 +1615,7 @@ bool collision_yoshi_egg(Player *player, struct YoshiValleyEgg *egg) {
|
||||
apply_hit_sound_effect(player, player - gPlayerOne);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool collision_tree(Player *player, struct Actor *actor) {
|
||||
@@ -1654,33 +1635,33 @@ bool collision_tree(Player *player, struct Actor *actor) {
|
||||
var_f16 = actor->unk_08;
|
||||
x_dist = actor->pos[0] - player->pos[0];
|
||||
if ((x_dist < 0.0f) && (x_dist < -var_f16)) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if (var_f16 < x_dist) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
z_dist = actor->pos[2] - player->pos[2];
|
||||
if ((z_dist < 0.0f) && (z_dist < -var_f16)) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if (var_f16 < z_dist) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
y_dist = player->pos[1] - actor->pos[1];
|
||||
if (y_dist < 0.0f) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if ((f32) actor->state < y_dist) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
xz_dist = sqrtf((x_dist * x_dist) + (z_dist * z_dist));
|
||||
if (var_f16 < xz_dist) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
func_802977B0(player);
|
||||
var_f16 = player->boundingBoxSize + actor->boundingBoxSize;
|
||||
if (var_f16 < xz_dist) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
sp48 = player->velocity[0];
|
||||
sp44 = player->velocity[2];
|
||||
@@ -1689,7 +1670,7 @@ bool collision_tree(Player *player, struct Actor *actor) {
|
||||
actor->flags |= 0x400;
|
||||
func_800C98B8(player->pos, player->velocity, SOUND_ARG_LOAD(0x19, 0x01, 0x80, 0x10));
|
||||
func_800C90F4(player - gPlayerOne, (player->characterId * 0x10) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x0D));
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
if (!(player->type & PLAYER_INVISIBLE_OR_BOMB)) {
|
||||
func_800C9060(player - gPlayerOne, SOUND_ARG_LOAD(0x19, 0x00, 0x70, 0x18));
|
||||
@@ -1720,7 +1701,7 @@ bool collision_tree(Player *player, struct Actor *actor) {
|
||||
player->pos[2] = actorPos[2] - (z_dist * var_f16 * 1.2f);
|
||||
player->velocity[0] = 0;
|
||||
player->velocity[2] = 0;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
temp_f12 = ((x_dist * sp48) + (z_dist * sp44)) / temp_f0_4;
|
||||
temp_f12 = temp_f0_4 * temp_f12 * 1.5f;
|
||||
@@ -1730,7 +1711,7 @@ bool collision_tree(Player *player, struct Actor *actor) {
|
||||
player->pos[0] += x_dist * temp_f2 * 0.5f;
|
||||
player->pos[2] += z_dist * temp_f2 * 0.5f;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool query_collision_player_vs_actor_item(Player *arg0, struct Actor *arg1) {
|
||||
|
||||
+7
-7
@@ -83,13 +83,13 @@ void destroy_actor(struct Actor*);
|
||||
s16 try_remove_destructable_item(Vec3f, Vec3s, Vec3f, s16);
|
||||
s16 add_actor_to_empty_slot(Vec3f, Vec3s, Vec3f, s16);
|
||||
s16 spawn_actor_at_pos(Vec3f, s16);
|
||||
s32 query_and_resolve_collision_player_actor(Player*, Vec3f, f32, f32, f32);
|
||||
s32 collision_mario_sign(Player*, struct Actor*);
|
||||
s32 collision_piranha_plant(Player*, struct PiranhaPlant*);
|
||||
s32 collision_yoshi_egg(Player*, struct YoshiValleyEgg*);
|
||||
s32 collision_tree(Player*, struct Actor*);
|
||||
s32 query_collision_player_vs_actor_item(Player*, struct Actor*);
|
||||
s32 query_collision_actor_vs_actor(struct Actor*, struct Actor*);
|
||||
bool query_and_resolve_collision_player_actor(Player*, Vec3f, f32, f32, f32);
|
||||
bool collision_mario_sign(Player*, struct Actor*);
|
||||
bool collision_piranha_plant(Player*, struct PiranhaPlant*);
|
||||
bool collision_yoshi_egg(Player*, struct YoshiValleyEgg*);
|
||||
bool collision_tree(Player*, struct Actor*);
|
||||
bool query_collision_player_vs_actor_item(Player*, struct Actor*);
|
||||
bool query_collision_actor_vs_actor(struct Actor*, struct Actor*);
|
||||
void destroy_destructable_actor(struct Actor*);
|
||||
void play_sound_on_destructible_actor_collision(struct Actor*, struct Actor*);
|
||||
void evaluate_actor_collision_between_two_destructible_actors(struct Actor*, struct Actor*);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <ultra64.h>
|
||||
#include <libultraship.h>
|
||||
#include <macros.h>
|
||||
#include <defines.h>
|
||||
#include <actor_types.h>
|
||||
@@ -315,19 +315,19 @@ void update_actor_banana_bunch(struct BananaBunchParent *banana_bunch) {
|
||||
bool is_shell_exist(s16 arg0) {
|
||||
struct ShellActor *actor;
|
||||
if (arg0 < 0) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
actor = (struct ShellActor*) &gActorList[arg0];
|
||||
if (actor->type == ACTOR_GREEN_SHELL) {
|
||||
if (actor->state == TRIPLE_GREEN_SHELL) {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
if (actor->state == TRIPLE_RED_SHELL) {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
void update_actor_triple_shell(TripleShellParent *parent, s16 shellType) {
|
||||
@@ -606,12 +606,12 @@ s32 use_green_shell_item(Player *player) {
|
||||
|
||||
// rotate to match player orientation
|
||||
mtxf_translate_vec3f_mat3(startingPos, player->orientationMatrix);
|
||||
|
||||
|
||||
// move to player position
|
||||
startingPos[0] += player->pos[0];
|
||||
startingPos[1] += player->pos[1];
|
||||
startingPos[2] += player->pos[2];
|
||||
|
||||
|
||||
// spawn the shell
|
||||
actorIndex = add_actor_to_empty_slot(startingPos, startingRot, startingVelocity, ACTOR_GREEN_SHELL);
|
||||
if (actorIndex < 0) {
|
||||
@@ -848,8 +848,8 @@ s32 use_banana_item(Player *player) {
|
||||
|
||||
/**
|
||||
* Strikes players with thunder
|
||||
*
|
||||
* @param Activating player (not to be struck)
|
||||
*
|
||||
* @param Activating player (not to be struck)
|
||||
*/
|
||||
void use_thunder_item(Player *player) {
|
||||
s32 index;
|
||||
@@ -932,7 +932,7 @@ void check_player_use_item(void) {
|
||||
|
||||
for (player = &gPlayers[0], loopController = &gControllers[0], target = &gControllers[4]; loopController != target; player++, loopController++) {
|
||||
controller = loopController;
|
||||
if (prevent_item_use(player) == FALSE) {
|
||||
if (prevent_item_use(player) == false) {
|
||||
if((player->type & PLAYER_INVISIBLE_OR_BOMB) != 0){
|
||||
if ((player - gPlayerTwo) == 0) {
|
||||
controller = gControllerSix;
|
||||
|
||||
+67
-82
@@ -1,6 +1,6 @@
|
||||
#include <ultra64.h>
|
||||
#include <libultraship.h>
|
||||
#include <macros.h>
|
||||
#include <PR/gbi.h>
|
||||
#include <libultra/gbi.h>
|
||||
#include <mk64.h>
|
||||
#include <common_structs.h>
|
||||
#include <actor_types.h>
|
||||
@@ -10,16 +10,11 @@
|
||||
#include "math_util.h"
|
||||
#include "code_800029B0.h"
|
||||
|
||||
#pragma intrinsic (sqrtf)
|
||||
|
||||
// Used to delete the choco mountain guard rail
|
||||
void nullify_displaylist(uintptr_t addr) {
|
||||
s32 segment = SEGMENT_NUMBER2(addr);
|
||||
s32 offset = SEGMENT_OFFSET(addr);
|
||||
|
||||
Gfx *macro;
|
||||
|
||||
macro = (Gfx *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
macro = (Gfx *) addr;
|
||||
macro->words.w0 = (G_ENDDL << 24);
|
||||
macro->words.w1 = 0;
|
||||
}
|
||||
@@ -127,7 +122,7 @@ s32 func_802AAE4C(Collision *collision, f32 boundingBoxSize, f32 posX, f32 posY,
|
||||
f32 temp_f10;
|
||||
f32 temp_f0_3;
|
||||
f32 temp_f2_2;
|
||||
s32 bool = 1;
|
||||
s32 flag = 1;
|
||||
|
||||
if (surfaceMap->gravity < -0.9f)
|
||||
return 0;
|
||||
@@ -160,7 +155,7 @@ s32 func_802AAE4C(Collision *collision, f32 boundingBoxSize, f32 posX, f32 posY,
|
||||
temp_f2_2 = (z3 - posZ) * (x1 - posX) - (x3 - posX) * (z1 - posZ);
|
||||
|
||||
if ((temp_f0_3 * temp_f2_2) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -170,22 +165,22 @@ s32 func_802AAE4C(Collision *collision, f32 boundingBoxSize, f32 posX, f32 posY,
|
||||
temp_f2_2 = (z3 - posZ) * (x1 - posX) - (x3 - posX) * (z1 - posZ);
|
||||
|
||||
if ((temp_f10 * temp_f2_2) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
} else {
|
||||
if ((temp_f10 * temp_f0_3) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
} else {
|
||||
temp_f2_2 = (z3 - posZ) * (x1 - posX) - (x3 - posX) * (z1 - posZ);
|
||||
if (temp_f2_2 != 0) {
|
||||
if ((temp_f0_3 * temp_f2_2) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!bool) {
|
||||
if (!flag) {
|
||||
return 0;
|
||||
}
|
||||
temp_f0_5 = ((surfaceMap->height * posX) + (surfaceMap->gravity * posY) + (surfaceMap->rotation * posZ)
|
||||
@@ -222,7 +217,7 @@ s32 func_802AB288(Collision *collision, f32 boundingBoxSize, f32 posX, f32 posY,
|
||||
f32 x3;
|
||||
f32 y3;
|
||||
UNUSED f32 pad2[1];
|
||||
|
||||
|
||||
UNUSED f32 pad3[5];
|
||||
f32 x2;
|
||||
f32 y2;
|
||||
@@ -232,7 +227,7 @@ s32 func_802AB288(Collision *collision, f32 boundingBoxSize, f32 posX, f32 posY,
|
||||
f32 temp_f2_2;
|
||||
f32 temp_f0_2;
|
||||
f32 temp_f2_3;
|
||||
s32 bool = 1;
|
||||
s32 flag = 1;
|
||||
|
||||
if (surfaceMap->vtx31 > posX) {
|
||||
return 0;
|
||||
@@ -272,29 +267,29 @@ s32 func_802AB288(Collision *collision, f32 boundingBoxSize, f32 posX, f32 posY,
|
||||
temp_f2_3 = (y3 - posY) * (x1 - posX) - (x3 - posX) * (y1 - posY);
|
||||
|
||||
if ((temp_f0_2 * temp_f2_3) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
} else {
|
||||
temp_f0_2 = (y2 - posY) * (x3 - posX) - (x2 - posX) * (y3 - posY);
|
||||
if (!temp_f0_2) {
|
||||
temp_f2_3 = (y3 - posY) * (x1 - posX) - (x3 - posX) * (y1 - posY);
|
||||
if (temp_f2_2 * temp_f2_3 < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
} else {
|
||||
if ((temp_f2_2 * temp_f0_2) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
} else {
|
||||
temp_f2_3 = ((y3 - posY) * (x1 - posX)) - ((x3 - posX) * (y1 - posY));
|
||||
if (temp_f2_3 != 0) {
|
||||
if ((temp_f0_2 * temp_f2_3) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!bool) {
|
||||
if (!flag) {
|
||||
return 0;
|
||||
}
|
||||
temp_f0_4 = ((surfaceMap->height * posX) + (surfaceMap->gravity * posY) + (surfaceMap->rotation * posZ) + surfaceMap->height2) - boundingBoxSize;
|
||||
@@ -325,7 +320,7 @@ s32 func_802AB288(Collision *collision, f32 boundingBoxSize, f32 posX, f32 posY,
|
||||
|
||||
s32 func_802AB6C4(Collision *collision, f32 boundingBoxSize, f32 posX, f32 posY, f32 posZ, u16 index) {
|
||||
mk64_surface_map_ram *surfaceMap = &gSurfaceMap[index];
|
||||
s32 bool = 1;
|
||||
bool flag = 1;
|
||||
UNUSED f32 pad[7];
|
||||
f32 sp20;
|
||||
f32 temp_f8;
|
||||
@@ -375,7 +370,7 @@ s32 func_802AB6C4(Collision *collision, f32 boundingBoxSize, f32 posX, f32 posY,
|
||||
temp_f2_3 = ((sp20 - posY) * (sp24 - posZ)) - ((temp_f8 - posZ) * (temp_f4 - posY));
|
||||
|
||||
if ((temp_f0_2 * temp_f2_3) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -385,23 +380,23 @@ s32 func_802AB6C4(Collision *collision, f32 boundingBoxSize, f32 posX, f32 posY,
|
||||
temp_f2_3 = ((sp20 - posY) * (sp24 - posZ)) - ((temp_f8 - posZ) * (temp_f4 - posY));
|
||||
|
||||
if ((temp_f2_2 * temp_f2_3) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
} else {
|
||||
|
||||
if ((temp_f2_2 * temp_f0_2) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
} else {
|
||||
temp_f2_3 = ((sp20 - posY) * (sp24 - posZ)) - ((temp_f8 - posZ) * (temp_f4 - posY));
|
||||
if (temp_f2_3 != 0) {
|
||||
if ((temp_f0_2 * temp_f2_3) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!bool) {
|
||||
if (!flag) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -447,7 +442,7 @@ s32 func_802ABB04(f32 posX, f32 posZ, u16 index) {
|
||||
f32 temp_f2_2;
|
||||
f32 temp_f2_3;
|
||||
f32 temp_f0_2;
|
||||
s32 bool = 1;
|
||||
s32 flag = 1;
|
||||
|
||||
x1 = surfaceMap->vtxPoly1->v.ob[0];
|
||||
z1 = surfaceMap->vtxPoly1->v.ob[2];
|
||||
@@ -467,29 +462,29 @@ s32 func_802ABB04(f32 posX, f32 posZ, u16 index) {
|
||||
temp_f2_3 = (z3 - posZ) * (x1 - posX) - (x3 - posX) * (z1 - posZ);
|
||||
|
||||
if ((temp_f0_2 * temp_f2_3) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
} else {
|
||||
temp_f0_2 = (z2 - posZ) * (x3 - posX) - (x2 - posX) * (z3 - posZ);
|
||||
if (!temp_f0_2) {
|
||||
temp_f2_3 = (z3 - posZ) * (x1 - posX) - (x3 - posX) * (z1 - posZ);
|
||||
if (temp_f2_2 * temp_f2_3 < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
} else {
|
||||
if ((temp_f2_2 * temp_f0_2) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
} else {
|
||||
temp_f2_3 = ((z3 - posZ) * (x1 - posX)) - ((x3 - posX) * (z1 - posZ));
|
||||
if (temp_f2_3 != 0) {
|
||||
if ((temp_f0_2 * temp_f2_3) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return bool;
|
||||
return flag;
|
||||
}
|
||||
|
||||
s8 get_surface_type(u16 index) {
|
||||
@@ -777,7 +772,7 @@ s32 is_colliding_with_drivable_surface(Collision *collision, f32 boundingBoxSize
|
||||
f32 area;
|
||||
f32 area2;
|
||||
f32 area3;
|
||||
s32 bool = 1;
|
||||
s32 flag = 1;
|
||||
|
||||
if (tile->vtx31 > x1) {
|
||||
return 0;
|
||||
@@ -810,7 +805,7 @@ s32 is_colliding_with_drivable_surface(Collision *collision, f32 boundingBoxSize
|
||||
area2 = (z3 - z1) * (x4 - x1) - (x3 - x1) * (z4 - z1);
|
||||
area3 = (z4 - z1) * (x2 - x1) - (x4 - x1) * (z2 - z1);
|
||||
if (area2 * area3 < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -822,22 +817,22 @@ s32 is_colliding_with_drivable_surface(Collision *collision, f32 boundingBoxSize
|
||||
area3 = (z4 - z1) * (x2 - x1) - (x4 - x1) * (z2 - z1);
|
||||
|
||||
if (area * area3 < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
} else {
|
||||
if ((area * area2) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
} else {
|
||||
area3 = (z4- z1) * (x2 - x1) - (x4 - x1) * (z2 - z1);
|
||||
if (area3 != 0) {
|
||||
if (area2 * area3 < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bool == 0) {
|
||||
if (flag == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -884,11 +879,11 @@ s32 is_colliding_with_wall2(Collision *arg, f32 boundingBoxSize, f32 x1, f32 y1,
|
||||
UNUSED s32 pad2[3];
|
||||
f32 temp_f0_4;
|
||||
f32 temp_f4_2;
|
||||
UNUSED s32 pad3[2];
|
||||
UNUSED s32 pad3[2];
|
||||
f32 area;
|
||||
f32 area2;
|
||||
f32 area3;
|
||||
s32 bool = 1;
|
||||
s32 flag = 1;
|
||||
if (tile->vtx31 > x1) {
|
||||
return 0;
|
||||
}
|
||||
@@ -925,7 +920,7 @@ s32 is_colliding_with_wall2(Collision *arg, f32 boundingBoxSize, f32 x1, f32 y1,
|
||||
|
||||
|
||||
if (area2 * area3 < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -936,23 +931,23 @@ s32 is_colliding_with_wall2(Collision *arg, f32 boundingBoxSize, f32 x1, f32 y1,
|
||||
|
||||
|
||||
if ((area * area3) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
} else {
|
||||
if ((area * area2) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
} else {
|
||||
area3 = (y4 - y1) * (x2 - x1) - (x4 - x1) * (y2 - y1);
|
||||
|
||||
if (area3 != 0) {
|
||||
if ((area2 * area3) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bool == 0) {
|
||||
if (flag == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1054,7 +1049,7 @@ s32 is_colliding_with_wall2(Collision *arg, f32 boundingBoxSize, f32 x1, f32 y1,
|
||||
*/
|
||||
s32 is_colliding_with_wall1(Collision *arg, f32 boundingBoxSize, f32 x1, f32 y1, f32 z1, u16 arg5, f32 arg6, f32 arg7, f32 arg8) {
|
||||
mk64_surface_map_ram *tile = &gSurfaceMap[arg5];
|
||||
s32 bool = 1;
|
||||
s32 flag = 1;
|
||||
UNUSED s32 pad[7];
|
||||
f32 y4;
|
||||
f32 z4;
|
||||
@@ -1065,7 +1060,7 @@ s32 is_colliding_with_wall1(Collision *arg, f32 boundingBoxSize, f32 x1, f32 y1,
|
||||
UNUSED s32 pad3[2];
|
||||
f32 temp_f0_4;
|
||||
f32 temp_f4_2;
|
||||
UNUSED s32 pad4[2];
|
||||
UNUSED s32 pad4[2];
|
||||
f32 area;
|
||||
f32 area2;
|
||||
f32 area3;
|
||||
@@ -1106,7 +1101,7 @@ s32 is_colliding_with_wall1(Collision *arg, f32 boundingBoxSize, f32 x1, f32 y1,
|
||||
|
||||
|
||||
if (area2 * area3 < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1117,23 +1112,23 @@ s32 is_colliding_with_wall1(Collision *arg, f32 boundingBoxSize, f32 x1, f32 y1,
|
||||
|
||||
|
||||
if ((area * area3) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
} else {
|
||||
if ((area * area2) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
} else {
|
||||
area3 = (y4 - y1) * (z2 - z1) - (z4 - z1) * (y2 - y1);
|
||||
|
||||
if (area3 != 0) {
|
||||
if ((area2 * area3) < 0.0f) {
|
||||
bool = 0;
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bool == 0) {
|
||||
if (flag == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1246,7 +1241,7 @@ u16 func_802AD950(Collision *collision, f32 boundingBoxSize, f32 x1, f32 y1, f32
|
||||
u16 flags = 0;
|
||||
s32 temp1;
|
||||
s32 temp2;
|
||||
|
||||
|
||||
u16 i;
|
||||
|
||||
collision->unk30 = 0;
|
||||
@@ -1341,7 +1336,7 @@ u16 func_802AD950(Collision *collision, f32 boundingBoxSize, f32 x1, f32 y1, f32
|
||||
}
|
||||
}
|
||||
phi_s2++;
|
||||
|
||||
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
@@ -1386,7 +1381,7 @@ u16 func_802ADDC8(Collision* collision, f32 boundingBoxSize, f32 posX, f32 posY,
|
||||
if (var_s4 == (0x4000 | 0x2000 | 0x8000)) {
|
||||
return var_s4;
|
||||
}
|
||||
|
||||
|
||||
temp_f4 = (s32) gCourseMaxX - gCourseMinX;
|
||||
temp_f6 = (s32) gCourseMaxZ - gCourseMinZ;
|
||||
|
||||
@@ -1396,7 +1391,7 @@ u16 func_802ADDC8(Collision* collision, f32 boundingBoxSize, f32 posX, f32 posY,
|
||||
temp_f10 = (posX - gCourseMinX) / temp1;
|
||||
temp_f16 = (posZ - gCourseMinZ) / temp2;
|
||||
|
||||
|
||||
|
||||
if (temp_f10 < 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1577,10 +1572,10 @@ void func_802AE434(Vtx *vtx1, Vtx *vtx2, Vtx *vtx3, s8 surfaceType, u16 sectionI
|
||||
tile->vtxPoly1 = vtx1;
|
||||
tile->vtxPoly2 = vtx2;
|
||||
tile->vtxPoly3 = vtx3;
|
||||
if ((tile->vtxPoly1->v.flag == 4) &&
|
||||
(tile->vtxPoly2->v.flag == 4) &&
|
||||
if ((tile->vtxPoly1->v.flag == 4) &&
|
||||
(tile->vtxPoly2->v.flag == 4) &&
|
||||
(tile->vtxPoly3->v.flag == 4)) {
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1680,7 +1675,7 @@ void func_802AE434(Vtx *vtx1, Vtx *vtx2, Vtx *vtx3, s8 surfaceType, u16 sectionI
|
||||
if (maxZ > gCourseMaxZ) {
|
||||
gCourseMaxZ = maxZ;
|
||||
}
|
||||
|
||||
|
||||
tile->height = normalX;
|
||||
tile->gravity = normalY;
|
||||
tile->rotation = normalZ;
|
||||
@@ -1782,7 +1777,7 @@ void set_vtx_from_quadrangle(u32 line, s8 surfaceType, u16 sectionId) {
|
||||
vtx2 = vtxBuffer[vert2];
|
||||
vtx3 = vtxBuffer[vert3];
|
||||
vtx4 = vtxBuffer[vert4];
|
||||
|
||||
|
||||
// Triangle 1
|
||||
func_802AE434(vtx1, vtx2, vtx3, surfaceType, sectionId);
|
||||
// Triangle 2
|
||||
@@ -1794,9 +1789,7 @@ void set_vtx_from_quadrangle(u32 line, s8 surfaceType, u16 sectionId) {
|
||||
*/
|
||||
void set_vtx_buffer(uintptr_t addr, u32 numVertices, u32 bufferIndex) {
|
||||
u32 i;
|
||||
u32 segment = SEGMENT_NUMBER2(addr);
|
||||
u32 offset = SEGMENT_OFFSET(addr);
|
||||
Vtx *vtx = (Vtx *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
Vtx *vtx = (Vtx *) addr;
|
||||
for (i = 0; i < numVertices; i++) {
|
||||
vtxBuffer[bufferIndex] = vtx;
|
||||
vtx++;
|
||||
@@ -1986,7 +1979,7 @@ void set_vertex_data_with_default_section_id(Gfx *gfx, s8 surfaceType) {
|
||||
extern u32 D_8015F58C;
|
||||
|
||||
/**
|
||||
* Recursive search and set for vertex data
|
||||
* Recursive search and set for vertex data
|
||||
*/
|
||||
void find_and_set_vertex_data(Gfx *addr, s8 surfaceType, u16 sectionId) {
|
||||
s32 opcode;
|
||||
@@ -1994,9 +1987,7 @@ void find_and_set_vertex_data(Gfx *addr, s8 surfaceType, u16 sectionId) {
|
||||
uintptr_t hi;
|
||||
s32 i;
|
||||
|
||||
s32 segment = SEGMENT_NUMBER2(addr);
|
||||
s32 offset = SEGMENT_OFFSET(addr);
|
||||
Gfx *gfx = (Gfx *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
Gfx *gfx = (Gfx *) addr;
|
||||
D_8015F6FA = 0;
|
||||
D_8015F6FC = 0;
|
||||
|
||||
@@ -2036,15 +2027,13 @@ void find_and_set_vertex_data(Gfx *addr, s8 surfaceType, u16 sectionId) {
|
||||
* Search for G_SETTILESIZE and set its args.
|
||||
*/
|
||||
void find_and_set_tile_size(uintptr_t addr, s32 uls, s32 ult) {
|
||||
u32 segment = SEGMENT_NUMBER2(addr);
|
||||
u32 offset = SEGMENT_OFFSET(addr);
|
||||
Gfx *gfx = (Gfx *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
Gfx *gfx = (Gfx *) addr;
|
||||
u32 opcode;
|
||||
|
||||
uls = (uls << 12) & 0xFFF000;
|
||||
ult &= 0xFFF;
|
||||
|
||||
while(TRUE) {
|
||||
while(true) {
|
||||
|
||||
opcode = GFX_GET_OPCODE(gfx->words.w0);
|
||||
|
||||
@@ -2060,10 +2049,8 @@ void find_and_set_tile_size(uintptr_t addr, s32 uls, s32 ult) {
|
||||
}
|
||||
|
||||
void set_vertex_colours(uintptr_t addr, u32 vertexCount, UNUSED s32 vert3, s8 alpha, u8 red, u8 green, u8 blue) {
|
||||
s32 segment = SEGMENT_NUMBER2(addr);
|
||||
s32 offset = SEGMENT_OFFSET(addr);
|
||||
s32 i;
|
||||
Vtx *vtx = (Vtx *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
Vtx *vtx = (Vtx *) addr;
|
||||
|
||||
for (i = 0; (u32)i < vertexCount; i++) {
|
||||
if (red) {
|
||||
@@ -2080,14 +2067,12 @@ void set_vertex_colours(uintptr_t addr, u32 vertexCount, UNUSED s32 vert3, s8 al
|
||||
* Recursive search for vertices and set their colour values.
|
||||
*/
|
||||
void find_vtx_and_set_colours(uintptr_t displayList, s8 alpha, u8 red, u8 green, u8 blue) {
|
||||
s32 segment = SEGMENT_NUMBER2(displayList);
|
||||
s32 offset = SEGMENT_OFFSET(displayList);
|
||||
Gfx *gfx = (Gfx *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
Gfx *gfx = (Gfx *) displayList;
|
||||
uintptr_t lo;
|
||||
uintptr_t hi;
|
||||
s32 opcode;
|
||||
|
||||
while(TRUE) {
|
||||
while(true) {
|
||||
lo = gfx->words.w0;
|
||||
hi = gfx->words.w1;
|
||||
opcode = GFX_GET_OPCODE(lo);
|
||||
@@ -2122,7 +2107,7 @@ u16 process_collision(Player *player, KartBoundingBoxCorner *corner, f32 cornerP
|
||||
f32 cornerPos3;
|
||||
f32 boundingBoxSize;
|
||||
f32 temp_f0;
|
||||
|
||||
|
||||
s32 temp_v0_2;
|
||||
s32 temp_v1;
|
||||
|
||||
@@ -2183,7 +2168,7 @@ u16 process_collision(Player *player, KartBoundingBoxCorner *corner, f32 cornerP
|
||||
}
|
||||
|
||||
// If the surface flags are not set then try setting them.
|
||||
|
||||
|
||||
temp_v0_2 = (s32) gCourseMaxX - gCourseMinX;
|
||||
temp_v1 = (s32) gCourseMaxZ - gCourseMinZ;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <ultra64.h>
|
||||
#include <libultraship.h>
|
||||
#include <mk64.h>
|
||||
#include <macros.h>
|
||||
#include <math_util.h>
|
||||
@@ -127,7 +127,7 @@ void *vec3f_copy_return(Vec3f dest, Vec3f src) {
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[2];
|
||||
//! @warning function returns address of local variable
|
||||
return &dest;
|
||||
return &dest;
|
||||
}
|
||||
|
||||
void vec3s_copy(Vec3s dest, Vec3s src) {
|
||||
@@ -422,8 +422,6 @@ void func_802B5D30(s16 arg0, s16 arg1, s32 arg2) {
|
||||
}
|
||||
|
||||
void func_802B5D64(uintptr_t addr, s16 arg1, s16 arg2, s32 arg3) {
|
||||
u32 segment = SEGMENT_NUMBER2(addr);
|
||||
u32 offset = SEGMENT_OFFSET(addr);
|
||||
UNUSED s32 pad;
|
||||
f32 sp48;
|
||||
f32 sp44;
|
||||
@@ -434,7 +432,7 @@ void func_802B5D64(uintptr_t addr, s16 arg1, s16 arg2, s32 arg3) {
|
||||
s8 sp2C[3];
|
||||
Lights1 *var_s0;
|
||||
|
||||
var_s0 = (Lights1 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
var_s0 = (Lights1 *) addr;
|
||||
sp48 = sins(arg2);
|
||||
sp44 = coss(arg2);
|
||||
sp40 = sins(arg1);
|
||||
@@ -1154,8 +1152,6 @@ f32 is_within_render_distance(Vec3f cameraPos, Vec3f objectPos, u16 orientationY
|
||||
// No idea if arg1 is actually a Mat4 or not, but since this function is unused
|
||||
// its impossible to know with certainty either way, very close of func_802B5D64
|
||||
UNUSED void func_802B8414(uintptr_t addr, Mat4 arg1, s16 arg2, s16 arg3, s32 arg4) {
|
||||
u32 segment = SEGMENT_NUMBER2(addr);
|
||||
u32 offset = SEGMENT_OFFSET(addr);
|
||||
UNUSED s32 pad;
|
||||
Vec3f sp40;
|
||||
s8 sp3C[3];
|
||||
@@ -1163,7 +1159,7 @@ UNUSED void func_802B8414(uintptr_t addr, Mat4 arg1, s16 arg2, s16 arg3, s32 arg
|
||||
UNUSED s32 pad2[3];
|
||||
Lights1 *var_s0;
|
||||
|
||||
var_s0 = (Lights1 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
var_s0 = (Lights1 *) addr;
|
||||
sins(arg3);
|
||||
coss(arg3);
|
||||
sins(arg2);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef MATH_UTIL_H
|
||||
#define MATH_UTIL_H
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include <libultra/types.h>
|
||||
|
||||
|
||||
//#define sins(x) gSineTable[(u16) (x) >> 4]
|
||||
|
||||
+18
-24
@@ -1,5 +1,5 @@
|
||||
#include <ultra64.h>
|
||||
#include <PR/ultratypes.h>
|
||||
#include <libultraship.h>
|
||||
#include <libultra/types.h>
|
||||
#include <macros.h>
|
||||
#include <common_structs.h>
|
||||
#include <segments.h>
|
||||
@@ -31,7 +31,7 @@ s32 memoryPadding[2];
|
||||
* @brief Returns the address of the next available memory location and updates the memory pointer
|
||||
* to reference the next location of available memory based provided size to allocate.
|
||||
* @param size of memory to allocate.
|
||||
* @return Address of free memory
|
||||
* @return Address of free memory
|
||||
*/
|
||||
void *get_next_available_memory_addr(u32 size) {
|
||||
u32 *freeSpace = (u32 *)gNextFreeMemoryAddress;
|
||||
@@ -84,7 +84,7 @@ void move_segment_table_to_dmem(void) {
|
||||
|
||||
/**
|
||||
* @brief Sets the starting location for allocating memory and calculates pool size.
|
||||
*
|
||||
*
|
||||
* Default memory size, 701.984 Kilobytes.
|
||||
*/
|
||||
void initialize_memory_pool(uintptr_t poolStart, uintptr_t poolEnd) {
|
||||
@@ -245,7 +245,7 @@ UNUSED void *func_802A80B0(u8 *dest, u8 *srcStart, u8 *srcEnd) {
|
||||
void *addr;
|
||||
u32 size = srcStart - dest;
|
||||
addr = main_pool_alloc(size, (u32) srcEnd);
|
||||
|
||||
|
||||
if (addr != 0) {
|
||||
|
||||
osInvalDCache(addr, size);
|
||||
@@ -349,7 +349,7 @@ UNUSED s32 func_802A8348(s32 arg0, s32 arg1, s32 arg2) {
|
||||
UNUSED void *pad;
|
||||
uintptr_t oldAddr;
|
||||
void *newAddr;
|
||||
|
||||
|
||||
offset = ALIGN16(arg1 * arg2);
|
||||
oldAddr = gNextFreeMemoryAddress;
|
||||
newAddr = (void *) (oldAddr + offset);
|
||||
@@ -357,7 +357,7 @@ UNUSED s32 func_802A8348(s32 arg0, s32 arg1, s32 arg2) {
|
||||
osInvalDCache(newAddr, offset);
|
||||
osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)], newAddr, offset, &gDmaMesgQueue);
|
||||
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
|
||||
|
||||
|
||||
func_80040030((u8 *) newAddr, (u8 *) oldAddr);
|
||||
gNextFreeMemoryAddress += offset;
|
||||
return oldAddr;
|
||||
@@ -370,7 +370,7 @@ UNUSED u8 *func_802A841C(u8* arg0, s32 arg1, s32 arg2) {
|
||||
temp_a0 = temp_v0 + arg2;
|
||||
arg1 = ALIGN16(arg1);
|
||||
arg2 = ALIGN16(arg2);
|
||||
|
||||
|
||||
osInvalDCache(temp_a0, arg1);
|
||||
osPiStartDma(&gDmaIoMesg, 0, 0, (uintptr_t) &_other_texturesSegmentRomStart[SEGMENT_OFFSET(arg0)],temp_a0, arg1, &gDmaMesgQueue);
|
||||
osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1);
|
||||
@@ -458,10 +458,8 @@ void func_802A86A8(CourseVtx *data, u32 arg1) {
|
||||
|
||||
void decompress_vtx(CourseVtx *arg0, u32 vertexCount) {
|
||||
s32 size = ALIGN16(vertexCount * 0x18);
|
||||
u32 segment = SEGMENT_NUMBER2(arg0);
|
||||
u32 offset = SEGMENT_OFFSET(arg0);
|
||||
void *freeSpace;
|
||||
u8 *vtxCompressed = VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
u8 *vtxCompressed = arg0;
|
||||
UNUSED s32 pad;
|
||||
|
||||
freeSpace = (void *) gNextFreeMemoryAddress;
|
||||
@@ -684,7 +682,7 @@ void unpack_tile_sync(Gfx *gfx, u8 *args, s8 opcode) {
|
||||
|
||||
lo = (G_SETTILE << 24) | (fmt << 21) | (siz << 19) | (line << 9) | tmem;
|
||||
hi = ((cmt) << 18) | ((maskt) << 14) | ((cms) << 8) | ((masks) << 4);
|
||||
|
||||
|
||||
gfx[sGfxSeekPosition].words.w0 = lo;
|
||||
gfx[sGfxSeekPosition].words.w1 = hi;
|
||||
sGfxSeekPosition++;
|
||||
@@ -954,16 +952,14 @@ UNUSED void func_802A9AEC(void) {
|
||||
* The opcodes range from 0 to 87 which are used to run the relevant unpack function.
|
||||
* The file pointer increments when arguments are used. This way,
|
||||
* displaylist_unpack will always read an opcode and not an argument by accident.
|
||||
*
|
||||
*
|
||||
* @warning opcodes that do not contain a definition in the switch are ignored. If an undefined opcode
|
||||
* contained arguments the unpacker might try to unpack those arguments.
|
||||
* This issue is prevented so long as the packed file adheres to correct opcodes and unpack code
|
||||
* increments the file pointer the correct number of times.
|
||||
*/
|
||||
void displaylist_unpack(uintptr_t *data, uintptr_t finalDisplaylistOffset, u32 arg2) {
|
||||
uintptr_t segment = SEGMENT_NUMBER2(data);
|
||||
uintptr_t offset = SEGMENT_OFFSET(data);
|
||||
u8 *packed_dl = VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
u8 *packed_dl = data;
|
||||
|
||||
Gfx *gfx;
|
||||
u32 addr;
|
||||
@@ -977,14 +973,14 @@ void displaylist_unpack(uintptr_t *data, uintptr_t finalDisplaylistOffset, u32 a
|
||||
sGfxSeekPosition = 0;
|
||||
sPackedSeekPosition = 0;
|
||||
|
||||
while(TRUE) {
|
||||
while(true) {
|
||||
|
||||
// Seek to the next byte
|
||||
opcode = packed_dl[sPackedSeekPosition++];
|
||||
|
||||
// Break when the eof has been reached denoted by opcode 0xFF
|
||||
if (opcode == 0xFF) break;
|
||||
|
||||
|
||||
switch (opcode) {
|
||||
case 0x0:
|
||||
unpack_lights(gfx, packed_dl, opcode);
|
||||
@@ -1036,7 +1032,7 @@ void displaylist_unpack(uintptr_t *data, uintptr_t finalDisplaylistOffset, u32 a
|
||||
break;
|
||||
case 0x10:
|
||||
unpack_lights(gfx, packed_dl, opcode);
|
||||
break;
|
||||
break;
|
||||
case 0x11:
|
||||
unpack_lights(gfx, packed_dl, opcode);
|
||||
break;
|
||||
@@ -1263,10 +1259,8 @@ struct UnkStr_802AA7C8 {
|
||||
};
|
||||
|
||||
void decompress_textures(u32 *arg0) {
|
||||
u32 segment = SEGMENT_NUMBER2(arg0);
|
||||
u32 offset = SEGMENT_OFFSET(arg0);
|
||||
struct UnkStr_802AA7C8 *phi_s0 =
|
||||
(struct UnkStr_802AA7C8 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
(struct UnkStr_802AA7C8 *) arg0;
|
||||
struct UnkStr_802AA7C8 *temp_s0;
|
||||
u32 temp_t2;
|
||||
u8 *temp_a0;
|
||||
@@ -1275,7 +1269,7 @@ void decompress_textures(u32 *arg0) {
|
||||
|
||||
phi_v0 = 0;
|
||||
temp_s0 = phi_s0;
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
temp_a0 = phi_s0->unk0;
|
||||
if ((temp_a0) == 0) {
|
||||
break;
|
||||
@@ -1287,7 +1281,7 @@ void decompress_textures(u32 *arg0) {
|
||||
gHeapEndPtr -= phi_v0;
|
||||
sp20 = gHeapEndPtr;
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
temp_a0 = phi_s0->unk0;
|
||||
if ((temp_a0) == 0) {
|
||||
break;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <ultra64.h>
|
||||
#include <libultraship.h>
|
||||
#include <macros.h>
|
||||
#include <mk64.h>
|
||||
#include <common_structs.h>
|
||||
@@ -836,7 +836,7 @@ void func_8028F970(void) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (gEnableDebugMode) {
|
||||
if (gModeSelection == BATTLE) {
|
||||
// do stuff?
|
||||
@@ -1108,7 +1108,7 @@ void func_802903B0(void) {
|
||||
void func_802903D8(Player *playerOne, Player *playerTwo) {
|
||||
f32 sp70 = (playerOne->boundingBoxSize + playerTwo->boundingBoxSize) - 5.0f;
|
||||
f32 temp_f0;
|
||||
f32 sp74;
|
||||
f32 sp74;
|
||||
Vec3f sp60;
|
||||
Vec3f sp54;
|
||||
f32 temp_f0_2;
|
||||
|
||||
+23
-27
@@ -1,4 +1,4 @@
|
||||
#include <ultra64.h>
|
||||
#include <libultraship.h>
|
||||
#include <macros.h>
|
||||
#include <mk64.h>
|
||||
#include <common_structs.h>
|
||||
@@ -44,9 +44,7 @@ s32 func_80290C20(Camera *camera) {
|
||||
}
|
||||
|
||||
void parse_course_displaylists(uintptr_t addr) {
|
||||
s32 segment = SEGMENT_NUMBER2(addr);
|
||||
s32 offset = SEGMENT_OFFSET(addr);
|
||||
TrackSections *section = (TrackSections *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
TrackSections *section = (TrackSections *) addr;
|
||||
|
||||
while(section->addr != 0) {
|
||||
if (section->flags & 0x8000) {
|
||||
@@ -74,10 +72,8 @@ extern u32 isFlycam;
|
||||
void load_surface_map(uintptr_t addr, struct UnkStruct_800DC5EC *arg1) {
|
||||
Player *player = arg1->player;
|
||||
Camera *camera = arg1->camera;
|
||||
u32 segment = SEGMENT_NUMBER2(addr);
|
||||
u32 offset = SEGMENT_OFFSET(addr);
|
||||
//! @todo Should be Gfx*
|
||||
s32 *gfx = (s32 *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[segment] + offset);
|
||||
Gfx* gfx = (Gfx*) addr;
|
||||
s16 var_a3;
|
||||
s16 temp_v1;
|
||||
s16 sp1E;
|
||||
@@ -125,12 +121,12 @@ void load_surface_map(uintptr_t addr, struct UnkStruct_800DC5EC *arg1) {
|
||||
temp_v1 = arg1->pathCounter;
|
||||
} else if (player->unk_110.unk3C[2] > 30.0f) {
|
||||
temp_v1 = arg1->pathCounter;
|
||||
} else {
|
||||
} else {
|
||||
temp_v1 = temp_v0_3;
|
||||
}
|
||||
} else if (camera->unk_54.unk3C[2] > 30.0f) {
|
||||
temp_v1 = arg1->pathCounter;
|
||||
} else {
|
||||
} else {
|
||||
temp_v1 = sp1E;
|
||||
}
|
||||
} else {
|
||||
@@ -163,7 +159,7 @@ void load_surface_map(uintptr_t addr, struct UnkStruct_800DC5EC *arg1) {
|
||||
temp_v1 = arg1->pathCounter;
|
||||
} else if (player->unk_110.unk3C[2] > 30.0f) {
|
||||
temp_v1 = arg1->pathCounter;
|
||||
} else {
|
||||
} else {
|
||||
temp_v1 = temp_v0_3;
|
||||
}
|
||||
break;
|
||||
@@ -173,14 +169,14 @@ void load_surface_map(uintptr_t addr, struct UnkStruct_800DC5EC *arg1) {
|
||||
temp_v1 = func_802ABD40(camera->unk_54.unk3A);
|
||||
if (camera->unk_54.unk3C[2] > 30.0f) {
|
||||
temp_v1 = arg1->pathCounter;
|
||||
} else if (temp_v1 == 255) {
|
||||
} else if (temp_v1 == 255) {
|
||||
temp_v1 = arg1->pathCounter;
|
||||
}
|
||||
}
|
||||
|
||||
arg1->pathCounter = temp_v1;
|
||||
temp_v1 = ((temp_v1 - 1) * 4) + var_a3;
|
||||
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, gfx[temp_v1]);
|
||||
}
|
||||
|
||||
@@ -866,7 +862,7 @@ void render_luigi_raceway(struct UnkStruct_800DC5EC *arg0) {
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
|
||||
|
||||
load_surface_map((uintptr_t) luigi_raceway_dls, arg0);
|
||||
|
||||
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2);
|
||||
// d_course_luigi_raceway_packed_dl_E0
|
||||
@@ -940,48 +936,48 @@ void render_moo_moo_farm(struct UnkStruct_800DC5EC *arg0) {
|
||||
|
||||
if ((temp_s0 < 14) && (temp_s0 > 10)) {
|
||||
if ((temp_s1 == 2) || (temp_s1 == 3) || (temp_s1 == 1))
|
||||
//
|
||||
//
|
||||
gSPDisplayList(gDisplayListHead++, d_course_moo_moo_farm_dl_13FF8);
|
||||
|
||||
|
||||
} else if (temp_s0 < 16) {
|
||||
gSPDisplayList(gDisplayListHead++, d_course_moo_moo_farm_dl_13FF8);
|
||||
} else if (temp_s0 < 19) {
|
||||
if (temp_s1 != 2)
|
||||
if (temp_s1 != 2)
|
||||
gSPDisplayList(gDisplayListHead++, d_course_moo_moo_farm_dl_13FF8);
|
||||
|
||||
|
||||
} else if (temp_s0 < 20) {
|
||||
if (temp_s1 == 0)
|
||||
if (temp_s1 == 0)
|
||||
gSPDisplayList(gDisplayListHead++, d_course_moo_moo_farm_dl_13FF8);
|
||||
|
||||
|
||||
}
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEI, G_CC_MODULATEI);
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
|
||||
|
||||
if ((temp_s0 >= 16) && (temp_s0 < 24)) {
|
||||
if ((temp_s1 == 2) || (temp_s1 == 3))
|
||||
if ((temp_s1 == 2) || (temp_s1 == 3))
|
||||
// d_course_moo_moo_farm_packed_dl_5410
|
||||
gSPDisplayList(gDisplayListHead++, ((uintptr_t)0x07005410));
|
||||
|
||||
|
||||
} else if (temp_s0 < 9) {
|
||||
if (temp_s1 == 2)
|
||||
if (temp_s1 == 2)
|
||||
// d_course_moo_moo_farm_packed_dl_5410
|
||||
gSPDisplayList(gDisplayListHead++, ((uintptr_t)0x07005410));
|
||||
|
||||
|
||||
}
|
||||
if (temp_s0 < 4) {
|
||||
if (temp_s1 != 0)
|
||||
gSPDisplayList(gDisplayListHead++, d_course_moo_moo_farm_dl_14060);
|
||||
|
||||
|
||||
} else if (temp_s0 < 8) {
|
||||
if (temp_s1 == 2)
|
||||
gSPDisplayList(gDisplayListHead++, d_course_moo_moo_farm_dl_14060);
|
||||
|
||||
|
||||
} else if (temp_s0 >= 22) {
|
||||
gSPDisplayList(gDisplayListHead++, d_course_moo_moo_farm_dl_14060);
|
||||
} else if (temp_s0 >= 18) {
|
||||
if ((temp_s1 == 0) || (temp_s1 == 3))
|
||||
gSPDisplayList(gDisplayListHead++, d_course_moo_moo_farm_dl_14060);
|
||||
|
||||
|
||||
}
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2);
|
||||
@@ -1412,7 +1408,7 @@ void func_80295D88(void) {
|
||||
gCourseMaxX = 0;
|
||||
gCourseMaxY = 0;
|
||||
gCourseMaxZ = 0;
|
||||
|
||||
|
||||
D_8015F59C = 0;
|
||||
D_8015F5A0 = 0;
|
||||
func_80295D6C();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <ultra64.h>
|
||||
#include <libultraship.h>
|
||||
#include <macros.h>
|
||||
#include <PR/gbi.h>
|
||||
#include <libultra/gbi.h>
|
||||
#include <mk64.h>
|
||||
|
||||
#include "skybox_and_splitscreen.h"
|
||||
@@ -471,7 +471,7 @@ void func_802A4A0C(Vtx *vtx, struct UnkStruct_800DC5EC *arg1, UNUSED s32 arg2, U
|
||||
vtx[2].v.ob[1] = temp_t5;
|
||||
vtx[4].v.ob[1] = temp_t5;
|
||||
vtx[7].v.ob[1] = temp_t5;
|
||||
|
||||
|
||||
init_rdp();
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
|
||||
gSPClearGeometryMode(gDisplayListHead++, G_ZBUFFER | G_LIGHTING);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef SKYBOX_AND_SPLITSCREEN_H
|
||||
#define SKYBOX_AND_SPLITSCREEN_H
|
||||
|
||||
#include <PR/gbi.h>
|
||||
#include <libultra/gbi.h>
|
||||
#include "code_800029B0.h"
|
||||
|
||||
#define G_CLEAR_ALL_MODES 0xFFFFFFFF
|
||||
|
||||
Reference in New Issue
Block a user