New Feature: Externalized Enemy taunts (by anv)

- Taunts will be shown in the tactica log, once enabled (TAUNT_SHOW_IN_LOG = TRUE)
- Enemies will randomly choose their taunt from an pool of applicable ones
- All taunts can be stored in TableData/EnemyTaunts.xml
- see: http://www.bears-pit.com/board/ubbthreads.php/topics/327830/Externalised_taunts.html#Post327830


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6575 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2013-11-10 08:26:05 +00:00
parent 896c1e3e24
commit 899d0f15a0
22 changed files with 1485 additions and 78 deletions
+38
View File
@@ -7,6 +7,44 @@
#endif
#include "Language Defines.h"
// anv: for selecting random line
#include "Random.h"
// anv: loading random line from the file
BOOLEAN LoadEncryptedDataFromFileRandomLine(STR pFileName, STR16 pDestString, UINT32 uiSeekAmount)
{
HWFILE hFile;
UINT32 uiBytesRead;
UINT32 uiSeekFrom;
hFile = FileOpen(pFileName, FILE_ACCESS_READ, FALSE);
if ( !hFile )
{
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "LoadEncryptedDataFromFile: Failed to FileOpen");
return( FALSE );
}
uiSeekFrom = Random( ( FileGetSize(hFile) / uiSeekAmount ) - 1 );
if ( FileSeek( hFile, uiSeekFrom * uiSeekAmount, FILE_SEEK_FROM_START ) == FALSE )
{
FileClose(hFile);
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "LoadEncryptedDataFromFile: Failed FileSeek");
return( FALSE );
}
if( !FileRead( hFile, pDestString, uiSeekAmount, &uiBytesRead) )
{
FileClose(hFile);
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "LoadEncryptedDataFromFile: Failed FileRead");
return( FALSE );
}
DecodeString(pDestString, uiSeekAmount);
FileClose(hFile);
return(TRUE);
}
BOOLEAN LoadEncryptedDataFromFile(STR pFileName, STR16 pDestString, UINT32 uiSeekFrom, UINT32 uiSeekAmount)
{