diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2025-05-14 18:30:32 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-14 18:30:32 -0600 |
| commit | 32632cacdb316d7f2d3b6ecdb634f0ef9aebadf0 (patch) | |
| tree | d374a84675fc0f49100c275aa34828bc9db538f8 /src/port/Game.cpp | |
| parent | 70f049cb6c326dede27e0ba7e88ac0d67b7651a4 (diff) | |
Impl new intro (#193)
* Update menus
* Update CMakeLists.txt
* Add Ship
* Impl hm ship actors
* Update HM course
* Impl new intro
* Finish intro scene
* Rename
* Start Editor Work
* raycast works
* Fix ScreenRayTrace in widescreen
* Basic Actor Picking
* wip
* Editor use vtx collision
* gizmo work
* otr works for object picking
* Impl objects for editor
* actor init
* Update
* Add all axis move (freemove)
* Docking Windows works here
* Setup imgui layout for editor
* Editor Snap to Ground works
* Basic Scene Explorer Works
* Editor get actor names
* Impl editor object names
* impl Editor Play and Pause buttons
* Editor translate works while paused
* Fix freecam lighting
* Added adjustable track properties to editor
* Editor matrix, icons, rotation, impl light
* Setup Track Properties 1
* Editor tooling wip
* Load modded o2rs
* Don't enable hud if editor is enabled
* Updates
* SceneManager nearly working
* Fix mario kart 64 intro logo sizing
* Fix Rotator
* Finish new matrix translation code
* Cleanup headers
* Cleanup
* Cleanup 2
* Cleanup 3
* Prevent divize by zero crash
* Add visible circle for translate in all axis
* Editor scaling/rot works properly now
* Scale All_Axis evenly
* Fixes to includes to work on Linux.
* Removed overfilled arguments in gfx_create_framebuffer()
* Added missing function definitions to Game.h
* Editor sun face the camera
* Add rotation model to gizmo
* Add new handles
* Failed attempt at transforming collision
* Impl water volume
* Import fast64 paths
* water surface
* Scene Setup 1
* Custom Track O2R almost working needs testing
* Custom Track Load path O2r
* Render custom track. Wip collision
* Add missing function
* Debug Spawning Custom O2R Track
* Import courses working now
* Fix memory leak
* Remove New Track Button
* Engine.cpp more consistent with sf64
* Fix Editor Enable Button
* Editor Accurate mouse click drag objects
* Editor selects closest object and cleanup
* Gizmo rot and scale collision working
* Remove constexpr from IRotator
* Impl properties for location/rot/scale
* Better Properties display, swap rot handles
* Fix content browser dock and editor now disabled by default
* Remove GameInfoWindow, Multiplayer Button, and FPS Slider
* Disable Editor when its disabled
* Add new logo to hm intro
* Fix pause menu item box cursor
* Remove minimap from Course::from_json and to_json
* Impl Import Minimap
* Fix custom minimap rendering
* minimap uses extension .png
* Refactor minimap
* Freecam only for player 1
* GrandPrix Balloons work in custom track
* Track Id is now std::string and outside of Props
* Moved editor assets to be included in ship.o2r
* Fixed GenerateO2R to package the correct folder and save to the correct filename
* Linux specific changes.
* Added "#include <stdio.h>" that required them
* Changed how the "ship.o2r" file is loaded to allow it to load the file from within appimages.
* Changed the Linuxdeploy version to avoid errors later when the Github Actions creates appimages(same fix applied to other ports.)
* Revert "Moved editor assets to be included in ship.o2r"
This reverts commit 05704c01f761baa67a83e357d9765f5c6b5e3fdb.
* Added back files(this time without LUS changes)
* Changed workflow file to use correct filename for assets file.
* Missed a few spots in the workflow file.
* Added .desktop file and made corrections to the main workflow.
* Added the rest of upstream CMakeLists.txt
* disabled USE_NETWORKING
* New InverseMatrix
* Renamed both .o2r files to be more accurate to its contents.
* Reverted CmakeList.txt
---------
Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
Co-authored-by: sitton76 <58642183+sitton76@users.noreply.github.com>
Diffstat (limited to 'src/port/Game.cpp')
| -rw-r--r-- | src/port/Game.cpp | 108 |
1 files changed, 92 insertions, 16 deletions
diff --git a/src/port/Game.cpp b/src/port/Game.cpp index 35a0cdf83..483971a48 100644 --- a/src/port/Game.cpp +++ b/src/port/Game.cpp @@ -28,7 +28,7 @@ #include "engine/courses/BigDonut.h" #include "engine/courses/Harbour.h" #include "engine/courses/TestCourse.h" -#include "engine/actors/AFinishline.h" +#include "engine/actors/Finishline.h" #include "engine/courses/PodiumCeremony.h" @@ -43,6 +43,12 @@ #include "Smoke.h" +#include "engine/HM_Intro.h" + +#include "engine/editor/Editor.h" +#include "engine/editor/EditorMath.h" +#include "engine/editor/SceneManager.h" + extern "C" { #include "main.h" #include "audio/load.h" @@ -95,6 +101,10 @@ Cup* gBattleCup; ModelLoader gModelLoader; +HarbourMastersIntro gMenuIntro; + +Editor::Editor gEditor; + s32 gTrophyIndex = NULL; void CustomEngineInit() { @@ -190,6 +200,26 @@ void CustomEngineInit() { extern "C" { +void HM_InitIntro() { + gMenuIntro.HM_InitIntro(); +} + +void HM_TickIntro() { + gMenuIntro.HM_TickIntro(); +} + +void HM_DrawIntro() { + gMenuIntro.HM_DrawIntro(); +} + +void CM_SpawnFromLevelProps() { + // Spawning actors needs to be delayed to the correct time. + // And loadlevel needs to happen asap + + //Editor::LoadLevel(nullptr); + // Editor::SpawnFromLevelProps(); +} + World* GetWorld(void) { return &gWorldInstance; } @@ -324,7 +354,9 @@ void CM_RenderCourse(struct UnkStruct_800DC5EC* arg0) { if (gWorldInstance.CurrentCourse->IsMod() == false) { if ((CVarGetInteger("gFreecam", 0) == true)) { // Render credits courses - func_8029569C(); + //gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); + //gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_CULL_BACK | G_SHADING_SMOOTH); + render_credits(); return; } } @@ -353,16 +385,21 @@ void CM_DrawActors(Camera* camera, struct Actor* actor) { } } +void CM_DrawStaticMeshActors() { + gWorldInstance.DrawStaticMeshActors(); +} + void CM_BeginPlay() { Course* course = gWorldInstance.CurrentCourse; if (course) { - // Do not spawn finishline in credits or battle mode. And if bSpawnFinishline. if ((gGamestate != CREDITS_SEQUENCE) && (gGamestate != BATTLE) && (course->bSpawnFinishline)) { gWorldInstance.AddActor(new AFinishline(course->FinishlineSpawnPoint)); } + gEditor.AddLight("Sun", nullptr, D_800DC610[1].l->l.dir); + course->BeginPlay(); } } @@ -387,6 +424,18 @@ void CM_DrawObjects(s32 cameraId) { } } +void CM_TickEditor() { + gEditor.Tick(); +} + +void CM_DrawEditor() { + gEditor.Draw(); +} + +void CM_Editor_SetLevelDimensions(s16 minX, s16 maxX, s16 minZ, s16 maxZ, s16 minY, s16 maxY) { + gEditor.SetLevelDimensions(minX, maxX, minZ, maxZ, minY, maxY); +} + void CM_TickParticles() { if (gWorldInstance.CurrentCourse) { gWorldInstance.TickParticles(); @@ -434,12 +483,6 @@ void CM_SomeCollisionThing(Player* player, Vec3f arg1, Vec3f arg2, Vec3f arg3, f } } -void CM_MinimapSettings() { - if (gWorldInstance.CurrentCourse) { - gWorldInstance.CurrentCourse->MinimapSettings(); - } -} - void CM_InitCourseObjects() { if (gWorldInstance.CurrentCourse) { gWorldInstance.CurrentCourse->InitCourseObjects(); @@ -485,12 +528,6 @@ void CM_WhatDoesThisDoAI(Player* player, int8_t playerId) { } } -void CM_MinimapFinishlinePosition() { - if (gWorldInstance.CurrentCourse) { - gWorldInstance.CurrentCourse->MinimapFinishlinePosition(); - } -} - void CM_SetStaffGhost() { if (gWorldInstance.CurrentCourse) { gWorldInstance.CurrentCourse->SetStaffGhost(); @@ -625,17 +662,50 @@ void CM_DeleteActor(size_t index) { * Clean up actors and other game objects. */ void CM_CleanWorld(void) { + World* world = &gWorldInstance; + for (auto& actor : world->Actors) { + delete actor; + } + + for (auto& object : world->Objects) { + delete object; + } + + for (auto& emitter : world->Emitters) { + delete emitter; + } + + for (auto& actor : world->StaticMeshActors) { + delete actor; + } + + gEditor.ClearObjects(); gWorldInstance.Actors.clear(); + gWorldInstance.StaticMeshActors.clear(); gWorldInstance.Objects.clear(); gWorldInstance.Emitters.clear(); gWorldInstance.Lakitus.clear(); gWorldInstance.Reset(); } -struct Actor* CM_AddBaseActor(void) { +struct Actor* CM_AddBaseActor() { return (struct Actor*) gWorldInstance.AddBaseActor(); } +void CM_AddEditorObject(struct Actor* actor, const char* name) { + gWorldInstance.AddEditorObject(actor, name); +} + +void Editor_AddLight(s8* direction) { + static size_t i = 0; + gEditor.AddLight(("Light "+std::to_string(i)).c_str(), nullptr, direction); + i += 1; +} + +void Editor_ClearMatrix() { + gEditor.ClearMatrixPool(); +} + size_t CM_GetActorSize() { return gWorldInstance.Actors.size(); } @@ -648,6 +718,11 @@ void CM_ActorCollision(Player* player, Actor* actor) { } } +f32 CM_GetWaterLevel(Vec3f pos, Collision* collision) { + FVector fPos = {pos[0], pos[1], pos[2]}; + return gWorldInstance.CurrentCourse->GetWaterLevel(fPos, collision); +} + void* GetMarioRaceway(void) { return gMarioRaceway; } @@ -789,6 +864,7 @@ extern "C" } thread5_game_loop(); + gEditor.Load(); while (WindowIsRunning()) { push_frame(); } |
