-fixed and enabled shared ally vision for TEAMPLAY and 'Locked Teams' modes

-fixed disabled players allying their team members
-reenabled God Mode (Ctrl-G) for Debug builds and campaign mode

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@769 4a71c877-e1ca-e34f-864e-861f7616d084
master
Roman C 2006-09-28 02:11:19 +00:00
parent 3f748bd1c2
commit 01259aaab9
5 changed files with 51 additions and 28 deletions

View File

@ -1421,7 +1421,6 @@ BOOL stageOneInitialise(void)
return FALSE; return FALSE;
} }
// debug mode only so use normal MALLOC // debug mode only so use normal MALLOC
psHeap = memGetBlockHeap(); psHeap = memGetBlockHeap();
memSetBlockHeap(NULL); memSetBlockHeap(NULL);
@ -1824,6 +1823,7 @@ BOOL stageThreeInitialise(void)
//UDWORD i,j; //UDWORD i,j;
STRUCTURE *psStr; STRUCTURE *psStr;
SDWORD i;
debug(LOG_MAIN, "stageThreeInitalise"); debug(LOG_MAIN, "stageThreeInitalise");
bTrackingTransporter = FALSE; bTrackingTransporter = FALSE;
@ -1908,9 +1908,23 @@ BOOL stageThreeInitialise(void)
setAllPauseStates(FALSE); setAllPauseStates(FALSE);
/* decide if we have to create teams */ /* decide if we have to create teams */
if(game.alliance == ALLIANCES_TEAMS) if(game.alliance == ALLIANCES_TEAMS && (game.type == TEAMPLAY || game.type == SKIRMISH))
{
createTeamAlliances(); createTeamAlliances();
/* Update ally vision for pre-placed structures */
for(i=0;i<MAX_PLAYERS;i++)
{
if(i != selectedPlayer)
{
for(psStr=apsStructLists[i]; psStr; psStr=psStr->psNext)
{
if(aiCheckAlliances(psStr->player,selectedPlayer))
visTilesUpdate((BASE_OBJECT *)psStr,FALSE);
}
}
}
}
// ffs JS (and its a global!) // ffs JS (and its a global!)
if (getLevelLoadType() != GTYPE_SAVE_MIDMISSION) if (getLevelLoadType() != GTYPE_SAVE_MIDMISSION)

View File

@ -428,7 +428,8 @@ void keyInitMappings( BOOL bForceDefaults )
keyAddMapping(KEYMAP_ASSIGNABLE,KEY_IGNORE,(KEY_CODE)KEY_MAXSCAN,KEYMAP_PRESSED,kf_ToggleReopenBuildMenu,strresGetString(psStringRes,STR_BIND_REOPEN_BUILD)); keyAddMapping(KEYMAP_ASSIGNABLE,KEY_IGNORE,(KEY_CODE)KEY_MAXSCAN,KEYMAP_PRESSED,kf_ToggleReopenBuildMenu,strresGetString(psStringRes,STR_BIND_REOPEN_BUILD));
// NOTE THIS!!!!!!! // NOTE THIS!!!!!!!
// available: ctrl+g, ctrl+e, ctrl+m // available: ctrl+e, ctrl+m
keyAddMapping(KEYMAP__DEBUG,KEY_LCTRL,KEY_G,KEYMAP_PRESSED,kf_ToggleGodMode, "Toggle god Mode Status"); //we need this one - Tr
keyAddMapping(KEYMAP___HIDE,KEY_LSHIFT,KEY_BACKSPACE,KEYMAP_PRESSED,kf_ToggleDebugMappings, "TOGGLE Debug Mappings"); keyAddMapping(KEYMAP___HIDE,KEY_LSHIFT,KEY_BACKSPACE,KEYMAP_PRESSED,kf_ToggleDebugMappings, "TOGGLE Debug Mappings");
keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_SCROLLLOCK,KEYMAP_PRESSED,kf_TogglePauseMode, strresGetString(psStringRes,STR_BIND_PAUSE)); keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_SCROLLLOCK,KEYMAP_PRESSED,kf_TogglePauseMode, strresGetString(psStringRes,STR_BIND_PAUSE));
keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_J,KEYMAP_PRESSED,kf_MaxScrollLimits, "Maximum scroll limits"); keyAddMapping(KEYMAP__DEBUG,KEY_IGNORE,KEY_J,KEYMAP_PRESSED,kf_MaxScrollLimits, "Maximum scroll limits");

View File

@ -483,7 +483,7 @@ void formAlliance(UBYTE p1, UBYTE p2,BOOL prop,BOOL allowAudio,BOOL allowNotific
} }
else if((bMultiPlayer || game.type == SKIRMISH) && game.alliance == ALLIANCES_TEAMS) //not campaign and alliances are transitive else if((bMultiPlayer || game.type == SKIRMISH) && game.alliance == ALLIANCES_TEAMS) //not campaign and alliances are transitive
{ {
giftRadar(p1,p2,FALSE); giftRadar(p1,p2,FALSE); //FIXME: reenable
giftRadar(p2,p1,FALSE); giftRadar(p2,p1,FALSE);
} }
@ -989,9 +989,12 @@ void createTeamAlliances(void)
{ {
if( i!=j && (playerTeam[i] == playerTeam[j]) //wto different players belonging to the same team if( i!=j && (playerTeam[i] == playerTeam[j]) //wto different players belonging to the same team
&& !aiCheckAlliances(i,j) && (playerTeam[i] >= 0)) //not allied and not ignoring teams && !aiCheckAlliances(i,j) && (playerTeam[i] >= 0)) //not allied and not ignoring teams
{
if(game.skDiff[i] && game.skDiff[j]) //make sure both players are enabled
formAlliance(i,j,FALSE,FALSE,FALSE); //create silently formAlliance(i,j,FALSE,FALSE,FALSE); //create silently
} }
} }
}
} }

View File

@ -716,7 +716,8 @@ static void DrawRadarObjects(UBYTE *screen,UDWORD Modulus,UWORD boxSizeH,UWORD b
{ {
if(psDroid->visible[selectedPlayer] if(psDroid->visible[selectedPlayer]
OR godMode OR godMode
OR (bMultiPlayer && game.type == TEAMPLAY && aiCheckAlliances(selectedPlayer,psDroid->player)) OR (bMultiPlayer && (game.type == TEAMPLAY || game.alliance == ALLIANCES_TEAMS)
&& aiCheckAlliances(selectedPlayer,psDroid->player))
) )
{ {
x=(psDroid->x/TILE_UNITS)-RadarScrollX; x=(psDroid->x/TILE_UNITS)-RadarScrollX;
@ -795,7 +796,8 @@ static void DrawRadarObjects(UBYTE *screen,UDWORD Modulus,UWORD boxSizeH,UWORD b
{ {
if(psStruct->visible[selectedPlayer] if(psStruct->visible[selectedPlayer]
OR godMode OR godMode
OR (bMultiPlayer && game.type == TEAMPLAY && aiCheckAlliances(selectedPlayer,psStruct->player)) OR (bMultiPlayer && (game.type == TEAMPLAY || game.alliance == ALLIANCES_TEAMS)
&& aiCheckAlliances(selectedPlayer,psStruct->player))
) )
{ {
x=(psStruct->x/TILE_UNITS)-RadarScrollX; x=(psStruct->x/TILE_UNITS)-RadarScrollX;

View File

@ -205,9 +205,10 @@ static BOOL rayTerrainCallback(SDWORD x, SDWORD y, SDWORD dist)
// new - ask alex M // new - ask alex M
if( (selectedPlayer!=rayPlayer) AND if( (selectedPlayer!=rayPlayer) AND
(bMultiPlayer && game.type == TEAMPLAY && aiCheckAlliances(selectedPlayer,rayPlayer)) ) (bMultiPlayer && (game.type == TEAMPLAY || game.alliance == ALLIANCES_TEAMS)
&& aiCheckAlliances(selectedPlayer,rayPlayer)) )
{ {
SET_TILE_VISIBLE(selectedPlayer,psTile); SET_TILE_VISIBLE(selectedPlayer,psTile); //reveal radar
} }
// new - ask Alex M // new - ask Alex M
@ -217,11 +218,12 @@ static BOOL rayTerrainCallback(SDWORD x, SDWORD y, SDWORD dist)
{ {
if( ((UDWORD)rayPlayer == selectedPlayer) OR if( ((UDWORD)rayPlayer == selectedPlayer) OR
// new - ask AM // new - ask AM
(bMultiPlayer && game.type == TEAMPLAY && aiCheckAlliances(selectedPlayer,rayPlayer)) // can see opponent moving (bMultiPlayer && (game.type == TEAMPLAY || game.alliance == ALLIANCES_TEAMS)
&& aiCheckAlliances(selectedPlayer,rayPlayer)) // can see opponent moving
// new - ask AM // new - ask AM
) )
{ {
avInformOfChange(x>>TILE_SHIFT,y>>TILE_SHIFT); avInformOfChange(x>>TILE_SHIFT,y>>TILE_SHIFT); //reveal map
} }
} }
@ -845,11 +847,10 @@ void processVisibility(BASE_OBJECT *psObj)
// get all the objects from the grid the droid is in // get all the objects from the grid the droid is in
gridStartIterate((SDWORD)psObj->x, (SDWORD)psObj->y); gridStartIterate((SDWORD)psObj->x, (SDWORD)psObj->y);
// Fix for ally vis // Make sure allies can see us
if( bMultiPlayer && (game.type == TEAMPLAY) ) if( bMultiPlayer && (game.type == TEAMPLAY || game.alliance == ALLIANCES_TEAMS) )
{ {
for(player=0; player<MAX_PLAYERS; player++) for(player=0; player<MAX_PLAYERS; player++)
{ {
@ -863,6 +864,21 @@ void processVisibility(BASE_OBJECT *psObj)
} }
} }
//forward out vision to our allies
if (bMultiPlayer && (game.type == TEAMPLAY || game.alliance == ALLIANCES_TEAMS))
{
for(player = 0; player < MAX_PLAYERS; player++)
{
for(ally = 0; ally < MAX_PLAYERS; ally++)
{
if (currVis[player] && aiCheckAlliances(player, ally))
{
currVis[ally] = TRUE;
}
}
}
}
//if a player has a SAT_UPLINK structure, they can see everything! //if a player has a SAT_UPLINK structure, they can see everything!
for (player=0; player<MAX_PLAYERS; player++) for (player=0; player<MAX_PLAYERS; player++)
{ {
@ -901,20 +917,7 @@ void processVisibility(BASE_OBJECT *psObj)
psViewer = gridIterate(); psViewer = gridIterate();
} }
// jiggle the visibility for team play
if (bMultiPlayer && (game.type == TEAMPLAY))
{
for(player = 0; player < MAX_PLAYERS; player++)
{
for(ally = 0; ally < MAX_PLAYERS; ally ++)
{
if (currVis[player] && aiCheckAlliances(player, ally))
{
currVis[ally] = TRUE;
}
}
}
}
// update the visibility levels // update the visibility levels
for(i=0; i<MAX_PLAYERS; i++) for(i=0; i<MAX_PLAYERS; i++)