mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Bump score to 51% with 6 new matches (#381)
* Very minor cleanup of init_controllers after consulting JFG * really rough starts to some funcs * some labeling, and match thread0_Main * Some documenting, and better match for a couple of memory funcs * Add more official names for vars and funcs, as well as clean up some matches a little * Force No Shadows on Surfaces Force No Shadows on Surfaces Committer: sixtyfour On branch DKRsixtyfour Changes to be committed: modified: src/unknown_0255E0.h * identify shadows and fix mislabelling from past-me (#380) * Removed outdated comment * split some funcs out of printf that aren't related * Move funcs to particles that should belong there * Some printf documenting * Do some documenting on the debug font details * Get func_800B63F4 in a good place for now * Match func_800B63F4 * Match render_printf and do some more documenting * Move some functions around into different files. * Match func_800AA3EC * Fix some warnings in func_800AA3EC * Rename the thread 0 assert * Migrate BSS from particles to thread0 and printf * Find and split out a function in particles and do more documenting * Rename sprintf and vsprintf stuff to match JFG * Clean up the texAnimateTexture function, and document some more places. * WIP build_tex_display_list and documenting * Missing file check in * Match memset * build_tex_display_list update with macros * MAssive cleanup of build_tex_display_list that brings the score down in a big way. * Removed a massive amount of extra lines in build_tex_display_list * Match texInitTextures * Update README score * Fix comment * Rename some funcs * Commit suggestions from Fazana * Fix for last commit --------- Co-authored-by: Turok64Nukem <Duke64Nukem@gmail.com> Co-authored-by: Fazana <52551480+FazanaJ@users.noreply.github.com>
This commit is contained in:
co-authored by
Turok64Nukem
Fazana
parent
c9fa292c3d
commit
b61e4c3fa4
+15
-16
@@ -10,10 +10,9 @@ u16 gButtonMask = 0xFFFF; //Used when anti-cheat/anti-tamper has failed in func_
|
||||
OSMesgQueue sSIMesgQueue;
|
||||
OSMesg sSIMesgBuf;
|
||||
OSMesg gSIMesg;
|
||||
OSContStatus status;
|
||||
UNUSED s32 D_80121108[2];
|
||||
OSContPad sControllerCurrData[MAXCONTROLLERS];
|
||||
OSContPad sControllerPrevData[MAXCONTROLLERS];
|
||||
OSContStatus gControllerStatus[MAXCONTROLLERS];
|
||||
OSContPad gControllerCurrData[MAXCONTROLLERS];
|
||||
OSContPad gControllerPrevData[MAXCONTROLLERS];
|
||||
u16 gControllerButtonsPressed[MAXCONTROLLERS];
|
||||
u16 gControllerButtonsReleased[MAXCONTROLLERS];
|
||||
u8 sPlayerID[16];
|
||||
@@ -37,13 +36,13 @@ s32 init_controllers(void) {
|
||||
|
||||
osCreateMesgQueue(&sSIMesgQueue, &sSIMesgBuf, 1);
|
||||
osSetEventMesg(OS_EVENT_SI, &sSIMesgQueue, gSIMesg);
|
||||
osContInit(&sSIMesgQueue, &bitpattern, &status);
|
||||
osContInit(&sSIMesgQueue, &bitpattern, gControllerStatus);
|
||||
osContStartReadData(&sSIMesgQueue);
|
||||
initialise_player_ids();
|
||||
|
||||
sNoControllerPluggedIn = FALSE;
|
||||
|
||||
if ((bitpattern & CONT_ABSOLUTE) && (!(status.errno & CONT_NO_RESPONSE_ERROR))) {
|
||||
if ((bitpattern & CONT_ABSOLUTE) && (!(gControllerStatus[0].errno & CONT_NO_RESPONSE_ERROR))) {
|
||||
return CONTROLLER_EXISTS;
|
||||
}
|
||||
|
||||
@@ -68,9 +67,9 @@ s32 handle_save_data_and_read_controller(s32 saveDataFlags, s32 updateRate) {
|
||||
if (osRecvMesg(&sSIMesgQueue, &unusedMsg, OS_MESG_NOBLOCK) == 0) {
|
||||
//Back up old controller data
|
||||
for (i = 0; i < MAXCONTROLLERS; i++) {
|
||||
sControllerPrevData[i] = sControllerCurrData[i];
|
||||
gControllerPrevData[i] = gControllerCurrData[i];
|
||||
}
|
||||
osContGetReadData(sControllerCurrData);
|
||||
osContGetReadData(gControllerCurrData);
|
||||
if (saveDataFlags != 0) {
|
||||
settings = get_settings();
|
||||
if (SAVE_DATA_FLAG_READ_EEPROM_INDEX(saveDataFlags)) {
|
||||
@@ -110,11 +109,11 @@ s32 handle_save_data_and_read_controller(s32 saveDataFlags, s32 updateRate) {
|
||||
}
|
||||
for (i = 0; i < MAXCONTROLLERS; i++) {
|
||||
if (sNoControllerPluggedIn) {
|
||||
sControllerCurrData[i].button = 0;
|
||||
gControllerCurrData[i].button = 0;
|
||||
}
|
||||
//XOR the diff between the last read of the controller data with the current read to see what buttons have been pushed and released.
|
||||
gControllerButtonsPressed[i] = ((sControllerCurrData[i].button ^ sControllerPrevData[i].button) & sControllerCurrData[i].button) & gButtonMask;
|
||||
gControllerButtonsReleased[i] = ((sControllerCurrData[i].button ^ sControllerPrevData[i].button) & sControllerPrevData[i].button) & gButtonMask;
|
||||
gControllerButtonsPressed[i] = ((gControllerCurrData[i].button ^ gControllerPrevData[i].button) & gControllerCurrData[i].button) & gButtonMask;
|
||||
gControllerButtonsReleased[i] = ((gControllerCurrData[i].button ^ gControllerPrevData[i].button) & gControllerPrevData[i].button) & gButtonMask;
|
||||
}
|
||||
return saveDataFlags;
|
||||
}
|
||||
@@ -173,7 +172,7 @@ void swap_player_1_and_2_ids(void) {
|
||||
* Official name: joyGetButtons
|
||||
*/
|
||||
u16 get_buttons_held_from_player(s32 player) {
|
||||
return sControllerCurrData[sPlayerID[player]].button;
|
||||
return gControllerCurrData[sPlayerID[player]].button;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,7 +197,7 @@ u16 get_buttons_released_from_player(s32 player) {
|
||||
* Official name: joyGetStickX
|
||||
*/
|
||||
s8 clamp_joystick_x_axis(s32 player) {
|
||||
return clamp_joystick(sControllerCurrData[sPlayerID[player]].stick_x);
|
||||
return clamp_joystick(gControllerCurrData[sPlayerID[player]].stick_x);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,7 +205,7 @@ s8 clamp_joystick_x_axis(s32 player) {
|
||||
* Official name: joyGetStickY
|
||||
*/
|
||||
s8 clamp_joystick_y_axis(s32 player) {
|
||||
return clamp_joystick(sControllerCurrData[sPlayerID[player]].stick_y);
|
||||
return clamp_joystick(gControllerCurrData[sPlayerID[player]].stick_y);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -218,12 +217,12 @@ s8 clamp_joystick(s8 stickMag) {
|
||||
return 0;
|
||||
}
|
||||
if (stickMag > 0) {
|
||||
stickMag -= 8;
|
||||
stickMag -= JOYSTICK_DEADZONE;
|
||||
if (stickMag > JOYSTICK_MAX_RANGE) {
|
||||
stickMag = JOYSTICK_MAX_RANGE;
|
||||
}
|
||||
} else {
|
||||
stickMag += 8;
|
||||
stickMag += JOYSTICK_DEADZONE;
|
||||
if (stickMag < -JOYSTICK_MAX_RANGE) {
|
||||
stickMag = -JOYSTICK_MAX_RANGE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user