Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: Warzone2100/warzone2100
base: e5e0f72
...
head fork: Warzone2100/warzone2100
compare: 2a33cd1
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 14 files changed
  • 0 commit comments
  • 1 contributor
Commits on Feb 28, 2012
@Cyp Cyp Try to be more consistent with gameTime usage.
When updating the game state, we now determine what happened in the interval
[gameTime - deltaGameTime + 1; gameTime]. The time gameTime - deltaGameTime is now
considered to be in the past, so the game state may be modified at time
gameTime - deltaGameTime + 1, at the earliest.

During GAME_* message processing, deltaGameTime is 0, however it is still considered
valid to change the game state at gameTime - deltaGameTime + 1, since that will lie
within the following update interval.

Refs ticket:3175.
f6dce9d
@Cyp Cyp Show allied unit counts.
Simplify displayMultiPlayer(), fix some duplicate and some quintuplicate code.
2a33cd1
View
2  lib/gamelib/animobj.cpp
@@ -221,7 +221,7 @@ animObj_Add( void *pParentObj, int iAnimID,
/* init object */
psObj->uwID = (UWORD) iAnimID;
psObj->psAnim = (ANIM3D *) psAnim;
- psObj->udwStartTime = gameTime - deltaGameTime; // Start animation at beginning of update period.
+ psObj->udwStartTime = gameTime - deltaGameTime + 1; // Start animation at beginning of update period.
psObj->udwStartDelay = udwStartDelay;
psObj->uwCycles = uwCycles;
psObj->bVisible = true;
View
6 src/combat.cpp
@@ -72,13 +72,13 @@ bool combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
return false;
}
- unsigned fireTime = gameTime - deltaGameTime; // Can fire earliest at the start of the tick.
+ unsigned fireTime = gameTime - deltaGameTime + 1; // Can fire earliest at the start of the tick.
/*see if reload-able weapon and out of ammo*/
if (psStats->reloadTime && !psWeap->ammo)
{
fireTime = std::max(fireTime, psWeap->lastFired + weaponReloadTime(psStats, psAttacker->player));
- if (gameTime <= fireTime)
+ if (gameTime < fireTime)
{
return false;
}
@@ -91,7 +91,7 @@ bool combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
firePause = std::max(firePause, 1u); // Don't shoot infinitely many shots at once.
fireTime = std::max(fireTime, psWeap->lastFired + firePause);
- if (gameTime <= fireTime)
+ if (gameTime < fireTime)
{
/* Too soon to fire again */
return false;
View
8 src/component.cpp
@@ -1156,10 +1156,10 @@ void compPersonToBits(DROID *psDroid)
/* Tell about player colour */
col = getPlayerColour(psDroid->player);
- addEffect(&position, EFFECT_GRAVITON, GRAVITON_TYPE_GIBLET, true, headImd, col, gameTime - deltaGameTime);
- addEffect(&position, EFFECT_GRAVITON, GRAVITON_TYPE_GIBLET, true, legsImd, col, gameTime - deltaGameTime);
- addEffect(&position, EFFECT_GRAVITON, GRAVITON_TYPE_GIBLET, true, armImd, col, gameTime - deltaGameTime);
- addEffect(&position, EFFECT_GRAVITON, GRAVITON_TYPE_GIBLET, true, bodyImd, col, gameTime - deltaGameTime);
+ addEffect(&position, EFFECT_GRAVITON, GRAVITON_TYPE_GIBLET, true, headImd, col, gameTime - deltaGameTime + 1);
+ addEffect(&position, EFFECT_GRAVITON, GRAVITON_TYPE_GIBLET, true, legsImd, col, gameTime - deltaGameTime + 1);
+ addEffect(&position, EFFECT_GRAVITON, GRAVITON_TYPE_GIBLET, true, armImd, col, gameTime - deltaGameTime + 1);
+ addEffect(&position, EFFECT_GRAVITON, GRAVITON_TYPE_GIBLET, true, bodyImd, col, gameTime - deltaGameTime + 1);
}
View
12 src/droid.cpp
@@ -389,7 +389,7 @@ void recycleDroid(DROID *psDroid)
vanishDroid(psDroid);
- addEffect(&position, EFFECT_EXPLOSION, EXPLOSION_TYPE_DISCOVERY, false, NULL, false, gameTime - deltaGameTime);
+ addEffect(&position, EFFECT_EXPLOSION, EXPLOSION_TYPE_DISCOVERY, false, NULL, false, gameTime - deltaGameTime + 1);
CHECK_DROID(psDroid);
}
@@ -794,8 +794,8 @@ void droidUpdate(DROID *psDroid)
emissionInterval = CALC_DROID_SMOKE_INTERVAL(percentDamage);
- int effectTime = std::max(gameTime - deltaGameTime, psDroid->lastEmission + emissionInterval);
- if (gameTime > effectTime)
+ int effectTime = std::max(gameTime - deltaGameTime + 1, psDroid->lastEmission + emissionInterval);
+ if (gameTime >= effectTime)
{
dv.x = psDroid->pos.x + DROID_DAMAGE_SPREAD;
dv.z = psDroid->pos.y + DROID_DAMAGE_SPREAD;
@@ -836,7 +836,7 @@ void droidUpdate(DROID *psDroid)
else
{
// do burn damage
- droidDamage(psDroid, BURN_DAMAGE, WC_HEAT, WSC_FLAME, gameTime - deltaGameTime/2, true);
+ droidDamage(psDroid, BURN_DAMAGE, WC_HEAT, WSC_FLAME, gameTime - deltaGameTime/2 + 1, true);
}
}
@@ -1383,7 +1383,7 @@ bool droidUpdateDroidRepair(DROID *psRepairDroid)
iVecEffect.y = psDroidToRepair->pos.z + rand()%8;;
iVecEffect.z = psDroidToRepair->pos.y + DROID_REPAIR_SPREAD;
effectGiveAuxVar(90+rand()%20);
- addEffect(&iVecEffect, EFFECT_EXPLOSION, EXPLOSION_TYPE_LASER, false, NULL, 0, gameTime - deltaGameTime + rand()%deltaGameTime);
+ addEffect(&iVecEffect, EFFECT_EXPLOSION, EXPLOSION_TYPE_LASER, false, NULL, 0, gameTime - deltaGameTime + 1 + rand()%deltaGameTime);
droidAddWeldSound( iVecEffect );
}
@@ -2009,7 +2009,7 @@ void droidSetBits(DROID_TEMPLATE *pTemplate,DROID *psDroid)
psDroid->body = calcTemplateBody(pTemplate, psDroid->player);
psDroid->originalBody = psDroid->body;
psDroid->expectedDamage = 0; // Begin life optimistically.
- psDroid->time = gameTime - deltaGameTime; // Start at beginning of tick.
+ psDroid->time = gameTime - deltaGameTime + 1; // Start at beginning of tick.
psDroid->prevSpacetime.time = psDroid->time - 1; // -1 for interpolation.
//create the droids weapons
View
2  src/feature.cpp
@@ -402,7 +402,7 @@ bool removeFeature(FEATURE *psDel)
pos.x = psDel->pos.x;
pos.z = psDel->pos.y;
pos.y = map_Height(pos.x, pos.z) + 30;
- addEffect(&pos, EFFECT_EXPLOSION, EXPLOSION_TYPE_DISCOVERY, false, NULL, 0, gameTime - deltaGameTime);
+ addEffect(&pos, EFFECT_EXPLOSION, EXPLOSION_TYPE_DISCOVERY, false, NULL, 0, gameTime - deltaGameTime + 1);
if (psDel->psStats->subType == FEAT_GEN_ARTE)
{
scoreUpdateVar(WD_ARTEFACTS_FOUND);
View
2  src/move.cpp
@@ -2648,7 +2648,7 @@ void moveUpdateDroid(DROID *psDroid)
pos.x = psDroid->pos.x + (18-rand()%36);
pos.z = psDroid->pos.y + (18-rand()%36);
pos.y = psDroid->pos.z + (psDroid->sDisplay.imd->max.y / 3);
- addEffect(&pos, EFFECT_EXPLOSION, EXPLOSION_TYPE_SMALL, false, NULL, 0, gameTime - deltaGameTime);
+ addEffect(&pos, EFFECT_EXPLOSION, EXPLOSION_TYPE_SMALL, false, NULL, 0, gameTime - deltaGameTime + 1);
}
movePlayAudio( psDroid, bStarted, bStopped, moveSpeed );
View
2  src/multibot.cpp
@@ -734,7 +734,7 @@ bool recvDestroyDroid(NETQUEUE queue)
{
turnOffMultiMsg(true);
debug(LOG_DEATH, "Killing droid %d on request from player %d - huh?", psDroid->id, queue.index);
- destroyDroid(psDroid, gameTime);
+ destroyDroid(psDroid, gameTime - deltaGameTime + 1); // deltaGameTime is actually 0 here, since we're between updates. However, the value of gameTime - deltaGameTime + 1 will not change when we start the next tick.
turnOffMultiMsg(false);
}
else
View
286 src/multimenu.cpp
@@ -760,7 +760,7 @@ bool runMultiRequester(UDWORD id, UDWORD *mode, char *chosen, UDWORD *chosenValu
static void displayExtraGubbins(UDWORD height)
{
- char str[128];
+ char str[128];
//draw grid
iV_Line(MULTIMENU_FORM_X+MULTIMENU_C0 -6 , MULTIMENU_FORM_Y,
@@ -792,16 +792,14 @@ static void displayExtraGubbins(UDWORD height)
iV_DrawText(_("Alliances"), MULTIMENU_FORM_X+MULTIMENU_C0, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET);
iV_DrawText(_("Score"), MULTIMENU_FORM_X+MULTIMENU_C8, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET);
iV_DrawText(_("Kills"), MULTIMENU_FORM_X+MULTIMENU_C9, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET);
+ iV_DrawText(_("Units"), MULTIMENU_FORM_X+MULTIMENU_C10, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET);
- if(getDebugMappingStatus())
- { // shows # units for *all* players in debug mode ONLY!
- iV_DrawText(_("Units"), MULTIMENU_FORM_X+MULTIMENU_C10, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET);
+ if (getDebugMappingStatus())
+ {
iV_DrawText(_("Power"), MULTIMENU_FORM_X+MULTIMENU_C11, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET);
}
else
- { // shows # units for *yourself* (+ team member?) only.
- iV_DrawText(_("Units"), MULTIMENU_FORM_X+MULTIMENU_C10, MULTIMENU_FORM_Y+MULTIMENU_FONT_OSET);
-
+ {
// ping is useless for non MP games, so display something useful depending on mode.
if (runningMultiplayer())
{
@@ -814,16 +812,14 @@ static void displayExtraGubbins(UDWORD height)
}
#ifdef DEBUG
- {
- unsigned int width;
+ unsigned int width;
- sprintf(str,"Traf: %u/%u", NETgetBytesSent(), NETgetBytesRecvd());
- width = iV_GetTextWidth(str);
- iV_DrawText(str, MULTIMENU_FORM_X, MULTIMENU_FORM_Y + MULTIMENU_FORM_H);
+ sprintf(str,"Traf: %u/%u", NETgetBytesSent(), NETgetBytesRecvd());
+ width = iV_GetTextWidth(str);
+ iV_DrawText(str, MULTIMENU_FORM_X, MULTIMENU_FORM_Y + MULTIMENU_FORM_H);
- sprintf(str,"Pack: %u/%u", NETgetPacketsSent(), NETgetPacketsRecvd());
- iV_DrawText(str, MULTIMENU_FORM_X + 20 + width, MULTIMENU_FORM_Y + MULTIMENU_FORM_H);
- }
+ sprintf(str,"Pack: %u/%u", NETgetPacketsSent(), NETgetPacketsRecvd());
+ iV_DrawText(str, MULTIMENU_FORM_X + 20 + width, MULTIMENU_FORM_Y + MULTIMENU_FORM_H);
#endif
return;
}
@@ -831,193 +827,141 @@ static void displayExtraGubbins(UDWORD height)
static void displayMultiPlayer(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours)
{
- char str[128];
- UDWORD x = xOffset+psWidget->x;
- UDWORD y = yOffset+psWidget->y;
- UDWORD player = psWidget->UserData; //get the in game player number.
- Position position;
- Vector3i rotation;
+ char str[128];
+ int x = xOffset + psWidget->x;
+ int y = yOffset + psWidget->y;
+ unsigned player = psWidget->UserData; // Get the in game player number.
- if( responsibleFor(player,0) )
+ if (responsibleFor(player, 0))
{
displayExtraGubbins(widgGetFromID(psWScreen,MULTIMENU_FORM)->height);
}
- iV_SetFont(font_regular); // font
+ iV_SetFont(font_regular); // font
iV_SetTextColour(WZCOL_TEXT_BRIGHT);
- if(isHumanPlayer(player) || (game.type == SKIRMISH && player<game.maxPlayers) )
+ const bool isHuman = isHumanPlayer(player);
+ const bool isAlly = aiCheckAlliances(selectedPlayer, player);
+ const bool isSelectedPlayer = player == selectedPlayer;
+
+ SetPlayerTextColor(alliances[selectedPlayer][player], player);
+
+ if (isHuman || (game.type == SKIRMISH && player<game.maxPlayers) )
{
ssprintf(str, "%d: %s", NetPlay.players[player].position, getPlayerName(player));
- if (isHumanPlayer(player))
- {
- SetPlayerTextColor(alliances[selectedPlayer][player], player);
- }
- else
- {
- SetPlayerTextColor(alliances[selectedPlayer][player], player);
- }
- while(iV_GetTextWidth(str) >= (MULTIMENU_C0-MULTIMENU_C2-10) )
+ while (iV_GetTextWidth(str) >= MULTIMENU_C0 - MULTIMENU_C2 - 10)
{
- str[strlen(str)-1]='\0';
+ str[strlen(str) - 1] = '\0';
}
- iV_DrawText(str, x+MULTIMENU_C2, y+MULTIMENU_FONT_OSET);
+ iV_DrawText(str, x + MULTIMENU_C2, y + MULTIMENU_FONT_OSET);
//c3-7 alliance
//manage buttons by showing or hiding them. gifts only in campaign,
+ if (game.alliance != NO_ALLIANCES)
{
- if(game.alliance != NO_ALLIANCES)
+ if (isAlly && !isSelectedPlayer && !giftsUp[player] )
{
- if(alliances[selectedPlayer][player] == ALLIANCE_FORMED)
+ if (game.alliance != ALLIANCES_TEAMS)
{
- if(player != selectedPlayer && !giftsUp[player] )
- {
- if (game.alliance != ALLIANCES_TEAMS)
- {
- widgReveal(psWScreen,MULTIMENU_GIFT_RAD+ player);
- widgReveal(psWScreen,MULTIMENU_GIFT_RES+ player);
- }
- widgReveal(psWScreen,MULTIMENU_GIFT_DRO+ player);
- widgReveal(psWScreen,MULTIMENU_GIFT_POW+ player);
- giftsUp[player] = true;
- }
+ widgReveal(psWScreen, MULTIMENU_GIFT_RAD + player);
+ widgReveal(psWScreen, MULTIMENU_GIFT_RES + player);
}
- else
+ widgReveal(psWScreen, MULTIMENU_GIFT_DRO + player);
+ widgReveal(psWScreen, MULTIMENU_GIFT_POW + player);
+ giftsUp[player] = true;
+ }
+ else if (!isAlly && !isSelectedPlayer && giftsUp[player])
+ {
+ if (game.alliance != ALLIANCES_TEAMS)
{
- if(player != selectedPlayer && giftsUp[player])
- {
- if (game.alliance != ALLIANCES_TEAMS)
- {
- widgHide(psWScreen,MULTIMENU_GIFT_RAD+ player);
- widgHide(psWScreen,MULTIMENU_GIFT_RES+ player);
- }
- widgHide(psWScreen,MULTIMENU_GIFT_DRO+ player);
- widgHide(psWScreen,MULTIMENU_GIFT_POW+ player);
- giftsUp[player] = false;
- }
+ widgHide(psWScreen, MULTIMENU_GIFT_RAD + player);
+ widgHide(psWScreen, MULTIMENU_GIFT_RES + player);
}
+ widgHide(psWScreen, MULTIMENU_GIFT_DRO + player);
+ widgHide(psWScreen, MULTIMENU_GIFT_POW + player);
+ giftsUp[player] = false;
}
}
}
- if(isHumanPlayer(player))
- {
- SetPlayerTextColor(alliances[selectedPlayer][player], player);
- // Let's use the real score for MP games
- if (NetPlay.bComms)
+ // Let's use the real score for MP games
+ if (NetPlay.bComms)
+ {
+ //c8:score,
+ if (Cheated)
{
- //c8:score,
- if (Cheated)
- {
- sprintf(str,"(cheated)");
- }
- else
- {
- sprintf(str,"%d",getMultiStats(player).recentScore);
- }
- iV_DrawText(str, x+MULTIMENU_C8, y+MULTIMENU_FONT_OSET);
-
- //c9:kills,
- sprintf(str,"%d",getMultiStats(player).recentKills);
- iV_DrawText(str, x+MULTIMENU_C9, y+MULTIMENU_FONT_OSET);
+ sprintf(str, "(cheated)");
}
else
{
- // estimate of score for skirmish games
- sprintf(str,"%d",ingame.skScores[player][0]);
- iV_DrawText(str, x+MULTIMENU_C8, y+MULTIMENU_FONT_OSET);
- // estimated kills
- sprintf(str,"%d",ingame.skScores[player][1]);
- iV_DrawText(str, x+MULTIMENU_C9, y+MULTIMENU_FONT_OSET);
+ sprintf(str, "%d", getMultiStats(player).recentScore);
}
+ iV_DrawText(str, x + MULTIMENU_C8, y + MULTIMENU_FONT_OSET);
- if(!getDebugMappingStatus())
- {
- //only show player's units, and nobody elses.
- //c10:units
- if (myResponsibility(player))
- {
- SetPlayerTextColor(alliances[selectedPlayer][player], player);
- sprintf(str, "%d", getNumDroids(player) + getNumTransporterDroids(player));
- iV_DrawText(str, x+MULTIMENU_C10, y+MULTIMENU_FONT_OSET);
- }
+ //c9:kills,
+ sprintf(str, "%d", getMultiStats(player).recentKills);
+ iV_DrawText(str, x + MULTIMENU_C9, y + MULTIMENU_FONT_OSET);
+ }
+ else
+ {
+ // estimate of score for skirmish games
+ sprintf(str, "%d", ingame.skScores[player][0]);
+ iV_DrawText(str, x + MULTIMENU_C8, y + MULTIMENU_FONT_OSET);
+ // estimated kills
+ sprintf(str, "%d", ingame.skScores[player][1]);
+ iV_DrawText(str, x + MULTIMENU_C9, y + MULTIMENU_FONT_OSET);
+ }
+
+ //only show player's and allies' unit counts, and nobody elses.
+ //c10:units
+ if (isAlly || getDebugMappingStatus())
+ {
+ sprintf(str, "%d", getNumDroids(player) + getNumTransporterDroids(player));
+ iV_DrawText(str, x + MULTIMENU_C10, y + MULTIMENU_FONT_OSET);
+ }
- if (runningMultiplayer())
+ /* Display player power instead of number of played games
+ * and number of units instead of ping when in debug mode
+ */
+ if (getDebugMappingStatus()) //Won't pass this when in both release and multiplayer modes
+ {
+ //c11: Player power
+ sprintf(str, "%u", (int)getPower(player));
+ iV_DrawText(str, MULTIMENU_FORM_X + MULTIMENU_C11, y + MULTIMENU_FONT_OSET);
+ }
+ else if (runningMultiplayer())
+ {
+ //c11:ping
+ if (!isSelectedPlayer && isHuman)
+ {
+ if (ingame.PingTimes[player] >= 2000)
{
- //c11:ping
- if (player != selectedPlayer)
- {
- if (ingame.PingTimes[player] >= 2000)
- {
- sprintf(str,"???");
- }
- else
- {
- sprintf(str, "%d", ingame.PingTimes[player]);
- }
- iV_DrawText(str, x+MULTIMENU_C11, y+MULTIMENU_FONT_OSET);
- }
+ sprintf(str, "???");
}
else
{
- int num;
- STRUCTURE *temp;
- // NOTE, This tallys up *all* the structures you have. Test out via 'start with no base'.
- for (num = 0, temp = apsStructLists[player]; temp != NULL;num++,temp = temp->psNext) {}
- //c11: Structures
- sprintf(str, "%d", num);
- iV_DrawText(str, x+MULTIMENU_C11, y+MULTIMENU_FONT_OSET);
+ sprintf(str, "%d", ingame.PingTimes[player]);
}
+ iV_DrawText(str, x + MULTIMENU_C11, y + MULTIMENU_FONT_OSET);
}
}
else
{
- SetPlayerTextColor(alliances[selectedPlayer][player], player);
-
- // Let's use the real score for MP games
- if (NetPlay.bComms)
+ //c11: Structures
+ if (isAlly || getDebugMappingStatus())
{
- //c8:score,
- if (Cheated)
- {
- sprintf(str,"(cheated)");
- }
- else
+ // NOTE, This tallys up *all* the structures you have. Test out via 'start with no base'.
+ int num = 0;
+ for (STRUCTURE *temp = apsStructLists[player]; temp != NULL; temp = temp->psNext)
{
- sprintf(str,"%d",getMultiStats(player).recentScore);
+ ++num;
}
- iV_DrawText(str, x+MULTIMENU_C8, y+MULTIMENU_FONT_OSET);
-
- //c9:kills,
- sprintf(str,"%d",getMultiStats(player).recentKills);
- iV_DrawText(str, x+MULTIMENU_C9, y+MULTIMENU_FONT_OSET);
- }
- else
- {
- // estimate of score for skirmish games
- sprintf(str,"%d",ingame.skScores[player][0]);
- iV_DrawText(str, x+MULTIMENU_C8, y+MULTIMENU_FONT_OSET);
- // estimated kills
- sprintf(str,"%d",ingame.skScores[player][1]);
- iV_DrawText(str, x+MULTIMENU_C9, y+MULTIMENU_FONT_OSET);
+ sprintf(str, "%d", num);
+ iV_DrawText(str, x + MULTIMENU_C11, y + MULTIMENU_FONT_OSET);
}
}
- /* Display player power instead of number of played games
- * and number of units instead of ping when in debug mode
- */
- if(getDebugMappingStatus()) //Won't pass this when in both release and multiplayer modes
- {
- //c10: Total number of player units in possession
- sprintf(str,"%d",getNumDroids(player) + getNumTransporterDroids(player));
- iV_DrawText(str, x+MULTIMENU_C10, y+MULTIMENU_FONT_OSET);
-
- //c11: Player power
- sprintf(str, "%u", (int)getPower(player));
- iV_DrawText(str, MULTIMENU_FORM_X+MULTIMENU_C11, y+MULTIMENU_FONT_OSET);
- }
-
// a droid of theirs.
DROID *displayDroid = apsDroidLists[player];
while (displayDroid != NULL && !displayDroid->visible[selectedPlayer])
@@ -1027,11 +971,8 @@ static void displayMultiPlayer(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset,
if (displayDroid)
{
pie_SetGeometricOffset( MULTIMENU_FORM_X+MULTIMENU_C1 ,y+MULTIMENU_PLAYER_H);
- rotation.x = -15;
- rotation.y = 45;
- rotation.z = 0;
- position.x = 0;
- position.y = 0;
+ Vector3i rotation(-15, 45, 0);
+ Position position(0, 0, 2000); // Scale them.
if (displayDroid->droidType == DROID_SUPERTRANSPORTER)
{
position.z = 7850;
@@ -1040,33 +981,30 @@ static void displayMultiPlayer(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset,
{
position.z = 4100;
}
- else
- {
- position.z = 2000; //scale them!
- }
+
displayComponentButtonObject(displayDroid, &rotation, &position, false, 100);
}
- else if(apsDroidLists[player])
+ else if (apsDroidLists[player])
{
// Show that they have droids, but not which droids, since we can't see them.
iV_DrawImageTc(IntImages, IMAGE_GENERIC_TANK, IMAGE_GENERIC_TANK_TC, MULTIMENU_FORM_X + MULTIMENU_C1 - iV_GetImageWidth(IntImages, IMAGE_GENERIC_TANK)/2, y + MULTIMENU_PLAYER_H - iV_GetImageHeight(IntImages, IMAGE_GENERIC_TANK), pal_GetTeamColour(getPlayerColour(player)));
}
// clean up widgets if player leaves while menu is up.
- if(!isHumanPlayer(player) && !(game.type == SKIRMISH && player<game.maxPlayers))
+ if (!isHuman && !(game.type == SKIRMISH && player < game.maxPlayers))
{
- if(widgGetFromID(psWScreen,MULTIMENU_CHANNEL+player))
+ if (widgGetFromID(psWScreen, MULTIMENU_CHANNEL + player) != NULL)
{
- widgDelete(psWScreen,MULTIMENU_CHANNEL+ player);
+ widgDelete(psWScreen, MULTIMENU_CHANNEL + player);
}
- if(widgGetFromID(psWScreen,MULTIMENU_ALLIANCE_BASE+player) )
+ if (widgGetFromID(psWScreen, MULTIMENU_ALLIANCE_BASE + player) != NULL)
{
- widgDelete(psWScreen,MULTIMENU_ALLIANCE_BASE+ player);
- widgDelete(psWScreen,MULTIMENU_GIFT_RAD+ player);
- widgDelete(psWScreen,MULTIMENU_GIFT_RES+ player);
- widgDelete(psWScreen,MULTIMENU_GIFT_DRO+ player);
- widgDelete(psWScreen,MULTIMENU_GIFT_POW+ player);
+ widgDelete(psWScreen, MULTIMENU_ALLIANCE_BASE + player);
+ widgDelete(psWScreen, MULTIMENU_GIFT_RAD + player);
+ widgDelete(psWScreen, MULTIMENU_GIFT_RES + player);
+ widgDelete(psWScreen, MULTIMENU_GIFT_DRO + player);
+ widgDelete(psWScreen, MULTIMENU_GIFT_POW + player);
giftsUp[player] = false;
}
}
View
2  src/multiplay.cpp
@@ -1548,7 +1548,7 @@ bool recvDestroyFeature(NETQUEUE queue)
debug(LOG_FEATURE, "p%d feature id %d destroyed (%s)", pF->player, pF->id, pF->psStats->pName);
// Remove the feature locally
turnOffMultiMsg(true);
- removeFeature(pF);
+ destroyFeature(pF, gameTime - deltaGameTime + 1); // deltaGameTime is actually 0 here, since we're between updates. However, the value of gameTime - deltaGameTime + 1 will not change when we start the next tick.
turnOffMultiMsg(false);
return true;
View
2  src/multistruct.cpp
@@ -196,7 +196,7 @@ bool recvDestroyStructure(NETQUEUE queue)
{
turnOffMultiMsg(true);
// Remove the struct from remote players machine
- destroyStruct(psStruct, gameTime);
+ destroyStruct(psStruct, gameTime - deltaGameTime + 1); // deltaGameTime is actually 0 here, since we're between updates. However, the value of gameTime - deltaGameTime + 1 will not change when we start the next tick.
turnOffMultiMsg(false);
// NOTE: I do not think this should be here!
technologyGiveAway(psStruct);
View
4 src/objmem.cpp
@@ -143,7 +143,7 @@ void objmemUpdate(void)
were destroyed before this turn */
/* First remove the objects from the start of the list */
- while (psDestroyedObj != NULL && psDestroyedObj->died < gameTime - deltaGameTime)
+ while (psDestroyedObj != NULL && psDestroyedObj->died <= gameTime - deltaGameTime)
{
psNext = psDestroyedObj->psNext;
objmemDestroy(psDestroyedObj);
@@ -155,7 +155,7 @@ void objmemUpdate(void)
for(psCurr = psPrev = psDestroyedObj; psCurr != NULL; psCurr = psNext)
{
psNext = psCurr->psNext;
- if (psCurr->died < gameTime - deltaGameTime)
+ if (psCurr->died <= gameTime - deltaGameTime)
{
objmemDestroy(psCurr);
View
3  src/projectile.cpp
@@ -896,6 +896,7 @@ static void proj_InFlightFunc(PROJECTILE *psProj)
{
// We hit!
setSpacetime(psProj, closestCollisionSpacetime);
+ psProj->time = std::max(psProj->time, gameTime - deltaGameTime + 1); // Make sure .died gets set in the interval [gameTime - deltaGameTime + 1; gameTime].
if(psProj->time == psProj->prevSpacetime.time)
{
--psProj->prevSpacetime.time;
@@ -1401,7 +1402,7 @@ static void proj_checkBurnDamage(PROJECTILE *psProj)
unsigned damageRate = weaponIncenDamage(psStats,psProj->player);
debug(LOG_NEVER, "Burn damage of %d per second to object %d, player %d\n", damageRate, psCurr->id, psCurr->player);
- int relativeDamage = objectDamage(psCurr, damageRate, psStats->weaponClass, psStats->weaponSubClass, gameTime - deltaGameTime/2, true);
+ int relativeDamage = objectDamage(psCurr, damageRate, psStats->weaponClass, psStats->weaponSubClass, gameTime - deltaGameTime/2 + 1, true);
proj_UpdateKills(psProj, relativeDamage);
}
}
View
2  src/projectiledef.h
@@ -43,7 +43,7 @@ struct PROJECTILE : public SIMPLE_OBJECT
PROJECTILE(uint32_t id, unsigned player) : SIMPLE_OBJECT(OBJ_PROJECTILE, id, player) {}
void update();
- bool deleteIfDead() { if (died == 0 || died > gameTime - deltaGameTime) return false; delete this; return true; }
+ bool deleteIfDead() { if (died == 0 || died >= gameTime - deltaGameTime) return false; delete this; return true; }
UBYTE state; ///< current projectile state
View
16 src/structure.cpp
@@ -2352,16 +2352,16 @@ static bool structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl,
iVecEffect.x = psNewDroid->pos.x;
iVecEffect.y = map_Height( psNewDroid->pos.x, psNewDroid->pos.y ) + DROID_CONSTRUCTION_SMOKE_HEIGHT;
iVecEffect.z = psNewDroid->pos.y;
- addEffect(&iVecEffect, EFFECT_CONSTRUCTION, CONSTRUCTION_TYPE_DRIFTING, false, NULL, 0, gameTime - deltaGameTime);
+ addEffect(&iVecEffect, EFFECT_CONSTRUCTION, CONSTRUCTION_TYPE_DRIFTING, false, NULL, 0, gameTime - deltaGameTime + 1);
iVecEffect.x = psNewDroid->pos.x - DROID_CONSTRUCTION_SMOKE_OFFSET;
iVecEffect.z = psNewDroid->pos.y - DROID_CONSTRUCTION_SMOKE_OFFSET;
- addEffect(&iVecEffect, EFFECT_CONSTRUCTION, CONSTRUCTION_TYPE_DRIFTING, false, NULL, 0, gameTime - deltaGameTime);
+ addEffect(&iVecEffect, EFFECT_CONSTRUCTION, CONSTRUCTION_TYPE_DRIFTING, false, NULL, 0, gameTime - deltaGameTime + 1);
iVecEffect.z = psNewDroid->pos.y + DROID_CONSTRUCTION_SMOKE_OFFSET;
- addEffect(&iVecEffect, EFFECT_CONSTRUCTION, CONSTRUCTION_TYPE_DRIFTING, false, NULL, 0, gameTime - deltaGameTime);
+ addEffect(&iVecEffect, EFFECT_CONSTRUCTION, CONSTRUCTION_TYPE_DRIFTING, false, NULL, 0, gameTime - deltaGameTime + 1);
iVecEffect.x = psNewDroid->pos.x + DROID_CONSTRUCTION_SMOKE_OFFSET;
- addEffect(&iVecEffect, EFFECT_CONSTRUCTION, CONSTRUCTION_TYPE_DRIFTING, false, NULL, 0, gameTime - deltaGameTime);
+ addEffect(&iVecEffect, EFFECT_CONSTRUCTION, CONSTRUCTION_TYPE_DRIFTING, false, NULL, 0, gameTime - deltaGameTime + 1);
iVecEffect.z = psNewDroid->pos.y - DROID_CONSTRUCTION_SMOKE_OFFSET;
- addEffect(&iVecEffect, EFFECT_CONSTRUCTION, CONSTRUCTION_TYPE_DRIFTING, false, NULL, 0, gameTime - deltaGameTime);
+ addEffect(&iVecEffect, EFFECT_CONSTRUCTION, CONSTRUCTION_TYPE_DRIFTING, false, NULL, 0, gameTime - deltaGameTime + 1);
}
/* add the droid to the list */
addDroid(psNewDroid, apsDroidLists);
@@ -3354,7 +3354,7 @@ static void aiUpdateStructure(STRUCTURE *psStructure, bool isMission)
iVecEffect.y = psDroid->pos.z + (10-rand()%20);
iVecEffect.z = psDroid->pos.y + (10-rand()%20);
effectSetSize(100);
- addEffect(&iVecEffect, EFFECT_EXPLOSION, EXPLOSION_TYPE_SPECIFIED, true, getImdFromIndex(MI_FLAME), 0, gameTime - deltaGameTime);
+ addEffect(&iVecEffect, EFFECT_EXPLOSION, EXPLOSION_TYPE_SPECIFIED, true, getImdFromIndex(MI_FLAME), 0, gameTime - deltaGameTime + 1);
}
}
}
@@ -3658,8 +3658,8 @@ void structureUpdate(STRUCTURE *psBuilding, bool mission)
if (damage > 0.)
{
emissionInterval = CalcStructureSmokeInterval(damage/65536.f);
- unsigned effectTime = std::max(gameTime - deltaGameTime, psBuilding->lastEmission + emissionInterval);
- if (gameTime > effectTime)
+ unsigned effectTime = std::max(gameTime - deltaGameTime + 1, psBuilding->lastEmission + emissionInterval);
+ if (gameTime >= effectTime)
{
widthScatter = getStructureWidth(psBuilding) * TILE_UNITS/2/3;
breadthScatter = getStructureBreadth(psBuilding) * TILE_UNITS/2/3;

No commit comments for this range

Something went wrong with that request. Please try again.