diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2025-06-07 21:38:12 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-07 21:38:12 -0600 |
| commit | 44db9bab773cc3b14c8f944a9411673b6fe08b01 (patch) | |
| tree | 8ad796dac5ec3f42eca1220efe1e054b576374e8 /src/camera.c | |
| parent | a67fbb6442d76016397c67f2cb7831687cdda91a (diff) | |
Add Interpolation (#204)
* initial work
* more work
* progress
* Fixed slow fps
* Add Lywx changes
* Interp Works
* Test default tick/logic update
* Added missing include (#202)
* Added missing include
* More missing includes
---------
Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
* test
* Revert "test"
This reverts commit 1a810d74cc8531ce486bcb1c399cc6798fa1b51d.
* Interp Item box
* Actually interpolate item box
* fix clouds
* interp player?
* Test 2
* Fix mistake
* tag and fix item boxes
* tag fake item box and whatever func_800696CC is
* these aren't needed
* tag karts
* Slightly better falling rocks(still needs work)
* Tag Smoke and Dust
* Removed unneeded code from falling_rock
* tag whatever func_80051ABC is
* add missing rotate x coord
* GrandPrixBallon/kart shadow
* Green shells tag, and added comments I neglected to add before.
* doesn't compile on win
* Fixes
* Disabled camera interpolation
* Balloons fixes
* progress
* set_transform_matrix compiles
* Compile setTransformMatrix
* More transforms interp
* Add more interps
* matrix
* Matrix multi interp
* Fix interpolation camera bug
* Missing includes needed for Linux.
* Excluded access to HM64 Labs on Switch.
* interpolation tags for various objects
* Bowser castle statue flame interpolated.
* tag hedgehogs
* cloud interpolation
* Interpolated smoke particles from shells
* cloud interpolation refactor
* Interpolated snowflakes
* Interpolated penguins, also added comment tags to places I missed.
* tag Snowman interpolation
* Interpolated player reflection(sherbet land)
* Forgot to uncomment stuff while testing
* better tag
* tag leaves
* Set the default FPS to 30
* tag hud
* Fixed "Match Refresh Rate" option
* adjust draw distance
* remove innecessary rock tag
* rag rocks
* better tag
* Tagged player rank placement in HUD
* Tagged Bat, Boos, and TrashBin(Banshee Boardwalk objects)
* Refactor render_screens and fix editor raycast
* better object interpolation
* shift is not needed here
* fix tag
* fix tags
* mole comments
* comment
* Changed how shell flames are interpolated.
* interpolated ended scene fireworks.
* Tagged star particles in the ending scene
* Shell flames handled better.
* this isn't needed
* Fix multiplayer cameras
* Fixed loading battle maps.
* Tagged battle balloons
* Some fixes for battle mode
* No longer needed changes toAFinishline with the changes mega made.
* Tag finishline
* fix to make it compile with cmake 3.31
* changed mtxf_multiplication() to fix vert explosion in Desert & DK parkway.(provided by Coco.)
* fix memory leaks, avoid invalidate texture (#207)
* Fixed macos
* More stupid fixes
* update with main and update torch and lus and enable action on this branch
* Update FrameInterpolation.h
* Update FrameInterpolation.cpp
* fix some memory leak
* Update torch
* Update torch
* update torch and lus
* reduce texture import
* don't use fork of torch and lus
* Update torch
* Update torch
---------
Co-authored-by: Lywx <kiritodev01@gmail.com>
* Refactor World::Courses to unique_ptr (#211)
* wip course unique ptr
* Track unique_ptr : This probably compiles
* Finish impl Courses as unique_ptr
* Fix error
* Fixes
* More fixes
* Cleanup
* Remove old vars
---------
Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
* particle boat and train
* fix player particle interpolation
* add modify interpolation target fps in menu
* fix windows
* Update libultraship
* Fix logo interp
* Interp SetTextMatrix
* Fix freecam camera
* Clarify comment
* Clarify func
* fix linux compilation
* Update Thwomp.cpp
* Update Thwomp.h
* Update render.inc.c
* Update render.inc.c
* Update gbiMacro.c
* interp falling rock shadow
* Revert change that has no explanation
* Update code_80057C60.c
* Update code_80057C60.c
* Update GrandPrixBalloons.cpp
* Update Lakitu.cpp
* Update framebuffer_effects.c
* Update render_courses.c
---------
Co-authored-by: Sonic Dreamcaster <alejandro.asenjo88@gmail.com>
Co-authored-by: KiritoDv <kiritodev01@gmail.com>
Co-authored-by: sitton76 <58642183+sitton76@users.noreply.github.com>
Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
Co-authored-by: coco875 <59367621+coco875@users.noreply.github.com>
Co-authored-by: coco875 <pereira.jannin@gmail.com>
Diffstat (limited to 'src/camera.c')
| -rw-r--r-- | src/camera.c | 151 |
1 files changed, 147 insertions, 4 deletions
diff --git a/src/camera.c b/src/camera.c index 953f1f96b..434ad25c2 100644 --- a/src/camera.c +++ b/src/camera.c @@ -18,17 +18,19 @@ #include "spawn_players.h" #include "enhancements/freecam/freecam_engine.h" #include "enhancements/freecam/freecam.h" +#include "port/interpolation/FrameInterpolation.h" #include "engine/GameAPI.h" #include "port/Game.h" f32 D_800DDB30[] = { 0.4f, 0.6f, 0.275f, 0.3f }; -Camera cameras[4]; +Camera cameras[5]; Camera* camera1 = &cameras[0]; Camera* camera2 = &cameras[1]; Camera* camera3 = &cameras[2]; Camera* camera4 = &cameras[3]; +Camera* gFreecamCamera = &cameras[4]; UNUSED s32 D_801649D0[2]; @@ -193,6 +195,146 @@ void camera_init(f32 posX, f32 posY, f32 posZ, UNUSED s16 rot, u32 arg4, s32 cam func_802B7F7C(camera->pos, camera->lookAt, camera->rot); } +// Many arrays are hard-coded to 4. Skip those. +void freecam_init(f32 posX, f32 posY, f32 posZ, UNUSED s16 rot, u32 arg4, s32 cameraId) { + Player* player = gPlayerOne; + Camera* camera = &cameras[cameraId]; + + camera->cameraId = cameraId; + + //D_80152300[cameraId] = arg4; + switch (arg4) { + case 0: + case 1: + case 3: + case 8: + case 9: + case 10: + D_80164A89 = 0; + camera->pos[0] = posX; + camera->pos[1] = posY; + camera->pos[2] = posZ; + camera->someBitFlags = 0; + camera->lookAt[0] = 0.0f; + camera->lookAt[2] = 150.0f; + camera->lookAt[1] = posY - 3.0; + camera->up[0] = 0.0f; + camera->up[1] = 1.0f; + camera->up[2] = 0.0f; + camera->playerId = (s16) 0; + camera->unk_B0 = 0; + camera->unk_A0 = 0.0f; + + // D_801649D8[cameraId] = 20.0f; + // D_801649E8[cameraId] = 10.0f; + // D_801649F8[cameraId] = 7.0f; + // D_80164A2C = 0; + // D_80164A30 = 30.0f; + // D_80164A38[cameraId] = 0.0f; + // D_80164A48[cameraId] = 0.0f; + + // D_80164A90[cameraId] = 0.0f; + // D_80164AA0[cameraId] = 0.0f; + // D_80164A78[cameraId] = D_800DDB30[gActiveScreenMode]; + // D_80164A18[cameraId] = 0; + // D_80164A08[cameraId] = 0; + // D_80164498[cameraId] = 0.0f; + camera->unk_94.unk_8 = 0; + camera->unk_94.unk_0 = 0.0f; + + player += cameraId; + camera->unk_2C = player->rotation[1]; + camera->unk_AC = player->rotation[1]; + switch (gActiveScreenMode) { + case SCREEN_MODE_1P: + case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL: + if (gModeSelection == BATTLE) { + camera->unk_30[0] = 0.0f; + camera->unk_30[1] = 11.6f; + camera->unk_30[2] = -38.5f; + camera->unk_3C[0] = 0.0f; + camera->unk_3C[1] = 0.0f; + camera->unk_3C[2] = 19.2f; + D_80164A88 = 0; + } else { + camera->unk_30[0] = 0.0f; + camera->unk_30[1] = 9.5f; + camera->unk_30[2] = -50.0f; + camera->unk_3C[0] = 0.0f; + camera->unk_3C[1] = 0.0f; + camera->unk_3C[2] = 70.0f; + } + break; + case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL: + if (gModeSelection == BATTLE) { + camera->unk_30[0] = 0.0f; + camera->unk_30[1] = 11.6f; + camera->unk_30[2] = -38.5f; + camera->unk_3C[0] = 0.0f; + camera->unk_3C[1] = 0.0f; + camera->unk_3C[2] = 19.2f; + } else { + camera->unk_30[0] = 0.0f; + camera->unk_30[1] = 9.6f; + camera->unk_30[2] = -35.0f; + camera->unk_3C[0] = 0.0f; + camera->unk_3C[1] = 0.0f; + camera->unk_3C[2] = 30.0f; + } + break; + case SCREEN_MODE_3P_4P_SPLITSCREEN: + if (gModeSelection == BATTLE) { + camera->unk_30[0] = 0.0f; + camera->unk_30[1] = 11.6f; + camera->unk_30[2] = -38.5f; + camera->unk_3C[0] = 0.0f; + camera->unk_3C[1] = 0.0f; + camera->unk_3C[2] = 19.2f; + } else { + camera->unk_30[0] = 0.0f; + camera->unk_30[1] = 9.0f; + camera->unk_30[2] = -40.0f; + camera->unk_3C[0] = 0.0f; + camera->unk_3C[1] = 0.0f; + camera->unk_3C[2] = 18.0f; + } + break; + } + + //func_80014DE4(cameraId); + + // if (D_80164678[cameraId] == 0) { + if (D_80164A28 == 1) { + // gCameraZoom[cameraId] = 80.0f; + } else { + // gCameraZoom[cameraId] = 40.0f; + } + camera->unk_B4 = gCameraZoom[0]; + // } + // if (D_80164678[cameraId] == 1) { + // if (D_80164A28 == 1) { + // gCameraZoom[cameraId] = 100.0f; + // } else { + // gCameraZoom[cameraId] = 60.0f; + // } + // camera->unk_B4 = gCameraZoom[cameraId]; + // // } + // if (D_80164678[cameraId] == 2) { + // if (D_80164A28 == 1) { + // gCameraZoom[cameraId] = 100.0f; + // } else { + // gCameraZoom[cameraId] = 60.0f; + // } + // camera->unk_B4 = gCameraZoom[cameraId]; + // D_80164A38[cameraId] = 20.0f; + // D_80164A48[cameraId] = 1.5f; + // D_80164A78[cameraId] = 1.0f; + // } + break; + } + func_802B7F7C(camera->pos, camera->lookAt, camera->rot); +} + // Thwomp related void func_8001CA10(Camera* camera) { camera->unk_94.unk_8 = 0; @@ -241,7 +383,7 @@ void func_8001CA78(UNUSED Player* player, Camera* camera, Vec3f arg2, f32* arg3, arg2[2] = camera->lookAt[2]; calculate_orientation_matrix(sp74, 0, 1, 0, -0x00008000); mtxf_translate_vec3f_mat3(sp5C, sp74); - if (GetCourse() == GetToadsTurnpike()) { + if (IsToadsTurnpike()) { var_f14 = sp5C[0]; } else { var_f14 = sp5C[0] + temp_s2->posX; @@ -252,7 +394,7 @@ void func_8001CA78(UNUSED Player* player, Camera* camera, Vec3f arg2, f32* arg3, arg2[1] += (temp_f18 - camera->lookAt[1]) * 1; arg2[2] += (temp_f16 - camera->lookAt[2]) * 1; mtxf_translate_vec3f_mat3(sp68, sp74); - if (GetCourse() == GetToadsTurnpike()) { + if (IsToadsTurnpike()) { var_f14 = sp68[0]; } else { var_f14 = sp68[0] + temp_s2->posX; @@ -345,7 +487,7 @@ void func_8001CCEC(Player* player, Camera* camera, Vec3f arg2, f32* arg3, f32* a move_f32_towards(&D_80164AA0[index], 10, 0.02f); break; default: - if (GetCourse() == GetYoshiValley()) { + if (IsYoshiValley()) { move_f32_towards(&D_80164A90[index], 50, 0.04f); move_f32_towards(&D_80164AA0[index], 35, 0.04f); } else { @@ -993,6 +1135,7 @@ void func_8001EE98(Player* player, Camera* camera, s8 index) { break; } freecam(camera, player, index); // Runs func_8001E45C when freecam is disabled + //func_8001E45C(camera, player, index); break; case 8: func_8001E0C4(camera, player, index); |
