Skip to content

Commit

Permalink
25.1.31
Browse files Browse the repository at this point in the history
[Engine]
* Microsoft compiler warning and error fixes.
* Prevent warning about interlacing with png codec.
* Don't try to apply use of internal built-in post-processing image filters when the actual external image codec filters already converted them internally and log properly when they do.
* Alter compression parameters on archive building with PMU build program.

[Diggers]
* Add mouseover tips for the HUD in-game.
* Optimise handling and drawing of object context menus in-game.
* Add indicator for currently selected level in zone map like in race select screen.

[Assets]
* Optimise file textures since almost all of them can be saved as 8-bit palletted with alpha channel. This does not affect how the game looks in any way what so ever.
  • Loading branch information
Mhatxotic committed Jan 31, 2025
1 parent 5fa6421 commit 74e9d77
Show file tree
Hide file tree
Showing 44 changed files with 472 additions and 394 deletions.
3 changes: 2 additions & 1 deletion diggers/src/asset.lua
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ local aAssetsData<const> = {
-- map.lua --------------------------------------------------------------- --
map = { T = 10, F = "map", P = { 0, {
0, 0, 672, 350, -- [00] Operations map
640, 0, 32, 32 -- [01] Completion flag
640, 0, 32, 32, -- [01] Completion flag
640, 32, 32, 32 -- [02] Selection flag
} } },
-- race.lua -------------------------------------------------------------- --
race = { T = 10, F = "race", P = { 0, {
Expand Down
352 changes: 190 additions & 162 deletions diggers/src/game.lua

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions diggers/src/input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ local function OnMouseClick(iButton, iState)
if fcbCb then
-- Protected call so we can handle errors
local bResult<const>, sReason<const> =
xpcall(fcbCb, CoreStack, iButton);
xpcall(fcbCb, CoreStack, iButton, iCursorX, iCursorY);
if not bResult then SetErrorMessage(sReason) end;
end
-- Done
Expand Down Expand Up @@ -355,9 +355,14 @@ local function CheckHotSpotHover(aHotSpot)
aHotSpot[3], aHotSpot[4]) then return end;
-- Set the cursor
SetCursor(aHotSpot[6]);
-- Call the function if it is available
local fcbFunc<const> = aHotSpot[7];
if fcbFunc then fcbFunc() end;
-- Call the function if it is available?
local fcbCb<const> = aHotSpot[7];
if fcbCb then
-- Protected call so we can handle errors
local bResult<const>, sReason<const> =
xpcall(fcbCb, CoreStack, iCursorX, iCursorY);
if not bResult then SetErrorMessage(sReason) end;
end
-- Success
return true;
end
Expand Down
3 changes: 2 additions & 1 deletion diggers/src/lobby.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ local function RenderOpen()
RenderInterface();
texLobby:BlitLT(8, 8);
RenderShadow(8, 8, 312, 208);
RenderTip();
-- Render fire
local iFrame<const> = CoreTicks() % 9;
if iFrame >= 6 then texLobby:BlitSLT(1, 113, 74);
elseif iFrame >= 3 then texLobby:BlitSLT(2, 113, 74);
else fcbRenderExtra() end;
-- Render tip
RenderTip();
end
-- Lobby closed render proc ------------------------------------------------ --
local function RenderClosed()
Expand Down
66 changes: 33 additions & 33 deletions diggers/src/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ local fontLarge; -- Large font (16px)
local fontLittle; -- Little font (8px)
local fontSpeech; -- Speech font (10px)
local fontTiny; -- Tiny font (5px)
local sTip; -- Current tip
local sTip; -- Current tip and bounds
local texSpr; -- Sprites texture
-- Stage dimensions -------------------------------------------------------- --
local iStageWidth = 320; -- Width of stage
Expand All @@ -59,14 +59,14 @@ local iStageBottom = iStageHeight; -- Bottom of stage
-- Library functions loaded later ------------------------------------------ --
local ClearStates, InitCredits, InitTitleCredits, InitDebugPlay, InitEnding,
InitFail, InitIntro, InitNewGame, InitScene, InitScore, InitTitle,
JoystickProc, LoadLevel, MainProcFunc, MusicVolume, aLevelsData,
aObjectTypes, aRacesData;
IsMouseInBounds, JoystickProc, LoadLevel, MainProcFunc, MusicVolume,
aLevelsData, aObjectTypes, aRacesData;
-- These could be called even though they aren't initialised yet ----------- --
local DisableKeyHandlers, RestoreKeyHandlers, SetKeys, SetHotSpot =
UtilBlank, UtilBlank, UtilBlank, UtilBlank;
-- Constants for loader ---------------------------------------------------- --
local aBFlags<const> = Image.Flags; -- Get bitmap loading flags
local iPNG<const> = aBFlags.FCE_PNG; -- Get forced PNG format flag
local iPNG<const> = aBFlags.TOGPU|aBFlags.FCE_PNG;-- Get forced PNG format flag
local aPFlags<const> = Pcm.Flags; -- Get waveform loading flags
local iOGG<const> = aPFlags.FCE_OGG; -- Get forced wave format
local aPrFlags<const> = Asset.Progress; -- Asset progress flags
Expand Down Expand Up @@ -215,6 +215,28 @@ local function SetErrorMessage(sReason)
-- Set loop function
CoreOnTick(OnTick);
end
-- Do render the tip ------------------------------------------------------- --
local function DoRenderTip(iX)
-- Draw the background of the tip rect
texSpr:BlitSLT(847, iX, 216);
texSpr:BlitSLT(848, iX + 16, 216);
texSpr:BlitSLT(848, iX + 32, 216);
texSpr:BlitSLT(848, iX + 48, 216);
texSpr:BlitSLT(849, iX + 64, 216);
-- Set tip colour and render the text
fontLittle:SetCRGB(1, 1, 1);
fontLittle:PrintC(iX + 40, 220, sTip);
end
-- Render the tip in the bottom right -------------------------------------- --
local function RenderTip()
-- Return if no tip
if not sTip then return end;
-- Draw tip in different positions if mouse cursor is over the tip
if IsMouseInBounds(232, 216, 312, 232) then DoRenderTip(144);
else DoRenderTip(232) end;
end
-- Render the tip ---------------------------------------------------------- --
local function RenderTipShadow() if sTip then DoRenderTip(232) end end;
-- Set bottom right tip ---------------------------------------------------- --
local function SetTip(strTip) sTip = strTip end;
-- ------------------------------------------------------------------------- --
Expand Down Expand Up @@ -418,28 +440,6 @@ local function RenderShadow(iL, iT, iR, iB)
-- Restore colour
texSpr:PopColour();
end
-- Render the tip ---------------------------------------------------------- --
local function RenderTip()
-- Return if no tip
if not sTip then return end;
-- Draw the left side of the tip rect
texSpr:BlitSLT(847, 232, 216);
-- Draw the background of the tip rect
for iColumn = 1, 3 do texSpr:BlitSLT(848, 232 + (iColumn * 16), 216) end;
-- Draw the right of the tip rect
texSpr:BlitSLT(849, 296, 216);
-- Set tip colour
fontLittle:SetCRGB(1, 1, 1);
-- Print the tip
fontLittle:PrintC(272, 220, sTip);
end
-- Render the tip ---------------------------------------------------------- --
local function RenderTipShadow()
-- Render tip shadow
RenderShadow(232, 216, 312, 232);
-- Render the tip
RenderTip();
end
-- Fade -------------------------------------------------------------------- --
local function Fade(S, E, C, D, A, M, L, T, R, B, Z)
-- Check parameters
Expand Down Expand Up @@ -569,9 +569,9 @@ local function fcbTick()
LoadResources = LoadResources, RefreshViewportInfo = RefreshViewportInfo,
RegisterFBUCallback = RegisterFrameBufferUpdateCallback,
RenderFade = RenderFade, RenderShadow = RenderShadow,
RenderTip = RenderTip, RenderTipShadow = RenderTipShadow,
SetCallbacks = SetCallbacks, SetErrorMessage = SetErrorMessage,
SetTip = SetTip, TimeIt = TimeIt } });
RenderTip = RenderTip,
RenderTipShadow = RenderTipShadow, SetCallbacks = SetCallbacks,
SetErrorMessage = SetErrorMessage, SetTip = SetTip, TimeIt = TimeIt } });
-- Setup a default sprite set until the real sprite is loaded since we are
-- loading everything asynchronously.
texSpr = TextureCreate(Image.Blank("placeholder", 1, 1, false, true), 0);
Expand Down Expand Up @@ -715,15 +715,15 @@ local function fcbTick()
-- Load dependecies we need on this module
ClearStates, DisableKeyHandlers, InitCredits, InitDebugPlay, InitEnding,
InitFail, InitIntro, InitNewGame, InitScene, InitScore, InitTitle,
InitTitleCredits, JoystickProc, LoadLevel, MusicVolume,
InitTitleCredits, IsMouseInBounds, JoystickProc, LoadLevel, MusicVolume,
RestoreKeyHandlers, SetHotSpot, SetKeys, aLevelsData, aObjectTypes,
aRacesData =
GetAPI("ClearStates", "DisableKeyHandlers", "InitCredits",
"InitDebugPlay", "InitEnding", "InitFail", "InitIntro",
"InitNewGame", "InitScene", "InitScore", "InitTitle",
"InitTitleCredits", "JoystickProc", "LoadLevel", "MusicVolume",
"RestoreKeyHandlers", "SetHotSpot", "SetKeys", "aLevelsData",
"aObjectTypes", "aRacesData");
"InitTitleCredits", "IsMouseInBounds", "JoystickProc", "LoadLevel",
"MusicVolume", "RestoreKeyHandlers", "SetHotSpot", "SetKeys",
"aLevelsData", "aObjectTypes", "aRacesData");
-- Assign loaded sound effects (audio.hpp)
GetAPI("RegisterSounds")(aResources, iBaseSounds, #aBaseSounds);
-- Get cursor render function (input.hpp)
Expand Down
Loading

0 comments on commit 74e9d77

Please sign in to comment.