Added several interactive actions that play a sound when clicking on a structure

git-svn-id: https://ja2svn.mooo.com/source/ja2_v1.13_data@2596 4f8fa57e-7814-0410-bad4-adc449f26b7c
This commit is contained in:
Flugente
2021-07-04 15:59:35 +00:00
parent f80f8e1fe7
commit ca3f83b583
8 changed files with 96 additions and 9 deletions
+36 -8
View File
@@ -556,6 +556,7 @@ ActionTypes =
ACTIONTYPE_WATERTAP = 3,
ACTIONTYPE_SODAMACHINE = 4,
ACTIONTYPE_MINIGAME = 5,
ACTIONTYPE_VARIOUS = 6,
}
InfoTypes =
@@ -575,6 +576,17 @@ MiniGames =
PONG = 1,
}
-- luaactionids that aren't used in ModSpecificActions
InteractiveAction =
{
MINIGAME_TETRIS = 50,
MINIGAME_PONG = 51,
BILLIARD = 52,
TABLETENNIS = 53,
TOILET = 54,
TV = 55,
}
-- We have an array of 1000 signed integers that a modder can use to set whatever data he wants.
-- We simply set up some enums here to make it easier for us to remember what is what
ModSpecificActions =
@@ -658,11 +670,6 @@ ModSpecificActions =
READING_SANMONA_KINGPIN_BOOKSHELF_1 = 49,
-- |||||||||||||||||||||||||||||||||| books |||||||||||||||||||||||||||||||||||||
-- |||||||||||||||||||||||||||||||||| minigames |||||||||||||||||||||||||||||||||||||
MINIGAME_TETRIS = 50,
MINIGAME_PONG = 51,
-- |||||||||||||||||||||||||||||||||| minigames |||||||||||||||||||||||||||||||||||||
-- |||||||||||||||||||||||||||||||||| photo data |||||||||||||||||||||||||||||||||||||
PHOTO_FLAGS_BEGIN = 60,
@@ -1646,7 +1653,7 @@ function HandleInteractiveActionResult(sSectorX, sSectorY, bSectorZ, sGridNo, bL
elseif ( usActionType == ActionTypes.ACTIONTYPE_MINIGAME ) then
-- for now, the only game we have is tetris
if ( sLuaactionid == ModSpecificActions.MINIGAME_TETRIS ) then
if ( sLuaactionid == InteractiveAction.MINIGAME_TETRIS ) then
-- playing a game costs $1
if ( SoldierSpendMoney(ubID, 1) == 1 ) then
@@ -1655,7 +1662,7 @@ function HandleInteractiveActionResult(sSectorX, sSectorY, bSectorZ, sGridNo, bL
SetPendingNewScreen(ScreenTypes.MINIGAME)
end
elseif ( sLuaactionid == ModSpecificActions.MINIGAME_PONG ) then
elseif ( sLuaactionid == InteractiveAction.MINIGAME_PONG ) then
-- playing a game costs $1
if ( SoldierSpendMoney(ubID, 1) == 1 ) then
@@ -1665,7 +1672,28 @@ function HandleInteractiveActionResult(sSectorX, sSectorY, bSectorZ, sGridNo, bL
end
end
elseif ( usActionType == ActionTypes.ACTIONTYPE_VARIOUS ) then
-- for now, the only game we have is tetris
if ( sLuaactionid == InteractiveAction.BILLIARD ) then
PlaySound("Sounds\\billiard.wav")
elseif ( sLuaactionid == InteractiveAction.TABLETENNIS ) then
PlaySound("Sounds\\tabletennis.wav")
elseif ( sLuaactionid == InteractiveAction.TOILET ) then
PlaySound("Sounds\\toilet.wav")
elseif ( sLuaactionid == InteractiveAction.TV ) then
PlaySound("Sounds\\tvstatic.wav")
end
end
@@ -27,6 +27,7 @@
3: take water from a water tap
4: buy soda from a soda machine
5: play a minigame
6: various
difficulty how hard it is to perform action
luaactionid if this is set, lua script HandleInteractiveActionResult() in Overhead.lua is called
with this Id to perform special actions. If no ID is set, the standard action is called.
@@ -1013,6 +1014,64 @@
<sActionType>5</sActionType>
<luaactionid>51</luaactionid>
</ACTION>
<!-- |||||||||||||||||||| MINIGAME |||||||||||||||||||| -->
<!-- |||||||||||||||||||| MINIGAME |||||||||||||||||||| -->
<!-- |||||||||||||||||||| VARIOUS |||||||||||||||||||| -->
<!-- billiard table -->
<ACTION>
<szTileSetName>m-furn4.sti</szTileSetName>
<usTileIndex>12</usTileIndex>
<usTileIndex>13</usTileIndex>
<sActionType>6</sActionType>
<luaactionid>52</luaactionid>
</ACTION>
<ACTION>
<szTileSetName>lawless.sti</szTileSetName>
<usTileIndex>3</usTileIndex>
<sActionType>6</sActionType>
<luaactionid>52</luaactionid>
</ACTION>
<!-- table tennis -->
<ACTION>
<szTileSetName>m-furn4.sti</szTileSetName>
<usTileIndex>14</usTileIndex>
<usTileIndex>15</usTileIndex>
<sActionType>6</sActionType>
<luaactionid>53</luaactionid>
</ACTION>
<!-- toilet -->
<ACTION>
<szTileSetName>furn_9.sti</szTileSetName>
<usTileIndex>0</usTileIndex>
<usTileIndex>1</usTileIndex>
<sActionType>6</sActionType>
<luaactionid>54</luaactionid>
</ACTION>
<!-- urinal -->
<ACTION>
<szTileSetName>furn_9.sti</szTileSetName>
<usTileIndex>12</usTileIndex>
<usTileIndex>13</usTileIndex>
<usTileIndex>14</usTileIndex>
<usTileIndex>15</usTileIndex>
<sActionType>6</sActionType>
<luaactionid>54</luaactionid>
</ACTION>
<!-- television -->
<ACTION>
<szTileSetName>furn_7.sti</szTileSetName>
<usTileIndex>10</usTileIndex>
<usTileIndex>20</usTileIndex>
<usTileIndex>21</usTileIndex>
<usTileIndex>22</usTileIndex>
<sActionType>6</sActionType>
<luaactionid>55</luaactionid>
</ACTION>
<!-- |||||||||||||||||||| VARIOUS |||||||||||||||||||| -->
</INTERACTIVEACTIONS>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.