hedgewars/uVisualGearsList.pas
author unc0rr
Thu, 07 Nov 2013 21:15:36 +0400
branchsdl2transition
changeset 9686 352393fc75be
parent 9287 bb9ad6a5f625
child 9769 5814e0c47c99
permissions -rw-r--r--
Sounds can be heard now
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
     1
(*
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
     3
 * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
     4
 *
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
     8
 *
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    12
 * GNU General Public License for more details.
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    13
 *
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    17
 *)
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    18
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    19
{$INCLUDE "options.inc"}
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    20
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    21
unit uVisualGearsList;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    22
interface
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    23
uses uTypes;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    24
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    25
function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; inline;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    26
function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord): PVisualGear; inline;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    27
function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    28
procedure DeleteVisualGear(Gear: PVisualGear);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    29
function  VisualGearByUID(uid : Longword) : PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    30
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    31
const 
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    32
    cExplFrameTicks = 110;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    33
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    34
var VGCounter: LongWord;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    35
    VisualGearLayers: array[0..6] of PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    36
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    37
implementation
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    38
uses uFloat, uVariables, uConsts, uTextures, uVisualGearsHandlers;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    39
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    40
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; inline;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    41
begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    42
    AddVisualGear:= AddVisualGear(X, Y, Kind, 0, false);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    43
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    44
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    45
function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord): PVisualGear; inline;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    46
begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    47
    AddVisualGear:= AddVisualGear(X, Y, Kind, State, false);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    48
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    49
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    50
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    51
var gear: PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    52
    t: Longword;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    53
    sp: real;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    54
begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    55
AddVisualGear:= nil;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    56
if ((GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) or fastScrolling) and // we are scrolling now
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    57
   ((Kind <> vgtCloud) and (not Critical)) then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    58
       exit;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    59
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    60
if ((cReducedQuality and rqAntiBoom) <> 0) and
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    61
   (not Critical) and
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    62
   (not (Kind in
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    63
   [vgtTeamHealthSorter,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    64
    vgtSmallDamageTag,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    65
    vgtSpeechBubble,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    66
    vgtHealthTag,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    67
    vgtExplosion,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    68
    vgtSmokeTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    69
    vgtEvilTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    70
    vgtNote,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    71
    vgtSmoothWindBar])) then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    72
    
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    73
        exit;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    74
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    75
inc(VGCounter);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    76
New(gear);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    77
FillChar(gear^, sizeof(TVisualGear), 0);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    78
gear^.X:= real(X);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    79
gear^.Y:= real(Y);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    80
gear^.Kind := Kind;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    81
gear^.doStep:= doStepHandlers[Kind];
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    82
gear^.State:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    83
gear^.Tint:= $FFFFFFFF;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    84
gear^.uid:= VGCounter;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    85
gear^.Layer:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    86
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    87
with gear^ do
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    88
    case Kind of
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    89
    vgtFlake:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    90
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    91
                Timer:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    92
                tdX:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    93
                tdY:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    94
                Scale:= 1.0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    95
                if SuddenDeathDmg then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    96
                    begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    97
                    FrameTicks:= random(vobSDFrameTicks);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    98
                    Frame:= random(vobSDFramesCount);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    99
                    end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   100
                else
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   101
                    begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   102
                    FrameTicks:= random(vobFrameTicks);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   103
                    Frame:= random(vobFramesCount);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   104
                    end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   105
                Angle:= random(360);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   106
                dx:= 0.0000038654705 * random(10000);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   107
                dy:= 0.000003506096 * random(7000);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   108
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   109
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   110
                if SuddenDeathDmg then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   111
                    dAngle:= (random(2) * 2 - 1) * (vobSDVelocity + random(vobSDVelocity)) / 1000
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   112
                else
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   113
                    dAngle:= (random(2) * 2 - 1) * (vobVelocity + random(vobVelocity)) / 1000
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   114
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   115
    vgtCloud:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   116
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   117
                Frame:= random(4);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   118
                dx:= 0.5 + 0.1 * random(5); // how much the cloud will be affected by wind
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   119
                timer:= random(4096);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   120
                Scale:= 1.0
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   121
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   122
    vgtExplPart,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   123
    vgtExplPart2:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   124
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   125
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   126
                sp:= 0.001 * (random(95) + 70);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   127
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   128
                dy:= hwFloat2Float(AngleCos(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   129
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   130
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   131
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   132
                    dy := -dy;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   133
                Frame:= 7 - random(3);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   134
                FrameTicks:= cExplFrameTicks
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   135
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   136
        vgtFire:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   137
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   138
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   139
                sp:= 0.001 * (random(85) + 95);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   140
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   141
                dy:= hwFloat2Float(AngleCos(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   142
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   143
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   144
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   145
                    dy := -dy;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   146
                FrameTicks:= 650 + random(250);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   147
                Frame:= random(8)
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   148
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   149
         vgtEgg:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   150
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   151
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   152
                sp:= 0.001 * (random(85) + 95);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   153
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   154
                dy:= hwFloat2Float(AngleCos(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   155
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   156
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   157
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   158
                    dy := -dy;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   159
                FrameTicks:= 650 + random(250);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   160
                Frame:= 1
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   161
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   162
        vgtShell: FrameTicks:= 500;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   163
    vgtSmallDamageTag:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   164
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   165
                gear^.FrameTicks:= 1100
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   166
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   167
    vgtBubble:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   168
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   169
                dx:= 0.0000038654705 * random(10000);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   170
                dy:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   171
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   172
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   173
                FrameTicks:= 250 + random(1751);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   174
                Frame:= random(5)
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   175
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   176
    vgtSteam:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   177
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   178
                dx:= 0.0000038654705 * random(10000);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   179
                dy:= 0.001 * (random(85) + 95);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   180
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   181
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   182
                Frame:= 7 - random(3);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   183
                FrameTicks:= cExplFrameTicks * 2;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   184
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   185
    vgtAmmo:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   186
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   187
                alpha:= 1.0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   188
                scale:= 1.0
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   189
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   190
  vgtSmokeWhite,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   191
  vgtSmoke:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   192
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   193
                Scale:= 1.0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   194
                dx:= 0.0002 * (random(45) + 10);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   195
                dy:= 0.0002 * (random(45) + 10);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   196
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   197
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   198
                Frame:= 7 - random(2);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   199
                FrameTicks:= cExplFrameTicks * 2;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   200
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   201
  vgtDust:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   202
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   203
                dx:= 0.005 * (random(15) + 10);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   204
                dy:= 0.001 * (random(40) + 20);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   205
                if random(2) = 0 then dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   206
                if random(2) = 0 then Tag:= 1
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   207
                else Tag:= -1;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   208
                Frame:= 7 - random(2);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   209
                FrameTicks:= random(20) + 15;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   210
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   211
  vgtSplash:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   212
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   213
                dx:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   214
                dy:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   215
                FrameTicks:= 740;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   216
                Frame:= 19;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   217
                Scale:= 0.75;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   218
                Timer:= 1;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   219
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   220
    vgtDroplet:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   221
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   222
                dx:= 0.001 * (random(180) - 90);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   223
                dy:= -0.001 * (random(160) + 40);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   224
                FrameTicks:= 250 + random(1751);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   225
                Frame:= random(3)
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   226
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   227
   vgtBeeTrace:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   228
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   229
                FrameTicks:= 1000;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   230
                Frame:= random(16);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   231
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   232
    vgtSmokeRing:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   233
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   234
                dx:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   235
                dy:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   236
                FrameTicks:= 600;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   237
                Timer:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   238
                Frame:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   239
                scale:= 0.6;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   240
                alpha:= 1;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   241
                angle:= random(360);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   242
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   243
     vgtFeather:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   244
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   245
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   246
                sp:= 0.001 * (random(85) + 95);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   247
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   248
                dy:= hwFloat2Float(AngleCos(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   249
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   250
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   251
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   252
                    dy := -dy;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   253
                FrameTicks:= 650 + random(250);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   254
                Frame:= 1
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   255
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   256
  vgtHealthTag:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   257
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   258
                Frame:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   259
                Timer:= 1500;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   260
                dY:= -0.08;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   261
                dX:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   262
                //gear^.Z:= 2002;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   263
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   264
  vgtSmokeTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   265
  vgtEvilTrace:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   266
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   267
                gear^.X:= gear^.X - 16;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   268
                gear^.Y:= gear^.Y - 16;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   269
                gear^.State:= 8;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   270
                //gear^.Z:= cSmokeZ
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   271
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   272
vgtBigExplosion:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   273
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   274
                gear^.Angle:= random(360);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   275
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   276
      vgtChunk:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   277
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   278
                gear^.Frame:= random(4);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   279
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   280
                sp:= 0.001 * (random(85) + 47);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   281
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   282
                dy:= hwFloat2Float(AngleCos(t)) * sp * -2;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   283
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   284
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   285
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   286
      vgtNote: 
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   287
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   288
                dx:= 0.005 * (random(15) + 10);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   289
                dy:= -0.001 * (random(40) + 20);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   290
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   291
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   292
                Frame:= random(4);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   293
                FrameTicks:= random(2000) + 1500;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   294
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   295
  vgtBulletHit:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   296
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   297
                dx:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   298
                dy:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   299
                FrameTicks:= 350;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   300
                Frame:= 7;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   301
                Angle:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   302
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   303
vgtSmoothWindBar: 
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   304
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   305
                Angle:= hwFloat2Float(cMaxWindSpeed)*2 / 1440; // seems rate below is supposed to change wind bar at 1px per 10ms. Max time, 1440ms. This tries to match the rate of change
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   306
                Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   307
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   308
 vgtStraightShot:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   309
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   310
                Angle:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   311
                Scale:= 1.0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   312
                dx:= 0.001 * random(45);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   313
                dy:= 0.001 * (random(20) + 25);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   314
                State:= ord(sprHealth);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   315
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   316
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   317
                Frame:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   318
                FrameTicks:= random(750) + 1250;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   319
                State:= ord(sprSnowDust);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   320
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   321
        end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   322
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   323
if State <> 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   324
    gear^.State:= State;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   325
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   326
case Gear^.Kind of
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   327
    vgtFlake: if cFlattenFlakes then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   328
        gear^.Layer:= 0
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   329
              else if random(3) = 0 then 
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   330
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   331
                  gear^.Scale:= 0.5;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   332
                  gear^.Layer:= 0   // 33% - far back
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   333
                  end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   334
              else if random(3) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   335
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   336
                  gear^.Scale:= 0.8;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   337
                  gear^.Layer:= 4   // 22% - mid-distance
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   338
                  end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   339
              else if random(3) <> 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   340
                  gear^.Layer:= 5  // 30% - just behind land
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   341
              else if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   342
                  gear^.Layer:= 6   // 7% - just in front of land
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   343
              else
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   344
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   345
                  gear^.Scale:= 1.5;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   346
                  gear^.Layer:= 2;  // 7% - close up
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   347
                  end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   348
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   349
    vgtCloud: if cFlattenClouds then gear^.Layer:= 5
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   350
              else if random(3) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   351
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   352
                  gear^.Scale:= 0.25;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   353
                  gear^.Layer:= 0
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   354
                  end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   355
              else if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   356
                  gear^.Layer:= 5
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   357
              else
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   358
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   359
                  gear^.Scale:= 0.4;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   360
                  gear^.Layer:= 4
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   361
                  end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   362
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   363
    // 0: this layer is very distant in the background when in stereo
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   364
    vgtTeamHealthSorter,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   365
    vgtSmoothWindBar: gear^.Layer:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   366
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   367
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   368
    // 1: this layer is on the land level (which is close but behind the screen plane) when stereo
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   369
    vgtSmokeTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   370
    vgtEvilTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   371
    vgtLineTrail,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   372
    vgtSmoke,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   373
    vgtSmokeWhite,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   374
    vgtDust,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   375
    vgtFire,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   376
    vgtSplash,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   377
    vgtDroplet,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   378
    vgtBubble: gear^.Layer:= 1;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   379
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   380
    // 3: this layer is on the screen plane (depth = 0) when stereo
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   381
    vgtSpeechBubble,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   382
    vgtSmallDamageTag,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   383
    vgtHealthTag,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   384
    vgtStraightShot,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   385
    vgtChunk: gear^.Layer:= 3;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   386
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   387
    // 2: this layer is outside the screen when stereo
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   388
    vgtExplosion,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   389
    vgtBigExplosion,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   390
    vgtExplPart,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   391
    vgtExplPart2,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   392
    vgtSteam,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   393
    vgtAmmo,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   394
    vgtShell,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   395
    vgtFeather,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   396
    vgtEgg,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   397
    vgtBeeTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   398
    vgtSmokeRing,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   399
    vgtNote,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   400
    vgtBulletHit,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   401
    vgtCircle: gear^.Layer:= 2
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   402
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   403
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   404
if VisualGearLayers[gear^.Layer] <> nil then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   405
    begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   406
    VisualGearLayers[gear^.Layer]^.PrevGear:= gear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   407
    gear^.NextGear:= VisualGearLayers[gear^.Layer]
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   408
    end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   409
VisualGearLayers[gear^.Layer]:= gear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   410
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   411
AddVisualGear:= gear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   412
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   413
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   414
procedure DeleteVisualGear(Gear: PVisualGear);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   415
begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   416
    FreeTexture(Gear^.Tex);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   417
    Gear^.Tex:= nil;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   418
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   419
    if Gear^.NextGear <> nil then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   420
        Gear^.NextGear^.PrevGear:= Gear^.PrevGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   421
    if Gear^.PrevGear <> nil then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   422
        Gear^.PrevGear^.NextGear:= Gear^.NextGear
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   423
    else
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   424
        VisualGearLayers[Gear^.Layer]:= Gear^.NextGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   425
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   426
    if lastVisualGearByUID = Gear then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   427
        lastVisualGearByUID:= nil;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   428
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   429
    Dispose(Gear);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   430
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   431
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   432
function  VisualGearByUID(uid : Longword) : PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   433
var vg: PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   434
    i: LongWord;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   435
begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   436
VisualGearByUID:= nil;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   437
if uid = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   438
    exit;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   439
if (lastVisualGearByUID <> nil) and (lastVisualGearByUID^.uid = uid) then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   440
    begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   441
    VisualGearByUID:= lastVisualGearByUID;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   442
    exit
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   443
    end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   444
// search in an order that is more likely to return layers they actually use.  Could perhaps track statistically AddVisualGear in uScript, since that is most likely the ones they want
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   445
for i:= 2 to 5 do
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   446
    begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   447
    vg:= VisualGearLayers[i mod 4];
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   448
    while vg <> nil do
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   449
        begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   450
        if vg^.uid = uid then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   451
            begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   452
            lastVisualGearByUID:= vg;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   453
            VisualGearByUID:= vg;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   454
            exit
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   455
            end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   456
        vg:= vg^.NextGear
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   457
        end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   458
    end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   459
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   460
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   461
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   462
end.