Expose save_file_is_cannon_unlocked to smlua (#395)

* Update convert_functions.py

* Update save_file.c

* Update save_file.h

* Update cannon_door.inc.c
This commit is contained in:
Dominicentek 2023-05-21 05:06:15 +02:00 committed by GitHub
parent 1e5c2f2aa1
commit 9a065ffced
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View file

@ -67,7 +67,7 @@ override_allowed_functions = {
"src/audio/external.h": [ " play_", "fade", "current_background", "stop_", "sound_banks" ],
"src/game/rumble_init.c": [ "queue_rumble_", "reset_rumble_timers" ],
"src/pc/djui/djui_popup.h" : [ "create" ],
"src/game/save_file.h": [ "save_file_get_", "save_file_set_flags", "save_file_clear_flags", "save_file_reload", "save_file_erase_current_backup_save", "save_file_set_star_flags" ],
"src/game/save_file.h": [ "save_file_get_", "save_file_set_flags", "save_file_clear_flags", "save_file_reload", "save_file_erase_current_backup_save", "save_file_set_star_flags", "save_file_is_cannon_unlocked" ],
"src/pc/lua/utils/smlua_model_utils.h": [ "smlua_model_util_get_id" ],
"src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ],
"src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*" ],

View file

@ -1,6 +1,6 @@
// cannon.c.inc
static void bhv_cannon_closed_init_non_spawn(void) {
if (save_file_is_cannon_unlocked() == 1) {
if (save_file_is_cannon_unlocked(gCurrSaveFileNum - 1, gCurrCourseNum) == 1) {
o->oAction = CANNON_TRAP_DOOR_ACT_OPEN;
o->activeFlags = ACTIVE_FLAG_DEACTIVATED;
}
@ -45,7 +45,7 @@ void bhv_cannon_closed_loop(void) {
o->oVelY = 0;
o->oDrawingDistance = 4000.0f;
if (save_file_is_cannon_unlocked() == 1)
if (save_file_is_cannon_unlocked(gCurrSaveFileNum - 1, gCurrCourseNum) == 1)
o->oAction = CANNON_TRAP_DOOR_ACT_CAM_ZOOM;
break;

View file

@ -696,11 +696,11 @@ s32 save_file_get_course_coin_score(s32 fileIndex, s32 courseIndex) {
/**
* Return TRUE if the cannon is unlocked in the current course.
*/
s32 save_file_is_cannon_unlocked(void) {
s32 save_file_is_cannon_unlocked(s32 fileIndex, s32 courseIndex) {
if (INVALID_FILE_INDEX(gCurrSaveFileNum - 1)) { return 0; }
if (INVALID_SRC_SLOT(gSaveFileUsingBackupSlot)) { return 0; }
if (INVALID_COURSE_STAR_INDEX(gCurrCourseNum)) { return 0; }
return (gSaveBuffer.files[gCurrSaveFileNum - 1][gSaveFileUsingBackupSlot].courseStars[gCurrCourseNum] & 0x80) != 0;
return (gSaveBuffer.files[fileIndex][gSaveFileUsingBackupSlot].courseStars[courseIndex] & 0x80) != 0;
}
/**

View file

@ -146,7 +146,7 @@ u32 save_file_get_flags(void);
u32 save_file_get_star_flags(s32 fileIndex, s32 courseIndex);
void save_file_set_star_flags(s32 fileIndex, s32 courseIndex, u32 starFlags);
s32 save_file_get_course_coin_score(s32 fileIndex, s32 courseIndex);
s32 save_file_is_cannon_unlocked(void);
s32 save_file_is_cannon_unlocked(s32 fileIndex, s32 courseIndex);
void save_file_set_cannon_unlocked(void);
void save_file_set_cap_pos(s16 x, s16 y, s16 z);
s32 save_file_get_cap_pos(Vec3s capPos);