mirror of
https://github.com/HarbourMasters/SpaghettiKart
synced 2026-07-09 23:02:11 -04:00
Debug Spawning Custom O2R Track
This commit is contained in:
@@ -374,7 +374,7 @@ glabel func_80009B60
|
||||
/* 00AC6C 8000A06C 94A30000 */ lhu $v1, ($a1)
|
||||
/* 00AC70 8000A070 AFA5002C */ sw $a1, 0x2c($sp)
|
||||
/* 00AC74 8000A074 AFA60028 */ sw $a2, 0x28($sp)
|
||||
/* 00AC78 8000A078 0C00B931 */ jal func_8002E4C4
|
||||
/* 00AC78 8000A078 0C00B931 */ jal set_player_height
|
||||
/* 00AC7C 8000A07C AFA70020 */ sw $a3, 0x20($sp)
|
||||
/* 00AC80 8000A080 8FA5002C */ lw $a1, 0x2c($sp)
|
||||
/* 00AC84 8000A084 8FA60028 */ lw $a2, 0x28($sp)
|
||||
|
||||
+1
-1
@@ -1721,7 +1721,7 @@ void func_80009B60(s32 playerId) {
|
||||
// gNearestWaypointByPlayerId[playerId] might need to be saved to a temp
|
||||
D_80164510[playerId] = D_80164550[D_80163448][gNearestWaypointByPlayerId[playerId]].posY + 4.3f;
|
||||
if ((D_801631F8[playerId] == 1) && (D_801631E0[playerId] == 0)) {
|
||||
func_8002E4C4(player);
|
||||
set_player_height(player);
|
||||
}
|
||||
if (D_801631E0[playerId] == 1) {
|
||||
player->pos[1] = D_80164510[playerId];
|
||||
|
||||
@@ -22,6 +22,7 @@ extern "C" {
|
||||
#include "code_800029B0.h"
|
||||
#include "render_courses.h"
|
||||
#include "collision.h"
|
||||
#include "actors.h"
|
||||
extern StaffGhost* d_mario_raceway_staff_ghost;
|
||||
}
|
||||
|
||||
@@ -103,13 +104,13 @@ void Course::LoadO2R(std::string trackPath) {
|
||||
for (auto& path : paths) {
|
||||
if (i == 0) {
|
||||
Props.PathTable[0] = (TrackWaypoint*)path.data();
|
||||
Props.PathTable[1] = (TrackWaypoint*)path.data();
|
||||
Props.PathTable[2] = (TrackWaypoint*)path.data();
|
||||
Props.PathTable[3] = (TrackWaypoint*)path.data();
|
||||
Props.PathTable[1] = NULL;
|
||||
Props.PathTable[2] = NULL;
|
||||
Props.PathTable[3] = NULL;
|
||||
Props.PathTable2[0] = (TrackWaypoint*)path.data();
|
||||
Props.PathTable2[1] = (TrackWaypoint*)path.data();
|
||||
Props.PathTable2[2] = (TrackWaypoint*)path.data();
|
||||
Props.PathTable2[3] = (TrackWaypoint*)path.data();
|
||||
Props.PathTable2[1] = NULL;
|
||||
Props.PathTable2[2] = NULL;
|
||||
Props.PathTable2[3] = NULL;
|
||||
}
|
||||
|
||||
i += 1;
|
||||
@@ -209,6 +210,29 @@ void Course::ParseCourseSections(TrackSectionsO2R* sections, size_t size) {
|
||||
}
|
||||
}
|
||||
|
||||
void Course::TestPath() {
|
||||
// DEBUG ONLY TO VISUALIZE PATH
|
||||
s16 x;
|
||||
s16 y;
|
||||
s16 z;
|
||||
Vec3s rot = {0, 0, 0};
|
||||
Vec3f vel = {0, 0, 0};
|
||||
|
||||
for (size_t i = 0; i < gWaypointCountByPathIndex[0]; i++) {
|
||||
x = D_80164550[0][i].posX;
|
||||
y = D_80164550[0][i].posY;
|
||||
z = D_80164550[0][i].posZ;
|
||||
|
||||
if (((x & 0xFFFF) == 0x8000) && ((y & 0xFFFF) == 0x8000) && ((z & 0xFFFF) == 0x8000)) {
|
||||
break;
|
||||
}
|
||||
|
||||
f32 height = spawn_actor_on_surface(x, 2000.0f, z);
|
||||
Vec3f itemPos = {x, height, z};
|
||||
add_actor_to_empty_slot(itemPos, rot, vel, ACTOR_ITEM_BOX);
|
||||
}
|
||||
}
|
||||
|
||||
void Course::Init() {
|
||||
gNumActors = 0;
|
||||
gCourseMinX = 0;
|
||||
@@ -233,6 +257,7 @@ void Course::LoadTextures() {
|
||||
}
|
||||
|
||||
void Course::BeginPlay() {
|
||||
TestPath();
|
||||
}
|
||||
|
||||
void Course::InitClouds() {
|
||||
@@ -307,6 +332,18 @@ void Course::Waypoints(Player* player, int8_t playerId) {
|
||||
|
||||
void Course::Render(struct UnkStruct_800DC5EC* arg0) {
|
||||
if (!TrackSectionsPtr.empty()) {
|
||||
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
|
||||
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
|
||||
// set_track_light_direction(D_800DC610, D_802B87D4, 0, 1);
|
||||
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
|
||||
gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
|
||||
|
||||
if (func_80290C20(arg0->camera) == 1) {
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE);
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
|
||||
// d_course_big_donut_packed_dl_DE8
|
||||
}
|
||||
|
||||
TrackSectionsO2R* sections = (TrackSectionsO2R*)LOAD_ASSET_RAW(TrackSectionsPtr.c_str());
|
||||
size_t size = ResourceGetSizeByName(TrackSectionsPtr.c_str());
|
||||
for (size_t i = 0; i < (size / sizeof(TrackSectionsO2R)); i++) {
|
||||
|
||||
@@ -251,6 +251,7 @@ public:
|
||||
* Actor spawning should go here.
|
||||
*/
|
||||
virtual void BeginPlay();
|
||||
virtual void TestPath();
|
||||
virtual void InitClouds();
|
||||
virtual void UpdateClouds(s32, Camera*);
|
||||
virtual void SomeCollisionThing(Player *player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32* arg4, f32* arg5, f32* arg6, f32* arg7);
|
||||
|
||||
@@ -2361,7 +2361,7 @@ void func_8002D268(Player* player, UNUSED Camera* camera, s8 screenId, s8 player
|
||||
func_8002C4F8(player, playerId);
|
||||
}
|
||||
|
||||
void func_8002E4C4(Player* player) {
|
||||
void set_player_height(Player* player) {
|
||||
s32 player_index;
|
||||
|
||||
player_index = get_player_index_for_player(player);
|
||||
|
||||
@@ -63,7 +63,7 @@ void apply_effect(Player*, s8, s8);
|
||||
void func_8002D028(Player*, s8);
|
||||
void func_8002D268(Player*, Camera*, s8, s8);
|
||||
|
||||
void func_8002E4C4(Player*);
|
||||
void set_player_height(Player*);
|
||||
void control_kart_ai_movement(Player*, Camera*, s8, s8);
|
||||
|
||||
void func_8002FCA8(Player*, s8);
|
||||
|
||||
@@ -1425,18 +1425,23 @@ f32 spawn_actor_on_surface(f32 posX, f32 posY, f32 posZ) {
|
||||
numTriangles = gCollisionGrid[gridSection].numTriangles;
|
||||
|
||||
if (sectionIndexX < 0) {
|
||||
printf("collision.c: actor outside of -sectionX %d\n", sectionIndexX);
|
||||
return 3000.0f;
|
||||
}
|
||||
if (sectionIndexZ < 0) {
|
||||
printf("collision.c: actor outside of -sectionZ %d\n", sectionIndexZ);
|
||||
return 3000.0f;
|
||||
}
|
||||
if (sectionIndexX >= GRID_SIZE) {
|
||||
printf("collision.c: actor outside of sectionX %d\n", sectionIndexX);
|
||||
return 3000.0f;
|
||||
}
|
||||
if (sectionIndexZ >= GRID_SIZE) {
|
||||
printf("collision.c: actor outside of sectionZ %d\n", sectionIndexZ);
|
||||
return 3000.0f;
|
||||
}
|
||||
if (numTriangles == 0) {
|
||||
printf("collision.c: No collision triangles in track!\n Something is wrong with the tracks geometry\n");
|
||||
return 3000.0f;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user