Skip to content

Commit

Permalink
24.8.1
Browse files Browse the repository at this point in the history
[Engine]
* Fix CVar autocomplete not working and optimise the routine a bit more.
* Readability updates in 'Flags' class.
* Add 'Util.IsBoolean', 'Util.IsFunction', 'Util.IsInteger', 'Util.IsNumber', 'Util.IsString', 'Util.IsTable' and 'Util.IsUserdata'.
* Wrap all of the 'lua_is*' functions so that they all return booleans.
* Copy "__dtor" metadata string from a static C++ string for LUA.
* Log warning instead of throwing exception to trace a mysterious destabilisation of the engine when trying to Sample:Play() on a sample with no handles (normally impossible!) loaded during an audio reset.
* Obsolete LUA API functions 'Input.GetMousePos()', 'Input.GetKeyState()' and 'Input.GetMouseState()' were removed.
* LUA API functions 'Display.Maximise()', 'Display.Focus()', 'Display.Restore(), 'Display.Minimise()', 'Display.Attention()' were fixed.
* Send mouse position LUA event at start of LUA execution.
* Prevent unaligned reads in 'Memory::MemReadInt()' detected by ASAN debuggers.
* Fix "Fill error" exception with 'Asset.Create(0)' LUA API function.
* Optimisations and readability changes.
* Optimise and fix LuaLib API functions so that user passed arguments are accessed in proper order on compilers that evaluate function calls right to left (i.e. MacOS/XCode). To be continued…
* Add functions to send common events.
* Add 'Credit.Libs' which uniquely id's all the available libs and also 'Libs.MAX' for the total.
* Remove obsolete 'Credit.Total()'.
* Engine compatible with LUA version 5.4.7.
* Optimise 'File.WriteStr()' to prevent pointless string duplication.
* Add 'Info.LUAMicroTime', 'Info.LUAMilliTime', 'Info.LUANanoTime', 'Info.LUATime', 'Info.UpMicroTime', 'Info.UpMilliTime', 'Info.UpNanoTime' LUA api functions to show total Lua and engine execution times.
* Improve 'Crypt::CryptRandomPtr()' engine function.
* Optimise and fix LuaLib API functions so that user passed arguments are accessed in proper order on compilers that evaluate function calls right to left (i.e. Windows/MSVC). To be continued…
* Fix infinite loop bug when trying to render or sort unfinished 'Stat' objects.
* Fix 'Sample:Spawn()' not assigning OpenAL buffer id's.
* Remove obsolete 'Asset.Set()'.
* Optimise and fix LuaLib API functions so that user passed arguments are accessed in proper order on compilers that evaluate function calls right to left (i.e. Windows/MSVC). To be continued…
* Rename all '*.ArrayAsync' functions to '*.AssetAsync' for naming consistency.
* Remove pointless 'Asset.StringAsync' which was ill-thought out.
* Fix 'Asset.Duplicate()' not copying identifier and request identifier argument for 'Asset.Create()'.
* Remove 'Asset.Fill()' and add 'Asset.FF32()', 'Asset.FF32BE()', 'Asset.FF32LE()', 'Asset.FF64()', 'Asset.FF64BE()', 'Asset.FF64LE()', 'Asset.FI16()', 'Asset.FI16BE()', 'Asset.FI16LE()', 'Asset.FI32()', 'Asset.FI32BE()', 'Asset.FI32LE()', 'Asset.FI64()', 'Asset.FI64BE()'  'Asset.FI64LE()'. 'Asset.FI8()', 'Asset.FU16()', 'Asset.FU16BE()', Asset.FU16LE()', 'Asset.FU32()', 'Asset.FU32BE()', 'Asset.FU32LE()', 'Asset.FU64()', 'Asset.FU64BE()'  'Asset.FU64LE()' and 'Asset.FU8()'.
* Optimise 'Memory::MemCheckParam()'.
* Don't validate filename twice with 'Archive.LoadAsync()'.
* Async loader optimisations.
* Other optimisations, readability improvements and clean-ups.
* Remove API function parameter labels since we have a reference manual now they're no longer needed.
* Optimise and fix LuaLib API functions so that user passed arguments are accessed in proper order on compilers that evaluate function calls right to left (i.e. Windows/MSVC). Work may continue across commits.
* Ignore certain user requested cvar values when not supported by the underlying operating system.
* Remove ability to create an allocated Mask object surface that is uninitialised and supply 'Mask.CreateZero' or 'Mask.CreateOne'.
* Enforce parameter counts on all functions.
* Collector classes will hold the literal name string of each member class so we can use it with Lua.
* Finished fixing all LuaLib API functions pending optimisations.
* Reduce uneccesary macro usage in all LuaLib functions.
* Revert counting parameters (except on Async funcs) since Lua's own built-in functions don't do it.
* Completed LuaLib function optimisations.
* Add 'Font:PrintUC', 'Font:PrintUCT', 'Font:PrintUR' and 'Font:PrintURT'.
* Fix saving and restoring original colour intensities of glyphs when using 'Font:Print*T*' functions.
* Add more entropy to libcrypto random seed and don't 'set' it anymore.
* Fix console 'find' command by flushing all the queued console lines output buffer on command execution.
* No need to check rows being finished when using 'Stat:Finish()'.
* Log the randomly generated seed.
* Pre-calculate Y axis positions before processing X axis positions on Mask functions.

[Diggers]
* Monsters pick better Digger targets and when around the trade centre, they won't relentless harass the same Digger.
* AI Diggers shall only teleport to safety when they are moving only so the Digger can try to regain health.
* Perform most AI procedures when firmly on the ground.
* Optimise setting object actions.
* AI won't teleport as much when in danger and health above half.
* Remove at least two of the four Jennites from Klarsh at the player spawn that the AI can easily get to.
* Optimise uses of 'type' and 'assert' with new 'Util.Is*' engine functions.
* Optimise storage of game terrain data tile ids to use a LUA array for much faster memory read/writes.
* Remove 'no-cache' flag from raw level data file.
* Fix script error when cleaning up pursuer targets.
* Don't re-read level tile when updating level terrain mask when the tile id is already known.
* Force viewport position when loading a level so scrolling never occurs from the far top-left of the screen.
* View all players' Diggers on title screen.
* Other minor optimisations and readability fixes.
* Optimise credits.
* Renamed some data variables.
* Added shroud system to hide parts of the level you wouldn't normally see in the original game.
* Add test value to test rolling credits.
* Let callers of LoadLevel() control when to scroll the viewport.
* Use original table in API instead of GetLevelData().
* Revert cave ceiling terrain mask tiles to original version tiles so the monsters don't get stuck.
* Make and use functions for calculating tile under mouse cursor.
* Use separate object member variable for checking for shroud update.
* Move AI choices data and shroud data to data source module.
* Deprecate use of the 'table.insert' function.
* Break out map post mortem into separate module.
* Optimise ending scene and texture.
* Change running away from low health when fighting to be based on intelligence.
* Re-optimise some graphics files because interlacing was accidently used which was bloating them.
* Don't apply inventory perks when in the shop.
* Break out debug mode to separate module.
* Remove use of 'math.floor()' when dealing with integers where needed.
* Fix numerous cases where numbers are being generated instead of integers.
* Debug mode changes.
* Miscellaneous optimisations.
* Check AI Digger fall even when in danger.
* Deprecate use of 'assert()' and properly debug affected variables.
* Optimisations and readability changes.
* Update setup module to use new 'Credit.Libs.MAX' const.
* Recognise when objects are in water with a flag.
* Clean up object flags.
* Fix script errors when respawning objects.
* Diggers will now try to jump gaps but falling into water is now completely impossible.
* Diggers won't drop into water thats only one tile deep anymore.
* AI Diggers phase out if they 'wriggle' too much (e.g. if they get stuck on a 1-pixel wide island).
* AI Diggers won't jump if the ceiling is too low.
* Decrease chances that AI Diggers will continuously dig down.
* AI dropped devices that can be deployed will be automatically deployed (if possible).
* Add AI for AI Digger purchased devices.
* AI won't steal opponents devices anymore.
* Colourised shroud depending on level type.
* Give all the code the once over with a spellchecker.
* Restore animation speed on respawn.

[Assets]
* Update refdoc with new functions and fixed some explanations.
  • Loading branch information
Mhatxotic committed Aug 1, 2024
1 parent 1a21652 commit cc07170
Show file tree
Hide file tree
Showing 134 changed files with 11,439 additions and 8,610 deletions.
Binary file modified diggers/lvl/klarsh.dao
Binary file not shown.
76 changes: 40 additions & 36 deletions diggers/src/bank.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@
-- Copyr. (c) MS-Design, 2024 Copyr. (c) Millennium Interactive Ltd., 1994 --
-- ========================================================================= --
-- Core function aliases --------------------------------------------------- --
local floor<const>, format<const>, unpack<const> =
math.floor, string.format, table.unpack;
local format<const>, unpack<const>, error<const> =
string.format, table.unpack, error;
-- M-Engine function aliases ----------------------------------------------- --
local InfoTicks<const>, UtilBlank<const> = Info.Ticks, Util.Blank;
local InfoTicks<const>, UtilBlank<const>, UtilIsTable<const> =
Info.Ticks, Util.Blank, Util.IsTable;
-- Diggers function and data aliases --------------------------------------- --
local Fade, GameProc, GetGameTicks, HaveZogsToWin, InitCon, InitLobby,
IsButtonPressed, IsMouseInBounds, IsMouseNotInBounds, IsScrollingDown,
IsScrollingUp, LoadResources, PlayMusic, PlayStaticSound, RenderInterface,
RenderShadow, SellSpecifiedItems, SetBottomRightTip, SetCallbacks, SetCursor,
aCursorIdData, aGemsAvailable, aObjectActions, aObjectData, aObjectDirections,
aObjectJobs, aObjectTypes, aSfxData, fontSpeech, texSpr;
local Fade, GameProc, GetGameTicks, HaveZogsToWin, InitLobby, IsButtonPressed,
IsMouseInBounds, IsMouseNotInBounds, IsScrollingDown, IsScrollingUp,
LoadResources, PlayMusic, PlayStaticSound, RenderInterface, RenderShadow,
SellSpecifiedItems, SetBottomRightTip, SetCallbacks, SetCursor,
aCursorIdData, aGemsAvailable, aObjectActions, aObjectData,
aObjectDirections, aObjectJobs, aObjectTypes, aSfxData, fontSpeech, texSpr;
-- Assets required --------------------------------------------------------- --
local aAssets<const> = { { T = 1, F = "bank", P = { 80, 94, 0, 0, 0 } },
{ T = 7, F = "bank", P = { } } };
-- Mouse over events ------------------------------------------------------- --
local function MsOvFTarg() return IsMouseInBounds(25,113,87,183) end;
local function MsOvHabbish() return IsMouseInBounds(129,95,191,184) end;
Expand All @@ -40,11 +44,13 @@ local aBankerStaticData<const> = {
-- Initialise the bank screen ---------------------------------------------- --
local function InitBank(aActiveObject)
-- Check parameter
assert(type(aActiveObject)=="table", "Object owner not specified!");
if not UtilIsTable(aActiveObject) then
error("Object owner not specified!") end;
-- Sanity check gems available count
assert(#aGemsAvailable >= #aBankerStaticData,
"Gems available mismatch ("..#aGemsAvailable.."<"..
#aBankerStaticData..")!");
if #aGemsAvailable < #aBankerStaticData then
error("Gems available mismatch ("..#aGemsAvailable.."<"..
#aBankerStaticData..")!")
end
-- Resources loaded event callback
local function OnLoaded(aResources)
-- Play bank music
Expand All @@ -57,7 +63,7 @@ local function InitBank(aActiveObject)
local tileBG<const> = texBank:TileA(208, 312, 512, 512);
local tileSpeech<const> = texBank:TileA(0, 488, 112, 512);
-- Get treasure value modifier
local iTreasureValueModifier<const> = floor(GetGameTicks()/18000);
local iTreasureValueModifier<const> = GetGameTicks() // 18000;
-- Banker data
local aBankerData<const> = { };
-- Function to refresh banker data
Expand All @@ -75,7 +81,7 @@ local function InitBank(aActiveObject)
aBankerData[iGemId] = {
iGemId, -- [01] Gem (banker) id
iGemTypeId, -- [02] Gem type id
floor(aGemObjData.VALUE / 2) + -- [03] Gem value
aGemObjData.VALUE // 2 + -- [03] Gem value
iTreasureValueModifier,
aGemObjData[aObjectActions.STOP] -- [04] Gem sprite
[aObjectDirections.NONE][1],
Expand Down Expand Up @@ -115,7 +121,7 @@ local function InitBank(aActiveObject)
end
-- Get active object and objects owner
local aPlayer<const> = aActiveObject.P;
-- Prevents duplicate win messsages
-- Prevents duplicate win messages
local bGameWon = false;
-- Function to check if player has won game
local function HasBeatenGame()
Expand All @@ -136,7 +142,7 @@ local function InitBank(aActiveObject)
-- No Jennite found so try what the banker is trading
elseif SellSpecifiedItems(aActiveObject, iGemId) > 0 then
strName = aObjectData[iGemId].LONGNAME end;
-- Money changed hands? Set succeded message and check for win
-- Money changed hands? Set succeeded message and check for win
if strName then
SetSpeech(iBankerId, 60, aSfxData.TRADE, strName.." SOLD FOR $"..
format("%03u", aPlayer.M - iMoney), HasBeatenGame);
Expand All @@ -161,7 +167,7 @@ local function InitBank(aActiveObject)
-- Speech bubble should show?
if iSpeechTimer > 0 then
-- Show banker talking graphic, speech bubble and text
texBank:BlitSLT(iBankerTexId + floor(InfoTicks() / 10) % 4,
texBank:BlitSLT(InfoTicks() // 10 % 4 + iBankerTexId,
iBankerX, iBankerY);
texBank:BlitSLT(tileSpeech, iSpeechBubbleX, iSpeechBubbleY);
fontSpeech:PrintC(iSpeechTextX, iSpeechTextY, strBankerSpeech);
Expand Down Expand Up @@ -189,7 +195,7 @@ local function InitBank(aActiveObject)
if IsButtonPressed(0) then
-- Play sound and exit to game
PlayStaticSound(aSfxData.SELECT);
-- Unreference assets to garbage collector
-- Dereference assets to garbage collector
texBank = nil;
-- Start the loading waiting procedure
SetCallbacks(GameProc, RenderInterface, nil);
Expand Down Expand Up @@ -234,27 +240,25 @@ local function InitBank(aActiveObject)
SetCallbacks(BankProc, BankRender, BankInput);
end
-- Load bank texture
LoadResources("Bank", {{T=1,F="bank",P={80,94,0,0,0}},
{T=7,F="bank",P={ }}}, OnLoaded);
LoadResources("Bank", aAssets, OnLoaded);
end
-- Exports and importants -------------------------------------------------- --
-- Exports and imports ----------------------------------------------------- --
return { A = { InitBank = InitBank }, F = function(GetAPI)
-- Imports --------------------------------------------------------------- --
LoadResources, SetCallbacks, SetCursor, IsMouseInBounds, aCursorIdData,
PlayStaticSound, Fade, IsMouseNotInBounds, aSfxData, InitCon, PlayMusic,
IsButtonPressed, IsScrollingDown, IsScrollingUp, aObjectData,
aGemsAvailable, aObjectActions, aObjectJobs, aObjectDirections, aObjectTypes,
InitLobby, texSpr, fontSpeech, GetGameTicks, SetBottomRightTip,
RenderInterface, HaveZogsToWin, GameProc, SellSpecifiedItems, RenderShadow
Fade, GameProc, GetGameTicks, HaveZogsToWin, InitLobby, IsButtonPressed,
IsMouseInBounds, IsMouseNotInBounds, IsScrollingDown, IsScrollingUp,
LoadResources, PlayMusic, PlayStaticSound, RenderInterface, RenderShadow,
SellSpecifiedItems, SetBottomRightTip, SetCallbacks, SetCursor,
aCursorIdData, aGemsAvailable, aObjectActions, aObjectData,
aObjectDirections, aObjectJobs, aObjectTypes, aSfxData, fontSpeech, texSpr
= -- --------------------------------------------------------------------- --
GetAPI("LoadResources", "SetCallbacks", "SetCursor", "IsMouseInBounds",
"aCursorIdData", "PlayStaticSound", "Fade", "IsMouseNotInBounds",
"aSfxData", "InitCon", "PlayMusic", "IsButtonPressed", "IsScrollingDown",
"IsScrollingUp", "aObjectData", "GemsAvailable",
"aObjectActions", "aObjectJobs", "aObjectDirections", "aObjectTypes",
"InitLobby", "texSpr", "fontSpeech", "GetGameTicks", "SetBottomRightTip",
"RenderInterface", "HaveZogsToWin", "GameProc", "SellSpecifiedItems",
"RenderShadow");
GetAPI("Fade", "GameProc", "GetGameTicks", "HaveZogsToWin", "InitLobby",
"IsButtonPressed", "IsMouseInBounds", "IsMouseNotInBounds",
"IsScrollingDown", "IsScrollingUp", "LoadResources", "PlayMusic",
"PlayStaticSound", "RenderInterface", "RenderShadow", "SellSpecifiedItems",
"SetBottomRightTip", "SetCallbacks", "SetCursor", "aCursorIdData",
"aGemsAvailable", "aObjectActions", "aObjectData", "aObjectDirections",
"aObjectJobs", "aObjectTypes", "aSfxData", "fontSpeech", "texSpr");
-- ----------------------------------------------------------------------- --
end };
-- End-of-File ============================================================= --
45 changes: 24 additions & 21 deletions diggers/src/book.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
-- Copyr. (c) MS-Design, 2024 Copyr. (c) Millennium Interactive Ltd., 1994 --
-- ========================================================================= --
-- Core function aliases --------------------------------------------------- --
local insert<const>, floor<const> = table.insert, math.floor;
-- M-Engine function aliases ----------------------------------------------- --
local ClampInt<const> = Util.ClampInt;
-- Diggers function and data aliases --------------------------------------- --
Expand All @@ -22,27 +21,31 @@ local LoadResources, Fade, SetCallbacks, IsMouseInBounds, IsMouseNotInBounds,
-- Locals ------------------------------------------------------------------ --
local iBookPage = 0; -- Book current page (persisted)
local bIntroPage = false; -- Intro page was displayed?
-- Assets ------------------------------------------------------------------ --
local aBookTexture<const> = { T = 2, F = "book", P = { 0 } };
local aLobbyOpenTexture<const> = { T = 7, F = "lobby", P = { 0 } };
local aLobbyClosedTexture<const> = { T = 2, F = "lobbyc", P = { 0 } };
local aAssets<const> = { aBookTexture, false };
local aPageAsset<const> = { { T = 1, F = false, P = { 255, 200, 0, 0, 0 } } };
-- Init book screen function ----------------------------------------------- --
local function InitBook(bFromInGame)
-- Pages each sized 510x200 stored inside texture sized 1024^2. OpenGL 3.2
-- garauntees us that 1024^2 textures are supported by every renderer.
-- guarantees us that 1024^2 textures are supported by every renderer.
local iPagesPerTexture<const> = 20;
-- Resources to load
local aToLoad<const> = { { T = 2, F = "book", P = { 0 } } };
-- Exit tip
local strExitTip, strTip;
-- Loading from in game?
if bFromInGame then
-- Set text for exit tip
strExitTip = "BACK TO GAME";
-- Load just the book texture
insert(aToLoad, { T = 7, F = "lobby", P = { 0 } });
aAssets[2] = aLobbyOpenTexture;
-- Loading from controller screen?
else
-- Set text for exit tip
strExitTip = "CONTROLLER";
-- Load backdrop from closed lobby (lobby music already playing)
insert(aToLoad, { T = 2, F = "lobbyc", P = { 0 } });
-- Load backdrop from closed lobby
aAssets[2] = aLobbyClosedTexture;
end
-- When the resources have loaded
local function OnLoadResources(aResources)
Expand Down Expand Up @@ -102,7 +105,7 @@ local function InitBook(bFromInGame)
local strPage<const> = "PAGE "..iBookPageP1.."/"..iTotalPages;
POIData[4][7] = strPage;
-- Which texture page do we need and if we need to load it?
local iLoadPage<const> = floor(iBookPage/iPagesPerTexture);
local iLoadPage<const> = iBookPage // iPagesPerTexture;
if iLoadPage == iFilePage and not fOnComplete then
-- Set new page and actual page on texture
iFilePage, iTilePage = iLoadPage, iBookPage % iPagesPerTexture;
Expand Down Expand Up @@ -130,19 +133,19 @@ local function InitBook(bFromInGame)
else SetCallbacks(nil, RenderBook, BookInput) end;
end
-- Load the specified texture with the page image
LoadResources("The Book "..iLoadPage,
{{T=1,F="e/"..iLoadPage,P={255,200,0,0,0}}}, OnPageLoaded);
aPageAsset[1].F = "e/"..iLoadPage;
LoadResources("The Book "..iLoadPage, aPageAsset, OnPageLoaded);
end
-- The render and input callbacks we have set
local fRender, fInput;
-- Set points of interest data
POIData = { -- Index
POIData = { -- Index
{ 17, 37, 70, 92, aCursorIdData.SELECT, aSfxData.CLICK, "CONTENTS",
function() LoadPage(1) end }, -- Last
function() LoadPage(1) end }, -- Last
{ 17, 37, 96,118, aCursorIdData.SELECT, aSfxData.CLICK, "NEXT PAGE",
function() LoadPage(iBookPage+1) end }, -- Next
function() LoadPage(iBookPage + 1) end }, -- Next
{ 17, 37,122,144, aCursorIdData.SELECT, aSfxData.CLICK, "LAST PAGE",
function() LoadPage(iBookPage-1) end }, -- Nada
function() LoadPage(iBookPage - 1) end }, -- Nada
{ 8,312, 8,208, aCursorIdData.ARROW, nil, nil,
function() end }
};
Expand Down Expand Up @@ -177,7 +180,7 @@ local function InitBook(bFromInGame)
PlayStaticSound(aSfxData.SELECT);
-- If from in game then continue the game
if bFromInGame then
-- Unreference assets for garbage collector
-- Dereference assets for garbage collector
texPage, texBook = nil, nil;
-- Start the loading waiting procedure
SetCallbacks(GameProc, RenderInterface, nil);
Expand All @@ -186,7 +189,7 @@ local function InitBook(bFromInGame)
end;
-- On faded event
local function OnFadeOut()
-- Unreference assets for garbage collector
-- Dereference assets for garbage collector
texPage, texBook, texLobby = nil, nil, nil;
-- Init controller screen
InitCon();
Expand All @@ -202,7 +205,7 @@ local function InitBook(bFromInGame)
if IsScrollingUp() then return ActivatePOI(POIData[2]) end;
-- Iterate through the points of interest
for iI = 1, #POIData do
-- Get poidata and return if mouse is in this POI
-- Get point of interest data and return if mouse is in this POI
local aData = POIData[iI];
if CursorInPOI(aData) then
-- Show appropriate cursor
Expand Down Expand Up @@ -248,9 +251,9 @@ local function InitBook(bFromInGame)
-- Play click sound
PlayStaticSound(aSfxData.SELECT);
-- If from controller?
if bFromInGame then
SetCallbacks(GameProc, RenderBook, BookInput);
else SetCallbacks(nil, RenderBook, BookInput) end;
local fcbGameProc;
if bFromInGame then fcbGameProc = GameProc end;
SetCallbacks(fcbGameProc, RenderBook, BookInput);
end
-- Done
return;
Expand All @@ -275,7 +278,7 @@ local function InitBook(bFromInGame)
LoadPage(iBookPage, OnPageLoaded);
end
-- Load the resources
LoadResources("The Book", aToLoad, OnLoadResources);
LoadResources("The Book", aAssets, OnLoadResources);
end
-- Exports and imports ----------------------------------------------------- --
return { A = { InitBook = InitBook }, F = function(GetAPI)
Expand Down
50 changes: 26 additions & 24 deletions diggers/src/cntrl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
-- Copyr. (c) MS-Design, 2024 Copyr. (c) Millennium Interactive Ltd., 1994 --
-- ========================================================================= --
-- Core function aliases --------------------------------------------------- --
local insert<const>, floor<const>, unpack<const> = table.insert, math.floor,
table.unpack;
local unpack<const> = table.unpack;
-- M-Engine function aliases ----------------------------------------------- --
local InfoTicks<const> = Info.Ticks;
-- Diggers function and data aliases --------------------------------------- --
local LoadResources, Fade, SetCallbacks, IsButtonReleased, IsMouseInBounds,
IsMouseNotInBounds, aCursorIdData, SetCursor, PlayStaticSound,
IsMouseNotInBounds, aSfxData, InitMap, InitRace, InitFile, InitBook,
InitLobby, fontSpeech, SetBottomRightTipAndShadow, RenderShadow,
aGlobalData;
local Fade, InitBook, InitFile, InitLobby, InitMap, InitRace, IsButtonReleased,
IsMouseInBounds, IsMouseNotInBounds, IsMouseNotInBounds, LoadResources,
PlayStaticSound, RenderShadow, SetBottomRightTipAndShadow, SetCallbacks,
SetCursor, aCursorIdData, aGlobalData, aSfxData, fontSpeech;
-- Assets required --------------------------------------------------------- --
local aAssets<const> = { { T = 2, F = "lobbyc", P = { 0 } },
{ T = 2, F = "cntrl", P = { 0 } } };
-- Init controller screen function ----------------------------------------- --
local function InitCon()
-- When controller resources have loaded?
Expand Down Expand Up @@ -105,19 +106,21 @@ local function InitCon()
fontSpeech:SetCRGB(0, 0, 0.25);
-- Render callback
local function RenderCon()
-- Frame timer slowed down
local iAnimTime<const> = InfoTicks() // 10;
-- Draw backdrop, controller screen and animated fish
texLobby:BlitLT(-54, 0);
texCon:BlitSLT(tileCon, 8, 8);
texCon:BlitSLT(tileFish+floor((InfoTicks()/10)%5), 9, 119);
texCon:BlitSLT(iAnimTime % 5 + tileFish, 9, 119);
-- Render shadow
RenderShadow(8, 8, 312, 208);
-- Draw speech bubble
if iSpeechTimer > 0 then
-- Draw yap
texCon:BlitSLT(tileConAnim+(floor(InfoTicks()/10)%4), 88, 36);
texCon:BlitSLT(iAnimTime % 4 + tileConAnim, 88, 36);
-- Draw flash
if aFlashData then texCon:BlitSLT(aFlashData[1] +
(floor(InfoTicks()/10)%2), aFlashData[2], aFlashData[3]) end;
if aFlashData then texCon:BlitSLT(iAnimTime % 2 + aFlashData[1],
aFlashData[2], aFlashData[3]) end;
-- Draw speech bubble
texCon:BlitSLT(tileSpeech, 0, 150);
-- Draw text
Expand Down Expand Up @@ -198,7 +201,7 @@ local function InitCon()
PlayStaticSound(aSfxData.SELECT);
-- Transition helper
local function OnFadeOut()
-- Unreference assets for garbage collection
-- Dereference assets for garbage collection
texLobby, texCon = nil, nil;
-- Do next procedure
fcbOnFadeOut(unpack(aMouseOverEvent[5]));
Expand All @@ -214,26 +217,25 @@ local function InitCon()
-- Set controller callbacks
SetCallbacks(ControllerLogic, RenderCon, ControllerInput);
end
-- Change render procs
-- Change render procedures
Fade(1, 0, 0.04, RenderCon, OnFadeIn);
end
-- Load resources
LoadResources("Controller", {{T=2,F="lobbyc",P={0}},
{T=2,F="cntrl",P={0}}}, OnLoaded);
LoadResources("Controller", aAssets, OnLoaded);
end
-- Exports and imports ----------------------------------------------------- --
return { A = { InitCon = InitCon }, F = function(GetAPI)
-- Imports --------------------------------------------------------------- --
LoadResources, SetCallbacks, SetCursor, IsMouseInBounds, aSfxData,
IsButtonReleased, PlayStaticSound, Fade, IsMouseNotInBounds, aCursorIdData,
InitMap, InitRace, InitFile, InitBook, InitLobby, fontSpeech,
SetBottomRightTipAndShadow, RenderShadow, aGlobalData
Fade, InitBook, InitFile, InitLobby, InitMap, InitRace, IsButtonReleased,
IsMouseInBounds, IsMouseNotInBounds, LoadResources, PlayStaticSound,
RenderShadow, SetBottomRightTipAndShadow, SetCallbacks, SetCursor,
aCursorIdData, aGlobalData, aSfxData, fontSpeech
= -- --------------------------------------------------------------------- --
GetAPI("LoadResources", "SetCallbacks", "SetCursor", "IsMouseInBounds",
"aSfxData", "IsButtonReleased", "PlayStaticSound", "Fade",
"IsMouseNotInBounds", "aCursorIdData", "InitMap", "InitRace", "InitFile",
"InitBook", "InitLobby", "fontSpeech", "SetBottomRightTipAndShadow",
"RenderShadow", "aGlobalData");
GetAPI("Fade", "InitBook", "InitFile", "InitLobby", "InitMap", "InitRace",
"IsButtonReleased", "IsMouseInBounds", "IsMouseNotInBounds",
"LoadResources", "PlayStaticSound", "RenderShadow",
"SetBottomRightTipAndShadow", "SetCallbacks", "SetCursor", "aCursorIdData",
"aGlobalData", "aSfxData", "fontSpeech");
-- ----------------------------------------------------------------------- --
end };
-- End-of-File ============================================================= --
Loading

0 comments on commit cc07170

Please sign in to comment.