hedgewars/uVisualGearsList.pas
author S.D.
Fri, 23 Sep 2022 02:21:21 +0300
changeset 15875 d7b53d08ad9c
parent 15773 da1bb21e6fbf
child 15900 128ace913837
permissions -rw-r--r--
Add FastForward/StopFastForward (/ff hh:mm:ss, /sff) chat commands to fast forward to a specific timestamp in a demo
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;
14584
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
    36
    VisualGearLayersStart: array[0..6] of PVisualGear;
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
    37
    VisualGearLayersEnd: array[0..6] of PVisualGear;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    38
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    39
implementation
11880
2eac7a96b342 Lua API: Add GetVisualGearType, onVisualGearAdd, onVisualGearDelete
Wuzzy <almikes@aol.com>
parents: 11857
diff changeset
    40
uses uCollisions, uFloat, uVariables, uConsts, uTextures, uVisualGearsHandlers, uScript;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    41
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    42
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear; inline;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    43
begin
10352
2af2309207b0 simplify some code
sheepluva
parents: 10251
diff changeset
    44
    // adjust some visual gear types if underwater
10354
56bd029245fc WIP: weSea tweaks, functional and visual
sheepluva
parents: 10352
diff changeset
    45
    if CheckCoordInWater(X, Y) and ((Kind = vgtBeeTrace) or (Kind = vgtSmokeTrace) or (Kind = vgtEvilTrace)) then
10352
2af2309207b0 simplify some code
sheepluva
parents: 10251
diff changeset
    46
        Kind:= vgtBubble;
2af2309207b0 simplify some code
sheepluva
parents: 10251
diff changeset
    47
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
    48
    AddVisualGear:= AddVisualGear(X, Y, Kind, 0, false, -1);
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    49
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    50
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    51
function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord): PVisualGear; inline;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    52
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
    53
    AddVisualGear:= AddVisualGear(X, Y, Kind, State, false, -1);
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    54
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    55
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
    56
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
    57
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
    58
    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
    59
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
    60
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
    61
function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord; Critical: Boolean; Layer: LongInt): PVisualGear;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    62
var gear: PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    63
    t: Longword;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    64
    sp: real;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    65
begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    66
AddVisualGear:= nil;
15875
d7b53d08ad9c Add FastForward/StopFastForward (/ff hh:mm:ss, /sff) chat commands to fast forward to a specific timestamp in a demo
S.D.
parents: 15773
diff changeset
    67
if fastUntilLag and (not Critical) then
d7b53d08ad9c Add FastForward/StopFastForward (/ff hh:mm:ss, /sff) chat commands to fast forward to a specific timestamp in a demo
S.D.
parents: 15773
diff changeset
    68
   exit;
13040
a87d3119c962 VideoRec: Fix many effects not being recorded
Wuzzy <Wuzzy2@mail.ru>
parents: 12110
diff changeset
    69
if (GameType <> gmtRecord) and
a87d3119c962 VideoRec: Fix many effects not being recorded
Wuzzy <Wuzzy2@mail.ru>
parents: 12110
diff changeset
    70
   (((GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) or fastScrolling) and // we are scrolling now
13329
e8801220c13f minor simplification of conditions for not spawning a visual gear - also allows lua to spawn clouds critically or non-critically. We probably shouldn't even exempt clouds from this, and just spawn them once synced, but, eh, probably isn't a significant hit since sheepluva made the motion more efficient.
nemo
parents: 13040
diff changeset
    71
   (not Critical)) then
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    72
       exit;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    73
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    74
if ((cReducedQuality and rqAntiBoom) <> 0) and
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    75
   (not Critical) and
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    76
   (not (Kind in
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    77
   [vgtTeamHealthSorter,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    78
    vgtSmallDamageTag,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    79
    vgtSpeechBubble,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    80
    vgtHealthTag,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    81
    vgtExplosion,
15097
260e96addf92 Allow vgtBigExplosion in low quality mode
Wuzzy <Wuzzy2@mail.ru>
parents: 14657
diff changeset
    82
    vgtBigExplosion,
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    83
    vgtSmokeTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    84
    vgtEvilTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    85
    vgtNote,
10876
d012728b89b9 draw birdy's feathers in low quality mode too
sheepluva
parents: 10634
diff changeset
    86
    vgtFeather,
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    87
    vgtSmoothWindBar])) then
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9998 9960
diff changeset
    88
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    89
        exit;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    90
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    91
inc(VGCounter);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    92
New(gear);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    93
FillChar(gear^, sizeof(TVisualGear), 0);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    94
gear^.X:= real(X);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    95
gear^.Y:= real(Y);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    96
gear^.Kind := Kind;
9960
fac73b8a52d3 Fix doStepHandlers confusion
unc0rr
parents: 9769
diff changeset
    97
gear^.doStep:= doStepVGHandlers[Kind];
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    98
gear^.Tint:= $FFFFFFFF;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
    99
gear^.uid:= VGCounter;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   100
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   101
with gear^ do
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   102
    case Kind of
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   103
    vgtFlake:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   104
                begin
15586
19c85b010144 Add fade-in effect when flake appears at top
Wuzzy <Wuzzy2@mail.ru>
parents: 15097
diff changeset
   105
                State:= 0;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   106
                Timer:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   107
                tdX:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   108
                tdY:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   109
                Scale:= 1.0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   110
                if SuddenDeathDmg then
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 vobSDFrameTicks > 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(vobSDFrameTicks);
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   114
                    Frame:= random(vobSDFramesCount);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   115
                    end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   116
                else
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   117
                    begin
10625
125e120165aa flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents: 10354
diff changeset
   118
                    if vobFrameTicks > 0 then
125e120165aa flake FrameTicks value of 0 now indicades that the frame should not be changed
sheepluva
parents: 10354
diff changeset
   119
                        FrameTicks:= random(vobFrameTicks);
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   120
                    Frame:= random(vobFramesCount);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   121
                    end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   122
                Angle:= random(360);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   123
                dx:= 0.0000038654705 * random(10000);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   124
                dy:= 0.000003506096 * random(7000);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   125
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   126
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   127
                if SuddenDeathDmg then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   128
                    dAngle:= (random(2) * 2 - 1) * (vobSDVelocity + random(vobSDVelocity)) / 1000
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   129
                else
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   130
                    dAngle:= (random(2) * 2 - 1) * (vobVelocity + random(vobVelocity)) / 1000
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   131
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   132
    vgtCloud:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   133
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   134
                Frame:= random(4);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   135
                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
   136
                timer:= random(4096);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   137
                Scale:= 1.0
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   138
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   139
    vgtExplPart,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   140
    vgtExplPart2:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   141
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   142
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   143
                sp:= 0.001 * (random(95) + 70);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   144
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   145
                dy:= hwFloat2Float(AngleCos(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   146
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   147
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   148
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   149
                    dy := -dy;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   150
                Frame:= 7 - random(3);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   151
                FrameTicks:= cExplFrameTicks
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   152
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   153
        vgtFire:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   154
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   155
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   156
                sp:= 0.001 * (random(85) + 95);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   157
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   158
                dy:= hwFloat2Float(AngleCos(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   159
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   160
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   161
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   162
                    dy := -dy;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   163
                FrameTicks:= 650 + random(250);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   164
                Frame:= random(8)
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   165
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   166
         vgtEgg:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   167
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   168
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   169
                sp:= 0.001 * (random(85) + 95);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   170
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   171
                dy:= hwFloat2Float(AngleCos(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   172
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   173
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   174
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   175
                    dy := -dy;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   176
                FrameTicks:= 650 + random(250);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   177
                Frame:= 1
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   178
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   179
        vgtShell: FrameTicks:= 500;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   180
    vgtSmallDamageTag:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   181
                begin
15773
da1bb21e6fbf Teach vgtSmallDamageTag to use dX, dY and screen coords (Frame<>0)
Wuzzy <Wuzzy2@mail.ru>
parents: 15586
diff changeset
   182
                gear^.Frame:= 0;
da1bb21e6fbf Teach vgtSmallDamageTag to use dX, dY and screen coords (Frame<>0)
Wuzzy <Wuzzy2@mail.ru>
parents: 15586
diff changeset
   183
                gear^.FrameTicks:= 1100;
da1bb21e6fbf Teach vgtSmallDamageTag to use dX, dY and screen coords (Frame<>0)
Wuzzy <Wuzzy2@mail.ru>
parents: 15586
diff changeset
   184
                gear^.dX:= 0;
da1bb21e6fbf Teach vgtSmallDamageTag to use dX, dY and screen coords (Frame<>0)
Wuzzy <Wuzzy2@mail.ru>
parents: 15586
diff changeset
   185
                gear^.dY:= -0.02;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   186
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   187
    vgtBubble:
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;
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
                FrameTicks:= 250 + random(1751);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   194
                Frame:= random(5)
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   195
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   196
    vgtSteam:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   197
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   198
                dx:= 0.0000038654705 * random(10000);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   199
                dy:= 0.001 * (random(85) + 95);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   200
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   201
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   202
                Frame:= 7 - random(3);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   203
                FrameTicks:= cExplFrameTicks * 2;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   204
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   205
    vgtAmmo:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   206
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   207
                alpha:= 1.0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   208
                scale:= 1.0
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   209
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   210
  vgtSmokeWhite,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   211
  vgtSmoke:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   212
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   213
                Scale:= 1.0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   214
                dx:= 0.0002 * (random(45) + 10);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   215
                dy:= 0.0002 * (random(45) + 10);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   216
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   217
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   218
                Frame:= 7 - random(2);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   219
                FrameTicks:= cExplFrameTicks * 2;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   220
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   221
  vgtDust:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   222
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   223
                dx:= 0.005 * (random(15) + 10);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   224
                dy:= 0.001 * (random(40) + 20);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   225
                if random(2) = 0 then dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   226
                if random(2) = 0 then Tag:= 1
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   227
                else Tag:= -1;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   228
                Frame:= 7 - random(2);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   229
                FrameTicks:= random(20) + 15;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   230
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   231
  vgtSplash:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   232
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   233
                dx:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   234
                dy:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   235
                FrameTicks:= 740;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   236
                Frame:= 19;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   237
                Scale:= 0.75;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   238
                Timer:= 1;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   239
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   240
    vgtDroplet:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   241
                begin
11857
cb137eb71556 pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents: 11046
diff changeset
   242
                // => min speed ~ 0.098, max speed ~ 0.218, speed range ~ 0.120
cb137eb71556 pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents: 11046
diff changeset
   243
                // => min angle(4096) ~ 129, max angle ~ 1919, angle range ~ 1790
cb137eb71556 pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents: 11046
diff changeset
   244
                dx:= 0.001 * (98 + random(121)); // speed
cb137eb71556 pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents: 11046
diff changeset
   245
                Frame:= 129 + random(1791); // angle
cb137eb71556 pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents: 11046
diff changeset
   246
                dy:= -dx * hwFloat2Float(AngleSin(Frame));
cb137eb71556 pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents: 11046
diff changeset
   247
                // divide by 2 to create an eliptic shape
cb137eb71556 pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
sheepluva
parents: 11046
diff changeset
   248
                dx:=  dx * hwFloat2Float(AngleCos(Frame)) / 2;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   249
                FrameTicks:= 250 + random(1751);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   250
                Frame:= random(3)
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   251
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   252
   vgtBeeTrace:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   253
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   254
                FrameTicks:= 1000;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   255
                Frame:= random(16);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   256
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   257
    vgtSmokeRing:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   258
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   259
                dx:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   260
                dy:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   261
                FrameTicks:= 600;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   262
                Timer:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   263
                Frame:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   264
                scale:= 0.6;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   265
                alpha:= 1;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   266
                angle:= random(360);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   267
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   268
     vgtFeather:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   269
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   270
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   271
                sp:= 0.001 * (random(85) + 95);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   272
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   273
                dy:= hwFloat2Float(AngleCos(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   274
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   275
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   276
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   277
                    dy := -dy;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   278
                FrameTicks:= 650 + random(250);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   279
                Frame:= 1
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   280
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   281
  vgtHealthTag:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   282
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   283
                Frame:= 0;
14657
b390479f24c1 vgtHealthTag now supports setting FrameTicks <> 0 to disable automatic water handling
Wuzzy <Wuzzy2@mail.ru>
parents: 14584
diff changeset
   284
                FrameTicks:= 0;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   285
                Timer:= 1500;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   286
                dY:= -0.08;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   287
                dX:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   288
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   289
  vgtSmokeTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   290
  vgtEvilTrace:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   291
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   292
                gear^.X:= gear^.X - 16;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   293
                gear^.Y:= gear^.Y - 16;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   294
                gear^.State:= 8;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   295
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   296
vgtBigExplosion:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   297
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   298
                gear^.Angle:= random(360);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   299
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   300
      vgtChunk:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   301
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   302
                gear^.Frame:= random(4);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   303
                t:= random(1024);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   304
                sp:= 0.001 * (random(85) + 47);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   305
                dx:= hwFloat2Float(AngleSin(t)) * sp;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   306
                dy:= hwFloat2Float(AngleCos(t)) * sp * -2;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   307
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   308
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   309
                end;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9998 9960
diff changeset
   310
      vgtNote:
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   311
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   312
                dx:= 0.005 * (random(15) + 10);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   313
                dy:= -0.001 * (random(40) + 20);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   314
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   315
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   316
                Frame:= random(4);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   317
                FrameTicks:= random(2000) + 1500;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   318
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   319
  vgtBulletHit:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   320
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   321
                dx:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   322
                dy:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   323
                FrameTicks:= 350;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   324
                Frame:= 7;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   325
                Angle:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   326
                end;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9998 9960
diff changeset
   327
vgtSmoothWindBar:
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   328
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   329
                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
   330
                Tag:= hwRound(cWindSpeed * 72 / cMaxWindSpeed);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   331
                end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   332
 vgtStraightShot:
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   333
                begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   334
                Angle:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   335
                Scale:= 1.0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   336
                dx:= 0.001 * random(45);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   337
                dy:= 0.001 * (random(20) + 25);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   338
                State:= ord(sprHealth);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   339
                if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   340
                    dx := -dx;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   341
                Frame:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   342
                FrameTicks:= random(750) + 1250;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   343
                State:= ord(sprSnowDust);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   344
                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
   345
  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
   346
                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
   347
                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
   348
                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
   349
                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
   350
                end;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   351
        end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   352
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   353
if State <> 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   354
    gear^.State:= State;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   355
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   356
case Gear^.Kind of
12110
f214d6315b71 requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents: 11880
diff changeset
   357
    vgtFlake: 
f214d6315b71 requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents: 11880
diff changeset
   358
              if random(3) = 0 then
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   359
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   360
                  gear^.Scale:= 0.5;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   361
                  gear^.Layer:= 0   // 33% - far back
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   362
                  end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   363
              else if random(3) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   364
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   365
                  gear^.Scale:= 0.8;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   366
                  gear^.Layer:= 4   // 22% - mid-distance
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   367
                  end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   368
              else if random(3) <> 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   369
                  gear^.Layer:= 5  // 30% - just behind land
12110
f214d6315b71 requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents: 11880
diff changeset
   370
              else if (not cFlattenFlakes) and (random(2) = 0) then
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   371
                  gear^.Layer:= 6   // 7% - just in front of land
12110
f214d6315b71 requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents: 11880
diff changeset
   372
              else if not cFlattenFlakes then
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   373
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   374
                  gear^.Scale:= 1.5;
12110
f214d6315b71 requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents: 11880
diff changeset
   375
                  gear^.Layer:= 2  // 7% - close up
f214d6315b71 requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents: 11880
diff changeset
   376
                  end
f214d6315b71 requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents: 11880
diff changeset
   377
              else begin 
f214d6315b71 requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents: 11880
diff changeset
   378
                   gear^.Layer:= 0;
f214d6315b71 requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents: 11880
diff changeset
   379
                   gear^.Scale:= 0.5
f214d6315b71 requested by CopherNeue - make "flatten-flakes" only exclude the foreground layers. testing on eyes/halloween seems ok.
nemo
parents: 11880
diff changeset
   380
                   end;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   381
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   382
    vgtCloud: if cFlattenClouds then gear^.Layer:= 5
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   383
              else if random(3) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   384
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   385
                  gear^.Scale:= 0.25;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   386
                  gear^.Layer:= 0
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   387
                  end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   388
              else if random(2) = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   389
                  gear^.Layer:= 5
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   390
              else
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   391
                  begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   392
                  gear^.Scale:= 0.4;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   393
                  gear^.Layer:= 4
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   394
                  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
   395
    vgtNoPlaceWarn: gear^.Layer:= 6;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   396
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   397
    // 0: this layer is very distant in the background when in stereo
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   398
    vgtTeamHealthSorter,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   399
    vgtSmoothWindBar: gear^.Layer:= 0;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   400
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   401
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   402
    // 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
   403
    vgtSmokeTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   404
    vgtEvilTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   405
    vgtLineTrail,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   406
    vgtSmoke,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   407
    vgtSmokeWhite,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   408
    vgtDust,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   409
    vgtFire,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   410
    vgtSplash,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   411
    vgtDroplet,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   412
    vgtBubble: gear^.Layer:= 1;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   413
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   414
    // 3: this layer is on the screen plane (depth = 0) when stereo
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   415
    vgtSpeechBubble,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   416
    vgtSmallDamageTag,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   417
    vgtHealthTag,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   418
    vgtStraightShot,
10876
d012728b89b9 draw birdy's feathers in low quality mode too
sheepluva
parents: 10634
diff changeset
   419
    vgtFeather,
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   420
    vgtChunk: gear^.Layer:= 3;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   421
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   422
    // 2: this layer is outside the screen when stereo
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   423
    vgtExplosion,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   424
    vgtBigExplosion,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   425
    vgtExplPart,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   426
    vgtExplPart2,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   427
    vgtSteam,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   428
    vgtAmmo,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   429
    vgtShell,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   430
    vgtEgg,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   431
    vgtBeeTrace,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   432
    vgtSmokeRing,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   433
    vgtNote,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   434
    vgtBulletHit,
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   435
    vgtCircle: gear^.Layer:= 2
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   436
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   437
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
   438
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
   439
14584
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   440
if VisualGearLayersStart[gear^.Layer] = nil then
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   441
    VisualGearLayersStart[gear^.Layer]:= gear;
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   442
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   443
if VisualGearLayersEnd[gear^.Layer] <> nil then
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   444
    begin
14584
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   445
    VisualGearLayersEnd[gear^.Layer]^.NextGear:= gear;
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   446
    gear^.PrevGear:= VisualGearLayersEnd[gear^.Layer]
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   447
    end;
14584
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   448
VisualGearLayersEnd[gear^.Layer]:= gear;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   449
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   450
AddVisualGear:= gear;
11880
2eac7a96b342 Lua API: Add GetVisualGearType, onVisualGearAdd, onVisualGearDelete
Wuzzy <almikes@aol.com>
parents: 11857
diff changeset
   451
ScriptCall('onVisualGearAdd', gear^.uid);
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   452
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   453
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   454
procedure DeleteVisualGear(Gear: PVisualGear);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   455
begin
11880
2eac7a96b342 Lua API: Add GetVisualGearType, onVisualGearAdd, onVisualGearDelete
Wuzzy <almikes@aol.com>
parents: 11857
diff changeset
   456
    ScriptCall('onVisualGearDelete', Gear^.uid);
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
   457
    FreeAndNilTexture(Gear^.Tex);
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   458
14584
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   459
    if (Gear^.NextGear = nil) and (Gear^.PrevGear = nil) then
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   460
        begin
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   461
        VisualGearLayersStart[Gear^.Layer]:= nil;
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   462
        VisualGearLayersEnd[Gear^.Layer]:= nil;
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   463
        end;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   464
    if Gear^.PrevGear <> nil then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   465
        Gear^.PrevGear^.NextGear:= Gear^.NextGear
14584
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   466
    else if Gear^.NextGear <> nil then
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   467
        VisualGearLayersStart[Gear^.Layer]:= Gear^.NextGear;
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   468
    if Gear^.NextGear <> nil then
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   469
        Gear^.NextGear^.PrevGear:= Gear^.PrevGear
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   470
    else if Gear^.PrevGear <> nil then
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   471
        VisualGearLayersEnd[Gear^.Layer]:= Gear^.PrevGear;
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   472
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   473
    if lastVisualGearByUID = Gear then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   474
        lastVisualGearByUID:= nil;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   475
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   476
    Dispose(Gear);
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   477
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   478
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   479
function  VisualGearByUID(uid : Longword) : PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   480
var vg: PVisualGear;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   481
    i: LongWord;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   482
begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   483
VisualGearByUID:= nil;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   484
if uid = 0 then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   485
    exit;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   486
if (lastVisualGearByUID <> nil) and (lastVisualGearByUID^.uid = uid) then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   487
    begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   488
    VisualGearByUID:= lastVisualGearByUID;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   489
    exit
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   490
    end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   491
// 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
   492
for i:= 2 to 5 do
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   493
    begin
14584
ab79cd4a7382 Reverse order of visual gears linked list
Wuzzy <Wuzzy2@mail.ru>
parents: 14572
diff changeset
   494
    vg:= VisualGearLayersStart[i mod 4];
9287
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   495
    while vg <> nil do
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   496
        begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   497
        if vg^.uid = uid then
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   498
            begin
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   499
            lastVisualGearByUID:= vg;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   500
            VisualGearByUID:= vg;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   501
            exit
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   502
            end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   503
        vg:= vg^.NextGear
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   504
        end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   505
    end
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   506
end;
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   507
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   508
bb9ad6a5f625 oops, forgot this file
unc0rr
parents:
diff changeset
   509
end.