Files
SpaghettiKart/src/camera.h
T
MegaMech 44db9bab77 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 1a810d74cc.

* 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>
2025-06-07 21:38:12 -06:00

100 lines
3.0 KiB
C

#ifndef CAMERA_H
#define CAMERA_H
#include <libultraship.h>
#include <common_structs.h>
/**
* @todo put this define in types.h or similar.
* Certain functions are marked as having return values, but do not
* actually return a value. This causes undefined behavior, which we'd rather
* avoid on modern GCC. This only impacts -O2 and can matter for both the function
* itself and functions that call it.
*/
#ifdef AVOID_UB
#define BAD_RETURN(cmd) void
#else
#define BAD_RETURN(cmd) cmd
#endif
typedef struct {
f32 unk_0;
s16 unk_4;
s16 unk_6;
s16 unk_8;
} UnkCameraInner;
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f lookAt;
// This is expected to be a normalized vector, indicates what direction is "up" for the camera
/* 0x18 */ Vec3f up;
// I think these are the "nautical angles" between pos and lookAt
// rot[0] = roll? Does nothing?, rot[1] = yaw, rot[2] = pitch
/* 0x24 */ Vec3s rot;
/* 0x2A */ u16 someBitFlags;
/* 0x2C */ s16 unk_2C;
/* 0x2E */ s16 unk_2E;
/* 0x30 */ Vec3f unk_30;
/* 0x3C */ Vec3f unk_3C;
/* 0x48 */ s32 unk_48;
/* 0x4C */ s32 unk_4C;
/* 0x50 */ s32 unk_50;
/* 0x54 */ Collision collision;
// When you hit a wall (or another driver) the camera's pos and lookAt bounce up and down. This is the velocity(?)
// of that bouncing
/* 0x94 */ UnkCameraInner unk_94;
// Timer for wall-hit bounce. Counts up instead of down
/* 0xA0 */ f32 unk_A0;
/* 0xA4 */ s32 unk_A4;
/* 0xA8 */ s32 unk_A8;
/* 0xAC */ s16 unk_AC;
// Id of the player the camera is following.
/* 0xAE */ s16 playerId;
// Seems related to camera movement during drifting
/* 0xB0 */ s16 unk_B0;
/* 0xB2 */ s16 unk_B2;
/* 0xB4 */ f32 unk_B4;
size_t cameraId;
} Camera; /* size = 0xB8 */
void camera_init(f32, f32, f32, s16, u32, s32);
void freecam_init(f32 posX, f32 posY, f32 posZ, s16 rot, u32 arg4, s32 cameraId);
void func_8001CA10(Camera*);
void func_8001CA24(Player*, f32);
void func_8001CA78(Player*, Camera*, Vec3f, f32*, f32*, f32*, s32, s32);
void func_8001CCEC(Player*, Camera*, Vec3f, f32*, f32*, f32*, s32*, s16, s16);
void func_8001D53C(Player*, Camera*, Vec3f, f32*, f32*, f32*, s16, s16);
void func_8001D794(Player*, Camera*, Vec3f, f32*, f32*, f32*, s16);
void func_8001D944(Player*, Camera*, Vec3f, f32*, f32*, f32*, s32*, s16, s16);
void func_8001E0C4(Camera*, Player*, s8);
void func_8001E45C(Camera*, Player*, s8);
void func_8001E8E8(Camera*, Player*, s8);
void func_8001EA0C(Camera*, Player*, s8);
void func_8001EE98(Player*, Camera*, s8);
void func_8001F394(Player*, f32*);
void func_8001F87C(s32);
extern f32 D_800DDB30[];
extern Camera cameras[];
extern Camera* camera1;
extern Camera* camera2;
extern Camera* camera3;
extern Camera* camera4;
extern Camera* gFreecamCamera;
// end of camera.c variables
extern s8 D_80164A89;
extern s32 D_80164A08[4];
extern s32 D_80164A28;
extern s32 D_80164A2C;
extern f32 D_80164A30;
extern f32 D_80164A90[];
extern f32 D_80164AA0[];
#endif