hedgewars/uGearsList.pas
author lovelacer
Tue, 17 Jan 2012 09:01:31 -0500
changeset 6580 6155187bf599
parent 6543 697e9b730189
child 6581 e510d1245bd7
permissions -rw-r--r--
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent. Some switch statements (uVisualGears.pas) are not lined up on the : so the internal code blocks are not aligned (lined up on the start of the label instead). Some function contents are indented against begin/end of function, some are not, some function begin/end are themselves indented (adler32). Also inconsistency in things like assigning of variables (whitespace before :=) and use of brackets in tests. Probably needs further review for possible code errors.
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;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
    51
        if ptmp^.NextGear <> nil then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
    52
            ptmp^.NextGear^.PrevGear:= Gear;
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    53
        ptmp^.NextGear:= Gear
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    54
        end
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    55
    else
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    56
        begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    57
        Gear^.NextGear:= GearsList;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
    58
        if Gear^.NextGear <> nil then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
    59
            Gear^.NextGear^.PrevGear:= Gear;
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    60
        GearsList:= Gear;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    61
        end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    62
end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    63
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    64
procedure RemoveGearFromList(Gear: PGear);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    65
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
    66
if Gear^.NextGear <> nil then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
    67
    Gear^.NextGear^.PrevGear:= Gear^.PrevGear;
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    68
if Gear^.PrevGear <> nil then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    69
    Gear^.PrevGear^.NextGear:= Gear^.NextGear
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    70
else
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    71
    GearsList:= Gear^.NextGear
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    72
end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    73
    
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    74
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
    75
const Counter: Longword = 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    76
var gear: PGear;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    77
begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    78
inc(Counter);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    79
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
    80
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    81
New(gear);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    82
FillChar(gear^, sizeof(TGear), 0);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    83
gear^.X:= int2hwFloat(X);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    84
gear^.Y:= int2hwFloat(Y);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    85
gear^.Target.X:= NoPointX;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    86
gear^.Kind := Kind;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    87
gear^.State:= State;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    88
gear^.Active:= true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    89
gear^.dX:= dX;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    90
gear^.dY:= dY;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    91
gear^.doStep:= doStepHandlers[Kind];
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    92
gear^.CollisionIndex:= -1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    93
gear^.Timer:= Timer;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    94
gear^.FlightTime:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    95
gear^.uid:= Counter;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    96
gear^.SoundChannel:= -1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    97
gear^.ImpactSound:= sndNone;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    98
gear^.nImpactSounds:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
    99
gear^.Density:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   100
// Define ammo association, if any.
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   101
gear^.AmmoType:= GearKindAmmoTypeMap[Kind];
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   102
if Ammoz[Gear^.AmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   103
    gear^.Z:= cHHZ+1
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   104
else gear^.Z:= cUsualZ;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   105
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   106
if CurrentHedgehog <> nil then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   107
    begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   108
    gear^.Hedgehog:= CurrentHedgehog;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   109
    gear^.IntersectGear:= CurrentHedgehog^.Gear
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   110
    end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   111
    
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   112
case Kind of
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   113
     gtGrenade,
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   114
     gtClusterBomb,
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   115
     gtGasBomb: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   116
                gear^.ImpactSound:= sndGrenadeImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   117
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   118
                gear^.AdvBounce:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   119
                gear^.Radius:= 5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   120
                gear^.Elasticity:= _0_8;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   121
                gear^.Friction:= _0_8;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   122
                gear^.Density:= _1_5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   123
                gear^.RenderTimer:= true;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   124
                if gear^.Timer = 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   125
                    gear^.Timer:= 3000
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   126
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   127
  gtWatermelon: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   128
                gear^.ImpactSound:= sndMelonImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   129
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   130
                gear^.AdvBounce:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   131
                gear^.Radius:= 6;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   132
                gear^.Elasticity:= _0_8;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   133
                gear^.Friction:= _0_995;
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
                gear^.RenderTimer:= true;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   136
                if gear^.Timer = 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   137
                    gear^.Timer:= 3000
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   138
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   139
  gtMelonPiece: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   140
                gear^.Density:= _2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   141
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   142
    gtHedgehog: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   143
                gear^.AdvBounce:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   144
                gear^.Radius:= cHHRadius;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   145
                gear^.Elasticity:= _0_35;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   146
                gear^.Friction:= _0_999;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   147
                gear^.Angle:= cMaxAngle div 2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   148
                gear^.Density:= _3;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   149
                gear^.Z:= cHHZ;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   150
                if (GameFlags and gfAISurvival) <> 0 then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   151
                    if gear^.Hedgehog^.BotLevel > 0 then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   152
                        gear^.Hedgehog^.Effects[heResurrectable] := true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   153
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   154
       gtShell: begin
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^.Density:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   157
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   158
       gtSnowball: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   159
                gear^.ImpactSound:= sndMudballImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   160
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   161
                gear^.Radius:= 4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   162
                gear^.Elasticity:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   163
                gear^.Friction:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   164
                gear^.Density:= _0_5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   165
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   166
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   167
     gtFlake: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   168
                with Gear^ do
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   169
                    begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   170
                    Pos:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   171
                    Radius:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   172
                    DirAngle:= random * 360;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   173
                    if State and gstTmpFlag = 0 then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   174
                        begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   175
                        dx.isNegative:= GetRandom(2) = 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   176
                        dx.QWordValue:= GetRandom(100000000);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   177
                        dy.isNegative:= false;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   178
                        dy.QWordValue:= GetRandom(70000000);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   179
                        if GetRandom(2) = 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   180
                            dx := -dx
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   181
                        end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   182
                    State:= State or gstInvisible;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   183
                    Health:= random(vobFrameTicks);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   184
                    Timer:= random(vobFramesCount);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   185
                    Angle:= (random(2) * 2 - 1) * (1 + random(10000)) * vobVelocity
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   186
                    end
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   187
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   188
       gtGrave: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   189
                gear^.ImpactSound:= sndGraveImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   190
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   191
                gear^.Radius:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   192
                gear^.Elasticity:= _0_6;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   193
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   194
         gtBee: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   195
                gear^.Radius:= 5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   196
                gear^.Timer:= 500;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   197
                gear^.RenderTimer:= true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   198
                gear^.Elasticity:= _0_9;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   199
                gear^.Tag:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   200
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   201
   gtSeduction: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   202
                gear^.Radius:= 250;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   203
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   204
 gtShotgunShot: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   205
                gear^.Timer:= 900;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   206
                gear^.Radius:= 2
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   207
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   208
  gtPickHammer: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   209
                gear^.Radius:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   210
                gear^.Timer:= 4000
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   211
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   212
   gtHammerHit: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   213
                gear^.Radius:= 8;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   214
                gear^.Timer:= 125
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   215
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   216
        gtRope: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   217
                gear^.Radius:= 3;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   218
                gear^.Friction:= _450 * _0_01 * cRopePercent;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   219
                RopePoints.Count:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   220
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   221
        gtMine: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   222
                gear^.ImpactSound:= sndMineImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   223
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   224
                gear^.Health:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   225
                gear^.State:= gear^.State or gstMoving;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   226
                gear^.Radius:= 2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   227
                gear^.Elasticity:= _0_55;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   228
                gear^.Friction:= _0_995;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   229
                gear^.Density:= _0_9;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   230
                if cMinesTime < 0 then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   231
                    gear^.Timer:= getrandom(51)*100
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   232
                else
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   233
                    gear^.Timer:= cMinesTime;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   234
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   235
       gtSMine: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   236
                gear^.Health:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   237
                gear^.State:= gear^.State or gstMoving;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   238
                gear^.Radius:= 2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   239
                gear^.Elasticity:= _0_55;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   240
                gear^.Friction:= _0_995;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   241
                gear^.Density:= _0_9;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   242
                gear^.Timer:= 500;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   243
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   244
        gtCase: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   245
                gear^.ImpactSound:= sndGraveImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   246
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   247
                gear^.Radius:= 16;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   248
                gear^.Elasticity:= _0_3
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   249
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   250
  gtExplosives: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   251
                gear^.ImpactSound:= sndGrenadeImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   252
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   253
                gear^.Radius:= 16;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   254
                gear^.Elasticity:= _0_4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   255
                gear^.Friction:= _0_995;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   256
                gear^.Density:= _6;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   257
                gear^.Health:= cBarrelHealth;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   258
                gear^.Z:= cHHZ-1
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   259
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   260
  gtDEagleShot: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   261
                gear^.Radius:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   262
                gear^.Health:= 50
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   263
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   264
  gtSniperRifleShot: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   265
                gear^.Radius:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   266
                gear^.Health:= 50
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   267
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   268
    gtDynamite: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   269
                gear^.Radius:= 3;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   270
                gear^.Elasticity:= _0_55;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   271
                gear^.Friction:= _0_03;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   272
                gear^.Density:= _2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   273
                gear^.Timer:= 5000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   274
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   275
     gtCluster: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   276
                gear^.Radius:= 2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   277
                gear^.Density:= _1_5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   278
                gear^.RenderTimer:= true
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   279
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   280
      gtShover: gear^.Radius:= 20;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   281
       gtFlame: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   282
                gear^.Tag:= GetRandom(32);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   283
                gear^.Radius:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   284
                gear^.Health:= 5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   285
                gear^.Density:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   286
                if (gear^.dY.QWordValue = 0) and (gear^.dX.QWordValue = 0) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   287
                    begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   288
                    gear^.dY:= (getrandom - _0_8) * _0_03;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   289
                    gear^.dX:= (getrandom - _0_5) * _0_4
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   290
                    end
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   291
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   292
   gtFirePunch: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   293
                gear^.Radius:= 15;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   294
                gear^.Tag:= Y
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   295
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   296
     gtAirBomb: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   297
                gear^.Radius:= 5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   298
                gear^.Density:= _2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   299
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   300
   gtBlowTorch: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   301
                gear^.Radius:= cHHRadius + cBlowTorchC;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   302
                gear^.Timer:= 7500
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   303
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   304
    gtSwitcher: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   305
                gear^.Z:= cCurrHHZ
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   306
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   307
      gtTarget: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   308
                gear^.ImpactSound:= sndGrenadeImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   309
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   310
                gear^.Radius:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   311
                gear^.Elasticity:= _0_3;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   312
                gear^.Timer:= 0
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   313
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   314
      gtTardis: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   315
                gear^.Timer:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   316
                gear^.Pos:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   317
                gear^.Z:= cCurrHHZ+1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   318
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   319
      gtMortar: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   320
                gear^.Radius:= 4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   321
                gear^.Elasticity:= _0_2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   322
                gear^.Friction:= _0_08;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   323
                gear^.Density:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   324
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   325
        gtWhip: gear^.Radius:= 20;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   326
      gtHammer: gear^.Radius:= 20;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   327
    gtKamikaze: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   328
                gear^.Health:= 2048;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   329
                gear^.Radius:= 20
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   330
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   331
        gtCake: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   332
                gear^.Health:= 2048;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   333
                gear^.Radius:= 7;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   334
                gear^.Z:= cOnHHZ;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   335
                gear^.RenderTimer:= true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   336
                gear^.DirAngle:= -90 * hwSign(Gear^.dX);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   337
                if not dX.isNegative then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   338
                    gear^.Angle:= 1
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   339
                else
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   340
                    gear^.Angle:= 3
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   341
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   342
 gtHellishBomb: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   343
                gear^.ImpactSound:= sndHellishImpact1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   344
                gear^.nImpactSounds:= 4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   345
                gear^.AdvBounce:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   346
                gear^.Radius:= 4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   347
                gear^.Elasticity:= _0_5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   348
                gear^.Friction:= _0_96;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   349
                gear^.Density:= _1_5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   350
                gear^.RenderTimer:= true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   351
                gear^.Timer:= 5000
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   352
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   353
       gtDrill: begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   354
                if gear^.Timer = 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   355
                    gear^.Timer:= 5000;
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   356
                // Tag for drill strike. if 1 then first impact occured already
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   357
                gear^.Tag := 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   358
                gear^.Radius:= 4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   359
                gear^.Density:= _1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   360
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   361
        gtBall: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   362
                gear^.ImpactSound:= sndGrenadeImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   363
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   364
                gear^.AdvBounce:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   365
                gear^.Radius:= 5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   366
                gear^.Tag:= random(8);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   367
                gear^.Timer:= 5000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   368
                gear^.Elasticity:= _0_7;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   369
                gear^.Friction:= _0_995;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   370
                gear^.Density:= _1_5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   371
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   372
     gtBallgun: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   373
                gear^.Timer:= 5001;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   374
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   375
     gtRCPlane: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   376
                gear^.Timer:= 15000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   377
                gear^.Health:= 3;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   378
                gear^.Radius:= 8
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   379
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   380
     gtJetpack: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   381
                gear^.Health:= 2000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   382
                gear^.Damage:= 100
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   383
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   384
     gtMolotov: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   385
                gear^.Radius:= 6;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   386
                gear^.Density:= _2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   387
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   388
       gtBirdy: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   389
                gear^.Radius:= 16; // todo: check
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   390
                gear^.Timer:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   391
                gear^.Health := 2000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   392
                gear^.FlightTime := 2;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   393
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   394
         gtEgg: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   395
                gear^.Radius:= 4;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   396
                gear^.Elasticity:= _0_6;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   397
                gear^.Friction:= _0_96;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   398
                gear^.Density:= _1;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   399
                if gear^.Timer = 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   400
                    gear^.Timer:= 3000
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   401
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   402
      gtPortal: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   403
                gear^.ImpactSound:= sndMelonImpact;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   404
                gear^.nImpactSounds:= 1;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   405
                gear^.AdvBounce:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   406
                gear^.Radius:= 17;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   407
                // set color
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   408
                gear^.Tag:= 2 * gear^.Timer;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   409
                gear^.Timer:= 15000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   410
                gear^.RenderTimer:= false;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   411
                gear^.Health:= 100;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   412
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   413
       gtPiano: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   414
                gear^.Radius:= 32;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   415
                gear^.Density:= _50;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   416
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   417
 gtSineGunShot: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   418
                gear^.Radius:= 5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   419
                gear^.Health:= 6000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   420
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   421
gtFlamethrower: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   422
                gear^.Tag:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   423
                gear^.Timer:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   424
                gear^.Health:= 500;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   425
                gear^.Damage:= 100;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   426
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   427
     gtLandGun: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   428
                gear^.Tag:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   429
                gear^.Timer:= 10;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   430
                gear^.Health:= 1000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   431
                gear^.Damage:= 100;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   432
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   433
 gtPoisonCloud: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   434
                gear^.Timer:= 5000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   435
                gear^.dY:= int2hwfloat(-4 + longint(getRandom(8))) / 1000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   436
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   437
 gtResurrector: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   438
                gear^.Radius := 100;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   439
                gear^.Tag := 0
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   440
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   441
     gtWaterUp: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   442
                gear^.Tag := 47;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   443
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   444
  gtNapalmBomb: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   445
                gear^.Timer:= 1000;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   446
                gear^.Radius:= 5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   447
                gear^.Density:= _1_5;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   448
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   449
   gtStructure: begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   450
                gear^.Elasticity:= _0_55;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   451
                gear^.Friction:= _0_995;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   452
                gear^.Density:= _0_9;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   453
                gear^.Radius:= 13;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   454
                gear^.Health:= 200;
6472
bced12412f94 present somthing that could be taken as a structure
Henek
parents: 6468
diff changeset
   455
                gear^.Timer:= 0;
bced12412f94 present somthing that could be taken as a structure
Henek
parents: 6468
diff changeset
   456
                gear^.Tag:= TotalRounds + 3;
bced12412f94 present somthing that could be taken as a structure
Henek
parents: 6468
diff changeset
   457
                gear^.Pos:= 1;
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   458
                end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   459
    end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   460
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   461
InsertGearToList(gear);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   462
AddGear:= gear;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   463
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   464
ScriptCall('onGearAdd', gear^.uid);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   465
end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   466
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   467
procedure DeleteGear(Gear: PGear);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   468
var team: PTeam;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   469
    t,i: Longword;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   470
    k: boolean;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   471
begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   472
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   473
ScriptCall('onGearDelete', gear^.uid);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   474
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   475
DeleteCI(Gear);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   476
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   477
FreeTexture(Gear^.Tex);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   478
Gear^.Tex:= nil;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   479
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   480
// make sure that portals have their link removed before deletion
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   481
if (Gear^.Kind = gtPortal) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   482
    begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   483
    if (Gear^.IntersectGear <> nil) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   484
        if (Gear^.IntersectGear^.IntersectGear = Gear) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   485
            Gear^.IntersectGear^.IntersectGear:= nil;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   486
    end
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   487
else if Gear^.Kind = gtHedgehog then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   488
    (*
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   489
    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
   490
     if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   491
        begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   492
        AttackBar:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   493
        Gear^.Message:= gmDestroy;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   494
        CurAmmoGear^.Message:= gmDestroy;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   495
        exit
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   496
        end
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   497
    else*)
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   498
        begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   499
        if (hwRound(Gear^.Y) >= cWaterLine) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   500
            begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   501
            t:= max(Gear^.Damage, Gear^.Health);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   502
            Gear^.Damage:= t;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   503
            if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cWaterOpacity < $FF)))
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   504
            and (hwRound(Gear^.Y) < cWaterLine + 256) then
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   505
                spawnHealthTagForHH(Gear, t);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   506
            end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   507
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   508
        team:= Gear^.Hedgehog^.Team;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   509
        if CurrentHedgehog^.Gear = Gear then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   510
            begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   511
            AttackBar:= 0;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   512
            FreeActionsList; // to avoid ThinkThread on drawned gear
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   513
            if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   514
            and (CurrentHedgehog^.MultiShootAttacks > 0) then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   515
                OnUsedAmmo(CurrentHedgehog^);
6468
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
        Gear^.Hedgehog^.Gear:= nil;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   519
        if Gear^.Hedgehog^.King then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   520
            begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   521
            // 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
   522
            k:= false;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   523
            for i:= 0 to Pred(team^.Clan^.TeamsNumber) do
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   524
                if (team^.Clan^.Teams[i]^.Hedgehogs[0].Gear <> nil) then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   525
                    k:= true;
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   526
            if not k then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   527
                for i:= 0 to Pred(team^.Clan^.TeamsNumber) do
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   528
                    begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   529
                    team^.Clan^.Teams[i]^.hasGone:= true;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   530
                    TeamGoneEffect(team^.Clan^.Teams[i]^)
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   531
                    end
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   532
            end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   533
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   534
        // 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
   535
        // same stand for CheckHHDamage
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   536
        if (Gear^.LastDamage <> nil) then
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   537
            uStats.HedgehogDamaged(Gear, Gear^.LastDamage, 0, true)
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   538
        else
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   539
            uStats.HedgehogDamaged(Gear, CurrentHedgehog, 0, true);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   540
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   541
        inc(KilledHHs);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   542
        RecountTeamHealth(team);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   543
        if (CurrentHedgehog <> nil) and CurrentHedgehog^.Effects[heResurrectable] and
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   544
        (not Gear^.Hedgehog^.Effects[heResurrectable]) then
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   545
            with CurrentHedgehog^ do 
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   546
                begin
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   547
                inc(Team^.stats.AIKills);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   548
                FreeTexture(Team^.AIKillsTex);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   549
                Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   550
                end
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   551
        end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   552
with Gear^ do
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   553
    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
   554
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   555
if CurAmmoGear = Gear then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   556
    CurAmmoGear:= nil;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   557
if FollowGear = Gear then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   558
    FollowGear:= nil;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   559
if lastGearByUID = Gear then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6543
diff changeset
   560
    lastGearByUID := nil;
6468
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   561
RemoveGearFromList(Gear);
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   562
Dispose(Gear)
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   563
end;
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   564
da1e7fe7cff7 Start refactoring uGears. Breaks build.
unc0rr
parents:
diff changeset
   565
end.