mirror of
				https://github.com/coop-deluxe/sm64coopdx.git
				synced 2025-10-30 08:01:01 +00:00 
			
		
		
		
	Fixes
This commit is contained in:
		
							parent
							
								
									60e81e2bd2
								
							
						
					
					
						commit
						a8541f0470
					
				
					 5 changed files with 35 additions and 195 deletions
				
			
		|  | @ -1,202 +1,47 @@ | |||
| -- name: [CS] \\#00ff00\\VL-Tone & Cjes Luigi | ||||
| -- description: [CS] VL-Tone & Cjes Luigi\nBy Coop Deluxe Team\n\nThis Character Select pack adds VL-Tone Luigi and Cjes Luigi, who was originally the model for luigi in earlier versions of sm64ex-coop. | ||||
| -- name: [CS] VL-Tone & Cjes Luigi | ||||
| -- description: [CS] \\#00ff00\\VL-Tone \\#dcdcdc\\& \\#00ff00\\Cjes Luigi\n\\#dcdcdc\\By: Coop Deluxe Team\n\nReturn of TWO nostalgic Luigi's dating back to the 2000s!\n\n\\#00ff00\\Model Credits:\n\\#dcdcdc\\VL-Tone\nCJes\n\n\\#00ff00\\Model Porting:\n\\#dcdcdc\\AngelicMiracles "Yuyake"\nFluffaMario\nSonicDark | ||||
| 
 | ||||
| local MOD_NAME = "VL & Cjes Luigi" | ||||
| 
 | ||||
| if not _G.charSelectExists then | ||||
|     local first = false | ||||
|     hook_event(HOOK_ON_LEVEL_INIT, function() | ||||
|         if not first then | ||||
|             first = true | ||||
|             play_sound(SOUND_MENU_CAMERA_BUZZ, gGlobalSoundSource) | ||||
|             djui_chat_message_create("\\#ffffa0\\Extra Characters requires Character Select to be enabled.\nPlease rehost with it enabled.") | ||||
|         end | ||||
|     end) | ||||
|     djui_popup_create("\\#ffffa0\\"..MOD_NAME.." requires\nCharacter Select to be enabled.\n\nPlease rehost with it enabled.", 4) | ||||
|     return | ||||
| end | ||||
| 
 | ||||
| --Loads Models | ||||
| -- localize functions to improve performance | ||||
| local table_insert,play_sound,djui_hud_get_screen_width,maxf,math_sin,djui_hud_set_color,djui_hud_set_font,string_format,djui_hud_measure_text,djui_hud_print_text,djui_hud_set_resolution,min,math_min,math_max,djui_hud_set_rotation,djui_hud_render_rect = table.insert,play_sound,djui_hud_get_screen_width,maxf,math.sin,djui_hud_set_color,djui_hud_set_font,string.format,djui_hud_measure_text,djui_hud_print_text,djui_hud_set_resolution,min,math.min,math.max,djui_hud_set_rotation,djui_hud_render_rect | ||||
| 
 | ||||
| local E_MODEL_VL = smlua_model_util_get_id("vl_geo") | ||||
| local E_MODEL_CJES = smlua_model_util_get_id("cjes_geo") | ||||
| 
 | ||||
| --Loads Mod Name | ||||
| local TEXT_MOD_NAME = "VL-Tone & Cjes Luigi" | ||||
| local TEXT_MOD_VERSION = "4.1" | ||||
| 
 | ||||
| --Palettes | ||||
| local PALETTE_VL =  { | ||||
|     [PANTS]  = {r = 0x20, g = 0x14, b = 0x7c}, -- 20147C | ||||
|     [SHIRT]  = {r = 0x00, g = 0x98, b = 0x00}, -- 009800 | ||||
|     [GLOVES] = {r = 0xff, g = 0xff, b = 0xff}, -- FFFFFF | ||||
|     [SHOES]  = {r = 0x48, g = 0x20, b = 0x18}, -- 482018 | ||||
|     [HAIR]   = {r = 0x68, g = 0x24, b = 0x14}, -- 682414 | ||||
|     [SKIN]   = {r = 0xfe, g = 0xc1, b = 0x79}, -- FEC179 | ||||
|     [CAP]    = {r = 0x00, g = 0x98, b = 0x00}, -- 009800 | ||||
|     [EMBLEM] = {r = 0x00, g = 0x98, b = 0x00}, -- 009800 | ||||
|     [PANTS]  = { r = 0x20, g = 0x14, b = 0x7c }, -- 20147C | ||||
|     [SHIRT]  = { r = 0x00, g = 0x98, b = 0x00 }, -- 009800 | ||||
|     [GLOVES] = { r = 0xff, g = 0xff, b = 0xff }, -- FFFFFF | ||||
|     [SHOES]  = { r = 0x48, g = 0x20, b = 0x18 }, -- 482018 | ||||
|     [HAIR]   = { r = 0x68, g = 0x24, b = 0x14 }, -- 682414 | ||||
|     [SKIN]   = { r = 0xfe, g = 0xc1, b = 0x79 }, -- FEC179 | ||||
|     [CAP]    = { r = 0x00, g = 0x98, b = 0x00 }, -- 009800 | ||||
|     [EMBLEM] = { r = 0x00, g = 0x98, b = 0x00 }, -- 009800 | ||||
| } | ||||
| 
 | ||||
| local PALETTE_CJES =  { | ||||
|     [PANTS]  = {r = 0x00, g = 0x00, b = 0xff}, -- 0000FF | ||||
|     [SHIRT]  = {r = 0x00, g = 0x8c, b = 0x00}, -- 008C00 | ||||
|     [GLOVES] = {r = 0xff, g = 0xff, b = 0xff}, -- FFFFFF | ||||
|     [SHOES]  = {r = 0x50, g = 0x16, b = 0x07}, -- 501607 | ||||
|     [HAIR]   = {r = 0x73, g = 0x06, b = 0x00}, -- 730600 | ||||
|     [SKIN]   = {r = 0xfe, g = 0xc1, b = 0x79}, -- FEC179 | ||||
|     [CAP]    = {r = 0x00, g = 0x8c, b = 0x00}, -- 008C00 | ||||
|     [EMBLEM] = {r = 0x00, g = 0x8c, b = 0x00}, -- 008C00 | ||||
|     [PANTS]  = { r = 0x00, g = 0x00, b = 0xff }, -- 0000FF | ||||
|     [SHIRT]  = { r = 0x00, g = 0x8c, b = 0x00 }, -- 008C00 | ||||
|     [GLOVES] = { r = 0xff, g = 0xff, b = 0xff }, -- FFFFFF | ||||
|     [SHOES]  = { r = 0x50, g = 0x16, b = 0x07 }, -- 501607 | ||||
|     [HAIR]   = { r = 0x73, g = 0x06, b = 0x00 }, -- 730600 | ||||
|     [SKIN]   = { r = 0xfe, g = 0xc1, b = 0x79 }, -- FEC179 | ||||
|     [CAP]    = { r = 0x00, g = 0x8c, b = 0x00 }, -- 008C00 | ||||
|     [EMBLEM] = { r = 0x00, g = 0x8c, b = 0x00 }, -- 008C00 | ||||
| } | ||||
| 
 | ||||
| --Character Adds | ||||
| local CT_VL_AND_CJES = _G.charSelect.character_add("VL & CJes", {"Fanmade models of Luigi that are a", "big nostalgic throwback to", "Super Mario 64 fan community!", "", "VL was created as an easter egg", "for Toads Tool 64, a romhack editor.", "", "CJES was the original model for exCoop before", "it was eventually replaced!"}, "VL-Tone and CJes", {r = 0, g = 152, b = 0}, E_MODEL_VL, CT_LUIGI, gTextures.luigi_head) | ||||
| 
 | ||||
| --Set Palettes | ||||
| _G.charSelect.character_add_palette_preset(E_MODEL_VL, PALETTE_VL) | ||||
| _G.charSelect.character_add_palette_preset(E_MODEL_CJES, PALETTE_CJES) | ||||
| 
 | ||||
| -------------------------------------------- | ||||
| --- Alt Costume code from Paper Partners --- | ||||
| ------------ Modified by Squishy ----------- | ||||
| -------------------------------------------- | ||||
| 
 | ||||
| local character_edit = _G.charSelect.character_edit | ||||
| local character_get_current_number = _G.charSelect.character_get_current_number | ||||
| local character_get_current_table = _G.charSelect.character_get_current_table | ||||
| local get_options_status = _G.charSelect.get_options_status | ||||
| local get_menu_color = _G.charSelect.get_menu_color | ||||
| local hook_render_in_menu = _G.charSelect.hook_render_in_menu | ||||
| 
 | ||||
| local table_insert = table.insert | ||||
| local play_sound = play_sound | ||||
| local djui_hud_get_screen_width = djui_hud_get_screen_width | ||||
| local djui_hud_measure_text = djui_hud_measure_text | ||||
| local djui_hud_set_color = djui_hud_set_color | ||||
| local djui_hud_set_resolution = djui_hud_set_resolution | ||||
| local djui_hud_set_rotation = djui_hud_set_rotation | ||||
| local djui_hud_set_font = djui_hud_set_font | ||||
| local djui_hud_print_text = djui_hud_print_text | ||||
| local djui_hud_render_rect = djui_hud_render_rect | ||||
| local maxf = maxf | ||||
| local math_min = math.min | ||||
| local math_max = math.max | ||||
| local math_sin = math.sin | ||||
| 
 | ||||
| local altCostumes = { | ||||
|     [CT_VL_AND_CJES] = { | ||||
|         currSkin = 1, | ||||
|         {name = " VL ", model = E_MODEL_VL,}, | ||||
|         {name = " CJES ", model = E_MODEL_CJES,}, | ||||
|     }, | ||||
| } | ||||
| 
 | ||||
| local function update_character_skin(currChar, currAlt) | ||||
|     local currSkin = altCostumes[currChar][currAlt] | ||||
|     if altCostumes[currChar].desc == nil then | ||||
|         altCostumes[currChar].desc = character_get_current_table().description | ||||
|     end | ||||
|     local description = {} | ||||
|     for i = 1, #altCostumes[currChar].desc do | ||||
|         table_insert(description, altCostumes[currChar].desc[i]) | ||||
|     end | ||||
|     if currSkin.name ~= "" then | ||||
|         table_insert(description, "") | ||||
|         table_insert(description, "Current Outfit: "..currSkin.name) | ||||
|     end | ||||
|     character_edit(currChar, nil, description, nil, nil, currSkin.model, nil, nil) | ||||
|     local cameraToObject = gMarioStates[0].marioObj.header.gfx.cameraToObject | ||||
|     play_sound(SOUND_MENU_MESSAGE_NEXT_PAGE, cameraToObject) | ||||
| local CT_VL = 0 | ||||
| local function on_character_select_load() | ||||
|     CT_VL = _G.charSelect.character_add("VL and Cjes", {"A Fanmade model of Luigi that", "are a big nostalgic throwback for", "the Super Mario 64 community!", "", "VL was created as an easter egg", "for Toads Tool 64, a level editor", "released back in 2007!",}, "VL-Tone", PALETTE_VL[CAP], E_MODEL_VL, CT_LUIGI, "L") | ||||
|     _G.charSelect.character_edit(CT_VL, "VL Luigi") | ||||
|     _G.charSelect.character_add_costume(CT_VL, "Cjes Luigi", {"A Fanmade model of Luigi that", "are a big nostalgic throwback for", "the Super Mario 64 community!", "", "Cjes was the original model for", "SM64EX-Coop before it was", "eventually replaced."}, "Cjes", PALETTE_CJES[CAP], E_MODEL_CJES, CT_LUIGI, gTextures.luigi_head) | ||||
|     _G.charSelect.character_add_palette_preset(E_MODEL_VL, PALETTE_VL) | ||||
|     _G.charSelect.character_add_palette_preset(E_MODEL_CJES, PALETTE_CJES) | ||||
| end | ||||
| 
 | ||||
| local inputLockTimer = 0 | ||||
| local buttonAnimTimer = 0 | ||||
| 
 | ||||
| local MATH_DIVIDE_320 = 1/320 | ||||
| 
 | ||||
| local latencyValueTable = {12, 6, 3} | ||||
| 
 | ||||
| local function hud_render() | ||||
|     local width = djui_hud_get_screen_width() + 1.4 | ||||
|     local widthScale = maxf(width, 321.4) * MATH_DIVIDE_320 | ||||
|     local currChar = character_get_current_number() | ||||
|     local charColors = character_get_current_table().color | ||||
|      | ||||
|     -- Mimick button swaying, which is missing from the paper code | ||||
|     local buttonAnim = 0 | ||||
|     local charSelectAnim = get_options_status(_G.charSelect.optionTableRef.anims) | ||||
|     if charSelectAnim > 0 then | ||||
|         buttonAnimTimer = buttonAnimTimer + 1 | ||||
|         buttonAnim = math_sin(buttonAnimTimer * 0.05) * 2.5 + 5 | ||||
|     else | ||||
|         buttonAnim = 10 | ||||
|     end | ||||
| 
 | ||||
|     local inputLockTimerTo = latencyValueTable[get_options_status(_G.charSelect.optionTableRef.inputLatency) + 1] | ||||
| 
 | ||||
|     if altCostumes[currChar] ~= nil then | ||||
|         -- Render Mod Variond under CS version | ||||
|         local menuColor = get_menu_color() | ||||
|         djui_hud_set_color(menuColor.r, menuColor.g, menuColor.b, 255) | ||||
|         djui_hud_set_font(FONT_TINY) | ||||
|         local string = TEXT_MOD_NAME.." ("..TEXT_MOD_VERSION..")" | ||||
|         djui_hud_print_text(string, width - 5 - djui_hud_measure_text(string)*0.5, 3, 0.5) | ||||
| 
 | ||||
|         ---@type Controller | ||||
|         local c = _G.charSelect.controller | ||||
|         local currAlts = altCostumes[currChar] | ||||
| 
 | ||||
|         djui_hud_set_font(FONT_NORMAL) | ||||
|         djui_hud_set_resolution(RESOLUTION_N64) | ||||
|         local inputLockTimerAnim = 0 | ||||
| 
 | ||||
|         local buttonX = 20 * widthScale + buttonAnim | ||||
|         local x1 = buttonX - 4 | ||||
|         local x2 = x1 + 73 | ||||
|         local y = 97 | ||||
| 
 | ||||
|         if charSelectAnim > 0 then | ||||
|             inputLockTimerAnim = inputLockTimer/inputLockTimerTo * 3 | ||||
|             x1 = x1 + math_min(inputLockTimerAnim, 0) | ||||
|             x2 = x2 + math_max(inputLockTimerAnim, 0) | ||||
|         end | ||||
|         -- Left Arrow | ||||
|         if currAlts.currSkin > 1 then | ||||
|             djui_hud_set_color(charColors.r, charColors.g, charColors.b, 255) | ||||
|             djui_hud_set_rotation(0x2000, 0.5, 0.5) | ||||
|             djui_hud_render_rect(x1, y, 5, 5) | ||||
|             djui_hud_set_color(0, 0, 0, 255) | ||||
|             djui_hud_set_rotation(0x0000, 0.5, 0.5) | ||||
|             djui_hud_render_rect(x1 + 2.5, y - 2, 6, 8) | ||||
|             djui_hud_set_color(charColors.r, charColors.g, charColors.b, 255) | ||||
|             djui_hud_render_rect(buttonX, y - 3, 1, 10) | ||||
| 
 | ||||
|             if inputLockTimer == 0 and (c.buttonDown & L_JPAD ~= 0 or c.stickX < -0.5) then | ||||
|                 currAlts.currSkin = math_max(currAlts.currSkin - 1, 1) | ||||
|                 update_character_skin(currChar, currAlts.currSkin) | ||||
|                 inputLockTimer = -inputLockTimerTo | ||||
|             end | ||||
|         end | ||||
|         -- Right Arrow | ||||
|         if currAlts.currSkin < #currAlts then | ||||
|             -- Changed arrows to mimick the ones seen in the options menu | ||||
|             djui_hud_set_color(charColors.r, charColors.g, charColors.b, 255) | ||||
|             djui_hud_set_rotation(0x2000, 0.5, 0.5) | ||||
|             djui_hud_render_rect(x2, y, 5, 5) | ||||
|             djui_hud_set_color(0, 0, 0, 255) | ||||
|             djui_hud_set_rotation(0x0000, 0.5, 0.5) | ||||
|             djui_hud_render_rect(x2 - 3.5, y - 2, 6, 8) | ||||
|             djui_hud_set_color(charColors.r, charColors.g, charColors.b, 255) | ||||
|             djui_hud_render_rect(buttonX + 69, y - 3, 1, 10) | ||||
| 
 | ||||
|             if inputLockTimer == 0 and (c.buttonDown & R_JPAD ~= 0 or c.stickX > 0.5) then | ||||
|                 currAlts.currSkin = currAlts.currSkin + 1 | ||||
|                 update_character_skin(currChar, currAlts.currSkin) | ||||
|                 inputLockTimer = inputLockTimerTo | ||||
|             end | ||||
|         end | ||||
|         -- use an input lock to prevent cycling too fast | ||||
|         if inputLockTimer > 0 then | ||||
|             inputLockTimer = inputLockTimer - 1 | ||||
|         elseif inputLockTimer < 0 then | ||||
|             inputLockTimer = inputLockTimer + 1 | ||||
|         end | ||||
|     end | ||||
| end | ||||
| 
 | ||||
| hook_render_in_menu(hud_render) | ||||
| hook_event(HOOK_ON_MODS_LOADED, on_character_select_load) | ||||
|  | @ -459,7 +459,7 @@ static void newcam_zoom_button(void) { | |||
|             newcam_distance = newcam_distance_target; | ||||
|     } | ||||
| 
 | ||||
|     if (newcam_l_centering && (gPlayer1Controller->buttonPressed & L_TRIG) && (newcam_modeflags & NC_FLAG_ZOOM)) { | ||||
|     if (newcam_l_centering && (gPlayer1Controller->buttonDown & L_TRIG) && (newcam_modeflags & NC_FLAG_ZOOM)) { | ||||
|         //When you press L, set the flag for centering the camera. Afterwards, start setting the yaw to the Player's yaw at the time.
 | ||||
|         newcam_yaw_target = -gMarioStates[0].faceAngle[1]-0x4000; | ||||
|         newcam_centering = 1; | ||||
|  |  | |||
|  | @ -403,8 +403,8 @@ void djui_hud_print_text_interpolated(const char* message, f32 prevX, f32 prevY, | |||
|     if (sInterpHudCount >= MAX_INTERP_HUD) { return; } | ||||
|     struct InterpHud* interp = &sInterpHuds[sInterpHudCount++]; | ||||
|     interp->headPos = savedHeadPos; | ||||
|     interp->prevX = prevX + (font->xOffset * prevScale); | ||||
|     interp->prevY = prevY + (font->yOffset * prevScale); | ||||
|     interp->prevX = prevX; | ||||
|     interp->prevY = prevY; | ||||
|     interp->prevScaleW = prevScale; | ||||
|     interp->prevScaleH = prevScale; | ||||
|     interp->x = x; | ||||
|  |  | |||
|  | @ -38,9 +38,6 @@ void djui_slider_update_value(struct DjuiBase* base) { | |||
|     u32  max   = slider->max; | ||||
|     u32* value = slider->value; | ||||
|     djui_base_set_size(&slider->rectValue->base, ((f32)*value - min) / ((f32)max - min), 1.0f); | ||||
|     char message[128]; | ||||
|     snprintf(message, 128, "%s - %d", slider->message, *value); | ||||
|     djui_text_set_text(slider->text, message); | ||||
| } | ||||
| 
 | ||||
| static void djui_slider_get_cursor_hover_location(struct DjuiBase* base, f32* x, f32* y) { | ||||
|  | @ -112,7 +109,6 @@ struct DjuiSlider* djui_slider_create(struct DjuiBase* parent, const char* messa | |||
|     slider->value = value; | ||||
|     slider->min = min; | ||||
|     slider->max = max; | ||||
|     slider->message = message; | ||||
| 
 | ||||
|     slider->updateRectValueColor = true; | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,7 +10,6 @@ struct DjuiSlider { | |||
|     unsigned int min; | ||||
|     unsigned int max; | ||||
|     bool updateRectValueColor; | ||||
|     const char* message; | ||||
| }; | ||||
| 
 | ||||
| struct DjuiSlider* djui_slider_create(struct DjuiBase* parent, const char* message, unsigned int* value, unsigned int min, unsigned int max, void (*on_value_change)(struct DjuiBase*)); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Agent X
						Agent X