Files
source/Laptop/Encyclopedia.cpp
T
Wanne e64d5a2fa6 MERGED source code from development trunk revision 4545 up to latest current revision 4882
Development Trunk: https://ja2svn.dyndns.org/source/ja2/branches/Wanne/JA2%201.13%20MP
A detailed list of all the features (changes) is visible in the history log of the development trunk:

INFO: The source code for the official 2011 release (4870) has been branched here:
https://ja2svn.dyndns.org/source/ja2/branches/JA2_rev.4870_2011

This commit contains the following features:

*** Externalized Vehicles ***
o Now with this feature we can add/remove vehicles
o New XML File: TableData\Vehicles.xml
o Added a new function parameter to lua file Scripts\Overhead lua to set up the helicopter in method: SetUpHelicopterForPlayer()
o Added example mini (Docs\Externalized Vehicles Example.zip) mod which adds 2 additional vehicles (hummer and ice-cream truck to sector A9)

*** Up to 255 save slots ***
- There is a "Next" and "Prev" button where you can scroll through the save slots
- It is now possible to load the automatic save (SAVE_EVERY_N_HOURS) from the load screen. This is the first slot after the quickload slot
- Added the 2 alternate players end turn saves (which can be enabled/disabled in option screen) to the save/load game form

*** New Feature: Externalized emails from Emails.edt to XML***
o This feature can be enabled/disabled in the Source:
--> See email.cpp: If "ReadXMLEmail" == FALSE, then normal way (read from Email.edt) otherwise read from XML files
o 2 new XML files: TableData\Email\EmailMercAvailable.xml and EmailMercLevelUp.xml
o Renamed SenderNamesList.xml to EmailSenderNamesList.xml and moved from TableData folder to TableData\Email folder
o Names for mercenaries are get from the file MercProfiles.xml and different names get from the file EmailSenderNamesList.xml

*** Externalized Hidden Towns (Tixa, Orta) ***
o Now it is possible to add new hidden towns (locations)
o See file: TableData/Map/Cities.xml
o New variable in TableData/Map/Cities.xml
- hiddenTown:   0 = show on strategy map, 1 = Hide on strategy map
- townIcon:     1 = on, 0 = off (This is the icon you see on the strategy map)
- szIconFile:   The path to the sti icon file (eg: interface\prison.sti, interface\my_icon.sti)
- iconPosition: The x,y position of the icon on the strategy map

*** Encyclopedia and Briefing Room, reachable from the laptop ***
o 2 new ja2_options.ini properties: BRIEFING_ROOM, ENCYCLOPEDIA
o demonstration video: http://www.youtube.com/watch?v=7CIXdXWLrAo
o Added Example usage of the Briefing Room
- Extract it in your JA2 1.13 folder and use the latest development executable
- The briefing room can be reached from the laptop. Enter SN5631 for the code and then click the "Exit" button
- See "Info_BriefingRoom.txt" and "BriefingRoom_Mission1.png"

*** Improved interrupt system (IIS) ***
o This system changes the way interrupts work. See: http://www.ja-galaxy-forum.com/board/ubbthreads.php?ubb=showflat&Number=290787#Post290787
o Option system (see ja2_options.ini: IMPROVED_INTERRUPT_SYSTEM)
o A few more settings for the interrupt system in ja2_options.ini
o INFO: Multiplayer games always use the "old" interrupt system, not matter what the user selects in the ja2_options.ini

*** Walking and sidestepping with weapon raised ***
o Enable/disable the walking/sidestepping with raised weapon in ja2_options.ini: ALLOW_WALKING_WITH_WEAPON_RAISED
o You can set an AP/BP modifier when walking/sidestepping with weapon raised in APBPConstants.ini: AP_MODIFIER_WEAPON_READY
o The following feature apply when you walk/sidestep with weapon raised:
-> limited angle of view, but you can see more farther when the weapon has a scope
-> better change for interrupts if you see an enemy
-> less APs and BPs when shooting, because the weapon is already raised
-> It should cost more APs when walking. Maybe you can export the additional AP and BP modifier to the APBPConstants.ini

*** Increase squad size to 8 (800x600) and 8 and 10 (1024x768) ***
o Squad sizes (dependend on the screen resolution) can be selected in the start new game screen
o In a multiplayer game, the squad size will always be 6, because it does not work with more soldiers/squad

*** Added UB-1.13 source code ***
o Merged the UB-1.13 source code (Revision: 4721) from svn: http://subversion.assembla.com/svn/ub-source113
o If you want to build UB-EXE or UB-MapEditor, just enable the 2 defines (JA2UB and JA2UBMAPS) in "builddefines.h"
o The UB-Verion reads from "ja2_UB.ini" instead of "ja2.ini"
o There are 2 new XML files
- Layout\LayoutMainMenu.xml
- MapAction\ActionItems.xml
o There are 2 new LUA-Script files
- Scripts\ExplosionControl.lua
- Scripts\InterfaceDialogue.lua

*** Hide enemy health text / enemy hit count ***
o ja2_options.ini: HIDE_ENEMY_HEALTH_TEXT, HIDE_ENEMY_HIT_COUNT
o both new settings only have effect in a singleplayer game
o see: http://www.ja-galaxy-forum.com/board/ubbthreads.php?ubb=showflat&Number=128840&page=1


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4885 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2012-01-18 11:19:01 +00:00

391 lines
11 KiB
C++

#ifdef PRECOMPILEDHEADERS
#include "Laptop All.h"
#else
#include "Laptop All.h"
#include "Utilities.h"
#include "WCheck.h"
#include "timer control.h"
#include "Debug.h"
#include "WordWrap.h"
#include "Encrypted File.h"
#include "email.h"
#include "Game Clock.h"
#include "Text.h"
#include "LaptopSave.h"
#include "Multi Language Graphic Utils.h"
#include "soldier profile type.h"
#endif
#include "Encyclopedia_Data.h"
#include "Encyclopedia.h"
// Link Images
#define ENCYCLOPEDIA_BUTTON_SIZE_X 205
#define ENCYCLOPEDIA_BUTTON_SIZE_Y 19
#define ENCYCLOPEDIA_COPYRIGHT_X iScreenWidthOffset + 160
#define ENCYCLOPEDIA_COPYRIGHT_Y iScreenHeightOffset + 415 // + LAPTOP_SCREEN_WEB_DELTA_Y
#define ENCYCLOPEDIA_COPYRIGHT_WIDTH 400
#define ENCYCLOPEDIA_COPYRIGHT_GAP 9
#define IMAGE_OFFSET_X LAPTOP_SCREEN_UL_X
#define IMAGE_OFFSET_Y LAPTOP_SCREEN_WEB_UL_Y
//262, 28
// RustBackGround
#define RUSTBACKGROUND_SIZE_X 125
#define RUSTBACKGROUND_SIZE_Y 100
#define RUSTBACKGROUND_1_X IMAGE_OFFSET_X
#define RUSTBACKGROUND_1_Y IMAGE_OFFSET_Y
#define ENCYCLOPEDIA_FONT12ARIAL FONT12ARIAL
#define ENCYCLOPEDIA_FONT_MCOLOR_WHITE FONT_MCOLOR_WHITE
#define ENCYCLOPEDIA_BUTTONS_DEF 4
#define ENCYCLOPEDIA_SUBTITLE_Y iScreenHeightOffset + 150 + LAPTOP_SCREEN_WEB_DELTA_Y
#define ENCYCLOPEDIA_CONTENTBUTTON_X iScreenWidthOffset + 259
#define ENCYCLOPEDIA_CONTENTBUTTON_Y ENCYCLOPEDIA_SUBTITLE_Y
#define ENCYCLOPEDIA_TOC_X ENCYCLOPEDIA_CONTENTBUTTON_X
#define ENCYCLOPEDIA_TOC_Y 5
#define ENCYCLOPEDIA_TOC_GAP_Y 25
UINT32 guiRustEncyclopediaBackGround;
UINT32 guiRustEncyclopediaLogoAim;
MOUSE_REGION gSelectedEncyclopediaTocMenuRegion[ 6 ];
UINT32 guiContentButtonEncy;
void SelectEncyclopediaLocationButton(MOUSE_REGION * pRegion, INT32 iReason );
void SelectEncyclopediaCharacterButton(MOUSE_REGION * pRegion, INT32 iReason );
void SelectEncyclopediaQuestsButton(MOUSE_REGION * pRegion, INT32 iReason );
void SelectEncyclopediaInentoryButton(MOUSE_REGION * pRegion, INT32 iReason );
void LaptopInitEncyclopedia();
void InitEncyklopediaBool();
BOOLEAN fFirstTimeInEncyclopedia = TRUE;
BOOLEAN DrawEncyclopediaLogoAim();
ENCYCLOPEDIA_LOCATION gEncyclopediaLocationData[ NUM_SECTOR ];
ENCYCLOPEDIA_LOCATION gEncyclopediaDataTemp[ NUM_MAX_TEMP ];
ENCYCLOPEDIA_LOCATION gEncyclopediaProfilesData[ NUM_PROFILES ];
ENCYCLOPEDIA_LOCATION gEncyclopediaInventoryData[ MAXITEMS ];
ENCYCLOPEDIA_LOCATION gEncyclopediaOldProfilesData[ NUM_PROFILES ];
ENCYCLOPEDIA_LOCATION gEncyclopediaQuestsData[ MAX_QUESTS ];
ENCYCLOPEDIA_LOCATION gBriefingRoomData[ NUM_SECTOR ];
ENCYCLOPEDIA_LOCATION gBriefingRoomSpecialMissionData[ NUM_SECTOR ];
BOOLEAN saveEncyclopediaLocationData[ NUM_SECTOR ];
ENCYCLOPEDIA_PROF_SAVE saveEncyclopediaProfilesData[ NUM_PROFILES ];
BOOLEAN saveEncyclopediaInventoryData[ MAXITEMS ];
BOOLEAN saveEncyclopediaOldProfilesData[ NUM_PROFILES ];
BOOLEAN saveEncyclopediaQuestsData[ MAX_QUESTS ];
MISSION_SAVE saveBriefingRoomData[ NUM_SECTOR ];
MISSION_SAVE saveBriefingRoomSpecialMissionData[ NUM_SECTOR ];
MISSION_SAVE saveMissionData[ NUM_SECTOR ];
void GameInitEncyclopedia()
{
LaptopInitEncyclopedia();
}
BOOLEAN EnterEncyclopedia()
{
VOBJECT_DESC VObjectDesc;
UINT16 i, usPosY;
LaptopInitEncyclopedia();
InitEncyclopediaDefaults();
// load the Rust bacground graphic and add it
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
//FilenameForBPP("LAPTOP\\rustbackground.sti", VObjectDesc.ImageFile);
FilenameForBPP("ENCYCLOPEDIA\\encyclopedialogoaim.sti", VObjectDesc.ImageFile);
CHECKF(AddVideoObject(&VObjectDesc, &guiRustEncyclopediaLogoAim));
// load the MemberShipcard graphic and add it
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
FilenameForBPP("Encyclopedia\\CONTENTBUTTON.sti", VObjectDesc.ImageFile);
CHECKF(AddVideoObject(&VObjectDesc, &guiContentButtonEncy));
//** Mouse Regions **
usPosY = ENCYCLOPEDIA_CONTENTBUTTON_Y + 120;
for(i=0; i<ENCYCLOPEDIA_BUTTONS_DEF; i++)
{
if ( i == 0 )
MSYS_DefineRegion( &gSelectedEncyclopediaTocMenuRegion[i], ENCYCLOPEDIA_TOC_X, usPosY, (UINT16)(ENCYCLOPEDIA_TOC_X + ENCYCLOPEDIA_BUTTON_SIZE_X), (UINT16)(usPosY + ENCYCLOPEDIA_BUTTON_SIZE_Y), MSYS_PRIORITY_HIGH,
CURSOR_WWW, MSYS_NO_CALLBACK, SelectEncyclopediaLocationButton);
else if ( i == 1 )
MSYS_DefineRegion( &gSelectedEncyclopediaTocMenuRegion[i], ENCYCLOPEDIA_TOC_X, usPosY, (UINT16)(ENCYCLOPEDIA_TOC_X + ENCYCLOPEDIA_BUTTON_SIZE_X), (UINT16)(usPosY + ENCYCLOPEDIA_BUTTON_SIZE_Y), MSYS_PRIORITY_HIGH,
CURSOR_WWW, MSYS_NO_CALLBACK, SelectEncyclopediaCharacterButton);
else if ( i == 2 )
MSYS_DefineRegion( &gSelectedEncyclopediaTocMenuRegion[i], ENCYCLOPEDIA_TOC_X, usPosY, (UINT16)(ENCYCLOPEDIA_TOC_X + ENCYCLOPEDIA_BUTTON_SIZE_X), (UINT16)(usPosY + ENCYCLOPEDIA_BUTTON_SIZE_Y), MSYS_PRIORITY_HIGH,
CURSOR_WWW, MSYS_NO_CALLBACK, SelectEncyclopediaInentoryButton);
else if ( i == 3 )
MSYS_DefineRegion( &gSelectedEncyclopediaTocMenuRegion[i], ENCYCLOPEDIA_TOC_X, usPosY, (UINT16)(ENCYCLOPEDIA_TOC_X + ENCYCLOPEDIA_BUTTON_SIZE_X), (UINT16)(usPosY + ENCYCLOPEDIA_BUTTON_SIZE_Y), MSYS_PRIORITY_HIGH,
CURSOR_WWW, MSYS_NO_CALLBACK, SelectEncyclopediaQuestsButton);
MSYS_AddRegion(&gSelectedEncyclopediaTocMenuRegion[i]);
usPosY += ENCYCLOPEDIA_TOC_GAP_Y;
}
fFirstTimeInEncyclopedia = FALSE;
RenderEncyclopedia();
return( TRUE );
}
void LaptopInitEncyclopedia()
{
}
void InitEncyklopediaBool()
{
bEncyclopediaLocation = FALSE;
bEncyclopediaCharacter = FALSE;
bEncyclopediaInventory = FALSE;
bEncyclopediaQuests = FALSE;
bBriefingRoom = FALSE;
bBriefingRoomSpecialMission = FALSE;
}
void ExitEncyclopedia()
{
UINT16 i;
//InitEncyklopediaBool();
RemoveEncyclopediaDefaults();
DeleteVideoObjectFromIndex(guiContentButtonEncy);
DeleteVideoObjectFromIndex(guiRustEncyclopediaLogoAim);
// Remove Mouse Regions
for(i=0; i<ENCYCLOPEDIA_BUTTONS_DEF; i++)
MSYS_RemoveRegion( &gSelectedEncyclopediaTocMenuRegion[i]);
//guiCurrentLaptopMode = LAPTOP_MODE_NONE;
}
void HandleEncyclopedia()
{
}
void RenderEncyclopedia()
{
UINT16 i, usPosY;
UINT16 usHeight;
HVOBJECT hContentButtonHandle;
UINT16 usWidth=0;
DrawEncyclopediaDefaults();
DrawEncyclopediaLogoAim();
GetVideoObject(&hContentButtonHandle, guiContentButtonEncy);
usHeight = GetFontHeight(ENCYCLOPEDIA_FONT12ARIAL);
usPosY = ENCYCLOPEDIA_CONTENTBUTTON_Y + 120;
for(i=0; i<ENCYCLOPEDIA_BUTTONS_DEF; i++)
{
BltVideoObject(FRAME_BUFFER, hContentButtonHandle, 0,ENCYCLOPEDIA_TOC_X, usPosY, VO_BLT_SRCTRANSPARENCY,NULL);
usWidth = StringPixLength(pMenuStrings[i], ENCYCLOPEDIA_FONT12ARIAL);
DrawTextToScreen(pMenuStrings[i], ENCYCLOPEDIA_TOC_X, (UINT16)(usPosY + ENCYCLOPEDIA_TOC_Y), ENCYCLOPEDIA_BUTTON_SIZE_X, ENCYCLOPEDIA_FONT12ARIAL, ENCYCLOPEDIA_FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED);
usPosY += ENCYCLOPEDIA_TOC_GAP_Y;
}
DisplayEncyclopediaSlogan();
DisplayEncyclopediaCopyright();
RenderWWWProgramTitleBar( );
//InitEncyklopediaBool();
InvalidateRegion(LAPTOP_SCREEN_UL_X,LAPTOP_SCREEN_WEB_UL_Y,LAPTOP_SCREEN_LR_X,LAPTOP_SCREEN_WEB_LR_Y);
}
void SelectEncyclopediaLocationButton(MOUSE_REGION * pRegion, INT32 iReason )
{
if (iReason & MSYS_CALLBACK_REASON_INIT)
{
}
else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
bEncyclopediaLocation = TRUE;
bEncyclopediaCharacter = FALSE;
bEncyclopediaInventory = FALSE;
bEncyclopediaQuests = FALSE;
bBriefingRoom = FALSE;
bBriefingRoomSpecialMission = FALSE;
ResetVal = TRUE;
IDPageEncyData = PAGEENCYCLOPEDIALOCATION;
if(!fFirstTimeInEncyclopedia) guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA_LOCATION;
}
else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP)
{
}
}
void SelectEncyclopediaCharacterButton(MOUSE_REGION * pRegion, INT32 iReason )
{
if (iReason & MSYS_CALLBACK_REASON_INIT)
{
}
else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
bEncyclopediaLocation = FALSE;
bEncyclopediaCharacter = TRUE;
bEncyclopediaInventory = FALSE;
bEncyclopediaQuests = FALSE;
bBriefingRoom = FALSE;
bBriefingRoomSpecialMission = FALSE;
ResetVal = TRUE;
IDPageEncyData = PAGEENCYCLOPEDIACHARACTER;
if(!fFirstTimeInEncyclopedia) guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA_LOCATION;
}
else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP)
{
}
}
void SelectEncyclopediaQuestsButton(MOUSE_REGION * pRegion, INT32 iReason )
{
if (iReason & MSYS_CALLBACK_REASON_INIT)
{
}
else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
bEncyclopediaLocation = FALSE;
bEncyclopediaCharacter = FALSE;
bEncyclopediaInventory = FALSE;
bEncyclopediaQuests = TRUE;
bBriefingRoom = FALSE;
bBriefingRoomSpecialMission = FALSE;
ResetVal = FALSE;
IDPageEncyData = PAGEENCYCLOPEDIAQUESTS;
if(!fFirstTimeInEncyclopedia) guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA_LOCATION;
}
else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP)
{
}
}
void SelectEncyclopediaInentoryButton(MOUSE_REGION * pRegion, INT32 iReason )
{
if (iReason & MSYS_CALLBACK_REASON_INIT)
{
}
else if(iReason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
bEncyclopediaLocation = FALSE;
bEncyclopediaCharacter = FALSE;
bEncyclopediaInventory = TRUE;
bEncyclopediaQuests = FALSE;
bBriefingRoom = FALSE;
bBriefingRoomSpecialMission = FALSE;
ResetVal = FALSE;
IDPageEncyData = PAGEENCYCLOPEDIAINVENTORY;
if(!fFirstTimeInEncyclopedia) guiCurrentLaptopMode = LAPTOP_MODE_ENCYCLOPEDIA_LOCATION;
}
else if (iReason & MSYS_CALLBACK_REASON_RBUTTON_UP)
{
}
}
BOOLEAN InitEncyclopediaDefaults()
{
VOBJECT_DESC VObjectDesc;
// load the Rust bacground graphic and add it
VObjectDesc.fCreateFlags=VOBJECT_CREATE_FROMFILE;
//FilenameForBPP("LAPTOP\\rustbackground.sti", VObjectDesc.ImageFile);
FilenameForBPP("ENCYCLOPEDIA\\encyclopediabackground.sti", VObjectDesc.ImageFile);
CHECKF(AddVideoObject(&VObjectDesc, &guiRustEncyclopediaBackGround));
return(TRUE);
}
BOOLEAN RemoveEncyclopediaDefaults()
{
DeleteVideoObjectFromIndex(guiRustEncyclopediaBackGround);
return(TRUE);
}
BOOLEAN DrawEncyclopediaLogoAim()
{
HVOBJECT hLogoEncyklopedia;
// UINT16 x,y, uiPosX, uiPosY;
GetVideoObject(&hLogoEncyklopedia, guiRustEncyclopediaLogoAim);
BltVideoObject(FRAME_BUFFER, hLogoEncyklopedia, 0,ENCYCLOPEDIA_TOC_X, RUSTBACKGROUND_1_Y + 40, VO_BLT_SRCTRANSPARENCY,NULL);
return(TRUE);
}
BOOLEAN DrawEncyclopediaDefaults()
{
HVOBJECT hRustBackGroundHandle;
// UINT16 x,y, uiPosX, uiPosY;
// Blt the rust background
GetVideoObject(&hRustBackGroundHandle, guiRustEncyclopediaBackGround);
BltVideoObject(FRAME_BUFFER, hRustBackGroundHandle, 0,RUSTBACKGROUND_1_X, RUSTBACKGROUND_1_Y, VO_BLT_SRCTRANSPARENCY,NULL);
/*
uiPosY = RUSTBACKGROUND_1_Y;
for(y=0; y<4; y++)
{
uiPosX = RUSTBACKGROUND_1_X;
for(x=0; x<4; x++)
{
BltVideoObject(FRAME_BUFFER, hRustBackGroundHandle, 0,uiPosX, uiPosY, VO_BLT_SRCTRANSPARENCY,NULL);
uiPosX += RUSTBACKGROUND_SIZE_X;
}
uiPosY += RUSTBACKGROUND_SIZE_Y;
}
*/
return(TRUE);
}
BOOLEAN DisplayEncyclopediaSlogan()
{
return(TRUE);
}
BOOLEAN DisplayEncyclopediaCopyright()
{
return(TRUE);
}