hedgewars/uVisualGearsList.pas
author antonc27 <antonc27@mail.ru>
Fri, 30 Oct 2015 03:14:39 +0100
branchios-revival
changeset 11261 f1b75bf7c4f2
parent 11046 47a8c19ecb60
child 11862 cb137eb71556
permissions -rw-r--r--
- Rus localization for Target Practices
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
11046
47a8c19ecb60 more copyright fixes
sheepluva
parents: 10876
diff changeset
     3
 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
9287
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
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: 10015
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
9287
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;
9769
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9287
diff changeset
    27
function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear; inline;
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9287
diff changeset
    28
function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean; Layer: LongInt): PVisualGear;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    29
procedure DeleteVisualGear(Gear: PVisualGear);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    30
function  VisualGearByUID(uid : Longword) : PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    31
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9998 9960
diff changeset
    32
const
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    33
    cExplFrameTicks = 110;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    34
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    35
var VGCounter: LongWord;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    36
    VisualGearLayers: array[0..6] of PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    37
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    38
implementation
10354
56bd029245fc WIP: weSea tweaks, functional and visual
sheepluva
parents: 10352
diff changeset
    39
uses uCollisions, uFloat, uVariables, uConsts, uTextures, uVisualGearsHandlers;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    40
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    41
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; inline;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    42
begin
10352
2af2309207b0 simplify some code
sheepluva
parents: 10251
diff changeset
    43
    // adjust some visual gear types if underwater
10354
56bd029245fc WIP: weSea tweaks, functional and visual
sheepluva
parents: 10352
diff changeset
    44
    if CheckCoordInWater(X, Y) and ((Kind = vgtBeeTrace) or (Kind = vgtSmokeTrace) or (Kind = vgtEvilTrace)) then
10352
2af2309207b0 simplify some code
sheepluva
parents: 10251
diff changeset
    45
        Kind:= vgtBubble;
2af2309207b0 simplify some code
sheepluva
parents: 10251
diff changeset
    46
9769
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9287
diff changeset
    47
    AddVisualGear:= AddVisualGear(X, Y, Kind, 0, false, -1);
9287
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): PVisualGear; inline;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    51
begin
9769
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9287
diff changeset
    52
    AddVisualGear:= AddVisualGear(X, Y, Kind, State, false, -1);
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    53
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    54
9769
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9287
diff changeset
    55
function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean): PVisualGear; inline;
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9287
diff changeset
    56
begin
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9287
diff changeset
    57
    AddVisualGear:= AddVisualGear(X, Y, Kind, State, Critical, -1);
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9287
diff changeset
    58
end;
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9287
diff changeset
    59
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9287
diff changeset
    60
function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean; Layer: LongInt): PVisualGear;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    61
var gear: PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    62
    t: Longword;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    63
    sp: real;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    64
begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    65
AddVisualGear:= nil;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    66
if ((GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) or fastScrolling) and // we are scrolling now
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    67
   ((Kind <> vgtCloud) and (not Critical)) then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    68
       exit;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    69
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    70
if ((cReducedQuality and rqAntiBoom) <> 0) and
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    71
   (not Critical) and
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    72
   (not (Kind in
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    73
   [vgtTeamHealthSorter,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    74
    vgtSmallDamageTag,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    75
    vgtSpeechBubble,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    76
    vgtHealthTag,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    77
    vgtExplosion,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    78
    vgtSmokeTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    79
    vgtEvilTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    80
    vgtNote,
10876
d012728b89b9 draw birdy's feathers in low quality mode too
sheepluva
parents: 10634
diff changeset
    81
    vgtFeather,
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    82
    vgtSmoothWindBar])) then
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9998 9960
diff changeset
    83
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    84
        exit;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    85
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    86
inc(VGCounter);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    87
New(gear);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    88
FillChar(gear^, sizeof(TVisualGear), 0);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    89
gear^.X:= real(X);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    90
gear^.Y:= real(Y);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    91
gear^.Kind := Kind;
9960
fac73b8a52d3 Fix doStepHandlers confusion
unc0rr
parents: 9769
diff changeset
    92
gear^.doStep:= doStepVGHandlers[Kind];
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    93
gear^.Tint:= $FFFFFFFF;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    94
gear^.uid:= VGCounter;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    95
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    96
with gear^ do
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    97
    case Kind of
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    98
    vgtFlake:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    99
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   100
                Timer:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   101
                tdX:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   102
                tdY:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   103
                Scale:= 1.0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   104
                if SuddenDeathDmg then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   105
                    begin
10625
125e120165aa flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents: 10354
diff changeset
   106
                    if vobSDFrameTicks > 0 then
125e120165aa flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents: 10354
diff changeset
   107
                        FrameTicks:= random(vobSDFrameTicks);
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   108
                    Frame:= random(vobSDFramesCount);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   109
                    end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   110
                else
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   111
                    begin
10625
125e120165aa flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents: 10354
diff changeset
   112
                    if vobFrameTicks > 0 then
125e120165aa flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents: 10354
diff changeset
   113
                        FrameTicks:= random(vobFrameTicks);
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   114
                    Frame:= random(vobFramesCount);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   115
                    end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   116
                Angle:= random(360);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   117
                dx:= 0.0000038654705 * random(10000);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   118
                dy:= 0.000003506096 * random(7000);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   119
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   120
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   121
                if SuddenDeathDmg then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   122
                    dAngle:= (random(2) * 2 - 1) * (vobSDVelocity + random(vobSDVelocity)) / 1000
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   123
                else
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   124
                    dAngle:= (random(2) * 2 - 1) * (vobVelocity + random(vobVelocity)) / 1000
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   125
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   126
    vgtCloud:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   127
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   128
                Frame:= random(4);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   129
                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
   130
                timer:= random(4096);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   131
                Scale:= 1.0
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   132
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   133
    vgtExplPart,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   134
    vgtExplPart2:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   135
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   136
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   137
                sp:= 0.001 * (random(95) + 70);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   138
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   139
                dy:= hwFloat2Float(AngleCos(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   140
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   141
                    dx := -dx;
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
                    dy := -dy;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   144
                Frame:= 7 - random(3);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   145
                FrameTicks:= cExplFrameTicks
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   146
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   147
        vgtFire:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   148
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   149
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   150
                sp:= 0.001 * (random(85) + 95);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   151
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   152
                dy:= hwFloat2Float(AngleCos(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   153
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   154
                    dx := -dx;
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
                    dy := -dy;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   157
                FrameTicks:= 650 + random(250);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   158
                Frame:= random(8)
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   159
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   160
         vgtEgg:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   161
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   162
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   163
                sp:= 0.001 * (random(85) + 95);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   164
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   165
                dy:= hwFloat2Float(AngleCos(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   166
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   167
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   168
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   169
                    dy := -dy;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   170
                FrameTicks:= 650 + random(250);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   171
                Frame:= 1
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   172
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   173
        vgtShell: FrameTicks:= 500;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   174
    vgtSmallDamageTag:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   175
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   176
                gear^.FrameTicks:= 1100
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   177
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   178
    vgtBubble:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   179
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   180
                dx:= 0.0000038654705 * random(10000);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   181
                dy:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   182
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   183
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   184
                FrameTicks:= 250 + random(1751);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   185
                Frame:= random(5)
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   186
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   187
    vgtSteam:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   188
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   189
                dx:= 0.0000038654705 * random(10000);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   190
                dy:= 0.001 * (random(85) + 95);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   191
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   192
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   193
                Frame:= 7 - random(3);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   194
                FrameTicks:= cExplFrameTicks * 2;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   195
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   196
    vgtAmmo:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   197
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   198
                alpha:= 1.0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   199
                scale:= 1.0
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   200
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   201
  vgtSmokeWhite,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   202
  vgtSmoke:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   203
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   204
                Scale:= 1.0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   205
                dx:= 0.0002 * (random(45) + 10);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   206
                dy:= 0.0002 * (random(45) + 10);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   207
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   208
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   209
                Frame:= 7 - random(2);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   210
                FrameTicks:= cExplFrameTicks * 2;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   211
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   212
  vgtDust:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   213
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   214
                dx:= 0.005 * (random(15) + 10);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   215
                dy:= 0.001 * (random(40) + 20);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   216
                if random(2) = 0 then dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   217
                if random(2) = 0 then Tag:= 1
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   218
                else Tag:= -1;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   219
                Frame:= 7 - random(2);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   220
                FrameTicks:= random(20) + 15;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   221
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   222
  vgtSplash:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   223
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   224
                dx:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   225
                dy:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   226
                FrameTicks:= 740;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   227
                Frame:= 19;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   228
                Scale:= 0.75;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   229
                Timer:= 1;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   230
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   231
    vgtDroplet:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   232
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   233
                dx:= 0.001 * (random(180) - 90);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   234
                dy:= -0.001 * (random(160) + 40);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   235
                FrameTicks:= 250 + random(1751);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   236
                Frame:= random(3)
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   237
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   238
   vgtBeeTrace:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   239
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   240
                FrameTicks:= 1000;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   241
                Frame:= random(16);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   242
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   243
    vgtSmokeRing:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   244
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   245
                dx:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   246
                dy:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   247
                FrameTicks:= 600;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   248
                Timer:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   249
                Frame:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   250
                scale:= 0.6;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   251
                alpha:= 1;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   252
                angle:= random(360);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   253
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   254
     vgtFeather:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   255
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   256
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   257
                sp:= 0.001 * (random(85) + 95);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   258
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   259
                dy:= hwFloat2Float(AngleCos(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   260
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   261
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   262
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   263
                    dy := -dy;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   264
                FrameTicks:= 650 + random(250);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   265
                Frame:= 1
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   266
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   267
  vgtHealthTag:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   268
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   269
                Frame:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   270
                Timer:= 1500;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   271
                dY:= -0.08;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   272
                dX:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   273
                //gear^.Z:= 2002;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   274
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   275
  vgtSmokeTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   276
  vgtEvilTrace:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   277
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   278
                gear^.X:= gear^.X - 16;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   279
                gear^.Y:= gear^.Y - 16;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   280
                gear^.State:= 8;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   281
                //gear^.Z:= cSmokeZ
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   282
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   283
vgtBigExplosion:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   284
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   285
                gear^.Angle:= random(360);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   286
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   287
      vgtChunk:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   288
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   289
                gear^.Frame:= random(4);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   290
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   291
                sp:= 0.001 * (random(85) + 47);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   292
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   293
                dy:= hwFloat2Float(AngleCos(t)) * sp * -2;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   294
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   295
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   296
                end;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9998 9960
diff changeset
   297
      vgtNote:
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   298
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   299
                dx:= 0.005 * (random(15) + 10);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   300
                dy:= -0.001 * (random(40) + 20);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   301
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   302
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   303
                Frame:= random(4);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   304
                FrameTicks:= random(2000) + 1500;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   305
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   306
  vgtBulletHit:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   307
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   308
                dx:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   309
                dy:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   310
                FrameTicks:= 350;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   311
                Frame:= 7;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   312
                Angle:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   313
                end;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9998 9960
diff changeset
   314
vgtSmoothWindBar:
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   315
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   316
                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
   317
                Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   318
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   319
 vgtStraightShot:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   320
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   321
                Angle:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   322
                Scale:= 1.0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   323
                dx:= 0.001 * random(45);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   324
                dy:= 0.001 * (random(20) + 25);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   325
                State:= ord(sprHealth);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   326
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   327
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   328
                Frame:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   329
                FrameTicks:= random(750) + 1250;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   330
                State:= ord(sprSnowDust);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   331
                end;
10251
a3b42e81803c collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents: 10193
diff changeset
   332
  vgtNoPlaceWarn:
a3b42e81803c collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents: 10193
diff changeset
   333
                begin
a3b42e81803c collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents: 10193
diff changeset
   334
                FrameTicks:= 2000;
a3b42e81803c collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents: 10193
diff changeset
   335
                Tint:= $FF0000FF;
a3b42e81803c collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents: 10193
diff changeset
   336
                Scale:= 1.0;
a3b42e81803c collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents: 10193
diff changeset
   337
                end;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   338
        end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   339
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   340
if State <> 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   341
    gear^.State:= State;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   342
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   343
case Gear^.Kind of
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   344
    vgtFlake: if cFlattenFlakes then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   345
        gear^.Layer:= 0
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9998 9960
diff changeset
   346
              else if random(3) = 0 then
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   347
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   348
                  gear^.Scale:= 0.5;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   349
                  gear^.Layer:= 0   // 33% - far back
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   350
                  end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   351
              else if random(3) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   352
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   353
                  gear^.Scale:= 0.8;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   354
                  gear^.Layer:= 4   // 22% - mid-distance
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   355
                  end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   356
              else if random(3) <> 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   357
                  gear^.Layer:= 5  // 30% - just behind land
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   358
              else if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   359
                  gear^.Layer:= 6   // 7% - just in front of land
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   360
              else
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   361
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   362
                  gear^.Scale:= 1.5;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   363
                  gear^.Layer:= 2;  // 7% - close up
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   364
                  end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   365
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   366
    vgtCloud: if cFlattenClouds then gear^.Layer:= 5
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   367
              else if random(3) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   368
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   369
                  gear^.Scale:= 0.25;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   370
                  gear^.Layer:= 0
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   371
                  end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   372
              else if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   373
                  gear^.Layer:= 5
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   374
              else
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   375
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   376
                  gear^.Scale:= 0.4;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   377
                  gear^.Layer:= 4
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   378
                  end;
10251
a3b42e81803c collision indicator on failed girder placement (especially useful with rubberband I guess). still needs some tweaks but I am going to bed now :P
sheepluva
parents: 10193
diff changeset
   379
    vgtNoPlaceWarn: gear^.Layer:= 6;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   380
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   381
    // 0: this layer is very distant in the background when in stereo
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   382
    vgtTeamHealthSorter,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   383
    vgtSmoothWindBar: gear^.Layer:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   384
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   385
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   386
    // 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
   387
    vgtSmokeTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   388
    vgtEvilTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   389
    vgtLineTrail,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   390
    vgtSmoke,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   391
    vgtSmokeWhite,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   392
    vgtDust,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   393
    vgtFire,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   394
    vgtSplash,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   395
    vgtDroplet,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   396
    vgtBubble: gear^.Layer:= 1;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   397
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   398
    // 3: this layer is on the screen plane (depth = 0) when stereo
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   399
    vgtSpeechBubble,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   400
    vgtSmallDamageTag,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   401
    vgtHealthTag,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   402
    vgtStraightShot,
10876
d012728b89b9 draw birdy's feathers in low quality mode too
sheepluva
parents: 10634
diff changeset
   403
    vgtFeather,
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   404
    vgtChunk: gear^.Layer:= 3;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   405
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   406
    // 2: this layer is outside the screen when stereo
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   407
    vgtExplosion,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   408
    vgtBigExplosion,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   409
    vgtExplPart,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   410
    vgtExplPart2,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   411
    vgtSteam,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   412
    vgtAmmo,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   413
    vgtShell,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   414
    vgtEgg,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   415
    vgtBeeTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   416
    vgtSmokeRing,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   417
    vgtNote,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   418
    vgtBulletHit,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   419
    vgtCircle: gear^.Layer:= 2
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   420
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   421
9769
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9287
diff changeset
   422
if Layer <> -1 then gear^.Layer:= Layer;
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9287
diff changeset
   423
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   424
if VisualGearLayers[gear^.Layer] <> nil then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   425
    begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   426
    VisualGearLayers[gear^.Layer]^.PrevGear:= gear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   427
    gear^.NextGear:= VisualGearLayers[gear^.Layer]
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   428
    end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   429
VisualGearLayers[gear^.Layer]:= gear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   430
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   431
AddVisualGear:= gear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   432
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   433
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   434
procedure DeleteVisualGear(Gear: PVisualGear);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   435
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
   436
    FreeAndNilTexture(Gear^.Tex);
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   437
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   438
    if Gear^.NextGear <> nil then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   439
        Gear^.NextGear^.PrevGear:= Gear^.PrevGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   440
    if Gear^.PrevGear <> nil then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   441
        Gear^.PrevGear^.NextGear:= Gear^.NextGear
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   442
    else
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   443
        VisualGearLayers[Gear^.Layer]:= Gear^.NextGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   444
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   445
    if lastVisualGearByUID = Gear then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   446
        lastVisualGearByUID:= nil;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   447
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   448
    Dispose(Gear);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   449
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   450
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   451
function  VisualGearByUID(uid : Longword) : PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   452
var vg: PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   453
    i: LongWord;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   454
begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   455
VisualGearByUID:= nil;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   456
if uid = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   457
    exit;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   458
if (lastVisualGearByUID <> nil) and (lastVisualGearByUID^.uid = uid) then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   459
    begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   460
    VisualGearByUID:= lastVisualGearByUID;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   461
    exit
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   462
    end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   463
// 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
   464
for i:= 2 to 5 do
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   465
    begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   466
    vg:= VisualGearLayers[i mod 4];
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   467
    while vg <> nil do
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   468
        begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   469
        if vg^.uid = uid then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   470
            begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   471
            lastVisualGearByUID:= vg;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   472
            VisualGearByUID:= vg;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   473
            exit
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   474
            end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   475
        vg:= vg^.NextGear
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   476
        end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   477
    end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   478
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   479
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   480
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   481
end.