hedgewars/uGearsList.pas
author unC0Rr
Thu, 29 Aug 2024 17:09:39 +0200
branchtransitional_engine
changeset 16055 ce4b50823a95
parent 16049 9be943326d9c
permissions -rw-r--r--
Allow switching between outline and wfc map generators
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
     1
(*
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
     2
 * Hedgewars, a free turn based strategy game
11046
47a8c19ecb60 more copyright fixes
sheepluva
parents: 11043
diff changeset
     3
 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
     4
 *
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
     8
 *
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    12
 * GNU General Public License for more details.
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    13
 *
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    14
 * You should have received a copy of the GNU General Public License
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    15
 * along with this program; if not, write to the Free Software
10108
c68cf030eded update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents: 10040
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    17
 *)
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    18
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    19
{$INCLUDE "options.inc"}
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    20
unit uGearsList;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    21
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    22
interface
10032
db65298717da This adds idle hog tinting. Active hog tinting still needed.
nemo
parents: 9998
diff changeset
    23
uses uFloat, uTypes, SDLh;
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    24
16049
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
    25
procedure initializeGear(gear: PGear; X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer, newUid: LongWord);
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    26
function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
11203
2f4d0a387a02 Pass overridden uid into AddGear instead
nemo
parents: 11171
diff changeset
    27
function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer, newUid: LongWord): PGear;
10646
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
    28
procedure DeleteGear(Gear: PGear);
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    29
procedure InsertGearToList(Gear: PGear);
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    30
procedure RemoveGearFromList(Gear: PGear);
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    31
7395
d0d38cd0d27c - Check for harmful gear deletions
unc0rr
parents: 7394
diff changeset
    32
var curHandledGear: PGear;
d0d38cd0d27c - Check for harmful gear deletions
unc0rr
parents: 7394
diff changeset
    33
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    34
implementation
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    35
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    36
uses uRandom, uUtils, uConsts, uVariables, uAmmos, uTeams, uStats,
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    37
    uTextures, uScript, uRenderUtils, uAI, uCollisions,
7395
d0d38cd0d27c - Check for harmful gear deletions
unc0rr
parents: 7394
diff changeset
    38
    uGearsRender, uGearsUtils, uDebug;
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
    39
8145
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    40
const
8795
b5b79a8f9354 merge correction, also what's with all those trailing whitespaces?
koda
parents: 8774
diff changeset
    41
    GearKindAmmoTypeMap : array [TGearType] of TAmmoType = (
8145
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    42
(*          gtFlame *)   amNothing
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    43
(*       gtHedgehog *) , amNothing
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    44
(*           gtMine *) , amMine
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    45
(*           gtCase *) , amNothing
10829
158b5dd6b3c9 avoid airmines too when spawning
nemo
parents: 10828
diff changeset
    46
(*        gtAirMine *) , amAirMine
8145
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    47
(*     gtExplosives *) , amNothing
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    48
(*        gtGrenade *) , amGrenade
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    49
(*          gtShell *) , amBazooka
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    50
(*          gtGrave *) , amNothing
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    51
(*            gtBee *) , amBee
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    52
(*    gtShotgunShot *) , amShotgun
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    53
(*     gtPickHammer *) , amPickHammer
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    54
(*           gtRope *) , amRope
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    55
(*     gtDEagleShot *) , amDEagle
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    56
(*       gtDynamite *) , amDynamite
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    57
(*    gtClusterBomb *) , amClusterBomb
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    58
(*        gtCluster *) , amClusterBomb
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    59
(*         gtShover *) , amBaseballBat  // Shover is only used for baseball bat right now
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    60
(*      gtFirePunch *) , amFirePunch
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    61
(*    gtATStartGame *) , amNothing
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    62
(*   gtATFinishGame *) , amNothing
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    63
(*      gtParachute *) , amParachute
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    64
(*      gtAirAttack *) , amAirAttack
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    65
(*        gtAirBomb *) , amAirAttack
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    66
(*      gtBlowTorch *) , amBlowTorch
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    67
(*         gtGirder *) , amGirder
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    68
(*       gtTeleport *) , amTeleport
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    69
(*       gtSwitcher *) , amSwitch
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    70
(*         gtTarget *) , amNothing
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    71
(*         gtMortar *) , amMortar
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    72
(*           gtWhip *) , amWhip
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    73
(*       gtKamikaze *) , amKamikaze
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    74
(*           gtCake *) , amCake
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    75
(*      gtSeduction *) , amSeduction
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    76
(*     gtWatermelon *) , amWatermelon
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    77
(*     gtMelonPiece *) , amWatermelon
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    78
(*    gtHellishBomb *) , amHellishBomb
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    79
(*        gtWaterUp *) , amNothing
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    80
(*          gtDrill *) , amDrill
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    81
(*        gtBallGun *) , amBallgun
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    82
(*           gtBall *) , amBallgun
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    83
(*        gtRCPlane *) , amRCPlane
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    84
(*gtSniperRifleShot *) , amSniperRifle
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    85
(*        gtJetpack *) , amJetpack
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    86
(*        gtMolotov *) , amMolotov
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    87
(*          gtBirdy *) , amBirdy
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    88
(*            gtEgg *) , amBirdy
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    89
(*         gtPortal *) , amPortalGun
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    90
(*          gtPiano *) , amPiano
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    91
(*        gtGasBomb *) , amGasBomb
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    92
(*    gtSineGunShot *) , amSineGun
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    93
(*   gtFlamethrower *) , amFlamethrower
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    94
(*          gtSMine *) , amSMine
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    95
(*    gtPoisonCloud *) , amNothing
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    96
(*         gtHammer *) , amHammer
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    97
(*      gtHammerHit *) , amHammer
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    98
(*    gtResurrector *) , amResurrector
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
    99
(*    gtPoisonCloud *) , amNothing
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   100
(*       gtSnowball *) , amSnowball
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   101
(*          gtFlake *) , amNothing
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   102
(*        gtLandGun *) , amLandGun
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   103
(*         gtTardis *) , amTardis
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   104
(*         gtIceGun *) , amIceGun
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   105
(*        gtAddAmmo *) , amNothing
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   106
(*  gtGenericFaller *) , amNothing
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   107
(*          gtKnife *) , amKnife
13872
f01798038c2e Rename amDuck and related symbols to amCreeper, gtCreeper, etc.
Wuzzy <Wuzzy2@mail.ru>
parents: 13871
diff changeset
   108
(*        gtCreeper *) , amCreeper
12898
8a40ce061d94 Machinegun. also tweaked ignore
alfadur
parents: 12828
diff changeset
   109
(*        gtMinigun *) , amMinigun
8a40ce061d94 Machinegun. also tweaked ignore
alfadur
parents: 12828
diff changeset
   110
(*  gtMinigunBullet *) , amMinigun
15661
afeffdb4a712 add sentry 🤖 stub
alfadur
parents: 15609
diff changeset
   111
(*         gtSentry *) , amSentry
8145
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   112
    );
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   113
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   114
7093
2d7f1fb73335 Bit more freezer.
nemo
parents: 7077
diff changeset
   115
var GCounter: LongWord = 0; // this does not get re-initialized, but should be harmless
7028
0f60591f3a16 old typed const moved to their proper unit
koda
parents: 7010
diff changeset
   116
8145
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   117
const
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   118
    cUsualZ = 500;
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   119
    cOnHHZ = 2000;
6408c0ba4ba1 Move global variables to units that use them
Joe Doyle (Ginto8) <ginto8@gmail.com>
parents: 7754
diff changeset
   120
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   121
procedure InsertGearToList(Gear: PGear);
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   122
var tmp, ptmp: PGear;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   123
begin
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   124
    tmp:= GearsList;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   125
    ptmp:= GearsList;
7366
e5a0856708dc Insert at front of same Z, not end. Saves a little time on insertion and lua lookup of recent adds.
nemo
parents: 7364
diff changeset
   126
    while (tmp <> nil) and (tmp^.Z < Gear^.Z) do
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   127
        begin
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   128
        ptmp:= tmp;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   129
        tmp:= tmp^.NextGear
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   130
        end;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   131
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   132
    if ptmp <> tmp then
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   133
        begin
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   134
        Gear^.NextGear:= ptmp^.NextGear;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   135
        Gear^.PrevGear:= ptmp;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   136
        if ptmp^.NextGear <> nil then
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   137
            ptmp^.NextGear^.PrevGear:= Gear;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   138
        ptmp^.NextGear:= Gear
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   139
        end
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   140
    else
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   141
        begin
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   142
        Gear^.NextGear:= GearsList;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   143
        if Gear^.NextGear <> nil then
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   144
            Gear^.NextGear^.PrevGear:= Gear;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   145
        GearsList:= Gear;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   146
        end;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   147
end;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   148
7395
d0d38cd0d27c - Check for harmful gear deletions
unc0rr
parents: 7394
diff changeset
   149
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   150
procedure RemoveGearFromList(Gear: PGear);
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   151
begin
10634
35d059bd0932 Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents: 10625
diff changeset
   152
if (Gear <> GearsList) and (Gear <> nil) and (Gear^.NextGear = nil) and (Gear^.PrevGear = nil) then
35d059bd0932 Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents: 10625
diff changeset
   153
    begin
35d059bd0932 Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents: 10625
diff changeset
   154
    AddFileLog('Attempted to remove Gear #'+inttostr(Gear^.uid)+' from the list twice.');
35d059bd0932 Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents: 10625
diff changeset
   155
    exit
35d059bd0932 Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents: 10625
diff changeset
   156
    end;
11539
c22d292e7266 Fix possible crashes/hangs due to recent changes
unC0Rr
parents: 11532
diff changeset
   157
    
c22d292e7266 Fix possible crashes/hangs due to recent changes
unC0Rr
parents: 11532
diff changeset
   158
checkFails((Gear = nil) or (curHandledGear = nil) or (Gear = curHandledGear), 'You''re doing it wrong', true);
7395
d0d38cd0d27c - Check for harmful gear deletions
unc0rr
parents: 7394
diff changeset
   159
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   160
if Gear^.NextGear <> nil then
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   161
    Gear^.NextGear^.PrevGear:= Gear^.PrevGear;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   162
if Gear^.PrevGear <> nil then
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   163
    Gear^.PrevGear^.NextGear:= Gear^.NextGear
11043
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   164
else
10634
35d059bd0932 Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents: 10625
diff changeset
   165
    GearsList:= Gear^.NextGear;
35d059bd0932 Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents: 10625
diff changeset
   166
35d059bd0932 Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents: 10625
diff changeset
   167
Gear^.NextGear:= nil;
35d059bd0932 Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents: 10625
diff changeset
   168
Gear^.PrevGear:= nil
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   169
end;
7395
d0d38cd0d27c - Check for harmful gear deletions
unc0rr
parents: 7394
diff changeset
   170
16049
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   171
procedure initializeGear(gear: PGear; X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer, newUid: LongWord);
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   172
var cakeData: PCakeData;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   173
begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   174
    FillChar(gear^, sizeof(TGear), 0);
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   175
    gear^.X:= int2hwFloat(X);
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   176
    gear^.Y:= int2hwFloat(Y);
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   177
    gear^.Target.X:= NoPointX;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   178
    gear^.Kind := Kind;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   179
    gear^.State:= State;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   180
    gear^.Active:= true;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   181
    gear^.dX:= dX;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   182
    gear^.dY:= dY;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   183
    gear^.doStep:= doStepHandlers[Kind];
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   184
    gear^.CollisionIndex:= -1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   185
    gear^.Timer:= Timer;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   186
    if newUid = 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   187
         gear^.uid:= GCounter
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   188
    else gear^.uid:= newUid;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   189
    gear^.SoundChannel:= -1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   190
    gear^.ImpactSound:= sndNone;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   191
    gear^.Density:= _1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   192
    // Define ammo association, if any.
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   193
    gear^.AmmoType:= GearKindAmmoTypeMap[Kind];
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   194
    gear^.CollisionMask:= lfAll;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   195
    gear^.Tint:= $FFFFFFFF;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   196
    gear^.Data:= nil;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   197
    gear^.Sticky:= false;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   198
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   199
    if CurrentHedgehog <> nil then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   200
        begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   201
        gear^.Hedgehog:= CurrentHedgehog;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   202
        if (CurrentHedgehog^.Gear <> nil) and (hwRound(CurrentHedgehog^.Gear^.X) = X) and (hwRound(CurrentHedgehog^.Gear^.Y) = Y) then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   203
            gear^.CollisionMask:= lfNotCurHogCrate
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   204
        end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   205
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   206
    if (Ammoz[Gear^.AmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0) then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   207
        gear^.Z:= cHHZ+1
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   208
    else gear^.Z:= cUsualZ;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   209
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   210
    // set gstInBounceEdge if gear spawned inside the bounce world edge
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   211
    if WorldEdge = weBounce then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   212
        if (hwRound(gear^.X) - Gear^.Radius < leftX) or (hwRound(gear^.X) + Gear^.Radius > rightX) then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   213
            case gear^.Kind of
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   214
                // list all gears here that could collide with the bounce world edge
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   215
                gtHedgehog,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   216
                gtFlame,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   217
                gtMine,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   218
                gtAirBomb,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   219
                gtDrill,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   220
                gtNapalmBomb,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   221
                gtCase,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   222
                gtAirMine,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   223
                gtExplosives,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   224
                gtGrenade,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   225
                gtShell,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   226
                gtBee,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   227
                gtDynamite,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   228
                gtClusterBomb,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   229
                gtMelonPiece,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   230
                gtCluster,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   231
                gtMortar,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   232
                gtKamikaze,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   233
                gtCake,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   234
                gtWatermelon,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   235
                gtGasBomb,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   236
                gtHellishBomb,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   237
                gtBall,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   238
                gtRCPlane,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   239
                gtSniperRifleShot,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   240
                gtShotgunShot,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   241
                gtDEagleShot,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   242
                gtSineGunShot,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   243
                gtMinigunBullet,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   244
                gtEgg,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   245
                gtPiano,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   246
                gtSMine,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   247
                gtSnowball,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   248
                gtKnife,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   249
                gtCreeper,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   250
                gtSentry,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   251
                gtMolotov,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   252
                gtFlake,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   253
                gtGrave,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   254
                gtPortal,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   255
                gtTarget:
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   256
                gear^.State := gear^.State or gstInBounceEdge;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   257
            end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   258
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   259
    case Kind of
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   260
              gtFlame: Gear^.Boom := 2;  // some additional expl in there are x3, x4 this
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   261
           gtHedgehog: Gear^.Boom := 30;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   262
               gtMine: Gear^.Boom := 50;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   263
               gtCase: Gear^.Boom := 25;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   264
            gtAirMine: Gear^.Boom := 30;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   265
         gtExplosives: Gear^.Boom := 75;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   266
            gtGrenade: Gear^.Boom := 50;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   267
              gtShell: Gear^.Boom := 50;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   268
                gtBee: Gear^.Boom := 50;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   269
        gtShotgunShot: Gear^.Boom := 25;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   270
         gtPickHammer: Gear^.Boom := 6;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   271
    //           gtRope: Gear^.Boom := 2; could be funny to have rope attaching to hog deal small amount of dmg?
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   272
         gtDEagleShot: Gear^.Boom := 7;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   273
           gtDynamite: Gear^.Boom := 75;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   274
        gtClusterBomb: Gear^.Boom := 20;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   275
         gtMelonPiece,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   276
            gtCluster: Gear^.Boom := Timer;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   277
             gtShover: Gear^.Boom := 30;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   278
          gtFirePunch: Gear^.Boom := 30;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   279
            gtAirBomb: Gear^.Boom := 30;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   280
          gtBlowTorch: Gear^.Boom := 2;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   281
             gtMortar: Gear^.Boom := 20;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   282
               gtWhip: Gear^.Boom := 30;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   283
           gtKamikaze: Gear^.Boom := 30; // both shove and explosion
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   284
               gtCake: Gear^.Boom := cakeDmg; // why is cake damage a global constant
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   285
         gtWatermelon: Gear^.Boom := 75;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   286
        gtHellishBomb: Gear^.Boom := 90;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   287
              gtDrill: if Gear^.State and gsttmpFlag = 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   288
                            Gear^.Boom := 50
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   289
                       else Gear^.Boom := 30;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   290
               gtBall: Gear^.Boom := 40;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   291
            gtRCPlane: Gear^.Boom := 25;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   292
    // sniper rifle is distance linked, this Boom is just an arbitrary scaling factor applied to timer-based-damage
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   293
    // because, eh, why not..
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   294
    gtSniperRifleShot: Gear^.Boom := 100000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   295
                gtEgg: Gear^.Boom := 10;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   296
              gtPiano: Gear^.Boom := 80;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   297
            gtGasBomb: Gear^.Boom := 20;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   298
        gtSineGunShot: Gear^.Boom := 35;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   299
              gtSMine: Gear^.Boom := 30;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   300
        gtSnowball: Gear^.Boom := 200000; // arbitrary scaling for the shove
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   301
             gtHammer: if cDamageModifier > _1 then // scale it based on cDamageModifier?
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   302
                             Gear^.Boom := 2
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   303
                        else Gear^.Boom := 3;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   304
        gtPoisonCloud: Gear^.Boom := 20;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   305
              gtKnife: Gear^.Boom := 40000; // arbitrary scaling factor since impact-based
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   306
            gtCreeper: Gear^.Boom := 100;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   307
      gtMinigunBullet: Gear^.Boom := 2;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   308
             gtSentry: Gear^.Boom := 40;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   309
        end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   310
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   311
    case Kind of
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   312
         gtGrenade,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   313
         gtClusterBomb,
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   314
         gtGasBomb: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   315
                    gear^.ImpactSound:= sndGrenadeImpact;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   316
                    gear^.nImpactSounds:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   317
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   318
                    gear^.Radius:= 5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   319
                    gear^.Elasticity:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   320
                    gear^.Friction:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   321
                    gear^.Density:= _1_5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   322
                    gear^.RenderTimer:= true;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   323
                    if gear^.Timer = 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   324
                        gear^.Timer:= 3000
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   325
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   326
      gtWatermelon: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   327
                    gear^.ImpactSound:= sndMelonImpact;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   328
                    gear^.nImpactSounds:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   329
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   330
                    gear^.Radius:= 6;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   331
                    gear^.Elasticity:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   332
                    gear^.Friction:= _0_995;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   333
                    gear^.Density:= _2;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   334
                    gear^.RenderTimer:= true;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   335
                    if gear^.Timer = 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   336
                        gear^.Timer:= 3000
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   337
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   338
      gtMelonPiece: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   339
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   340
                    gear^.Density:= _2;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   341
                    gear^.Elasticity:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   342
                    gear^.Friction:= _0_995;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   343
                    gear^.Radius:= 4
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   344
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   345
        gtHedgehog: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   346
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   347
                    gear^.Radius:= cHHRadius;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   348
                    gear^.Elasticity:= _0_35;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   349
                    gear^.Friction:= _0_999;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   350
                    gear^.Angle:= cMaxAngle div 2;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   351
                    gear^.Density:= _3;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   352
                    gear^.Z:= cHHZ;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   353
                    if (GameFlags and gfAISurvival) <> 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   354
                        if gear^.Hedgehog^.BotLevel > 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   355
                            gear^.Hedgehog^.Effects[heResurrectable] := 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   356
                    if (GameFlags and gfArtillery) <> 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   357
                        gear^.Hedgehog^.Effects[heArtillery] := 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   358
                    // this would presumably be set in the frontend
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   359
                    // if we weren't going to do that yet, would need to reinit GetRandom
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   360
                    // oh, and, randomising slightly R and B might be nice too.
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   361
                    //gear^.Tint:= $fa00efff or ((random(80)+128) shl 16)
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   362
                    //gear^.Tint:= $faa4efff
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   363
                    //gear^.Tint:= (($e0+random(32)) shl 24) or
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   364
                    //             ((random(80)+128) shl 16) or
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   365
                    //             (($d5+random(32)) shl 8) or $ff
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   366
                    {c:= GetRandom(32);
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   367
                    gear^.Tint:= (($e0+c) shl 24) or
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   368
                                 ((GetRandom(90)+128) shl 16) or
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   369
                                 (($d5+c) shl 8) or $ff}
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   370
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   371
       gtParachute: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   372
                    gear^.Tag:= 1; // hog face dir. 1 = right, -1 = left
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   373
                    gear^.Z:= cCurrHHZ;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   374
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   375
           gtShell: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   376
                    gear^.Elasticity:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   377
                    gear^.Friction:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   378
                    gear^.Radius:= 4;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   379
                    gear^.Density:= _1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   380
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   381
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   382
           gtSnowball: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   383
                    gear^.ImpactSound:= sndMudballImpact;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   384
                    gear^.nImpactSounds:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   385
                    gear^.Radius:= 4;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   386
                    gear^.Density:= _0_5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   387
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   388
                    gear^.Elasticity:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   389
                    gear^.Friction:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   390
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   391
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   392
         gtFlake: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   393
                    with Gear^ do
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   394
                        begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   395
                        Pos:= 0;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   396
                        Radius:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   397
                        DirAngle:= random(360);
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   398
                        Sticky:= true;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   399
                        if State and gstTmpFlag = 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   400
                            begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   401
                            dx.isNegative:= GetRandom(2) = 0;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   402
                            dx.QWordValue:= QWord($40DA) * GetRandom(10000) * 8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   403
                            dy.isNegative:= false;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   404
                            dy.QWordValue:= QWord($3AD3) * GetRandom(7000) * 8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   405
                            if GetRandom(2) = 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   406
                                dx := -dx;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   407
                            Tint:= $FFFFFFFF
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   408
                            end
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   409
                        else
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   410
                            Tint:= (ExplosionBorderColor shr RShift and $FF shl 24) or
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   411
                                   (ExplosionBorderColor shr GShift and $FF shl 16) or
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   412
                                   (ExplosionBorderColor shr BShift and $FF shl 8) or $FF;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   413
                        State:= State or gstInvisible;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   414
                        // use health field to store current frameticks
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   415
                        if vobFrameTicks > 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   416
                            Health:= random(vobFrameTicks)
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   417
                        else
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   418
                            Health:= 0;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   419
                        // use timer to store currently displayed frame index
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   420
                        if gear^.Timer = 0 then Timer:= random(vobFramesCount);
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   421
                        Damage:= (random(2) * 2 - 1) * (vobVelocity + random(vobVelocity)) * 8
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   422
                        end
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   423
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   424
           gtGrave: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   425
                    gear^.ImpactSound:= sndGraveImpact;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   426
                    gear^.nImpactSounds:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   427
                    gear^.Radius:= 10;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   428
                    gear^.Elasticity:= _0_6;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   429
                    gear^.Z:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   430
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   431
             gtBee: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   432
                    gear^.Radius:= 5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   433
                    if gear^.Timer = 0 then gear^.Timer:= 500;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   434
                    gear^.RenderTimer:= true;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   435
                    gear^.Elasticity:= _0_9;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   436
                    gear^.Tag:= 0;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   437
                    gear^.State:= Gear^.State or gstSubmersible
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   438
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   439
       gtSeduction: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   440
                    gear^.Radius:= cSeductionDist;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   441
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   442
     gtShotgunShot: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   443
                    if gear^.Timer = 0 then gear^.Timer:= 900;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   444
                    gear^.Radius:= 2
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   445
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   446
      gtPickHammer: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   447
                    gear^.Radius:= 10;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   448
                    if gear^.Timer = 0 then gear^.Timer:= 4000
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   449
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   450
       gtHammerHit: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   451
                    gear^.Radius:= 8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   452
                    if gear^.Timer = 0 then gear^.Timer:= 125
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   453
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   454
            gtRope: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   455
                    gear^.Radius:= 3;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   456
                    gear^.Friction:= _450 * _0_01 * cRopePercent;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   457
                    RopePoints.Count:= 0;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   458
                    gear^.Tint:= $D8D8D8FF;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   459
                    gear^.Tag:= 0; // normal rope render
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   460
                    gear^.CollisionMask:= lfNotCurHogCrate //lfNotObjMask or lfNotHHObjMask;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   461
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   462
            gtMine: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   463
                    gear^.ImpactSound:= sndMineImpact;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   464
                    gear^.nImpactSounds:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   465
                    gear^.Health:= 10;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   466
                    gear^.State:= gear^.State or gstMoving;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   467
                    gear^.Radius:= 2;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   468
                    gear^.Elasticity:= _0_55;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   469
                    gear^.Friction:= _0_995;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   470
                    gear^.Density:= _1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   471
                    if gear^.Timer = 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   472
                        begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   473
                        if cMinesTime < 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   474
                            begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   475
                            gear^.Timer:= getrandom(51)*100;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   476
                            gear^.Karma:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   477
                            end
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   478
                        else
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   479
                            gear^.Timer:= cMinesTime;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   480
                        end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   481
                    gear^.RenderTimer:= true;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   482
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   483
         gtAirMine: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   484
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   485
                    gear^.ImpactSound:= sndAirMineImpact;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   486
                    gear^.nImpactSounds:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   487
                    gear^.Health:= 30;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   488
                    gear^.State:= gear^.State or gstMoving or gstNoGravity or gstSubmersible;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   489
                    gear^.Radius:= 8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   490
                    gear^.Elasticity:= _0_55;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   491
                    gear^.Friction:= _0_995;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   492
                    gear^.Density:= _1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   493
                    gear^.Angle:= 175; // Radius at which air bombs will start "seeking". $FFFFFFFF = unlimited. check is skipped.
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   494
                    gear^.Power:= cMaxWindSpeed.QWordValue div 2; // hwFloat converted. 1/2 g default. defines the "seek" speed when a gear is in range.
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   495
                    gear^.Pos:= cMaxWindSpeed.QWordValue * 3 div 2; // air friction. slows it down when not hitting stuff
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   496
                    gear^.Tag:= 0;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   497
                    if gear^.Timer = 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   498
                        begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   499
                        if cMinesTime < 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   500
                            begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   501
                            gear^.Timer:= getrandom(13)*100;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   502
                            gear^.Karma:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   503
                            end
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   504
                        else
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   505
                            gear^.Timer:= cMinesTime div 4;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   506
                        end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   507
                    gear^.RenderTimer:= true;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   508
                    gear^.WDTimer:= gear^.Timer
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   509
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   510
           gtSMine: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   511
                    gear^.Health:= 10;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   512
                    gear^.State:= gear^.State or gstMoving;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   513
                    gear^.Radius:= 2;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   514
                    gear^.Elasticity:= _0_55;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   515
                    gear^.Friction:= _0_995;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   516
                    gear^.Density:= _1_6;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   517
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   518
                    gear^.Sticky:= true;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   519
                    if gear^.Timer = 0 then gear^.Timer:= 500;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   520
                    gear^.RenderTimer:= true;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   521
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   522
           gtKnife: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   523
                    gear^.ImpactSound:= sndKnifeImpact;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   524
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   525
                    gear^.Elasticity:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   526
                    gear^.Friction:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   527
                    gear^.Density:= _4;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   528
                    gear^.Radius:= 7;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   529
                    gear^.Sticky:= true;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   530
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   531
            gtCase: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   532
                    gear^.ImpactSound:= sndCaseImpact;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   533
                    gear^.nImpactSounds:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   534
                    gear^.Radius:= 16;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   535
                    gear^.Elasticity:= _0_3;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   536
                    if gear^.Timer = 0 then gear^.Timer:= 500
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   537
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   538
      gtExplosives: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   539
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   540
                    if GameType in [gmtDemo, gmtRecord] then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   541
                        gear^.RenderHealth:= true;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   542
                    gear^.ImpactSound:= sndGrenadeImpact;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   543
                    gear^.nImpactSounds:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   544
                    gear^.Radius:= 16;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   545
                    gear^.Elasticity:= _0_4;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   546
                    gear^.Friction:= _0_995;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   547
                    gear^.Density:= _6;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   548
                    gear^.Health:= cBarrelHealth;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   549
                    gear^.Z:= cHHZ-1
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   550
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   551
      gtDEagleShot: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   552
                    gear^.Radius:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   553
                    gear^.Health:= 50;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   554
                    gear^.Data:= nil;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   555
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   556
      gtSniperRifleShot: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   557
                    gear^.Radius:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   558
                    gear^.Health:= 50
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   559
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   560
        gtDynamite: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   561
                    gear^.ImpactSound:= sndDynamiteImpact;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   562
                    gear^.nImpactSounds:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   563
                    gear^.Radius:= 3;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   564
                    gear^.Elasticity:= _0_55;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   565
                    gear^.Friction:= _0_03;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   566
                    gear^.Density:= _2;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   567
                    if gear^.Timer = 0 then gear^.Timer:= 5000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   568
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   569
         gtCluster: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   570
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   571
                    gear^.Elasticity:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   572
                    gear^.Friction:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   573
                    gear^.Radius:= 2;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   574
                    gear^.Density:= _1_5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   575
                    gear^.RenderTimer:= true
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   576
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   577
          gtShover: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   578
                    gear^.Radius:= 20;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   579
                    gear^.Tag:= 0;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   580
                    gear^.Timer:= 50;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   581
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   582
           gtFlame: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   583
                    gear^.Tag:= GetRandom(32);
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   584
                    gear^.Radius:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   585
                    gear^.Health:= 5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   586
                    gear^.Density:= _1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   587
                    gear^.FlightTime:= 9999999; // determines whether in-air flames do damage. disabled by default
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   588
                    if (gear^.dY.QWordValue = 0) and (gear^.dX.QWordValue = 0) then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   589
                        begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   590
                        gear^.dY:= (getrandomf - _0_8) * _0_03;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   591
                        gear^.dX:= (getrandomf - _0_5) * _0_4
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   592
                        end
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   593
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   594
       gtFirePunch: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   595
                    if gear^.Timer = 0 then gear^.Timer:= 3000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   596
                    gear^.Radius:= 15;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   597
                    gear^.Tag:= Y
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   598
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   599
       gtAirAttack: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   600
                    gear^.Health:= 6;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   601
                    gear^.Damage:= 30;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   602
                    gear^.Z:= cHHZ+2;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   603
                    gear^.Karma:= 0; // for sound effect: 0 = normal, 1 = underwater
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   604
                    gear^.Radius:= 150;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   605
                    gear^.FlightTime:= 0; // for timeout in weWrap
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   606
                    gear^.Power:= 0; // count number of wraps in weWrap
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   607
                    gear^.WDTimer:= 0; // number of required wraps
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   608
                    gear^.Density:= _19;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   609
                    gear^.Tint:= gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   610
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   611
         gtAirBomb: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   612
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   613
                    gear^.Radius:= 5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   614
                    gear^.Density:= _2;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   615
                    gear^.Elasticity:= _0_55;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   616
                    gear^.Friction:= _0_995
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   617
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   618
       gtBlowTorch: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   619
                    gear^.Radius:= cHHRadius + cBlowTorchC - 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   620
                    if gear^.Timer = 0 then gear^.Timer:= 7500
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   621
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   622
        gtSwitcher: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   623
                    gear^.Z:= cCurrHHZ
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   624
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   625
          gtTarget: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   626
                    gear^.ImpactSound:= sndGrenadeImpact;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   627
                    gear^.nImpactSounds:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   628
                    gear^.Radius:= 10;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   629
                    gear^.Elasticity:= _0_3;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   630
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   631
          gtTardis: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   632
                    gear^.Pos:= 1; // tardis phase
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   633
                    gear^.Tag:= 0; // 1 = hedgehog died, disappeared, took damage or moved
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   634
                    gear^.Z:= cCurrHHZ+1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   635
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   636
          gtMortar: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   637
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   638
                    gear^.Radius:= 4;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   639
                    gear^.Elasticity:= _0_2;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   640
                    gear^.Friction:= _0_08;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   641
                    gear^.Density:= _1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   642
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   643
            gtWhip: gear^.Radius:= 20;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   644
          gtHammer: gear^.Radius:= 20;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   645
        gtKamikaze: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   646
                    gear^.Health:= 2048;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   647
                    gear^.Radius:= 20
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   648
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   649
            gtCake: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   650
                    gear^.Health:= 2048;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   651
                    gear^.Radius:= 7;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   652
                    gear^.Z:= cOnHHZ;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   653
                    gear^.RenderTimer:= false;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   654
                    gear^.DirAngle:= -90 * hwSign(Gear^.dX);
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   655
                    gear^.FlightTime:= 100; // (roughly) ticks spent dropping, used to skip getting up anim when stuck.
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   656
                                            // Initially set to a high value so cake has at least one getting up anim.
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   657
                    if not dX.isNegative then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   658
                        gear^.Angle:= 1
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   659
                    else
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   660
                        gear^.Angle:= 3;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   661
                    New(cakeData);
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   662
                    gear^.Data:= Pointer(cakeData);
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   663
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   664
     gtHellishBomb: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   665
                    gear^.ImpactSound:= sndHellishImpact1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   666
                    gear^.nImpactSounds:= 4;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   667
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   668
                    gear^.Radius:= 4;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   669
                    gear^.Elasticity:= _0_5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   670
                    gear^.Friction:= _0_96;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   671
                    gear^.Density:= _1_5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   672
                    gear^.RenderTimer:= true;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   673
                    if gear^.Timer = 0 then gear^.Timer:= 5000
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   674
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   675
           gtDrill: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   676
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   677
                    gear^.Elasticity:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   678
                    gear^.Friction:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   679
                    if gear^.Timer = 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   680
                        gear^.Timer:= 5000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   681
                    // Tag for drill strike. if 1 then first impact occured already
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   682
                    gear^.Tag := 0;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   683
                    // Pos for state. If 1, drill is drilling
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   684
                    gear^.Pos := 0;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   685
                    gear^.Radius:= 4;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   686
                    gear^.Density:= _1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   687
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   688
            gtBall: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   689
                    gear^.ImpactSound:= sndGrenadeImpact;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   690
                    gear^.nImpactSounds:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   691
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   692
                    gear^.Radius:= 5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   693
                    gear^.Tag:= random(8);
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   694
                    if gear^.Timer = 0 then gear^.Timer:= 5000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   695
                    gear^.Elasticity:= _0_7;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   696
                    gear^.Friction:= _0_995;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   697
                    gear^.Density:= _1_5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   698
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   699
         gtBallgun: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   700
                    if gear^.Timer = 0 then gear^.Timer:= 5001;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   701
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   702
         gtRCPlane: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   703
                    if gear^.Timer = 0 then gear^.Timer:= 15000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   704
                    gear^.Health:= 3;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   705
                    gear^.Radius:= 8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   706
                    gear^.Tint:= gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   707
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   708
         gtJetpack: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   709
                    gear^.Health:= 2000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   710
                    gear^.Damage:= 100;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   711
                    gear^.State:= Gear^.State or gstSubmersible
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   712
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   713
         gtMolotov: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   714
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   715
                    gear^.Radius:= 6;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   716
                    gear^.Elasticity:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   717
                    gear^.Friction:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   718
                    gear^.Density:= _2
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   719
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   720
           gtBirdy: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   721
                    gear^.Radius:= 16; // todo: check
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   722
                    gear^.Health := 2000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   723
                    gear^.FlightTime := 2;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   724
                    gear^.Z:= cCurrHHZ;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   725
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   726
             gtEgg: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   727
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   728
                    gear^.Radius:= 4;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   729
                    gear^.Elasticity:= _0_6;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   730
                    gear^.Friction:= _0_96;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   731
                    gear^.Density:= _1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   732
                    if gear^.Timer = 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   733
                        gear^.Timer:= 3000
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   734
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   735
          gtPortal: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   736
                    gear^.ImpactSound:= sndMelonImpact;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   737
                    gear^.nImpactSounds:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   738
                    gear^.Radius:= 17;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   739
                    // set color
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   740
                    gear^.Tag:= 2 * gear^.Timer;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   741
                    gear^.Timer:= 15000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   742
                    gear^.RenderTimer:= false;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   743
                    gear^.Health:= 100;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   744
                    gear^.Sticky:= true;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   745
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   746
           gtPiano: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   747
                    gear^.Radius:= 32;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   748
                    gear^.Density:= _50;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   749
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   750
     gtSineGunShot: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   751
                    gear^.Radius:= 5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   752
                    gear^.Health:= 6000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   753
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   754
    gtFlamethrower: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   755
                    gear^.Tag:= 10;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   756
                    if gear^.Timer = 0 then gear^.Timer:= 10;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   757
                    gear^.Health:= 500;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   758
                    gear^.Damage:= 100;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   759
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   760
         gtLandGun: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   761
                    gear^.Tag:= 10;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   762
                    if gear^.Timer = 0 then gear^.Timer:= 10;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   763
                    gear^.Health:= 1000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   764
                    gear^.Damage:= 100;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   765
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   766
     gtPoisonCloud: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   767
                    if gear^.Timer = 0 then gear^.Timer:= 5000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   768
                    gear^.WDTimer:= gear^.Timer; // initial timer
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   769
                    gear^.dY:= int2hwfloat(-4 + longint(getRandom(8))) / 1000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   770
                    gear^.Tint:= $C0C000C0
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   771
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   772
     gtResurrector: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   773
                    gear^.Radius := cResurrectorDist;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   774
                    gear^.Tag := 0;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   775
                    gear^.Tint:= $F5DB35FF
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   776
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   777
         gtWaterUp: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   778
                    gear^.Tag := 47;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   779
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   780
      gtNapalmBomb: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   781
                    gear^.Elasticity:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   782
                    gear^.Friction:= _0_8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   783
                    if gear^.Timer = 0 then gear^.Timer:= 1000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   784
                    gear^.Radius:= 5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   785
                    gear^.Density:= _1_5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   786
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   787
          gtIceGun: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   788
                    gear^.Health:= 1000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   789
                    gear^.Radius:= 8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   790
                    gear^.Density:= _0;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   791
                    gear^.Tag:= 0; // sound state: 0 = no sound, 1 = ice beam sound, 2 = idle sound
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   792
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   793
         gtCreeper: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   794
                    // TODO: Finish creeper initialization implementation
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   795
                    gear^.Radius:= cHHRadius;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   796
                    gear^.Elasticity:= _0_35;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   797
                    gear^.Friction:= _0_93;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   798
                    gear^.Density:= _5;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   799
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   800
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   801
                    gear^.ImpactSound:= sndAirMineImpact;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   802
                    gear^.nImpactSounds:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   803
                    gear^.Health:= 30;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   804
                    gear^.Radius:= 8;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   805
                    gear^.Angle:= 175; // Radius at which it will start "seeking". $FFFFFFFF = unlimited. check is skipped.
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   806
                    gear^.Power:= cMaxWindSpeed.QWordValue div 2; // hwFloat converted. 1/2 g default. defines the "seek" speed when a gear is in range.
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   807
                    gear^.Pos:= cMaxWindSpeed.QWordValue * 3 div 2; // air friction. slows it down when not hitting stuff
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   808
                    if gear^.Timer = 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   809
                        gear^.Timer:= 5000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   810
                    gear^.WDTimer:= gear^.Timer
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   811
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   812
         gtMinigun: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   813
                    // Timer. First, it's the timer before shooting. Then it will become the shooting timer and is set to Karma
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   814
                    if gear^.Timer = 0 then
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   815
                        gear^.Timer:= 601;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   816
                    // minigun shooting time. 1 bullet is fired every 50ms
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   817
                    gear^.Karma:= 3451;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   818
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   819
     gtMinigunBullet: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   820
                    gear^.Radius:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   821
                    gear^.Health:= 2;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   822
                    gear^.Karma:= 5; //impact radius
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   823
                    gear^.Pos:= 0; //uses non-global hit order
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   824
                    gear^.Data:= nil;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   825
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   826
            gtSentry: begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   827
                    gear^.Radius:= cHHRadius;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   828
                    gear^.Health:= cSentryHealth;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   829
                    gear^.Friction:= _0_999;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   830
                    gear^.Elasticity:= _0_35;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   831
                    gear^.Density:= _3;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   832
                    gear^.Tag:= 0;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   833
                    gear^.Timer:= 1000;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   834
                    gear^.WDTimer:= 0;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   835
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   836
    gtGenericFaller:begin
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   837
                    gear^.AdvBounce:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   838
                    gear^.Radius:= 1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   839
                    gear^.Elasticity:= _0_9;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   840
                    gear^.Friction:= _0_995;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   841
                    gear^.Density:= _1;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   842
                    end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   843
        end;
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   844
end;
7395
d0d38cd0d27c - Check for harmful gear deletions
unc0rr
parents: 7394
diff changeset
   845
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   846
function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
11203
2f4d0a387a02 Pass overridden uid into AddGear instead
nemo
parents: 11171
diff changeset
   847
begin
2f4d0a387a02 Pass overridden uid into AddGear instead
nemo
parents: 11171
diff changeset
   848
AddGear:= AddGear(X, Y, Kind, State, dX, dY, Timer, 0);
2f4d0a387a02 Pass overridden uid into AddGear instead
nemo
parents: 11171
diff changeset
   849
end;
2f4d0a387a02 Pass overridden uid into AddGear instead
nemo
parents: 11171
diff changeset
   850
function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer, newUid: LongWord): PGear;
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   851
var gear: PGear;
10518
dbbe2f6c0a96 make gear ability to speak somewhat less ironic
sheepluva
parents: 10495
diff changeset
   852
    //c: byte;
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   853
begin
11203
2f4d0a387a02 Pass overridden uid into AddGear instead
nemo
parents: 11171
diff changeset
   854
if newUid = 0 then
2f4d0a387a02 Pass overridden uid into AddGear instead
nemo
parents: 11171
diff changeset
   855
    inc(GCounter);
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7754
diff changeset
   856
7028
0f60591f3a16 old typed const moved to their proper unit
koda
parents: 7010
diff changeset
   857
AddFileLog('AddGear: #' + inttostr(GCounter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   858
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   859
New(gear);
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   860
16049
9be943326d9c Store all snowflakes in a separate array, achieving performance increase of about 10% for the whole engine on winter maps
unC0Rr
parents: 15869
diff changeset
   861
initializeGear(gear, X, Y, Kind, State, dX, dY, Timer, newUid);
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   862
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   863
InsertGearToList(gear);
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   864
AddGear:= gear;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   865
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   866
ScriptCall('onGearAdd', gear^.uid);
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   867
end;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   868
10646
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   869
procedure DeleteGear(Gear: PGear);
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   870
var team: PTeam;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   871
    t,i: Longword;
10874
059a6492176e allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents: 10848
diff changeset
   872
    cakeData: PCakeData;
11043
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   873
    iterator: PGear;
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   874
begin
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   875
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   876
ScriptCall('onGearDelete', gear^.uid);
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   877
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   878
DeleteCI(Gear);
14027
105793e575d6 make firepunch hit moving gears (airmines are not amused)
alfadur
parents: 14009
diff changeset
   879
RemoveFromProximityCache(Gear);
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   880
10634
35d059bd0932 Use FreeAndNil across the board. Even if we are immediately assigning after, probably avoids accidental mistakes. Also free neglected owner tex on shutdown, and delete hog gears using the normal deletion procedure if for any reason they still exist (EndGame call?).
nemo
parents: 10625
diff changeset
   881
FreeAndNilTexture(Gear^.Tex);
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   882
11043
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   883
// remove potential links to this gear
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   884
// currently relevant to: gears linked by hammer
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   885
if (Gear^.Kind = gtHedgehog) or (Gear^.Kind = gtMine) or (Gear^.Kind = gtExplosives) then
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   886
    begin
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   887
    // check all gears for stuff to port through
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   888
    iterator := nil;
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   889
    while true do
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   890
        begin
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   891
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   892
        // iterate through GearsList
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   893
        if iterator = nil then
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   894
            iterator := GearsList
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   895
        else
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   896
            iterator := iterator^.NextGear;
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   897
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   898
        // end of list?
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   899
        if iterator = nil then
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   900
            break;
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   901
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   902
        if iterator^.LinkedGear = Gear then
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   903
            iterator^.LinkedGear:= nil;
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   904
        end;
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   905
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   906
    end;
79a77bef4c61 Hammer had been accessing dangling pointers under particular circumstances (e.g. when hitting a mine/barrel right when it exploded)
sheepluva
parents: 11036
diff changeset
   907
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   908
// make sure that portals have their link removed before deletion
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   909
if (Gear^.Kind = gtPortal) then
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   910
    begin
7272
71df899c4163 Second part of the change. Make collision check use the new mask bit.
nemo
parents: 7176
diff changeset
   911
    if (Gear^.LinkedGear <> nil) then
71df899c4163 Second part of the change. Make collision check use the new mask bit.
nemo
parents: 7176
diff changeset
   912
        if (Gear^.LinkedGear^.LinkedGear = Gear) then
71df899c4163 Second part of the change. Make collision check use the new mask bit.
nemo
parents: 7176
diff changeset
   913
            Gear^.LinkedGear^.LinkedGear:= nil;
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   914
    end
10874
059a6492176e allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents: 10848
diff changeset
   915
else if Gear^.Kind = gtCake then
059a6492176e allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents: 10848
diff changeset
   916
    begin
059a6492176e allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents: 10848
diff changeset
   917
        cakeData:= PCakeData(Gear^.Data);
059a6492176e allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents: 10848
diff changeset
   918
        Dispose(cakeData);
059a6492176e allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents: 10848
diff changeset
   919
        cakeData:= nil;
059a6492176e allow gear specific data (with gear type specific type). applied to cake
sheepluva
parents: 10848
diff changeset
   920
    end
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   921
else if Gear^.Kind = gtHedgehog then
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   922
    (*
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   923
    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
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   924
     if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   925
        begin
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   926
        AttackBar:= 0;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   927
        Gear^.Message:= gmDestroy;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   928
        CurAmmoGear^.Message:= gmDestroy;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   929
        exit
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   930
        end
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   931
    else*)
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   932
        begin
10646
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   933
        if ((CurrentHedgehog = nil) or (Gear <> CurrentHedgehog^.Gear)) or (CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtKamikaze) then
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   934
            Gear^.Hedgehog^.Team^.Clan^.Flawless:= false;
10663
9bbb29d2bd68 remove a not that somehow magically appeared in a prior commit.
nemo
parents: 10646
diff changeset
   935
        if CheckCoordInWater(hwRound(Gear^.X), hwRound(Gear^.Y)) then
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   936
            begin
10646
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   937
            t:= max(Gear^.Damage, Gear^.Health);
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   938
            Gear^.Damage:= t;
13739
bbea77a8dff9 Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents: 13651
diff changeset
   939
            // Display hedgehog damage in water
bbea77a8dff9 Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents: 13651
diff changeset
   940
            spawnHealthTagForHH(Gear, t);
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   941
            end;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   942
10646
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   943
        team:= Gear^.Hedgehog^.Team;
10636
aba9ae27ead0 meh. will persevere. DeleteGear can't call that much stuff...
nemo
parents: 10634
diff changeset
   944
        if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear = Gear) then
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   945
            begin
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   946
            AttackBar:= 0;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   947
            FreeActionsList; // to avoid ThinkThread on drawned gear
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   948
            if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0)
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   949
            and (CurrentHedgehog^.MultiShootAttacks > 0) then
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   950
                OnUsedAmmo(CurrentHedgehog^);
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   951
            end;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   952
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   953
        Gear^.Hedgehog^.Gear:= nil;
10646
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   954
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   955
        if Gear^.Hedgehog^.King then
15231
f783f5d55717 King Mode: Fix whole clan being killed when king died
Wuzzy <Wuzzy2@mail.ru>
parents: 15167
diff changeset
   956
            // If king died, kill the rest of the team
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   957
            begin
15231
f783f5d55717 King Mode: Fix whole clan being killed when king died
Wuzzy <Wuzzy2@mail.ru>
parents: 15167
diff changeset
   958
            with Gear^.Hedgehog^.Team^ do
f783f5d55717 King Mode: Fix whole clan being killed when king died
Wuzzy <Wuzzy2@mail.ru>
parents: 15167
diff changeset
   959
                begin
f783f5d55717 King Mode: Fix whole clan being killed when king died
Wuzzy <Wuzzy2@mail.ru>
parents: 15167
diff changeset
   960
                Gear^.Hedgehog^.Team^.hasKing:= false;
f783f5d55717 King Mode: Fix whole clan being killed when king died
Wuzzy <Wuzzy2@mail.ru>
parents: 15167
diff changeset
   961
                for t:= 0 to cMaxHHIndex do
f783f5d55717 King Mode: Fix whole clan being killed when king died
Wuzzy <Wuzzy2@mail.ru>
parents: 15167
diff changeset
   962
                    if Hedgehogs[t].Gear <> nil then
f783f5d55717 King Mode: Fix whole clan being killed when king died
Wuzzy <Wuzzy2@mail.ru>
parents: 15167
diff changeset
   963
                        Hedgehogs[t].Gear^.Health:= 0
f783f5d55717 King Mode: Fix whole clan being killed when king died
Wuzzy <Wuzzy2@mail.ru>
parents: 15167
diff changeset
   964
                    else if (Hedgehogs[t].GearHidden <> nil) then
f783f5d55717 King Mode: Fix whole clan being killed when king died
Wuzzy <Wuzzy2@mail.ru>
parents: 15167
diff changeset
   965
                        Hedgehogs[t].GearHidden^.Health:= 0  // Hog is still hidden. If tardis should return though, Lua, eh ...
f783f5d55717 King Mode: Fix whole clan being killed when king died
Wuzzy <Wuzzy2@mail.ru>
parents: 15167
diff changeset
   966
                end;
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
   967
            end;
10646
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   968
14637
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   969
        // Update passive status of clan
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   970
        if (not Gear^.Hedgehog^.Team^.Clan^.Passive) then
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   971
            begin
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   972
            Gear^.Hedgehog^.Team^.Clan^.Passive:= true;
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   973
            for i:= 0 to Pred(team^.Clan^.TeamsNumber) do
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   974
                begin
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   975
                with team^.Clan^.Teams[i]^ do
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   976
                    if (not Passive) then
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   977
                        for t:= 0 to cMaxHHIndex do
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   978
                            if (Hedgehogs[t].Gear <> nil) or (Hedgehogs[t].GearHidden <> nil) then
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   979
                                begin
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   980
                                Gear^.Hedgehog^.Team^.Clan^.Passive:= false;
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   981
                                break;
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   982
                                end;
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   983
                if (not Gear^.Hedgehog^.Team^.Clan^.Passive) then
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   984
                    break;
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   985
                end;
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   986
            end;
4638aa2ea8f2 Update clan passive status when team died / got resurrected
Wuzzy <Wuzzy2@mail.ru>
parents: 14419
diff changeset
   987
10646
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   988
        // should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   989
        // same stand for CheckHHDamage
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   990
        if (Gear^.LastDamage <> nil) and (CurrentHedgehog <> nil) then
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   991
            uStats.HedgehogDamaged(Gear, Gear^.LastDamage, 0, true)
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   992
        else if CurrentHedgehog <> nil then
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   993
            uStats.HedgehogDamaged(Gear, CurrentHedgehog, 0, true);
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   994
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   995
        inc(KilledHHs);
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   996
        RecountTeamHealth(team);
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   997
        if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Effects[heResurrectable] <> 0)  and
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   998
        //(Gear^.Hedgehog^.Effects[heResurrectable] = 0) then
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
   999
        (Gear^.Hedgehog^.Team^.Clan <> CurrentHedgehog^.Team^.Clan) then
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
  1000
            with CurrentHedgehog^ do
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
  1001
                begin
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
  1002
                inc(Team^.stats.AIKills);
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
  1003
                FreeAndNilTexture(Team^.AIKillsTex);
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
  1004
                Team^.AIKillsTex := RenderStringTex(ansistring(inttostr(Team^.stats.AIKills)), Team^.Clan^.Color, fnt16);
0be6442946b1 put back the old uteams cleanup, leaks and all, to worry about post-release since my attempt to use DeleteGear was running into the fact that that procedure does way more than just delete a gear. might need an explicit cleanup routine for both to call.
nemo
parents: 10645
diff changeset
  1005
                end
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
  1006
        end;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
  1007
with Gear^ do
7389
15c3fb4882df Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents: 7366
diff changeset
  1008
    begin
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
  1009
    AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
7389
15c3fb4882df Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents: 7366
diff changeset
  1010
    AddRandomness(X.round xor X.frac xor dX.round xor dX.frac xor Y.round xor Y.frac xor dY.round xor dY.frac)
15c3fb4882df Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents: 7366
diff changeset
  1011
    end;
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
  1012
if CurAmmoGear = Gear then
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
  1013
    CurAmmoGear:= nil;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
  1014
if FollowGear = Gear then
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
  1015
    FollowGear:= nil;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
  1016
if lastGearByUID = Gear then
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
  1017
    lastGearByUID := nil;
10638
99975e1860d2 oh, probably need nil checks here too
nemo
parents: 10636
diff changeset
  1018
if (Gear^.Hedgehog = nil) or (Gear^.Hedgehog^.GearHidden <> Gear) then // hidden hedgehogs shouldn't be in the list
10639
992863acb2b7 sheepluva is right
nemo
parents: 10638
diff changeset
  1019
     RemoveGearFromList(Gear)
992863acb2b7 sheepluva is right
nemo
parents: 10638
diff changeset
  1020
else Gear^.Hedgehog^.GearHidden:= nil;
10638
99975e1860d2 oh, probably need nil checks here too
nemo
parents: 10636
diff changeset
  1021
6581
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
  1022
Dispose(Gear)
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
  1023
end;
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
  1024
e510d1245bd7 fix line endings
nemo
parents: 6580
diff changeset
  1025
end.