DEADSOFTWARE

Cosmetic: Replace "goal" with "score" everywhere in game code
[d2df-sdl.git] / src / game / g_triggers.pas
index 3cfca16904004997968584ee954eefc307e92c79..2509650d413b5ccc9af45f390ad91339bd4a30ad 100644 (file)
@@ -725,37 +725,37 @@ begin
 
     TRIGGER_SHOT_IMP:
       begin
-        g_Weapon_ball1(wx, wy, dx, dy, 0, -1, True);
+        g_Weapon_ball1(wx, wy, dx, dy, 0, -1, True, False);
         snd := 'SOUND_WEAPON_FIREBALL';
       end;
 
     TRIGGER_SHOT_PLASMA:
       begin
-        g_Weapon_Plasma(wx, wy, dx, dy, 0, -1, True);
+        g_Weapon_Plasma(wx, wy, dx, dy, 0, -1, True, False);
         snd := 'SOUND_WEAPON_FIREPLASMA';
       end;
 
     TRIGGER_SHOT_SPIDER:
       begin
-        g_Weapon_aplasma(wx, wy, dx, dy, 0, -1, True);
+        g_Weapon_aplasma(wx, wy, dx, dy, 0, -1, True, False);
         snd := 'SOUND_WEAPON_FIREPLASMA';
       end;
 
     TRIGGER_SHOT_CACO:
       begin
-        g_Weapon_ball2(wx, wy, dx, dy, 0, -1, True);
+        g_Weapon_ball2(wx, wy, dx, dy, 0, -1, True, False);
         snd := 'SOUND_WEAPON_FIREBALL';
       end;
 
     TRIGGER_SHOT_BARON:
       begin
-        g_Weapon_ball7(wx, wy, dx, dy, 0, -1, True);
+        g_Weapon_ball7(wx, wy, dx, dy, 0, -1, True, False);
         snd := 'SOUND_WEAPON_FIREBALL';
       end;
 
     TRIGGER_SHOT_MANCUB:
       begin
-        g_Weapon_manfire(wx, wy, dx, dy, 0, -1, True);
+        g_Weapon_manfire(wx, wy, dx, dy, 0, -1, True, False);
         snd := 'SOUND_WEAPON_FIREBALL';
       end;
 
@@ -767,13 +767,13 @@ begin
 
     TRIGGER_SHOT_ROCKET:
       begin
-        g_Weapon_Rocket(wx, wy, dx, dy, 0, -1, True);
+        g_Weapon_Rocket(wx, wy, dx, dy, 0, -1, True, False);
         snd := 'SOUND_WEAPON_FIREROCKET';
       end;
 
     TRIGGER_SHOT_BFG:
       begin
-        g_Weapon_BFGShot(wx, wy, dx, dy, 0, -1, True);
+        g_Weapon_BFGShot(wx, wy, dx, dy, 0, -1, True, False);
         snd := 'SOUND_WEAPON_FIREBFG';
       end;
 
@@ -807,7 +807,7 @@ begin
 
     TRIGGER_SHOT_FLAME:
       begin
-        g_Weapon_flame(wx, wy, dx, dy, 0, -1, True);
+        g_Weapon_flame(wx, wy, dx, dy, 0, -1, True, False);
         snd := 'SOUND_GAME_BURNING';
       end;
 
@@ -884,7 +884,13 @@ begin
       TRIGGER_EFFECT_DLIQUID: g_GFX_SimpleWater(X, Y, 1, VX, VY, 5, CR, CG, CB);
       TRIGGER_EFFECT_BLOOD: g_GFX_Blood(X, Y, 1, VX, VY, 0, 0, CR, CG, CB);
       TRIGGER_EFFECT_SPARK: g_GFX_Spark(X, Y, 1, GetAngle2(VX, VY), 0, 0);
-      TRIGGER_EFFECT_BUBBLE: g_GFX_Bubbles(X, Y, 1, 0, 0);
+      TRIGGER_EFFECT_BUBBLE:
+      begin
+        g_GFX_Bubbles(X, Y, 1, 0, 0);
+        if not Silent then if Random(2) = 0
+          then g_Sound_PlayExAt('SOUND_GAME_BUBBLE1', X, Y)
+          else g_Sound_PlayExAt('SOUND_GAME_BUBBLE2', X, Y);
+      end;
     end;
   end;
 
@@ -1224,7 +1230,7 @@ begin
 
   if not Trigger.Enabled then exit;
   if (Trigger.TimeOut <> 0) and (actType <> ACTIVATE_CUSTOM) then exit;
-  if (gLMSRespawn = LMS_RESPAWN_WARMUP) then exit;
+  if (gLMSRespawn > LMS_RESPAWN_NONE) then exit;
 
   if (Trigger.exoCheck <> nil) then
   begin
@@ -1349,17 +1355,13 @@ begin
         begin
           Enabled := False;
           Result := True;
-          if gLMSRespawn = LMS_RESPAWN_NONE then
+          p := g_Player_Get(ActivateUID);
+          p.GetSecret();
+          Inc(gCoopSecretsFound);
+          if g_Game_IsNet then
           begin
-            p := g_Player_Get(ActivateUID);
-            p.GetSecret();
-            Inc(gCoopSecretsFound);
-            if g_Game_IsNet then
-            begin
-              MH_SEND_GameStats();
-              if p.FClientID >= 0 then
-                MH_SEND_GameEvent(NET_EV_SECRET, p.UID, '');
-            end;
+            MH_SEND_GameStats();
+            MH_SEND_GameEvent(NET_EV_SECRET, p.UID, '');
           end;
         end;
 
@@ -1709,7 +1711,7 @@ begin
               if ((tgcScoreAction = TRIGGER_SCORE_ACTION_ADD) and (tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_RED) and (p.Team = TEAM_RED))
               or ((tgcScoreAction = TRIGGER_SCORE_ACTION_ADD) and (tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_BLUE) and (p.Team = TEAM_BLUE)) then
               begin
-                Inc(gTeamStat[TEAM_RED].Goals, tgcScoreCount); // Red Scores
+                Inc(gTeamStat[TEAM_RED].Score, tgcScoreCount); // Red Scores
 
                 if tgcScoreCon then
                 begin
@@ -1736,7 +1738,7 @@ begin
               if ((tgcScoreAction = TRIGGER_SCORE_ACTION_SUB) and (tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_RED) and (p.Team = TEAM_RED))
               or ((tgcScoreAction = TRIGGER_SCORE_ACTION_SUB) and (tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_BLUE) and (p.Team = TEAM_BLUE)) then
               begin
-                Dec(gTeamStat[TEAM_RED].Goals, tgcScoreCount); // Red Fouls
+                Dec(gTeamStat[TEAM_RED].Score, tgcScoreCount); // Red Fouls
 
                 if tgcScoreCon then
                 begin
@@ -1763,7 +1765,7 @@ begin
               if ((tgcScoreAction = TRIGGER_SCORE_ACTION_ADD) and (tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_RED) and (p.Team = TEAM_BLUE))
               or ((tgcScoreAction = TRIGGER_SCORE_ACTION_ADD) and (tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_BLUE) and (p.Team = TEAM_RED)) then
               begin
-                Inc(gTeamStat[TEAM_BLUE].Goals, tgcScoreCount); // Blue Scores
+                Inc(gTeamStat[TEAM_BLUE].Score, tgcScoreCount); // Blue Scores
 
                 if tgcScoreCon then
                 begin
@@ -1790,7 +1792,7 @@ begin
               if ((tgcScoreAction = TRIGGER_SCORE_ACTION_SUB) and (tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_RED) and (p.Team = TEAM_BLUE))
               or ((tgcScoreAction = TRIGGER_SCORE_ACTION_SUB) and (tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_BLUE) and (p.Team = TEAM_RED)) then
               begin
-                Dec(gTeamStat[TEAM_BLUE].Goals, tgcScoreCount); // Blue Fouls
+                Dec(gTeamStat[TEAM_BLUE].Score, tgcScoreCount); // Blue Fouls
 
                 if tgcScoreCon then
                 begin
@@ -1821,7 +1823,7 @@ begin
             begin
               if (tgcScoreAction = TRIGGER_SCORE_ACTION_ADD) and (tgcScoreTeam = TRIGGER_SCORE_TEAM_FORCE_RED) then
               begin
-                Inc(gTeamStat[TEAM_RED].Goals, tgcScoreCount); // Red Scores
+                Inc(gTeamStat[TEAM_RED].Score, tgcScoreCount); // Red Scores
 
                 if tgcScoreCon then
                 begin
@@ -1839,7 +1841,7 @@ begin
               end;
               if (tgcScoreAction = TRIGGER_SCORE_ACTION_SUB) and (tgcScoreTeam = TRIGGER_SCORE_TEAM_FORCE_RED) then
               begin
-                Dec(gTeamStat[TEAM_RED].Goals, tgcScoreCount); // Red Fouls
+                Dec(gTeamStat[TEAM_RED].Score, tgcScoreCount); // Red Fouls
 
                 if tgcScoreCon then
                 begin
@@ -1857,7 +1859,7 @@ begin
               end;
               if (tgcScoreAction = TRIGGER_SCORE_ACTION_ADD) and (tgcScoreTeam = TRIGGER_SCORE_TEAM_FORCE_BLUE) then
               begin
-                Inc(gTeamStat[TEAM_BLUE].Goals, tgcScoreCount); // Blue Scores
+                Inc(gTeamStat[TEAM_BLUE].Score, tgcScoreCount); // Blue Scores
 
                 if tgcScoreCon then
                 begin
@@ -1875,7 +1877,7 @@ begin
               end;
               if (tgcScoreAction = TRIGGER_SCORE_ACTION_SUB) and (tgcScoreTeam = TRIGGER_SCORE_TEAM_FORCE_BLUE) then
               begin
-                Dec(gTeamStat[TEAM_BLUE].Goals, tgcScoreCount); // Blue Fouls
+                Dec(gTeamStat[TEAM_BLUE].Score, tgcScoreCount); // Blue Fouls
 
                 if tgcScoreCon then
                 begin
@@ -1895,7 +1897,7 @@ begin
             end;
           end;
           // Âûèãðûø
-          if (tgcScoreAction = TRIGGER_SCORE_ACTION_WIN) and (gGameSettings.GoalLimit > 0) then
+          if (tgcScoreAction = TRIGGER_SCORE_ACTION_WIN) and (gGameSettings.ScoreLimit > 0) then
           begin
             // Ñâîåé èëè ÷óæîé êîìàíäû
             if (tgcScoreTeam in [TRIGGER_SCORE_TEAM_MINE_RED, TRIGGER_SCORE_TEAM_MINE_BLUE]) and (g_GetUIDType(ActivateUID) = UID_PLAYER) then
@@ -1904,9 +1906,9 @@ begin
               if ((tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_RED) and (p.Team = TEAM_RED)) // Red Wins
               or ((tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_BLUE) and (p.Team = TEAM_BLUE)) then
               begin
-                if gTeamStat[TEAM_RED].Goals < SmallInt(gGameSettings.GoalLimit) then
+                if gTeamStat[TEAM_RED].Score < SmallInt(gGameSettings.ScoreLimit) then
                 begin
-                  gTeamStat[TEAM_RED].Goals := gGameSettings.GoalLimit;
+                  gTeamStat[TEAM_RED].Score := gGameSettings.ScoreLimit;
 
                   if tgcScoreCon then
                   begin
@@ -1929,9 +1931,9 @@ begin
               if ((tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_RED) and (p.Team = TEAM_BLUE)) // Blue Wins
               or ((tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_BLUE) and (p.Team = TEAM_RED)) then
               begin
-                if gTeamStat[TEAM_BLUE].Goals < SmallInt(gGameSettings.GoalLimit) then
+                if gTeamStat[TEAM_BLUE].Score < SmallInt(gGameSettings.ScoreLimit) then
                 begin
-                  gTeamStat[TEAM_BLUE].Goals := gGameSettings.GoalLimit;
+                  gTeamStat[TEAM_BLUE].Score := gGameSettings.ScoreLimit;
 
                   if tgcScoreCon then
                   begin
@@ -1957,24 +1959,24 @@ begin
             begin
               if (tgcScoreTeam = TRIGGER_SCORE_TEAM_FORCE_RED) then // Red Wins
               begin
-                if gTeamStat[TEAM_RED].Goals < SmallInt(gGameSettings.GoalLimit) then
+                if gTeamStat[TEAM_RED].Score < SmallInt(gGameSettings.ScoreLimit) then
                 begin
-                  gTeamStat[TEAM_RED].Goals := gGameSettings.GoalLimit;
+                  gTeamStat[TEAM_RED].Score := gGameSettings.ScoreLimit;
                   Result := True;
                 end;
               end;
               if (tgcScoreTeam = TRIGGER_SCORE_TEAM_FORCE_BLUE) then // Blue Wins
               begin
-                if gTeamStat[TEAM_BLUE].Goals < SmallInt(gGameSettings.GoalLimit) then
+                if gTeamStat[TEAM_BLUE].Score < SmallInt(gGameSettings.ScoreLimit) then
                 begin
-                  gTeamStat[TEAM_BLUE].Goals := gGameSettings.GoalLimit;
+                  gTeamStat[TEAM_BLUE].Score := gGameSettings.ScoreLimit;
                   Result := True;
                 end;
               end;
             end;
           end;
           // Ïðîèãðûø
-          if (tgcScoreAction = TRIGGER_SCORE_ACTION_LOOSE) and (gGameSettings.GoalLimit > 0) then
+          if (tgcScoreAction = TRIGGER_SCORE_ACTION_LOOSE) and (gGameSettings.ScoreLimit > 0) then
           begin
             // Ñâîåé èëè ÷óæîé êîìàíäû
             if (tgcScoreTeam in [TRIGGER_SCORE_TEAM_MINE_RED, TRIGGER_SCORE_TEAM_MINE_BLUE]) and (g_GetUIDType(ActivateUID) = UID_PLAYER) then
@@ -1982,9 +1984,9 @@ begin
               p := g_Player_Get(ActivateUID);
               if ((tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_RED) and (p.Team = TEAM_BLUE)) // Red Wins
               or ((tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_BLUE) and (p.Team = TEAM_RED)) then
-                if gTeamStat[TEAM_RED].Goals < SmallInt(gGameSettings.GoalLimit) then
+                if gTeamStat[TEAM_RED].Score < SmallInt(gGameSettings.ScoreLimit) then
                 begin
-                  gTeamStat[TEAM_RED].Goals := gGameSettings.GoalLimit;
+                  gTeamStat[TEAM_RED].Score := gGameSettings.ScoreLimit;
 
                   if tgcScoreCon then
                     if tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_RED then
@@ -2003,9 +2005,9 @@ begin
                 end;
               if ((tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_RED) and (p.Team = TEAM_RED)) // Blue Wins
               or ((tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_BLUE) and (p.Team = TEAM_BLUE)) then
-                if gTeamStat[TEAM_BLUE].Goals < SmallInt(gGameSettings.GoalLimit) then
+                if gTeamStat[TEAM_BLUE].Score < SmallInt(gGameSettings.ScoreLimit) then
                 begin
-                  gTeamStat[TEAM_BLUE].Goals := gGameSettings.GoalLimit;
+                  gTeamStat[TEAM_BLUE].Score := gGameSettings.ScoreLimit;
 
                   if tgcScoreCon then
                     if tgcScoreTeam = TRIGGER_SCORE_TEAM_MINE_RED then
@@ -2028,17 +2030,17 @@ begin
             begin
               if (tgcScoreTeam = TRIGGER_SCORE_TEAM_FORCE_BLUE) then // Red Wins
               begin
-                if gTeamStat[TEAM_RED].Goals < SmallInt(gGameSettings.GoalLimit) then
+                if gTeamStat[TEAM_RED].Score < SmallInt(gGameSettings.ScoreLimit) then
                 begin
-                  gTeamStat[TEAM_RED].Goals := gGameSettings.GoalLimit;
+                  gTeamStat[TEAM_RED].Score := gGameSettings.ScoreLimit;
                   Result := True;
                 end;
               end;
               if (tgcScoreTeam = TRIGGER_SCORE_TEAM_FORCE_RED) then // Blue Wins
               begin
-                if gTeamStat[TEAM_BLUE].Goals < SmallInt(gGameSettings.GoalLimit) then
+                if gTeamStat[TEAM_BLUE].Score < SmallInt(gGameSettings.ScoreLimit) then
                 begin
-                  gTeamStat[TEAM_BLUE].Goals := gGameSettings.GoalLimit;
+                  gTeamStat[TEAM_BLUE].Score := gGameSettings.ScoreLimit;
                   Result := True;
                 end;
               end;
@@ -2599,8 +2601,9 @@ var
 begin
   if (tgMonsList = nil) then tgMonsList := TSimpleMonsterList.Create();
 
-  if gTriggers = nil then
-    Exit;
+  if gTriggers = nil then Exit;
+  if gLMSRespawn > LMS_RESPAWN_NONE then Exit; // don't update triggers at all
+
   SetLength(Affected, 0);
 
   for a := 0 to High(gTriggers) do