New feature: Minigames are interactive actions that happen in a dedicated screen. For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=347722&#msg_347722

GameDir >= r2350 is required.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8346 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2016-12-11 12:43:41 +00:00
parent ea9d5f74a5
commit d08b4d13b9
30 changed files with 1478 additions and 29 deletions
+9 -9
View File
@@ -15,9 +15,9 @@
#ifdef JA2EDITOR
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8340 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8345 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8340 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8345 (Development Build)" };
#endif
// ------------------------------
@@ -27,11 +27,11 @@
//DEBUG BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8340 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8345 (Development Build)" };
#elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8340 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8345 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8340 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8345 (Development Build)" };
#endif
#elif defined CRIPPLED_VERSION
@@ -46,16 +46,16 @@
//RELEASE BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8340 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8345 (Development Build)" };
#elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8340 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8345 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Release v1.13.8340 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release v1.13.8345 (Development Build)" };
#endif
#endif
CHAR8 czVersionNumber[16] = { "Build 16.11.16" }; //YY.MM.DD
CHAR8 czVersionNumber[16] = { "Build 16.12.11" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" };
// SAVE_GAME_VERSION is defined in header, change it there
+2
View File
@@ -69,6 +69,8 @@ Screens GameScreens[MAX_SCREENS] =
{ MPChatScreenInit, MPChatScreenHandle, MPChatScreenShutdown }, // OJW - 20090314
{ MPConnectScreenInit, MPConnectScreenHandle, MPConnectScreenShutdown }, // OJW - 20090422
{ MiniGameScreenInit, MiniGameScreenHandle, MiniGameScreenShutdown }, // added by Flugente
#ifdef JA2BETAVERSION
{ AIViewerScreenInit, AIViewerScreenHandle, AIViewerScreenShutdown },
#endif
+37 -8
View File
@@ -74,6 +74,8 @@ extern "C" {
#include "Encrypted File.h"
#include "BriefingRoom_Data.h"
#include "MiniGame.h" // added by Flugente
extern UINT8 gubWaitingForAllMercsToExitCode;
//-------------------------- UB ------------------------------
@@ -864,6 +866,9 @@ static int l_NumNonPlayerTeamInSector( lua_State *L );
static int l_SetSamSiteHackStatus( lua_State *L );
static int l_GetSamSiteHackStatus( lua_State *L );
static int l_SetMiniGameType( lua_State *L );
static int l_SoldierSpendMoney( lua_State *L );
using namespace std;
UINT16 idProfil;
@@ -1736,6 +1741,9 @@ void IniFunction(lua_State *L, BOOLEAN bQuests )
lua_register( L, "NumNonPlayerTeamInSector", l_NumNonPlayerTeamInSector );
lua_register( L, "SetSamSiteHackStatus", l_SetSamSiteHackStatus );
lua_register( L, "GetSamSiteHackStatus", l_GetSamSiteHackStatus );
lua_register( L, "SetMiniGameType", l_SetMiniGameType );
lua_register( L, "SoldierSpendMoney", l_SoldierSpendMoney );
}
#ifdef NEWMUSIC
BOOLEAN LetLuaMusicControl(UINT8 Init)
@@ -10582,16 +10590,12 @@ static int l_SetPendingNewScreenSEXSCREEN (lua_State *L)
static int l_SetPendingNewScreen (lua_State *L)
{
UINT8 n = lua_gettop(L);
UINT8 scr = 0;
int i = 0;
for (i= 1; i<=n; i++ )
if ( lua_gettop( L ) >= 1 )
{
if (i == 1 ) scr = lua_tointeger(L,i);
}
UINT32 scr = lua_tointeger( L, 1 );
SetPendingNewScreen( scr );
SetPendingNewScreen( scr );
}
return 0;
}
@@ -13331,3 +13335,28 @@ static int l_GetSamSiteHackStatus( lua_State *L )
return 1;
}
static int l_SetMiniGameType( lua_State *L )
{
if ( lua_gettop( L ) >= 1 )
{
UINT32 usMiniGame = lua_tointeger( L, 1 );
SetNextGame( usMiniGame );
}
return 0;
}
static int l_SoldierSpendMoney( lua_State *L )
{
if ( lua_gettop( L ) >= 2 )
{
UINT8 usId = lua_tointeger( L, 1 );
UINT32 amount = lua_tointeger( L, 2 );
lua_pushinteger( L, SpendMoney( MercPtrs[usId], amount ) );
}
return 1;
}
+10 -5
View File
@@ -8916,14 +8916,15 @@ void DoInteractiveActionDefaultResult( INT32 sGridNo, UINT8 ubID, BOOLEAN aSucce
}
}
}
}
if ( !aSuccess )
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szInteractiveActionText[7], pSoldier->GetName( ) );
}
}
break;
case INTERACTIVE_STRUCTURE_MINIGAME:
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szInteractiveActionText[9] );
}
break;
default:
break;
@@ -8963,5 +8964,9 @@ BOOLEAN SpendMoney( SOLDIERTYPE *pSoldier, UINT32 aAmount )
aAmount = 0;
}
// warning if we don't have enough money
if ( aAmount > 0 )
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szInteractiveActionText[7], pSoldier->GetName( ) );
return (aAmount == 0);
}
+1
View File
@@ -130,6 +130,7 @@ typedef enum
INTERACTIVE_STRUCTURE_READFILE,
INTERACTIVE_STRUCTURE_WATERTAP,
INTERACTIVE_STRUCTURE_SODAMACHINE,
INTERACTIVE_STRUCTURE_MINIGAME,
INTERACTIVE_STRUCTURE_TYPE_MAX,
} INTERACTIVE_STRUCTURE_TYPE;
+3
View File
@@ -230,6 +230,9 @@ UICursor gUICursors[ NUM_UI_CURSORS ] =
SODAMACHINE_GREY_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_SODAMACHINE, 0,
SODAMACHINE_RED_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_SODAMACHINE_RED, 0,
MINIGAME_GREY_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_MINIGAME, 0,
MINIGAME_RED_UICURSOR, UICURSOR_FREEFLOWING, CURSOR_MINIGAME_RED, 0,
};
+3
View File
@@ -207,6 +207,9 @@ typedef enum
SODAMACHINE_GREY_UICURSOR,
SODAMACHINE_RED_UICURSOR,
MINIGAME_GREY_UICURSOR,
MINIGAME_RED_UICURSOR,
NUM_UI_CURSORS
} UICursorDefines;
+34
View File
@@ -0,0 +1,34 @@
#ifndef __MINIGAME_H
#define __MINIGAME_H
/**
* @file
* @author Flugente (bears-pit.com)
*/
// Flugente: lets create a few minigames
enum
{
MINIGAME_FIRST = 0,
TETRIS = MINIGAME_FIRST,
};
// enums of gamestates
enum
{
MINIGAME_STARTSCREEN = 0,
MINIGAME_GAME,
MINIGAME_GAMEOVER,
MINIGAME_PAUSE,
};
void SetNextGame( UINT32 ausGame, UINT32 ausGameState = MINIGAME_STARTSCREEN );
UINT32 MiniGameScreenInit( void );
UINT32 MiniGameScreenHandle( void );
UINT32 MiniGameScreenShutdown( void );
void MiniGame_Init_Tetris();
UINT32 MiniGame_Handle_Tetris();
#endif //__MINIGAME_H
File diff suppressed because it is too large Load Diff
+3
View File
@@ -4031,6 +4031,9 @@ INT16 GetAPsForInteractiveAction( SOLDIERTYPE *pSoldier, UINT8 usActionType )
case INTERACTIVE_STRUCTURE_SODAMACHINE:
sAPCost += APBPConstants[AP_SODAMACHINE];
break;
case INTERACTIVE_STRUCTURE_MINIGAME:
sAPCost += APBPConstants[AP_READFILE];
break;
default:
break;
+10
View File
@@ -19135,6 +19135,16 @@ UINT16 SOLDIERTYPE::GetInteractiveActionSkill( INT32 sGridNo, UINT8 usLevel, UIN
}
break;
case INTERACTIVE_STRUCTURE_MINIGAME:
{
if ( this->ubProfile == ROBOT || IsVehicle( this ) )
return 0;
// we are pros at playing games
return 100;
}
break;
default:
break;
}
+8
View File
@@ -530,6 +530,10 @@
RelativePath=".\Militia Control.h"
>
</File>
<File
RelativePath=".\MiniGame.h"
>
</File>
<File
RelativePath=".\Morale.h"
>
@@ -884,6 +888,10 @@
RelativePath=".\Militia Control.cpp"
>
</File>
<File
RelativePath=".\MiniGame.cpp"
>
</File>
<File
RelativePath=".\Morale.cpp"
>
+8
View File
@@ -534,6 +534,10 @@
RelativePath="Militia Control.h"
>
</File>
<File
RelativePath="MiniGame.h"
>
</File>
<File
RelativePath="Morale.h"
>
@@ -886,6 +890,10 @@
RelativePath="Militia Control.cpp"
>
</File>
<File
RelativePath="MiniGame.cpp"
>
</File>
<File
RelativePath="Morale.cpp"
>
+4 -2
View File
@@ -71,7 +71,8 @@
<ClInclude Include="merc entering.h" />
<ClInclude Include="Merc Hiring.h" />
<ClInclude Include="Militia Control.h" />
<ClInclude Include="Morale.h" />
<ClInclude Include="MiniGame.h" />
<ClInclude Include="Morale.h" />
<ClInclude Include="opplist.h" />
<ClInclude Include="Overhead Types.h" />
<ClInclude Include="Overhead.h" />
@@ -159,7 +160,8 @@
<ClCompile Include="Merc Entering.cpp" />
<ClCompile Include="Merc Hiring.cpp" />
<ClCompile Include="Militia Control.cpp" />
<ClCompile Include="Morale.cpp" />
<ClCompile Include="MiniGame.cpp" />
<ClCompile Include="Morale.cpp" />
<ClCompile Include="opplist.cpp" />
<ClCompile Include="Overhead.cpp" />
<ClCompile Include="PATHAI.cpp" />
+8 -2
View File
@@ -144,7 +144,10 @@
<ClInclude Include="Militia Control.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Morale.h">
<ClInclude Include="MiniGame.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Morale.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="opplist.h">
@@ -404,7 +407,10 @@
<ClCompile Include="Militia Control.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Morale.cpp">
<ClCompile Include="MiniGame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Morale.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="opplist.cpp">
+2
View File
@@ -71,6 +71,7 @@
<ClInclude Include="merc entering.h" />
<ClInclude Include="Merc Hiring.h" />
<ClInclude Include="Militia Control.h" />
<ClInclude Include="MiniGame.h" />
<ClInclude Include="Morale.h" />
<ClInclude Include="opplist.h" />
<ClInclude Include="Overhead Types.h" />
@@ -160,6 +161,7 @@
<ClCompile Include="Merc Entering.cpp" />
<ClCompile Include="Merc Hiring.cpp" />
<ClCompile Include="Militia Control.cpp" />
<ClCompile Include="Minigame.cpp" />
<ClCompile Include="Morale.cpp" />
<ClCompile Include="opplist.cpp" />
<ClCompile Include="Overhead.cpp" />
+6
View File
@@ -276,6 +276,9 @@
<ClInclude Include="Disease.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MiniGame.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Air Raid.cpp">
@@ -704,5 +707,8 @@
<ClCompile Include="XML_InteractiveTiles.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Minigame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
+2
View File
@@ -2294,6 +2294,8 @@ UINT8 HandleHackCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT32 uiCursorFla
return skill ? WATERTAP_GREY_UICURSOR : WATERTAP_RED_UICURSOR;
else if ( possibleaction == INTERACTIVE_STRUCTURE_SODAMACHINE )
return skill ? SODAMACHINE_GREY_UICURSOR : SODAMACHINE_RED_UICURSOR;
else if ( possibleaction == INTERACTIVE_STRUCTURE_MINIGAME )
return skill ? MINIGAME_GREY_UICURSOR : MINIGAME_RED_UICURSOR;
return NO_UICURSOR;
}
+19 -1
View File
@@ -140,6 +140,9 @@ CursorFileData CursorFileDatabase[] =
{"CURSORS\\sodamachine.sti" , FALSE, 0, ANIMATED_CURSOR, 3, NULL}, // Flugente: soda machine
{"CURSORS\\sodamachine_r.sti" , FALSE, 0, ANIMATED_CURSOR, 3, NULL},
{"CURSORS\\minigame.sti" , FALSE, 0, ANIMATED_CURSOR, 3, NULL}, // Flugente: minigames
{"CURSORS\\minigame_r.sti" , FALSE, 0, ANIMATED_CURSOR, 3, NULL},
{ "CURSORS\\can_01.sti" , FALSE, 0, 0, 0, NULL },
{ "CURSORS\\can_02.sti" , FALSE, 0, 0, 0, NULL },
{ "CURSORS\\cur_tagr_ncth.sti" , FALSE, 0, ANIMATED_CURSOR, 7, NULL },
@@ -1290,7 +1293,7 @@ CursorData CursorDatabase[] =
0, 0, 0, 0, 0,
2, CENTER_CURSOR, CENTER_CURSOR, 0, 0, 0, 0},
// Flugente: soad machine
// Flugente: soda machine
{C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR,
C_SODAMACHINE, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR,
0, 0, 0, 0, 0,
@@ -1304,6 +1307,21 @@ CursorData CursorDatabase[] =
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
2, CENTER_CURSOR, CENTER_CURSOR, 0, 0, 0, 0},
// Flugente: minigames
{C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR,
C_MINIGAME, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
2, CENTER_CURSOR, CENTER_CURSOR, 0, 0, 0, 0},
{C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR,
C_MINIGAME_RED, 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
2, CENTER_CURSOR, CENTER_CURSOR, 0, 0, 0, 0},
{ C_TRINGS, 6, 0, HIDE_SUBCURSOR, HIDE_SUBCURSOR,
C_FUEL , 0, 0, CENTER_SUBCURSOR, CENTER_SUBCURSOR,
+5
View File
@@ -174,6 +174,9 @@ typedef enum
CURSOR_SODAMACHINE,
CURSOR_SODAMACHINE_RED,
CURSOR_MINIGAME,
CURSOR_MINIGAME_RED,
CURSOR_FUEL,
CURSOR_FUEL_RED,
@@ -261,6 +264,8 @@ typedef enum
C_WATERTAP_RED,
C_SODAMACHINE,
C_SODAMACHINE_RED,
C_MINIGAME,
C_MINIGAME_RED,
C_FUEL,
C_FUEL_RED,
C_ACTIONMODERED_NCTH,
+1
View File
@@ -11184,6 +11184,7 @@ STR16 szInteractiveActionText[] =
L"%s 没有足够的钱。那真让人难为情",//L"%s doesn't have enough money. That's just embarassing.",
L"%s 从水龙头喝水",//L"%s drank from water tap",
L"This machine doesn't seem to be working.", // TODO.Translate
};
// WANNE: Some Chinese specific strings that needs to be in unicode!
+1
View File
@@ -11202,6 +11202,7 @@ STR16 szInteractiveActionText[] =
L"%s doesn't have enough money. That's just embarassing.",
L"%s drank from water tap",
L"This machine doesn't seem to be working.", // TODO.Translate
};
#endif //DUTCH
+1
View File
@@ -11185,6 +11185,7 @@ STR16 szInteractiveActionText[] =
L"%s doesn't have enough money. That's just embarassing.",
L"%s drank from water tap",
L"This machine doesn't seem to be working.",
};
#endif //ENGLISH
+1
View File
@@ -11184,6 +11184,7 @@ STR16 szInteractiveActionText[] =
L"%s doesn't have enough money. That's just embarassing.",
L"%s drank from water tap",
L"This machine doesn't seem to be working.", // TODO.Translate
};
#endif //FRENCH
+3 -2
View File
@@ -10986,8 +10986,8 @@ STR16 szWeatherTypeText[] = // TODO.Translate
STR16 szSnakeText[] =
{
L"%s evaded a snake attack!",
L"%s was attacked by a snake!",
L"%s weicht Schlangenangriff aus!",
L"%s wurde von Schlange angegriffen!",
};
STR16 szSMilitiaResourceText[] =
@@ -11014,6 +11014,7 @@ STR16 szInteractiveActionText[] =
L"%s doesn't have enough money. That's just embarassing.",
L"%s drank from water tap",
L"This machine doesn't seem to be working.", // TODO.Translate
};
#endif //GERMAN
+1
View File
@@ -11193,6 +11193,7 @@ STR16 szInteractiveActionText[] =
L"%s doesn't have enough money. That's just embarassing.",
L"%s drank from water tap",
L"This machine doesn't seem to be working.", // TODO.Translate
};
#endif //ITALIAN
+1
View File
@@ -11206,6 +11206,7 @@ STR16 szInteractiveActionText[] =
L"%s doesn't have enough money. That's just embarassing.",
L"%s drank from water tap",
L"This machine doesn't seem to be working.", // TODO.Translate
};
#endif //POLISH
+1
View File
@@ -11185,6 +11185,7 @@ STR16 szInteractiveActionText[] =
L"%s doesn't have enough money. That's just embarassing.",
L"%s drank from water tap",
L"This machine doesn't seem to be working.", // TODO.Translate
};
#endif //RUSSIAN
+5
View File
@@ -144,6 +144,11 @@ extern UINT32 MPConnectScreenInit( void );
extern UINT32 MPConnectScreenHandle( void );
extern UINT32 MPConnectScreenShutdown( void );
extern UINT32 MiniGameScreenInit( void );
extern UINT32 MiniGameScreenHandle( void );
extern UINT32 MiniGameScreenShutdown( void );
// External functions
void DisplayFrameRate( );
+1
View File
@@ -33,6 +33,7 @@ typedef enum ScreenTypes
MP_SCORE_SCREEN, // OJW - 20081222
MP_CHAT_SCREEN, // OJW - 20090315
MP_CONNECT_SCREEN, //OJW - 20090422
MINIGAME_SCREEN, // Flugente
#ifdef JA2BETAVERSION
AIVIEWER_SCREEN,