hedgewars/uGearsList.pas
author bovi
Sun, 15 Jan 2012 22:46:36 +0100
changeset 6570 216a5ccadf0e
parent 6543 697e9b730189
child 6580 6155187bf599
permissions -rw-r--r--
provide a minimal Romanian translation for engine
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
     1
(*
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
     3
 * Copyright (c) 2004-2011 Andrey Korotaev <unC0Rr@gmail.com>
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
     4
 *
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
     8
 *
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    12
 * GNU General Public License for more details.
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    13
 *
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    17
 *)
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    18
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    19
{$INCLUDE "options.inc"}
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    20
unit uGearsList;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    21
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    22
interface
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    23
uses uFloat, uTypes;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    24
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    25
function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    26
procedure DeleteGear(Gear: PGear);
6543
697e9b730189 Fix build
unc0rr
parents: 6472
diff changeset
    27
procedure InsertGearToList(Gear: PGear);
697e9b730189 Fix build
unc0rr
parents: 6472
diff changeset
    28
procedure RemoveGearFromList(Gear: PGear);
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    29
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    30
implementation
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    31
6543
697e9b730189 Fix build
unc0rr
parents: 6472
diff changeset
    32
uses uRandom, uUtils, uConsts, uVariables, uAmmos, uTeams, uStats,
697e9b730189 Fix build
unc0rr
parents: 6472
diff changeset
    33
    uTextures, uScript, uRenderUtils, uAI, uCollisions,
697e9b730189 Fix build
unc0rr
parents: 6472
diff changeset
    34
    uGearsRender, uGearsUtils;
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    35
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    36
procedure InsertGearToList(Gear: PGear);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    37
var tmp, ptmp: PGear;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    38
begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    39
    tmp:= GearsList;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    40
    ptmp:= GearsList;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    41
    while (tmp <> nil) and (tmp^.Z <= Gear^.Z) do
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    42
        begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    43
        ptmp:= tmp;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    44
        tmp:= tmp^.NextGear
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    45
        end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    46
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    47
    if ptmp <> tmp then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    48
        begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    49
        Gear^.NextGear:= ptmp^.NextGear;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    50
        Gear^.PrevGear:= ptmp;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    51
        if ptmp^.NextGear <> nil then ptmp^.NextGear^.PrevGear:= Gear;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    52
        ptmp^.NextGear:= Gear
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    53
        end
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    54
    else
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    55
        begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    56
        Gear^.NextGear:= GearsList;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    57
        if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    58
        GearsList:= Gear;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    59
        end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    60
end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    61
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    62
procedure RemoveGearFromList(Gear: PGear);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    63
begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    64
if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear^.PrevGear;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    65
if Gear^.PrevGear <> nil then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    66
    Gear^.PrevGear^.NextGear:= Gear^.NextGear
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    67
else
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    68
    GearsList:= Gear^.NextGear
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    69
end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    70
    
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    71
function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    72
const Counter: Longword = 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    73
var gear: PGear;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    74
begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    75
inc(Counter);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    76
AddFileLog('AddGear: #' + inttostr(Counter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    77
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    78
New(gear);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    79
FillChar(gear^, sizeof(TGear), 0);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    80
gear^.X:= int2hwFloat(X);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    81
gear^.Y:= int2hwFloat(Y);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    82
gear^.Target.X:= NoPointX;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    83
gear^.Kind := Kind;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    84
gear^.State:= State;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    85
gear^.Active:= true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    86
gear^.dX:= dX;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    87
gear^.dY:= dY;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    88
gear^.doStep:= doStepHandlers[Kind];
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    89
gear^.CollisionIndex:= -1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    90
gear^.Timer:= Timer;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    91
gear^.FlightTime:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    92
gear^.uid:= Counter;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    93
gear^.SoundChannel:= -1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    94
gear^.ImpactSound:= sndNone;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    95
gear^.nImpactSounds:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    96
gear^.Density:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    97
// Define ammo association, if any.
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    98
gear^.AmmoType:= GearKindAmmoTypeMap[Kind];
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    99
if Ammoz[Gear^.AmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then gear^.Z:= cHHZ+1
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   100
else gear^.Z:= cUsualZ;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   101
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   102
if CurrentHedgehog <> nil then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   103
    begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   104
    gear^.Hedgehog:= CurrentHedgehog;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   105
    gear^.IntersectGear:= CurrentHedgehog^.Gear
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   106
    end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   107
    
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   108
case Kind of
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   109
     gtGrenade,
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   110
     gtClusterBomb,
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   111
     gtGasBomb: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   112
                gear^.ImpactSound:= sndGrenadeImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   113
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   114
                gear^.AdvBounce:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   115
                gear^.Radius:= 5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   116
                gear^.Elasticity:= _0_8;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   117
                gear^.Friction:= _0_8;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   118
                gear^.Density:= _1_5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   119
                gear^.RenderTimer:= true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   120
                if gear^.Timer = 0 then gear^.Timer:= 3000
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   121
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   122
  gtWatermelon: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   123
                gear^.ImpactSound:= sndMelonImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   124
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   125
                gear^.AdvBounce:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   126
                gear^.Radius:= 6;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   127
                gear^.Elasticity:= _0_8;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   128
                gear^.Friction:= _0_995;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   129
                gear^.Density:= _2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   130
                gear^.RenderTimer:= true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   131
                if gear^.Timer = 0 then gear^.Timer:= 3000
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   132
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   133
  gtMelonPiece: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   134
                gear^.Density:= _2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   135
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   136
    gtHedgehog: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   137
                gear^.AdvBounce:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   138
                gear^.Radius:= cHHRadius;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   139
                gear^.Elasticity:= _0_35;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   140
                gear^.Friction:= _0_999;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   141
                gear^.Angle:= cMaxAngle div 2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   142
                gear^.Density:= _3;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   143
                gear^.Z:= cHHZ;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   144
                if (GameFlags and gfAISurvival) <> 0 then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   145
                    if gear^.Hedgehog^.BotLevel > 0 then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   146
                        gear^.Hedgehog^.Effects[heResurrectable] := true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   147
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   148
       gtShell: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   149
                gear^.Radius:= 4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   150
                gear^.Density:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   151
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   152
       gtSnowball: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   153
                gear^.ImpactSound:= sndMudballImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   154
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   155
                gear^.Radius:= 4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   156
                gear^.Elasticity:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   157
                gear^.Friction:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   158
                gear^.Density:= _0_5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   159
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   160
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   161
     gtFlake: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   162
                with Gear^ do
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   163
                    begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   164
                    Pos:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   165
                    Radius:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   166
                    DirAngle:= random * 360;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   167
                    if State and gstTmpFlag = 0 then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   168
                        begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   169
                        dx.isNegative:= GetRandom(2) = 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   170
                        dx.QWordValue:= GetRandom(100000000);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   171
                        dy.isNegative:= false;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   172
                        dy.QWordValue:= GetRandom(70000000);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   173
                        if GetRandom(2) = 0 then dx := -dx
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   174
                        end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   175
                    State:= State or gstInvisible;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   176
                    Health:= random(vobFrameTicks);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   177
                    Timer:= random(vobFramesCount);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   178
                    Angle:= (random(2) * 2 - 1) * (1 + random(10000)) * vobVelocity
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   179
                    end
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   180
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   181
       gtGrave: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   182
                gear^.ImpactSound:= sndGraveImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   183
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   184
                gear^.Radius:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   185
                gear^.Elasticity:= _0_6;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   186
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   187
         gtBee: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   188
                gear^.Radius:= 5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   189
                gear^.Timer:= 500;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   190
                gear^.RenderTimer:= true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   191
                gear^.Elasticity:= _0_9;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   192
                gear^.Tag:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   193
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   194
   gtSeduction: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   195
                gear^.Radius:= 250;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   196
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   197
 gtShotgunShot: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   198
                gear^.Timer:= 900;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   199
                gear^.Radius:= 2
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   200
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   201
  gtPickHammer: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   202
                gear^.Radius:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   203
                gear^.Timer:= 4000
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   204
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   205
   gtHammerHit: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   206
                gear^.Radius:= 8;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   207
                gear^.Timer:= 125
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   208
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   209
        gtRope: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   210
                gear^.Radius:= 3;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   211
                gear^.Friction:= _450 * _0_01 * cRopePercent;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   212
                RopePoints.Count:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   213
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   214
        gtMine: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   215
                gear^.ImpactSound:= sndMineImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   216
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   217
                gear^.Health:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   218
                gear^.State:= gear^.State or gstMoving;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   219
                gear^.Radius:= 2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   220
                gear^.Elasticity:= _0_55;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   221
                gear^.Friction:= _0_995;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   222
                gear^.Density:= _0_9;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   223
                if cMinesTime < 0 then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   224
                    gear^.Timer:= getrandom(51)*100
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   225
                else
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   226
                    gear^.Timer:= cMinesTime;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   227
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   228
       gtSMine: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   229
                gear^.Health:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   230
                gear^.State:= gear^.State or gstMoving;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   231
                gear^.Radius:= 2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   232
                gear^.Elasticity:= _0_55;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   233
                gear^.Friction:= _0_995;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   234
                gear^.Density:= _0_9;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   235
                gear^.Timer:= 500;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   236
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   237
        gtCase: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   238
                gear^.ImpactSound:= sndGraveImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   239
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   240
                gear^.Radius:= 16;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   241
                gear^.Elasticity:= _0_3
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   242
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   243
  gtExplosives: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   244
                gear^.ImpactSound:= sndGrenadeImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   245
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   246
                gear^.Radius:= 16;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   247
                gear^.Elasticity:= _0_4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   248
                gear^.Friction:= _0_995;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   249
                gear^.Density:= _6;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   250
                gear^.Health:= cBarrelHealth;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   251
                gear^.Z:= cHHZ-1
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   252
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   253
  gtDEagleShot: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   254
                gear^.Radius:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   255
                gear^.Health:= 50
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   256
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   257
  gtSniperRifleShot: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   258
                gear^.Radius:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   259
                gear^.Health:= 50
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   260
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   261
    gtDynamite: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   262
                gear^.Radius:= 3;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   263
                gear^.Elasticity:= _0_55;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   264
                gear^.Friction:= _0_03;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   265
                gear^.Density:= _2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   266
                gear^.Timer:= 5000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   267
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   268
     gtCluster: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   269
                gear^.Radius:= 2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   270
                gear^.Density:= _1_5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   271
                gear^.RenderTimer:= true
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   272
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   273
      gtShover: gear^.Radius:= 20;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   274
       gtFlame: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   275
                gear^.Tag:= GetRandom(32);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   276
                gear^.Radius:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   277
                gear^.Health:= 5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   278
                gear^.Density:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   279
                if (gear^.dY.QWordValue = 0) and (gear^.dX.QWordValue = 0) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   280
                    begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   281
                    gear^.dY:= (getrandom - _0_8) * _0_03;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   282
                    gear^.dX:= (getrandom - _0_5) * _0_4
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   283
                    end
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   284
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   285
   gtFirePunch: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   286
                gear^.Radius:= 15;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   287
                gear^.Tag:= Y
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   288
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   289
     gtAirBomb: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   290
                gear^.Radius:= 5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   291
                gear^.Density:= _2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   292
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   293
   gtBlowTorch: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   294
                gear^.Radius:= cHHRadius + cBlowTorchC;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   295
                gear^.Timer:= 7500
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   296
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   297
    gtSwitcher: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   298
                gear^.Z:= cCurrHHZ
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   299
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   300
      gtTarget: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   301
                gear^.ImpactSound:= sndGrenadeImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   302
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   303
                gear^.Radius:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   304
                gear^.Elasticity:= _0_3;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   305
                gear^.Timer:= 0
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   306
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   307
      gtTardis: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   308
                gear^.Timer:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   309
                gear^.Pos:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   310
                gear^.Z:= cCurrHHZ+1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   311
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   312
      gtMortar: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   313
                gear^.Radius:= 4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   314
                gear^.Elasticity:= _0_2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   315
                gear^.Friction:= _0_08;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   316
                gear^.Density:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   317
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   318
        gtWhip: gear^.Radius:= 20;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   319
      gtHammer: gear^.Radius:= 20;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   320
    gtKamikaze: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   321
                gear^.Health:= 2048;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   322
                gear^.Radius:= 20
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   323
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   324
        gtCake: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   325
                gear^.Health:= 2048;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   326
                gear^.Radius:= 7;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   327
                gear^.Z:= cOnHHZ;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   328
                gear^.RenderTimer:= true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   329
                gear^.DirAngle:= -90 * hwSign(Gear^.dX);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   330
                if not dX.isNegative then gear^.Angle:= 1 else gear^.Angle:= 3
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   331
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   332
 gtHellishBomb: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   333
                gear^.ImpactSound:= sndHellishImpact1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   334
                gear^.nImpactSounds:= 4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   335
                gear^.AdvBounce:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   336
                gear^.Radius:= 4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   337
                gear^.Elasticity:= _0_5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   338
                gear^.Friction:= _0_96;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   339
                gear^.Density:= _1_5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   340
                gear^.RenderTimer:= true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   341
                gear^.Timer:= 5000
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   342
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   343
       gtDrill: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   344
                if gear^.Timer = 0 then gear^.Timer:= 5000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   345
                // Tag for drill strike. if 1 then first impact occured already
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   346
                gear^.Tag := 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   347
                gear^.Radius:= 4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   348
                gear^.Density:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   349
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   350
        gtBall: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   351
                gear^.ImpactSound:= sndGrenadeImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   352
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   353
                gear^.AdvBounce:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   354
                gear^.Radius:= 5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   355
                gear^.Tag:= random(8);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   356
                gear^.Timer:= 5000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   357
                gear^.Elasticity:= _0_7;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   358
                gear^.Friction:= _0_995;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   359
                gear^.Density:= _1_5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   360
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   361
     gtBallgun: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   362
                gear^.Timer:= 5001;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   363
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   364
     gtRCPlane: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   365
                gear^.Timer:= 15000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   366
                gear^.Health:= 3;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   367
                gear^.Radius:= 8
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   368
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   369
     gtJetpack: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   370
                gear^.Health:= 2000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   371
                gear^.Damage:= 100
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   372
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   373
     gtMolotov: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   374
                gear^.Radius:= 6;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   375
                gear^.Density:= _2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   376
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   377
       gtBirdy: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   378
                gear^.Radius:= 16; // todo: check
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   379
                gear^.Timer:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   380
                gear^.Health := 2000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   381
                gear^.FlightTime := 2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   382
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   383
         gtEgg: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   384
                gear^.Radius:= 4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   385
                gear^.Elasticity:= _0_6;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   386
                gear^.Friction:= _0_96;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   387
                gear^.Density:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   388
                if gear^.Timer = 0 then gear^.Timer:= 3000
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   389
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   390
      gtPortal: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   391
                gear^.ImpactSound:= sndMelonImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   392
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   393
                gear^.AdvBounce:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   394
                gear^.Radius:= 17;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   395
                // set color
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   396
                gear^.Tag:= 2 * gear^.Timer;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   397
                gear^.Timer:= 15000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   398
                gear^.RenderTimer:= false;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   399
                gear^.Health:= 100;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   400
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   401
       gtPiano: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   402
                gear^.Radius:= 32;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   403
                gear^.Density:= _50;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   404
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   405
 gtSineGunShot: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   406
                gear^.Radius:= 5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   407
                gear^.Health:= 6000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   408
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   409
gtFlamethrower: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   410
                gear^.Tag:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   411
                gear^.Timer:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   412
                gear^.Health:= 500;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   413
                gear^.Damage:= 100;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   414
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   415
     gtLandGun: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   416
                gear^.Tag:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   417
                gear^.Timer:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   418
                gear^.Health:= 1000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   419
                gear^.Damage:= 100;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   420
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   421
 gtPoisonCloud: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   422
                gear^.Timer:= 5000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   423
                gear^.dY:= int2hwfloat(-4 + longint(getRandom(8))) / 1000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   424
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   425
 gtResurrector: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   426
                gear^.Radius := 100;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   427
                gear^.Tag := 0
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   428
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   429
     gtWaterUp: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   430
                gear^.Tag := 47;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   431
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   432
  gtNapalmBomb: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   433
                gear^.Timer:= 1000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   434
                gear^.Radius:= 5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   435
                gear^.Density:= _1_5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   436
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   437
   gtStructure: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   438
                gear^.Elasticity:= _0_55;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   439
                gear^.Friction:= _0_995;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   440
                gear^.Density:= _0_9;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   441
                gear^.Radius:= 13;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   442
                gear^.Health:= 200;
6472
bced12412f94 present somthing that could be taken as a structure
Henek
parents: 6468
diff changeset
   443
                gear^.Timer:= 0;
bced12412f94 present somthing that could be taken as a structure
Henek
parents: 6468
diff changeset
   444
                gear^.Tag:= TotalRounds + 3;
bced12412f94 present somthing that could be taken as a structure
Henek
parents: 6468
diff changeset
   445
                gear^.Pos:= 1;
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   446
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   447
    end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   448
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   449
InsertGearToList(gear);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   450
AddGear:= gear;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   451
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   452
ScriptCall('onGearAdd', gear^.uid);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   453
end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   454
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   455
procedure DeleteGear(Gear: PGear);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   456
var team: PTeam;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   457
    t,i: Longword;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   458
    k: boolean;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   459
begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   460
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   461
ScriptCall('onGearDelete', gear^.uid);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   462
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   463
DeleteCI(Gear);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   464
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   465
FreeTexture(Gear^.Tex);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   466
Gear^.Tex:= nil;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   467
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   468
// make sure that portals have their link removed before deletion
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   469
if (Gear^.Kind = gtPortal) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   470
    begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   471
    if (Gear^.IntersectGear <> nil) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   472
        if (Gear^.IntersectGear^.IntersectGear = Gear) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   473
            Gear^.IntersectGear^.IntersectGear:= nil;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   474
    end
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   475
else if Gear^.Kind = gtHedgehog then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   476
    (*
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   477
    This behaviour dates back to revision 4, and I accidentally encountered it with TARDIS.  I don't think it must apply to any modern weapon, since if it was actually hit, the best the gear could do would be to destroy itself immediately, and you'd still end up with two graves.  I believe it should be removed
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   478
     if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   479
        begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   480
        AttackBar:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   481
        Gear^.Message:= gmDestroy;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   482
        CurAmmoGear^.Message:= gmDestroy;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   483
        exit
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   484
        end
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   485
    else*)
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   486
        begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   487
        if (hwRound(Gear^.Y) >= cWaterLine) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   488
            begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   489
            t:= max(Gear^.Damage, Gear^.Health);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   490
            Gear^.Damage:= t;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   491
            if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cWaterOpacity < $FF))) and (hwRound(Gear^.Y) < cWaterLine + 256) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   492
                spawnHealthTagForHH(Gear, t);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   493
            end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   494
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   495
        team:= Gear^.Hedgehog^.Team;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   496
        if CurrentHedgehog^.Gear = Gear then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   497
            begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   498
            AttackBar:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   499
            FreeActionsList; // to avoid ThinkThread on drawned gear
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   500
            if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (CurrentHedgehog^.MultiShootAttacks > 0) then OnUsedAmmo(CurrentHedgehog^);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   501
            end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   502
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   503
        Gear^.Hedgehog^.Gear:= nil;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   504
        if Gear^.Hedgehog^.King then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   505
            begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   506
            // are there any other kings left? Just doing nil check.  Presumably a mortally wounded king will get reaped soon enough
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   507
            k:= false;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   508
            for i:= 0 to Pred(team^.Clan^.TeamsNumber) do
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   509
                if (team^.Clan^.Teams[i]^.Hedgehogs[0].Gear <> nil) then k:= true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   510
            if not k then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   511
                for i:= 0 to Pred(team^.Clan^.TeamsNumber) do
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   512
                    begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   513
                    team^.Clan^.Teams[i]^.hasGone:= true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   514
                    TeamGoneEffect(team^.Clan^.Teams[i]^)
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   515
                    end
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   516
            end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   517
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   518
        // should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   519
        // same stand for CheckHHDamage
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   520
        if (Gear^.LastDamage <> nil) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   521
            uStats.HedgehogDamaged(Gear, Gear^.LastDamage, 0, true)
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   522
        else
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   523
            uStats.HedgehogDamaged(Gear, CurrentHedgehog, 0, true);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   524
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   525
        inc(KilledHHs);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   526
        RecountTeamHealth(team);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   527
        if (CurrentHedgehog <> nil) and CurrentHedgehog^.Effects[heResurrectable] and (not Gear^.Hedgehog^.Effects[heResurrectable]) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   528
            with CurrentHedgehog^ do 
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   529
                begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   530
                inc(Team^.stats.AIKills);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   531
                FreeTexture(Team^.AIKillsTex);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   532
                Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   533
                end
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   534
        end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   535
with Gear^ do
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   536
    AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   537
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   538
if CurAmmoGear = Gear then CurAmmoGear:= nil;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   539
if FollowGear = Gear then FollowGear:= nil;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   540
if lastGearByUID = Gear then lastGearByUID := nil;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   541
RemoveGearFromList(Gear);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   542
Dispose(Gear)
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   543
end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   544
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   545
end.