Skip to content

Commit

Permalink
25.2.22
Browse files Browse the repository at this point in the history
[Engine]
* Do not send redraw event when changing texture filter, just send a redraw request the main frame buffer instead.

[Diggers]
* Do not bounds check when a redraw event is sent when in the map screen to prevent an issue in setup.
* Use protected calls in framebuffer redraw event.
* Allow any button to drag the zone map like the rest of the game.
* Allow click dragging of level in map post mortem.
* Remove duplicated Jennites on Habbard so the player can't quick win with lucky zipper teleports.
* Resolve not being able to dig up-left or up-right when there is a skull tile (95) or a window tile (96) above the block (e.g. Habbard).
* Fix moving the cursor with game controller due to texture scaling.
* Adjust arrow cursor and direction cursor tiles to centre of their tile space also updating the corresponding cursor origin data.

[Assets]
* Fill unused sprite mask tiles with black squares and 0-index tile numbers in them. The squares with letters underneath are reserved for unique sprite masks.
  • Loading branch information
Mhatxotic committed Feb 22, 2025
1 parent 868c192 commit 0c4910e
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 31 deletions.
6 changes: 0 additions & 6 deletions diggers/lvl/habbard.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@
[ 10, 768, 1088 ],
[ 14, 320, 1216 ],
[ 4, 304, 1232 ],
[ 4, 304, 1232 ],
[ 4, 320, 1232 ],
[ 4, 320, 1232 ],
[ 4, 336, 1232 ],
[ 4, 336, 1232 ],
[ 11, 1120, 1600 ],
[ 4, 1104, 1616 ],
[ 4, 1104, 1616 ],
[ 4, 1120, 1616 ],
[ 4, 1120, 1616 ],
[ 4, 1136, 1616 ],
[ 4, 1136, 1616 ]
]
16 changes: 10 additions & 6 deletions diggers/src/data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ local CID<const> = {
-- Cursor data ------------------------------------------------------------- --
local aCursorData<const> = {
-- CID ------- S - C - X Y ---- CID ------- S - C - X Y ---
[CID.ARROW] ={ 992, 1, 0, 0}, [CID.OK] ={1005, 4,-7,-8},
[CID.EXIT] ={1001, 4,-7, -8}, [CID.LEFT] ={ 997, 1,-7,-7},
[CID.TOP] ={ 998, 1,-7, 0}, [CID.RIGHT] ={ 999, 1,-7,-7},
[CID.BOTTOM]={1000, 1,-7,-15}, [CID.SELECT]={ 993, 4,-7,-7},
[CID.WAIT] ={ 960, 8,-7, -7}, [CID.NONE] ={1009, 1, 0, 0},
[CID.ARROW] ={ 992, 1,-3, -3}, [CID.OK] ={1005, 4, -7,-8},
[CID.EXIT] ={1001, 4,-7, -8}, [CID.LEFT] ={ 997, 1, -2,-7},
[CID.TOP] ={ 998, 1,-7, -2}, [CID.RIGHT] ={ 999, 1,-13,-7},
[CID.BOTTOM]={1000, 1,-7,-13}, [CID.SELECT]={ 993, 4, -7,-7},
[CID.WAIT] ={ 960, 8,-7, -7}, [CID.NONE] ={1009, 1, 0, 0},
-- CID ------- S - C - X Y ---- CID ------- S - C - X Y ---
};
-- Object flags ------------------------------------------------------------ --
Expand Down Expand Up @@ -1661,7 +1661,7 @@ local DF<const> = {
-- ----------------------------------------------------------------------- --
};
-- Digging tile data ------------------------------------------------------- --
local aDigData<const> = {
local aDigData<const> = { -- Note that tile ids are 0-indexed here
-- ------------------------------------------------------------------------- --
-- FO (FromOver) DF.MO*. Tile to match from object's over tile
-- FA (FromAbove) DF.MA*. Tile to match from object's above tile
Expand All @@ -1678,6 +1678,8 @@ local aDigData<const> = {
{ 3, 3, 0, 0, 44, 0, 0,DF.MO|DF.MA |DF.SO |DF.OB},
{ 3, 7, 0, 12,208, 0, 0,DF.MO|DF.MA|DF.MC|DF.SO |DF.OB},
{ 3, 7, 0, 0, 44, 0, 0,DF.MO|DF.MA |DF.SO |DF.OB},
{ 3, 95, 0, 12,208, 0, 0,DF.MO|DF.MA|DF.MC|DF.SO |DF.OB},
{ 3, 96, 0, 0, 44, 0, 0,DF.MO|DF.MA |DF.SO |DF.OB},
{ 3,150, 0, 12,208, 0, 0,DF.MO|DF.MA|DF.MC|DF.SO |DF.OB},
{ 3,150, 0, 0, 44, 0, 0,DF.MO|DF.MA |DF.SO |DF.OB},
{ 3,170, 0, 12,208, 0, 0,DF.MO|DF.MA|DF.MC|DF.SO |DF.OB},
Expand All @@ -1702,6 +1704,8 @@ local aDigData<const> = {
{ 3, 3, 0, 0, 26, 0, 0,DF.MO|DF.MA |DF.SO |DF.OB},
{ 3, 7, 0, 6, 33, 0, 0,DF.MO|DF.MA|DF.MC|DF.SO |DF.OB},
{ 3, 7, 0, 0, 26, 0, 0,DF.MO|DF.MA |DF.SO |DF.OB},
{ 3, 95, 0, 6, 33, 0, 0,DF.MO|DF.MA|DF.MC|DF.SO |DF.OB},
{ 3, 96, 0, 0, 26, 0, 0,DF.MO|DF.MA |DF.SO |DF.OB},
{ 3,150, 0, 6, 33, 0, 0,DF.MO|DF.MA|DF.MC|DF.SO |DF.OB},
{ 3,150, 0, 0, 26, 0, 0,DF.MO|DF.MA |DF.SO |DF.OB},
{ 3,170, 0, 6, 33, 0, 0,DF.MO|DF.MA|DF.MC|DF.SO |DF.OB},
Expand Down
2 changes: 1 addition & 1 deletion diggers/src/input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ local function JoystickProc()
-- Axis moving?
if nJoyAX ~= 0 or nJoyAY ~= 0 then
-- Update mouse position
InputSetCursorPos(
SetCursorPos(
UtilClamp(iCursorX + nJoyAX, iStageLeft, iStageRight - 1),
UtilClamp(iCursorY + nJoyAY, iStageTop, iStageBottom - 1));
-- No axis pressed
Expand Down
9 changes: 6 additions & 3 deletions diggers/src/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,12 @@ local function RefreshViewportInfo()
floor(iOrthoWidth)//iTexScale, floor(iOrthoHeight)//iTexScale;
-- Call frame buffer callbacks
for _, fcbC in pairs(fcbFrameBufferCbs) do
fcbC(iStageWidth, iStageHeight,
iStageLeft, iStageTop, iStageRight, iStageBottom,
iOrthoWidth, iOrthoHeight) end;
-- Protected call so we can handle errors
local bResult<const>, sReason<const> = xpcall(fcbC, CoreStack,
iStageWidth, iStageHeight, iStageLeft, iStageTop, iStageRight,
iStageBottom, iOrthoWidth, iOrthoHeight);
if not bResult then SetErrorMessage(sReason) end;
end
end
-- Register a callback and automatically when window size changes ---------- --
local function RegisterFrameBufferUpdateCallback(sName, fCB)
Expand Down
13 changes: 6 additions & 7 deletions diggers/src/map.lua
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,9 @@ local function OnStageUpdated(...)
-- Clamp current co-ordinates
AdjustMapViewX(0);
AdjustMapViewY(0);
-- Update hover state
OnHover();
-- The mouse could be over something else now so clear selections
aHoverData = 0;
OnHoverGeneric(iCArrow, nil, nil);
end
-- When screen has faded out ----------------------------------------------- --
local function OnFadedOutToController()
Expand Down Expand Up @@ -248,19 +249,17 @@ local function GoScrollRight() AdjustMapViewX(8) OnHover() end;
local function GoScrollUp() AdjustMapViewY(-8) OnHover() end;
local function GoScrollDown() AdjustMapViewY(8) OnHover() end;
-- Cursor drag event ------------------------------------------------------- --
local function OnDrag(iButton, _, _, iMoveX, iMoveY)
-- Return if not right mouse button
if iButton ~= 1 then return end;
local function OnDrag(_, _, _, iMoveX, iMoveY)
-- Move the map to how the mouse is dragging
AdjustMapViewX(iMoveX);
AdjustMapViewY(iMoveY);
-- Keep arrow shown
SetCursor(iCArrow)
end
-- Cursor pressed event ---------------------------------------------------- --
local function OnPress(iButton)
local function OnPress()
-- Ignore if nothing pressed or left button not pressed
if not aHoverData or iButton ~= 0 then return;
if not aHoverData then return;
-- If a zone is selected then accept the level and fade out to lobby
elseif UtilIsTable(aHoverData) then FinishAndAccept();
-- If mouse is over the exit then cancel back to lobby
Expand Down
10 changes: 9 additions & 1 deletion diggers/src/post.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ local function OnScroll(nX, nY)
end
-- On mouse released (remove logic function) ------------------------------- --
local function OnRelease() SetCallbacks(nil, ProcRenderPostMortem) end;
-- Cursor drag event ------------------------------------------------------- --
local function OnDrag(_, _, _, iMoveX, iMoveY)
-- Move the level to how the mouse is dragging
AdjustViewPortX(iMoveX);
AdjustViewPortY(iMoveY);
-- Keep arrow shown
SetCursor(iCArrow)
end
-- On mouse pressed -------------------------------------------------------- --
local function OnPress()
-- Mouse pressed over top edge of screen?
Expand Down Expand Up @@ -249,7 +257,7 @@ local function OnScriptLoaded(GetAPI)
});
-- Set hot spot
iHotSpotId = RegisterHotSpot({
{ 0, 0, 0, 240, 3, 0, OnHover, OnScroll, { OnRelease, OnPress, false } }
{ 0, 0, 0, 240, 3, 0, OnHover, OnScroll, { OnRelease, OnPress, OnDrag } }
});
-- Set cursor ids
iCLeft, iCRight, iCTop, iCBottom, iCWait, iCArrow, iCExit =
Expand Down
Binary file modified diggers/tex/sprites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions src/engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#define VER_AUTHOR "Mhatxotic Design" // Author of engine
#define VER_MAJOR 25 // Version major (year)
#define VER_MINOR 2 // Version minor (month)
#define VER_BUILD 20 // Version build (day)
#define VER_REV 46 // Version rev (build#)
#define VER_STR_NQ 25,2,20,46 // Version as literal
#define VER_STR "25.2.20.46" // Version as string
#define VER_DATE "Thu Feb 20 21:40:36 2025 +0000" // Compilation date
#define VER_BUILD 21 // Version build (day)
#define VER_REV 1 // Version rev (build#)
#define VER_STR_NQ 25,2,21,1 // Version as literal
#define VER_STR "25.2.21.1" // Version as string
#define VER_DATE "Fri Feb 21 13:28:03 2025 +0000" // Compilation date
/* == EoF =========================================================== EoF == */
4 changes: 2 additions & 2 deletions src/fbocore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ static class FboCore final : // The main fbo operations manager
// Commit the filters
fboMain.FboCommitFilter();
fboConsole.FboCommitFilter();
// Ask LUA to tell guest to redraw if needed
cEvtMain->Add(EMC_LUA_REDRAW);
// Redraw the main frame-buffer
SetDraw();
// Return success
return ACCEPT;
}
Expand Down

0 comments on commit 0c4910e

Please sign in to comment.