mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-01-22 07:32:07 -05:00
More fixes
This commit is contained in:
parent
404614cfea
commit
a997fe0a2e
11 changed files with 66 additions and 42 deletions
|
@ -105,7 +105,7 @@ end
|
|||
|
||||
--- @param o Object
|
||||
function bhv_breakable_window_loop(o)
|
||||
if (o.oInteractStatus & INT_STATUS_INTERACTED) == 0 or (o.oInteractStatus & INT_STATUS_WAS_ATTACKED) == 0 then
|
||||
if (o.oInteractStatus & INT_STATUS_INTERACTED) ~= 0 or (o.oInteractStatus & INT_STATUS_WAS_ATTACKED) ~= 0 then
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- @param o Object
|
||||
local function bhv_custom_koopa_the_quick_loop(o)
|
||||
if o.oKoopaMovementType >= KOOPA_BP_KOOPA_THE_QUICK_BASE then
|
||||
if gNetworkPlayers[0].currLevelNum == 27 then
|
||||
if gNetworkPlayers[0].currLevelNum == LEVEL_PSS then
|
||||
o.oKoopaTheQuickRaceIndex = 1
|
||||
else
|
||||
o.oKoopaTheQuickRaceIndex = 0
|
||||
|
@ -71,7 +71,7 @@ local function bhv_custom_big_bully_loop(o)
|
|||
end
|
||||
end
|
||||
|
||||
id_bhvBigBully = hook_behavior(id_bhvBigBully, OBJ_LIST_GENACTOR, true, bhv_custom_big_bully_init, bhv_custom_big_bully_loop, "bhvBigBully")
|
||||
id_bhvBigBully = hook_behavior(id_bhvBigBully, OBJ_LIST_GENACTOR, true, bhv_custom_big_bully_init, bhv_custom_big_bully_loop, "bhvBigBullyBoss")
|
||||
|
||||
---------------------------------------------------
|
||||
|
||||
|
|
|
@ -108,4 +108,17 @@ function spawn_object_abs_with_rot(parent, _, modelId, bhvId, x, y, z, rx, ry, r
|
|||
obj_set_angle(childObj, rx, ry, rz)
|
||||
|
||||
return childObj
|
||||
end
|
||||
|
||||
|
||||
--- @param obj Object
|
||||
--- Replacement for DROP_TO_FLOOR()
|
||||
function object_drop_to_floor(obj)
|
||||
local x = obj.oPosX
|
||||
local y = obj.oPosY
|
||||
local z = obj.oPosZ
|
||||
|
||||
local floorHeight = find_floor_height(x, y + 200, z)
|
||||
obj.oPosY = floorHeight
|
||||
obj.oMoveFlags = (obj.oMoveFlags | OBJ_MOVE_ON_GROUND)
|
||||
end
|
|
@ -251,7 +251,7 @@ u16 level_control_timer(s32 timerOp) {
|
|||
|
||||
u32 pressed_pause(void) {
|
||||
if (gServerSettings.pauseAnywhere) {
|
||||
if (get_dialog_id() < 0) {
|
||||
if (get_dialog_id() < 0 && !gWarpTransition.isActive && sDelayedWarpOp == WARP_OP_NONE) {
|
||||
return gPlayer1Controller->buttonPressed & START_BUTTON;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -17,13 +17,12 @@ static void djui_font_normal_render_char(char* c) {
|
|||
index &= ~0x010000;
|
||||
u32 tx = index % 64;
|
||||
u32 ty = index / 64;
|
||||
extern ALIGNED8 const u8 texture_font_jp[];
|
||||
extern ALIGNED8 const Texture texture_font_jp[];
|
||||
djui_gfx_render_texture_tile(texture_font_jp, 512, 1024, 32, tx * 8, ty * 16, 8, 16, false, true);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
u32 tx = index % 32;
|
||||
u32 ty = index / 32;
|
||||
extern ALIGNED8 const u8 texture_font_normal[];
|
||||
extern ALIGNED8 const Texture texture_font_normal[];
|
||||
djui_gfx_render_texture_tile(texture_font_normal, 256, 128, 32, tx * 8, ty * 16, 8, 16, false, true);
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +61,7 @@ static void djui_font_title_render_char(char* c) {
|
|||
u32 tx = index % 16;
|
||||
u32 ty = index / 16;
|
||||
|
||||
extern ALIGNED8 const u8 texture_font_title[];
|
||||
extern ALIGNED8 const Texture texture_font_title[];
|
||||
djui_gfx_render_texture_tile(texture_font_title, 1024, 512, 32, tx * 64, ty * 64, 64, 64, false, true);
|
||||
}
|
||||
|
||||
|
@ -157,13 +156,12 @@ static void djui_font_aliased_render_char(char* c) {
|
|||
index &= ~0x010000;
|
||||
u32 tx = index % 64;
|
||||
u32 ty = index / 64;
|
||||
extern ALIGNED8 const u8 texture_font_jp_aliased[];
|
||||
extern ALIGNED8 const Texture texture_font_jp_aliased[];
|
||||
djui_gfx_render_texture_tile(texture_font_jp_aliased, 1024, 2048, 32, tx * 16, ty * 32, 16, 32, false, true);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
u32 tx = index % 32;
|
||||
u32 ty = index / 32;
|
||||
extern ALIGNED8 const u8 texture_font_aliased[];
|
||||
extern ALIGNED8 const Texture texture_font_aliased[];
|
||||
djui_gfx_render_texture_tile(texture_font_aliased, 512, 256, 32, tx * 16, ty * 32, 16, 32, false, true);
|
||||
}
|
||||
}
|
||||
|
@ -197,7 +195,7 @@ static void djui_font_custom_hud_render_char(char* c) {
|
|||
u32 tx = index % 16;
|
||||
u32 ty = index / 16;
|
||||
|
||||
extern ALIGNED8 const u8 texture_font_hud[];
|
||||
extern ALIGNED8 const Texture texture_font_hud[];
|
||||
djui_gfx_render_texture_tile(texture_font_hud, 512, 512, 32, tx * 32, ty * 32, 32, 32, false, true);
|
||||
}
|
||||
|
||||
|
@ -210,7 +208,7 @@ static void djui_font_custom_hud_recolor_render_char(char* c) {
|
|||
u32 tx = index % 16;
|
||||
u32 ty = index / 16;
|
||||
|
||||
extern ALIGNED8 const u8 texture_font_hud_recolor[];
|
||||
extern ALIGNED8 const Texture texture_font_hud_recolor[];
|
||||
djui_gfx_render_texture_tile(texture_font_hud_recolor, 512, 512, 32, tx * 32, ty * 32, 32, 32, false, true);
|
||||
}
|
||||
|
||||
|
@ -251,11 +249,19 @@ static void djui_font_special_render_char(char* c) {
|
|||
if (*c == ' ') { return; }
|
||||
|
||||
u32 index = djui_unicode_get_sprite_index(c);
|
||||
u32 tx = index % 32;
|
||||
u32 ty = index / 32;
|
||||
if (index & 0x010000) {
|
||||
index &= ~0x010000;
|
||||
u32 tx = index % 64;
|
||||
u32 ty = index / 64;
|
||||
extern ALIGNED8 const Texture texture_font_jp[];
|
||||
djui_gfx_render_texture_tile(texture_font_jp, 512, 1024, 32, tx * 8, ty * 16, 8, 16, false, true);
|
||||
} else {
|
||||
u32 tx = index % 32;
|
||||
u32 ty = index / 32;
|
||||
extern ALIGNED8 const Texture texture_font_special[];
|
||||
djui_gfx_render_texture_tile(texture_font_special, 256, 128, 32, tx * 8, ty * 16, 8, 16, false, true);
|
||||
}
|
||||
|
||||
extern ALIGNED8 const u8 texture_font_special[];
|
||||
djui_gfx_render_texture_tile(texture_font_special, 256, 128, 32, tx * 8, ty * 16, 8, 16, false, true);
|
||||
}
|
||||
|
||||
static f32 djui_font_special_char_width(char* c) {
|
||||
|
|
|
@ -28,7 +28,7 @@ static s32 djui_paginated_get_count(struct DjuiPaginated* paginated) {
|
|||
|
||||
void djui_paginated_update_page_buttons(struct DjuiPaginated* paginated) {
|
||||
s32 count = djui_paginated_get_count(paginated);
|
||||
paginated->startIndex = MIN(paginated->startIndex, count) & ~(paginated->showCount - 1);
|
||||
paginated->startIndex = MIN(paginated->startIndex, count);
|
||||
|
||||
char pageNumString[32] = { 0 };
|
||||
snprintf(pageNumString, 32, "%d/%d", paginated->startIndex / paginated->showCount + 1, (count - 1) / paginated->showCount + 1);
|
||||
|
@ -64,21 +64,16 @@ void djui_paginated_calculate_height(struct DjuiPaginated* paginated) {
|
|||
f32 height = 0;
|
||||
s32 count = 0;
|
||||
|
||||
if (paginated->showMaxCount) {
|
||||
height = paginated->showCount * (32 + paginated->layout->margin.value);
|
||||
count = paginated->showCount + 1;
|
||||
} else {
|
||||
while (dbc != NULL) {
|
||||
struct DjuiBase* cbase = dbc->base;
|
||||
if (count < paginated->showCount) {
|
||||
if (height != 0) {
|
||||
height += paginated->layout->margin.value;
|
||||
}
|
||||
height += cbase->height.value;
|
||||
while (dbc != NULL) {
|
||||
struct DjuiBase* cbase = dbc->base;
|
||||
if (count < paginated->showCount) {
|
||||
if (height != 0) {
|
||||
height += paginated->layout->margin.value;
|
||||
}
|
||||
count++;
|
||||
dbc = dbc->next;
|
||||
height += cbase->height.value;
|
||||
}
|
||||
count++;
|
||||
dbc = dbc->next;
|
||||
}
|
||||
|
||||
if (count <= paginated->showCount) {
|
||||
|
|
|
@ -9,7 +9,6 @@ struct DjuiPaginated {
|
|||
struct DjuiText* pageNumText;
|
||||
s32 startIndex;
|
||||
s32 showCount;
|
||||
bool showMaxCount;
|
||||
};
|
||||
|
||||
void djui_paginated_update_page_buttons(struct DjuiPaginated* paginated);
|
||||
|
|
|
@ -226,7 +226,6 @@ void djui_panel_host_mods_create(struct DjuiBase* caller) {
|
|||
}
|
||||
djui_selectionbox_create(body, DLANG(HOST_MODS, CATEGORIES), categoryChoices, numCategories, &sSelectedCategory, djui_panel_on_categories_change);
|
||||
struct DjuiPaginated* paginated = djui_paginated_create(body, 8);
|
||||
paginated->showMaxCount = true;
|
||||
sModLayout = paginated->layout;
|
||||
djui_panel_host_mods_add_mods(&paginated->layout->base);
|
||||
djui_paginated_calculate_height(paginated);
|
||||
|
|
|
@ -35,14 +35,14 @@ void djui_panel_rules_create(struct DjuiBase* caller) {
|
|||
|
||||
struct DjuiText* text1 = djui_text_create(body, sRules);
|
||||
djui_base_set_location(&text1->base, 0, 0);
|
||||
djui_base_set_size(&text1->base, (DJUI_DEFAULT_PANEL_WIDTH * (configDjuiThemeCenter ? DJUI_THEME_CENTERED_WIDTH : 1)) - 64, 11 * 27);
|
||||
djui_base_set_size(&text1->base, (DJUI_DEFAULT_PANEL_WIDTH * (configDjuiThemeCenter ? DJUI_THEME_CENTERED_WIDTH : 1)) - 64, 11 * 30);
|
||||
djui_base_set_color(&text1->base, 220, 220, 220, 255);
|
||||
djui_text_set_drop_shadow(text1, 64, 64, 64, 100);
|
||||
djui_text_set_alignment(text1, DJUI_HALIGN_LEFT, DJUI_VALIGN_TOP);
|
||||
|
||||
struct DjuiText* text2 = djui_text_create(body, DLANG(RULES, SUBJECT_TO_CHANGE));
|
||||
djui_base_set_location(&text2->base, 0, 0);
|
||||
djui_base_set_size(&text2->base, (DJUI_DEFAULT_PANEL_WIDTH * (configDjuiThemeCenter ? DJUI_THEME_CENTERED_WIDTH : 1)) - 64, 2 * 27);
|
||||
djui_base_set_size(&text2->base, (DJUI_DEFAULT_PANEL_WIDTH * (configDjuiThemeCenter ? DJUI_THEME_CENTERED_WIDTH : 1)) - 64, 2 * 30);
|
||||
djui_base_set_color(&text2->base, 220, 220, 220, 255);
|
||||
djui_text_set_drop_shadow(text2, 64, 64, 64, 100);
|
||||
djui_text_set_alignment(text2, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
|
@ -50,7 +50,7 @@ void djui_panel_rules_create(struct DjuiBase* caller) {
|
|||
if (configRulesVersion != RULES_VERSION) {
|
||||
struct DjuiText* text3 = djui_text_create(body, DLANG(RULES, NOTICE));
|
||||
djui_base_set_location(&text3->base, 0, 0);
|
||||
djui_base_set_size(&text3->base, (DJUI_DEFAULT_PANEL_WIDTH * (configDjuiThemeCenter ? DJUI_THEME_CENTERED_WIDTH : 1)) - 64, 3 * 27);
|
||||
djui_base_set_size(&text3->base, (DJUI_DEFAULT_PANEL_WIDTH * (configDjuiThemeCenter ? DJUI_THEME_CENTERED_WIDTH : 1)) - 64, 3 * 30);
|
||||
djui_base_set_color(&text3->base, 220, 220, 220, 255);
|
||||
djui_text_set_drop_shadow(text3, 64, 64, 64, 100);
|
||||
djui_text_set_alignment(text3, DJUI_HALIGN_CENTER, DJUI_VALIGN_CENTER);
|
||||
|
|
|
@ -84,8 +84,8 @@ void nametags_render(void) {
|
|||
|
||||
Vec3f pos;
|
||||
Vec3f out;
|
||||
vec3f_copy(pos, m->marioBodyState->headPos);
|
||||
pos[1] += 100;
|
||||
vec3f_copy(pos, m->marioObj->header.gfx.pos);
|
||||
pos[1] += 200;
|
||||
|
||||
if (djui_hud_world_pos_to_screen_pos(pos, out) &&
|
||||
(i != 0 || (i == 0 && m->action != ACT_FIRST_PERSON))) {
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#include "pc/network/version.h"
|
||||
#include "pc/loading.h"
|
||||
|
||||
#define URL "https://sm64coopdx.com/download/version.txt"
|
||||
#define URL "https://raw.githubusercontent.com/coop-deluxe/sm64coopdx/refs/heads/main/src/pc/network/version.h"
|
||||
#define VERSION_IDENTIFIER "#define SM64COOPDX_VERSION \""
|
||||
|
||||
static char sVersionUpdateTextBuffer[256] = { 0 };
|
||||
static char sRemoteVersion[8] = { 0 };
|
||||
|
@ -38,10 +39,20 @@ size_t write_callback(char *ptr, size_t size, size_t nmemb, char **data) {
|
|||
}
|
||||
#endif
|
||||
|
||||
void parse_version(const char *data) {
|
||||
const char *version = strstr(data, VERSION_IDENTIFIER);
|
||||
if (version == NULL) { return; }
|
||||
u8 len = strlen(VERSION_IDENTIFIER);
|
||||
version += len;
|
||||
const char *end = strchr(version, '"');
|
||||
memcpy(sRemoteVersion, version, end - version);
|
||||
sRemoteVersion[end - version] = '\0';
|
||||
}
|
||||
|
||||
// function to download a text file from the internet
|
||||
void get_version_remote(void) {
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
char buffer[8];
|
||||
char buffer[0xFF];
|
||||
|
||||
// initialize WinINet
|
||||
HINTERNET hInternet = InternetOpenA("sm64coopdx", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
|
||||
|
@ -112,6 +123,7 @@ void get_version_remote(void) {
|
|||
// Clean up
|
||||
curl_easy_cleanup(curl);
|
||||
#endif
|
||||
parse_version(buffer);
|
||||
}
|
||||
|
||||
void check_for_updates(void) {
|
||||
|
|
Loading…
Reference in a new issue