mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Fixing smlua_level_util_get_info_from_short_name typing and bug reintroduced by commit cc4f4e9
- Instant Warp Function (#494)
This commit is contained in:
parent
f4b08ddf52
commit
0b53dbcdbd
8 changed files with 15 additions and 15 deletions
|
@ -7920,7 +7920,7 @@
|
||||||
[CustomLevelInfo](structs.md#CustomLevelInfo)
|
[CustomLevelInfo](structs.md#CustomLevelInfo)
|
||||||
|
|
||||||
### C Prototype
|
### C Prototype
|
||||||
`struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(char* shortName);`
|
`struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(const char* shortName);`
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
|
|
@ -490,7 +490,7 @@ u8 str_ascii_char_to_dialog(char c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void str_ascii_to_dialog(const char* string, u8* dialog, u16 length) {
|
void str_ascii_to_dialog(const char* string, u8* dialog, u16 length) {
|
||||||
char* c = (char*) string;
|
const char* c = string;
|
||||||
u8* d = dialog;
|
u8* d = dialog;
|
||||||
u16 converted = 0;
|
u16 converted = 0;
|
||||||
|
|
||||||
|
|
|
@ -249,7 +249,7 @@ const char *get_level_name_ascii(s16 courseNum, s16 levelNum, s16 areaIndex, s16
|
||||||
const u8 *get_level_name_sm64(s16 courseNum, s16 levelNum, s16 areaIndex, s16 charCase) {
|
const u8 *get_level_name_sm64(s16 courseNum, s16 levelNum, s16 areaIndex, s16 charCase) {
|
||||||
static u8 output[256];
|
static u8 output[256];
|
||||||
char levelName[256];
|
char levelName[256];
|
||||||
snprintf(levelName, 256, " %d %s", courseNum, (char*) get_level_name_ascii(courseNum, levelNum, areaIndex, charCase));
|
snprintf(levelName, 256, " %d %s", courseNum, get_level_name_ascii(courseNum, levelNum, areaIndex, charCase));
|
||||||
convert_string_ascii_to_sm64(output, levelName);
|
convert_string_ascii_to_sm64(output, levelName);
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
static enum ChatConfirmCommand sConfirming = CCC_NONE;
|
static enum ChatConfirmCommand sConfirming = CCC_NONE;
|
||||||
static u8 sConfirmPlayerIndex = 0;
|
static u8 sConfirmPlayerIndex = 0;
|
||||||
|
|
||||||
static struct NetworkPlayer* chat_get_network_player(char* name) {
|
static struct NetworkPlayer* chat_get_network_player(const char* name) {
|
||||||
// check for id
|
// check for id
|
||||||
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||||
if (!gNetworkPlayers[i].connected) { continue; }
|
if (!gNetworkPlayers[i].connected) { continue; }
|
||||||
|
@ -39,7 +39,7 @@ static struct NetworkPlayer* chat_get_network_player(char* name) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool str_starts_with(const char* pre, char* str) {
|
static bool str_starts_with(const char* pre, const char* str) {
|
||||||
return strncmp(pre, str, strlen(pre)) == 0;
|
return strncmp(pre, str, strlen(pre)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,12 @@ static void _debuglog_print_network_type(void) {
|
||||||
printf(" [%02d] ", (gNetworkPlayerLocal != NULL) ? gNetworkPlayerLocal->globalIndex : -1);
|
printf(" [%02d] ", (gNetworkPlayerLocal != NULL) ? gNetworkPlayerLocal->globalIndex : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _debuglog_print_log_type(char* logType) {
|
static void _debuglog_print_log_type(const char* logType) {
|
||||||
printf("[%s] ", logType);
|
printf("[%s] ", logType);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _debuglog_print_short_filename(char* filename) {
|
static void _debuglog_print_short_filename(const char* filename) {
|
||||||
char* last = strrchr(filename, '/');
|
const char* last = strrchr(filename, '/');
|
||||||
if (last != NULL) {
|
if (last != NULL) {
|
||||||
printf("%s: ", last + 1);
|
printf("%s: ", last + 1);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ static void _debuglog_print_short_filename(char* filename) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _debuglog_print_log(char* logType, char* filename) {
|
static void _debuglog_print_log(const char* logType, char* filename) {
|
||||||
_debuglog_print_timestamp();
|
_debuglog_print_timestamp();
|
||||||
_debuglog_print_network_type();
|
_debuglog_print_network_type();
|
||||||
_debuglog_print_log_type(logType);
|
_debuglog_print_log_type(logType);
|
||||||
|
|
|
@ -27731,7 +27731,7 @@ int smlua_func_smlua_level_util_get_info_from_short_name(lua_State* L) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* shortName = (char*)smlua_to_cobject(L, 1, LOT_NONE);
|
const char* shortName = smlua_to_string(L, 1);
|
||||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_level_util_get_info_from_short_name"); return 0; }
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_level_util_get_info_from_short_name"); return 0; }
|
||||||
|
|
||||||
smlua_push_object(L, LOT_CUSTOMLEVELINFO, smlua_level_util_get_info_from_short_name(shortName));
|
smlua_push_object(L, LOT_CUSTOMLEVELINFO, smlua_level_util_get_info_from_short_name(shortName));
|
||||||
|
|
|
@ -51,7 +51,7 @@ struct CustomLevelInfo* smlua_level_util_get_info(s16 levelNum) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(char* shortName) {
|
struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(const char* shortName) {
|
||||||
struct CustomLevelInfo* node = sCustomLevelHead;
|
struct CustomLevelInfo* node = sCustomLevelHead;
|
||||||
while (node != NULL) {
|
while (node != NULL) {
|
||||||
if (!strcmp(node->shortName, shortName)) {
|
if (!strcmp(node->shortName, shortName)) {
|
||||||
|
@ -62,7 +62,7 @@ struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(char* shortNam
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct CustomLevelInfo* smlua_level_util_get_info_from_script(char* scriptEntryName) {
|
static struct CustomLevelInfo* smlua_level_util_get_info_from_script(const char* scriptEntryName) {
|
||||||
struct CustomLevelInfo* node = sCustomLevelHead;
|
struct CustomLevelInfo* node = sCustomLevelHead;
|
||||||
while (node != NULL) {
|
while (node != NULL) {
|
||||||
if (!strcmp(node->scriptEntryName, scriptEntryName)) {
|
if (!strcmp(node->scriptEntryName, scriptEntryName)) {
|
||||||
|
@ -102,13 +102,13 @@ s16 level_register(const char* scriptEntryName, s16 courseNum, const char* fullN
|
||||||
}
|
}
|
||||||
|
|
||||||
// find duplicate
|
// find duplicate
|
||||||
struct CustomLevelInfo* info = smlua_level_util_get_info_from_script((char*)scriptEntryName);
|
struct CustomLevelInfo* info = smlua_level_util_get_info_from_script(scriptEntryName);
|
||||||
if (info != NULL) {
|
if (info != NULL) {
|
||||||
return info->levelNum;
|
return info->levelNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
// find script
|
// find script
|
||||||
LevelScript* script = dynos_get_level_script((char*)scriptEntryName);
|
LevelScript* script = dynos_get_level_script(scriptEntryName);
|
||||||
if (script == NULL) {
|
if (script == NULL) {
|
||||||
LOG_LUA("Failed to find script: %s", scriptEntryName);
|
LOG_LUA("Failed to find script: %s", scriptEntryName);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -21,7 +21,7 @@ struct CustomLevelInfo {
|
||||||
void smlua_level_util_reset(void);
|
void smlua_level_util_reset(void);
|
||||||
void smlua_level_util_change_area(s32 areaIndex);
|
void smlua_level_util_change_area(s32 areaIndex);
|
||||||
struct CustomLevelInfo* smlua_level_util_get_info(s16 levelNum);
|
struct CustomLevelInfo* smlua_level_util_get_info(s16 levelNum);
|
||||||
struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(char* shortName);
|
struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(const char* shortName);
|
||||||
struct CustomLevelInfo* smlua_level_util_get_info_from_course_num(u8 courseNum);
|
struct CustomLevelInfo* smlua_level_util_get_info_from_course_num(u8 courseNum);
|
||||||
s16 level_register(const char* scriptEntryName, s16 courseNum, const char* fullName, const char* shortName, u32 acousticReach, u32 echoLevel1, u32 echoLevel2, u32 echoLevel3);
|
s16 level_register(const char* scriptEntryName, s16 courseNum, const char* fullName, const char* shortName, u32 acousticReach, u32 echoLevel1, u32 echoLevel2, u32 echoLevel3);
|
||||||
bool level_is_vanilla_level(s16 levelNum);
|
bool level_is_vanilla_level(s16 levelNum);
|
||||||
|
|
Loading…
Reference in a new issue