Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reonucam and camera collision defines #778

Open
wants to merge 22 commits into
base: develop/3.0.0
Choose a base branch
from

Conversation

Reonu
Copy link
Contributor

@Reonu Reonu commented Apr 2, 2024

This PR adds Reonucam as a define, and additionally, adds a camera collision define for 8 direction camera that also affects Reonucam by extension (but you can toggle either separately)

Will update this in a sec listing all the features of reonucam

REONUCAM FEATURES

  • Pressing the cbuttons will rotate the camera by 45º as usual
  • Pressing R+Cbuttons will rotate it smoothly
    • If you rotate it smoothly, and then rotate it 45º again, it will re-align itself to 45º automatically
    • You can change the speed of the smooth rotation in the pause menu
  • Tap R once to center the camera behind Mario
  • Tap R twice to enter Mario cam (as in vanilla mario cam)
  • Compatible with camera collision
  • When in water or flying, you can press R at any time to swap between the vanilla swimming/flying cam, or Reonucam (default is vanilla)
  • You can press R+Cup in order to look down cliffs. The camera will continue being angled down until you let go of both R and C-up. So you can press R+C-up, then let go of C-up but keep holding R, and you'll have a top-down view until you let go of R.
  • Doesn't use a single button more than the vanilla camera. Perfect for hacks with lots of custom mechanics that might want L and the dpad to be free.

@Reonu Reonu added the do not merge Do not merge (yet) label Apr 2, 2024
@Reonu Reonu added this to the 3.0 milestone Apr 2, 2024
@Reonu Reonu self-assigned this Apr 2, 2024
@Reonu Reonu marked this pull request as ready for review April 17, 2024 20:26
@Reonu Reonu requested a review from gheskett as a code owner April 17, 2024 20:26
@Reonu Reonu changed the title [DO NOT MERGE] reonucam Reonucam and camera collision defines Apr 17, 2024
@Reonu Reonu added enhancement New feature or request monkaS monkaS and removed do not merge Do not merge (yet) labels Apr 17, 2024
src/game/camera.c Outdated Show resolved Hide resolved
@@ -1116,13 +1141,98 @@ s32 snap_to_45_degrees(s16 angle) {
return angle;
}

#ifdef EIGHT_DIR_CAMERA_COLLISION
void eight_dir_collision_handler(struct Camera *c) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would like some lines of spacing between parts of the code in this function and the below function, its a little hard to read

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mark it as resolved if you think it's ok now

/**
* A mode that only has 8 camera angles, 45 degrees apart
*/
void mode_8_directions_camera(struct Camera *c) {
Vec3f pos;
s16 oldAreaYaw = sAreaYaw;

#ifdef REONUCAM
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this function i think it might be better if reonucam_handler was expanded to include the other parts of this function and then it would be a replacement for this function rather than being full of ifdefs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, will look into it tomorrow

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still havent done this smh

@@ -2882,14 +3003,23 @@ void update_camera(struct Camera *c) {
// Only process R_TRIG if 'fixed' is not selected in the menu
if (cam_select_alt_mode(CAM_SELECTION_NONE) == CAM_SELECTION_MARIO) {
if (gPlayer1Controller->buttonPressed & R_TRIG) {
#ifdef REONUCAM
if (set_cam_angle(0) == CAM_ANGLE_MARIO) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be in the cam handler not here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless thats not possible with how the cam angle stuff works idk

}

void play_sound_cbutton_down(void) {
#ifndef REONUCAM
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleaner (both codewise and optimization wise) to ifdef this whole block and then if reonucam is defined instead do #define play_sound_cbutton_up()

@@ -4741,6 +4881,7 @@ void handle_c_button_movement(struct Camera *c) {
}
}


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get this formatting change outta here!!!!!!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think arceveti took over my pc

@@ -5210,7 +5351,11 @@ void set_camera_mode_8_directions(struct Camera *c) {
if (c->mode != CAMERA_MODE_8_DIRECTIONS) {
c->mode = CAMERA_MODE_8_DIRECTIONS;
sStatusFlags &= ~CAM_FLAG_SMOOTH_MOVEMENT;
#ifdef REONUCAM
s8DirModeBaseYaw = snap_to_45_degrees(s8DirModeBaseYaw);
#else
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems weird, how do you know what s8DirModeBaseYaw is here? that variable is not used outside of 8 direction camera afaik so i don't know if this has the effect you think it does

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right and this is completely unnecessary

Copy link
Collaborator

@gheskett gheskett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will review this properly tomorrow:tm:, but for now please remove reonucam from the enhancements folder

@Reonu
Copy link
Contributor Author

Reonu commented Apr 18, 2024

Will review this properly tomorrow:tm:, but for now please remove reonucam from the enhancements folder

it's already not there in 3.0

Copy link
Collaborator

@gheskett gheskett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry this is a lot of mostly nitpicks, but there's some important stuff in here too.

README.md Outdated Show resolved Hide resolved

// Enables Reonucam, a custom camera that aims to be a more feature-rich "aglabcam" that doesn't use a single button more than the vanilla camera.
// An explanation the features can be seen here: https://www.youtube.com/watch?v=TQNkznX9Z3k (please note that the analog feature shown at the end is no longer present)
//#define REONUCAM
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: // #define REONUCAM (the space)

Comment on lines +145 to +147
#ifndef USE_COURSE_DEFAULT_MODE
#define USE_COURSE_DEFAULT_MODE
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: #undef here instead

include/config/config_safeguards.h Outdated Show resolved Hide resolved
src/game/ingame_menu.c Show resolved Hide resolved
src/game/ingame_menu.c Outdated Show resolved Hide resolved
src/game/camera.c Outdated Show resolved Hide resolved
src/game/camera.c Outdated Show resolved Hide resolved
} else if (gPlayer1Controller->buttonPressed & L_JPAD) {
gReonucamState.speed--;
}
gReonucamState.speed = (gReonucamState.speed + 5) % 5;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you extern cameraSpeeds, give it a hard size (5), and use ARRAY_COUNT here instead? Would make configuring camera speeds safer. Also rename it to gReonucamSpeeds or something less generic.

src/game/camera.c Outdated Show resolved Hide resolved
@@ -58,7 +58,7 @@
/**
* Enables Puppy Camera 2, a rewritten camera that can be freely configured and modified.
*/
// #define PUPPYCAM
//#define PUPPYCAM
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should have been a bit more clear; the commented defines in the other files do use a space here. Space is also better because it's consistent with VSCode's commenting shortcut (Ctrl + /).

Comment on lines +54 to +55
// Enables Reonucam, a custom camera that aims to be a more feature-rich "aglabcam" that doesn't use a single button more than the vanilla camera.
// An explanation the features can be seen here: https://www.youtube.com/watch?v=TQNkznX9Z3k (please note that the analog feature shown at the end is no longer present)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this last time, but this should use a block comment rather than line comments like the rest of the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request monkaS monkaS
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

3 participants