Files
source/Multiplayer/connect.h
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

226 lines
6.8 KiB
C

#pragma once
#include "Soldier Init List.h"
#include "Merc Hiring.h"
#include "event pump.h"
#include "Bullets.h"
#include "builddefines.h"
extern bool isOwnTeamWipedOut;
extern bool is_connected;
extern bool is_connecting;
extern bool is_client;
extern bool is_server;
extern bool is_networked;
extern bool is_host; // OJW - added 20081129
// OJW - 20040922
extern bool recieved_settings;
extern bool recieved_transfer_settings;
extern INT16 serverSyncClientsDirectory;
extern int PLAYER_TEAM_TIMER_SEC_PER_TICKS;
extern int CLIENT_NUM;
extern UINT8 gEnemyEnabled;
extern UINT8 gCreatureEnabled;
extern UINT8 gMilitiaEnabled;
extern UINT8 gCivEnabled;
extern UINT8 cMaxClients;
extern UINT8 cSameMercAllowed;
extern UINT8 cGameType;
extern bool allowlaptop;
extern UINT8 netbTeam;
extern UINT8 ubID_prefix;
extern FLOAT cDamageMultiplier;
//OJW - 20081218
extern UINT8 gRandomStartingEdge;
extern UINT8 gRandomMercs;
//OJW - 20090317
extern bool is_game_started;
//OJW - 20090403
extern UINT8 gMaxEnemiesEnabled;
//OJW - 20090405
extern STRING512 gCurrentTransferFilename;
extern INT32 gCurrentTransferBytes;
extern INT32 gTotalTransferBytes;
extern UINT32 crate_usMapPos;
//extern int INTERRUPTS;
extern UINT8 cAllowMercEquipment;
extern UINT8 cMaxMercs;
void lockui (bool unlock);
void start_battle ( void );
void DropOffItemsInSector( UINT8 ubOrderNum );
void mp_help (void);
void mp_help2 (void);
void grid_display ( void);
void send_loaded (void);
void send_donegui ( UINT8 ubResult );
UINT8 numenemyLAN( UINT8 ubSectorX, UINT8 ubSectorY );
void connect_client ( void );
void start_server (void);
void client_packet ( void );
void server_packet ( void );
void NetworkAutoStart(); // OJW - 20081130 - Automate connection functions
void server_disconnect (void);
void client_disconnect (void);
void DialogRemoved( UINT8 ubResult );
void manual_overide(void);
void send_path ( SOLDIERTYPE *pSoldier, INT32 sDestGridNo, UINT16 usMovementAnim, BOOLEAN fFromUI, BOOLEAN fForceRestartAnim );
void send_stance ( SOLDIERTYPE *pSoldier, UINT8 ubDesiredStance );
void send_dir ( SOLDIERTYPE *pSoldier, UINT16 usDesiredDirection );
void send_fire( SOLDIERTYPE *pSoldier, INT32 sTargetGridNo );
void send_hit( EV_S_WEAPONHIT *SWeaponHit );
void send_bullet( BULLET * pBullet, UINT16 usHandItem);
void send_hire( UINT8 iNewIndex, UINT8 ubCurrentSoldier, INT16 iTotalContractLength, BOOLEAN fCopyProfileItemsOver);
void send_dismiss( UINT8 ubCurrentSoldier);
void send_gui_pos(SOLDIERTYPE *pSoldier, FLOAT dNewXPos, FLOAT dNewYPos);
void send_gui_dir(SOLDIERTYPE *pSoldier, UINT16 usNewDirection);
void send_EndTurn( UINT8 ubNextTeam );
void send_AI( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *pubID );
void send_stop (EV_S_STOP_MERC *SStopMerc);
void send_interrupt(SOLDIERTYPE *pSoldier);
// OJW - 20091002 - explosives
void send_grenade (OBJECTTYPE *pGameObj, float dLifeLength, float xPos, float yPos, float zPos, float xForce, float yForce, float zForce, UINT32 sTargetGridNo, UINT8 ubOwner, UINT8 ubActionCode, UINT32 uiActionData, INT32 iRealObjectID , bool bIsThrownGrenade);
void send_grenade_result (float xPos, float yPos, float zPos, INT32 sGridNo, UINT8 ubOwnerID, INT32 iRealObjectID, bool bIsDud);
void send_plant_explosive (UINT8 ubID,UINT16 usItem,UINT8 ubItemStatus,UINT16 usFlags, UINT32 sGridNo,UINT8 ubLevel, UINT32 uiWorldIndex);
void send_detonate_explosive (UINT32 uiWorldIndex, UINT8 ubID);
void send_spreadeffect ( INT32 sGridNo, UINT8 ubRadius, UINT16 usItem, UINT8 ubOwner, BOOLEAN fSubsequent, INT8 bLevel, INT32 iSmokeEffectID );
void send_newsmokeeffect(INT32 sGridNo, UINT16 usItem, INT8 bLevel, UINT8 ubOwner, INT32 iSmokeEffectID);
void send_gasdamage( SOLDIERTYPE * pSoldier, UINT16 usExplosiveClassID , INT16 sSubsequent, BOOLEAN fRecompileMovementCosts, INT16 sWoundAmt, INT16 sBreathAmt, UINT8 ubOwner );
void send_explosivedamage( UINT8 ubPerson, UINT8 ubOwner, INT32 sBombGridNo, INT16 sWoundAmt, INT16 sBreathAmt, UINT32 uiDist, UINT16 usItem, INT16 sSubsequent );
void send_disarm_explosive(UINT32 sGridNo, UINT32 uiWorldIndex, UINT8 ubID);
void OpenChatMsgBox(void);
INT8 FireBullet( SOLDIERTYPE * pFirer, BULLET * pBullet, BOOLEAN fFake );
void reapplySETTINGS();
BOOLEAN CheckConditionsForBattle( GROUP *pGroup ); // this comes from strategic movement.cpp
extern char client_names[4][30];
// OJW - 20081204
// I need to keep track of all the clients readyness, spawn edge and team
// <TODO> want to change this all to use client_info, but dont want to make sweeping
// changes to the codebase without talking to the other devs
extern int client_ready[4];
extern int client_teams[4];
extern int client_edges[5];
extern int client_downloading[4];
extern int client_progress[4];
extern char cServerName[30];
//OJW - 20081224
#define MAX_CONNECT_RETRIES 5
#define ENABLE_COLLISION (is_server && pBullet->pFirer->ubID<120) || (!is_server && is_client && pBullet->pFirer->ubID<20) || (!is_server && !is_client)
extern bool auto_retry;
extern int giNumTries;
void send_settings();
void send_mapchange(); // added 20081201 by OJW
void send_teamchange( int newteam ); // send team a change
void send_edgechange( int newedge ); // send an edge change
bool can_teamchange(); // UI Checks
bool can_edgechange(); // UI Checks
void StartInterrupt( void );
// MP GameTypes
enum
{
MP_TYPE_DEATHMATCH,
MP_TYPE_TEAMDEATMATCH,
MP_TYPE_COOP,
NUM_MP_GAMETYPE
};
typedef struct
{
int kills;
int deaths;
int hits;
int misses;
} player_stats;
extern player_stats gMPPlayerStats[5];
extern void game_over( void );
// OJW - 20090422
extern BOOLEAN fClientReceivedAllFiles;
// OJW - 20090507
// Add basic version checking, will only work from now on
// note: this cannot be longer than char[30]
#ifdef JA2UB
#define MPVERSION "MP v2.0(UB)"
#else
#define MPVERSION "MP v2.0"
#endif
// OJW - 2009128 - inline funcs for working with soldiers and teams
// sick of confusing myself :)
// this one should be called before passing an ID off the client
inline UINT8 MPEncodeSoldierID( UINT8 ubID )
{
if ( ubID < 20 )
return ubID + ubID_prefix; // soldier is ours
else
return ubID; // soldier is another teams, dont touch its ID
}
// this one can be called anywhere, even if the ID was not "encoded"
inline UINT8 MPDecodeSoldierID( UINT8 ubID )
{
if ( ubID >= ubID_prefix && ubID < (ubID_prefix + 7) )
return ubID - ubID_prefix; // soldier is ours
else
return ubID; // soldier is another teams, dont touch its ID
}
inline bool IsOurSoldier (SOLDIERTYPE* pSoldier)
{
return pSoldier->bTeam == netbTeam || pSoldier->bTeam == 0;
}
inline bool IsOurSoldier (UINT8 ubID)
{
return (ubID >= ubID_prefix && ubID < (ubID_prefix + 7)) || ubID < 20;
}