hedgewars/uVisualGears.pas
author unc0rr
Tue, 11 Feb 2014 22:05:03 +0400
changeset 10130 a9d509848390
parent 10121 8b65699beb56
child 10193 d7cd5b43588f
permissions -rw-r--r--
Small fix which makes pas2c engine successfully replay demos
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
     1
(*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 1047
diff changeset
     2
 * Hedgewars, a free turn based strategy game
9998
736015b847e3 update copyright to 2014
sheepluva
parents: 9769
diff changeset
     3
 * Copyright (c) 2004-2014 Andrey Korotaev <unC0Rr@gmail.com>
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
     4
 *
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
     8
 *
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    12
 * GNU General Public License for more details.
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    13
 *
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
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
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    17
 *)
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    18
2599
c7153d2348f3 move compiler directives to standard pascal
koda
parents: 2587
diff changeset
    19
{$INCLUDE "options.inc"}
2587
0dfa56a8513c fix a segfault in the iphone simulator by moving options.inc at the beginning of the file
koda
parents: 2428
diff changeset
    20
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    21
unit uVisualGears;
5121
2d34ec60992c added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents: 5065
diff changeset
    22
(*
2d34ec60992c added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents: 5065
diff changeset
    23
 * This unit defines the behavior and the appearance of visual gears.
2d34ec60992c added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents: 5065
diff changeset
    24
 *
2d34ec60992c added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents: 5065
diff changeset
    25
 * Visual gears are "things"/"objects" in the game that do not need to be
2d34ec60992c added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents: 5065
diff changeset
    26
 * perfectly synchronized over all clients since their effect is only
2d34ec60992c added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents: 5065
diff changeset
    27
 * of visual nature.
2d34ec60992c added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents: 5065
diff changeset
    28
 *
2d34ec60992c added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents: 5065
diff changeset
    29
 * E.g.: background flakes, visual effects: explosion, smoke trails, etc.
2d34ec60992c added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents: 5065
diff changeset
    30
 *)
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    31
interface
9285
8e8b908970c2 Refactoring: get rid of GSHandlers.inc
unc0rr
parents: 9283
diff changeset
    32
uses uConsts, GLunit, uTypes;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    33
3038
4e48c276a468 In pascal unit is a namespace
unc0rr
parents: 3032
diff changeset
    34
procedure initModule;
4e48c276a468 In pascal unit is a namespace
unc0rr
parents: 3032
diff changeset
    35
procedure freeModule;
2716
b9ca1bfca24f complete the replacement of init/free wrappers for every unit
koda
parents: 2715
diff changeset
    36
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    37
procedure ProcessVisualGears(Steps: Longword);
1045
ea195268734f Testing explosion particles implementation
unc0rr
parents: 1041
diff changeset
    38
procedure DrawVisualGears(Layer: LongWord);
6986
409dd3851309 add support for default pascal mode by removing default arguments value (maybe this also helps the parser)
koda
parents: 6982
diff changeset
    39
803
3f73901a350a - Use cloud as 'visual gear'
unc0rr
parents: 802
diff changeset
    40
procedure AddClouds;
4806
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
    41
procedure AddFlakes;
6986
409dd3851309 add support for default pascal mode by removing default arguments value (maybe this also helps the parser)
koda
parents: 6982
diff changeset
    42
procedure AddDamageTag(X, Y, Damage, Color: LongWord);
409dd3851309 add support for default pascal mode by removing default arguments value (maybe this also helps the parser)
koda
parents: 6982
diff changeset
    43
409dd3851309 add support for default pascal mode by removing default arguments value (maybe this also helps the parser)
koda
parents: 6982
diff changeset
    44
procedure ChangeToSDClouds;
4806
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
    45
procedure ChangeToSDFlakes;
6986
409dd3851309 add support for default pascal mode by removing default arguments value (maybe this also helps the parser)
koda
parents: 6982
diff changeset
    46
409dd3851309 add support for default pascal mode by removing default arguments value (maybe this also helps the parser)
koda
parents: 6982
diff changeset
    47
procedure KickFlakes(Radius, X, Y: LongInt);
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    48
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    49
implementation
9285
8e8b908970c2 Refactoring: get rid of GSHandlers.inc
unc0rr
parents: 9283
diff changeset
    50
uses uVariables, uRender, Math, uRenderUtils, uStore, uUtils
8e8b908970c2 Refactoring: get rid of GSHandlers.inc
unc0rr
parents: 9283
diff changeset
    51
    , uVisualGearsList;
3440
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
    52
1505
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
    53
procedure AddDamageTag(X, Y, Damage, Color: LongWord);
10121
8b65699beb56 Implement a bit of astring
unc0rr
parents: 10108
diff changeset
    54
var Gear: PVisualGear;
1505
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
    55
begin
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
    56
if cAltDamage then
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    57
    begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    58
    Gear:= AddVisualGear(X, Y, vgtSmallDamageTag);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    59
    if Gear <> nil then
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    60
        with Gear^ do
10121
8b65699beb56 Implement a bit of astring
unc0rr
parents: 10108
diff changeset
    61
            Tex:= RenderStringTex(ansistring(inttostr(Damage)), Color, fntSmall);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    62
    end
1505
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
    63
end;
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
    64
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
    65
803
3f73901a350a - Use cloud as 'visual gear'
unc0rr
parents: 802
diff changeset
    66
// ==================================================================
2042
905c554d62e6 Move Speech to visual gears. This checkin CRASHES on deletion of visual gear outside the doStep
nemo
parents: 2014
diff changeset
    67
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    68
procedure ProcessVisualGears(Steps: Longword);
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    69
var Gear, t: PVisualGear;
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
    70
    i: LongWord;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    71
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
    72
if Steps = 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
    73
    exit;
803
3f73901a350a - Use cloud as 'visual gear'
unc0rr
parents: 802
diff changeset
    74
6302
db8bdbb34e03 Spread flakes out over 5 layers now (far back, mid distance, just behind land, just in front of lands and hog, near distance). Spread clouds out over 3 layers (far back, mid distance, just behind land). Add a flatten clouds option, use
nemo
parents: 6291
diff changeset
    75
for i:= 0 to 6 do
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
    76
    begin
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
    77
    t:= VisualGearLayers[i];
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
    78
    while t <> nil do
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
    79
        begin
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
    80
        Gear:= t;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
    81
        t:= Gear^.NextGear;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
    82
        Gear^.doStep(Gear, Steps)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
    83
        end;
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
    84
    end
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    85
end;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    86
3083
8da8f2515221 Eliminate flake kick on themes with no flakes, more than 200 flakes (city) or explosions of 25 or smaller
nemo
parents: 3080
diff changeset
    87
procedure KickFlakes(Radius, X, Y: LongInt);
2985
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
    88
var Gear, t: PVisualGear;
6302
db8bdbb34e03 Spread flakes out over 5 layers now (far back, mid distance, just behind land, just in front of lands and hog, near distance). Spread clouds out over 3 layers (far back, mid distance, just behind land). Add a flatten clouds option, use
nemo
parents: 6291
diff changeset
    89
    dmg, i: LongInt;
2985
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
    90
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
    91
if (vobCount = 0) or (vobCount > 200) then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
    92
    exit;
6306
553680d78546 tweak % again
nemo
parents: 6302
diff changeset
    93
for i:= 2 to 6 do
553680d78546 tweak % again
nemo
parents: 6302
diff changeset
    94
    if i <> 3 then
553680d78546 tweak % again
nemo
parents: 6302
diff changeset
    95
        begin
553680d78546 tweak % again
nemo
parents: 6302
diff changeset
    96
        t:= VisualGearLayers[i];
553680d78546 tweak % again
nemo
parents: 6302
diff changeset
    97
        while t <> nil do
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
    98
            begin
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
    99
            Gear:= t;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   100
            if Gear^.Kind = vgtFlake then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   101
                begin
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   102
                // Damage calc from doMakeExplosion
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   103
                dmg:= Min(101, Radius + cHHRadius div 2 - LongInt(abs(round(Gear^.X) - X) + abs(round(Gear^.Y) - Y)) div 5);
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   104
                if dmg > 1 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   105
                    begin
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   106
                    Gear^.tdX:= 0.02 * dmg + 0.01;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   107
                    if Gear^.X - X < 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   108
                        Gear^.tdX := -Gear^.tdX;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   109
                    Gear^.tdY:= 0.02 * dmg + 0.01;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   110
                    if Gear^.Y - Y < 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   111
                        Gear^.tdY := -Gear^.tdY;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   112
                    Gear^.Timer:= 200
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   113
                    end
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   114
                end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   115
            t:= Gear^.NextGear
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   116
            end
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   117
        end
2985
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   118
end;
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   119
1045
ea195268734f Testing explosion particles implementation
unc0rr
parents: 1041
diff changeset
   120
procedure DrawVisualGears(Layer: LongWord);
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   121
var Gear: PVisualGear;
4475
54e78c40970b rendering optimisations. remove the recursive flames in explosions (might need more due to the gravity change in the new flames) but more usefully, eliminate a number of redundant Tint calls
nemo
parents: 4465
diff changeset
   122
    tinted: boolean;
4545
180d703cfdd0 offset the sprite
nemo
parents: 4544
diff changeset
   123
    tmp: real;
5748
70d7f8e40f53 Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents: 5690
diff changeset
   124
    i: LongInt;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   125
begin
1045
ea195268734f Testing explosion particles implementation
unc0rr
parents: 1041
diff changeset
   126
case Layer of
5256
e3fada9358b0 fix water bubbles like sheepluva wanted (also code formatting)
koda
parents: 5179
diff changeset
   127
    // this layer is very distant in the background when stereo
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   128
    0: begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   129
        Gear:= VisualGearLayers[0];
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   130
        while Gear <> nil do
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   131
            begin
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   132
            if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   133
            case Gear^.Kind of
6302
db8bdbb34e03 Spread flakes out over 5 layers now (far back, mid distance, just behind land, just in front of lands and hog, near distance). Spread clouds out over 3 layers (far back, mid distance, just behind land). Add a flatten clouds option, use
nemo
parents: 6291
diff changeset
   134
              vgtCloud: if SuddenDeathDmg then
6553
91365db8b82c Slow down flakes/clouds that are farther away. Also unbreak NTPX w/ SDL 1.2
nemo
parents: 6453
diff changeset
   135
                             DrawTextureF(SpritesData[sprSDCloud].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 2, SpritesData[sprCloud].Width, SpritesData[sprCloud].Height)
6302
db8bdbb34e03 Spread flakes out over 5 layers now (far back, mid distance, just behind land, just in front of lands and hog, near distance). Spread clouds out over 3 layers (far back, mid distance, just behind land). Add a flatten clouds option, use
nemo
parents: 6291
diff changeset
   136
                         else
6553
91365db8b82c Slow down flakes/clouds that are farther away. Also unbreak NTPX w/ SDL 1.2
nemo
parents: 6453
diff changeset
   137
                            DrawTextureF(SpritesData[sprCloud].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 2, SpritesData[sprCloud].Width, SpritesData[sprCloud].Height);
6288
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   138
               vgtFlake: if cFlattenFlakes then
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   139
                             begin
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   140
                             if SuddenDeathDmg then
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   141
                                 if vobSDVelocity = 0 then
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   142
                                     DrawSprite(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   143
                                 else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   144
                                     DrawSpriteRotatedF(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle)
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   145
                             else
6288
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   146
                                 if vobVelocity = 0 then
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   147
                                     DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   148
                                 else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   149
                                     DrawSpriteRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle)
6288
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   150
                             end
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   151
                         else
6288
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   152
                             begin
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   153
                             if SuddenDeathDmg then
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   154
                                 if vobSDVelocity = 0 then
6553
91365db8b82c Slow down flakes/clouds that are farther away. Also unbreak NTPX w/ SDL 1.2
nemo
parents: 6453
diff changeset
   155
                                     DrawTextureF(SpritesData[sprSDFlake].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
6288
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   156
                                 else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   157
                                     DrawTextureRotatedF(SpritesData[sprSDFlake].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   158
                             else
6288
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   159
                                 if vobVelocity = 0 then
6553
91365db8b82c Slow down flakes/clouds that are farther away. Also unbreak NTPX w/ SDL 1.2
nemo
parents: 6453
diff changeset
   160
                                     DrawTextureF(SpritesData[sprFlake].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
6288
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   161
                                 else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   162
                                     DrawTextureRotatedF(SpritesData[sprFlake].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
6288
fcc50b96d20a Flatten flakes for halloween theme, based on feedback from sheepluva
nemo
parents: 6184
diff changeset
   163
                             end;
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   164
               end;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   165
           if Gear^.Tint <> $FFFFFFFF then
9666
8dcb25112d96 - Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents: 9285
diff changeset
   166
               untint;
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   167
           Gear:= Gear^.NextGear
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   168
           end
5256
e3fada9358b0 fix water bubbles like sheepluva wanted (also code formatting)
koda
parents: 5179
diff changeset
   169
       end;
e3fada9358b0 fix water bubbles like sheepluva wanted (also code formatting)
koda
parents: 5179
diff changeset
   170
    // this layer is on the land level (which is close but behind the screen plane) when stereo
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   171
    1: begin
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   172
       Gear:= VisualGearLayers[1];
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   173
       while Gear <> nil do
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   174
          begin
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   175
          //tinted:= false;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   176
          if Gear^.Tint <> $FFFFFFFF then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   177
              Tint(Gear^.Tint);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   178
          case Gear^.Kind of
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   179
              vgtFlake: if SuddenDeathDmg then
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   180
                             if vobSDVelocity = 0 then
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   181
                                 DrawSprite(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   182
                             else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   183
                                 DrawSpriteRotatedF(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle)
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   184
                         else
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   185
                             if vobVelocity = 0 then
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   186
                                 DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   187
                             else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   188
                                 DrawSpriteRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   189
              vgtSmokeTrace: if Gear^.State < 8 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   190
                  DrawSprite(sprSmokeTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State);
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   191
              vgtEvilTrace: if Gear^.State < 8 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   192
                  DrawSprite(sprEvilTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   193
              vgtLineTrail: DrawLine(Gear^.X, Gear^.Y, Gear^.dX, Gear^.dY, 1.0, $FF, min(Gear^.Timer, $C0), min(Gear^.Timer, $80), min(Gear^.Timer, $FF));
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   194
          end;
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   195
          if (cReducedQuality and rqAntiBoom) = 0 then
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   196
              case Gear^.Kind of
6323
c1aa6a3c84a7 Dir should not be 0, but set it to 1 if 0 in case I missed some other place this was done. Also correct cloud scaling.
nemo
parents: 6322
diff changeset
   197
                  vgtSmoke: DrawTextureF(SpritesData[sprSmoke].Texture, Gear^.scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 7 - Gear^.Frame, 1, SpritesData[sprSmoke].Width, SpritesData[sprSmoke].Height);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   198
                  vgtSmokeWhite: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   199
                  vgtDust: if Gear^.State = 1 then
7597
1ef520fea21c make cheating a bit easier (mikade insisted). Also, try flipping dust for a bit more variety.
nemo
parents: 7543
diff changeset
   200
                               DrawSpriteRotatedF(sprSnowDust, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame, Gear^.Tag, Gear^.Angle)
5256
e3fada9358b0 fix water bubbles like sheepluva wanted (also code formatting)
koda
parents: 5179
diff changeset
   201
                           else
7597
1ef520fea21c make cheating a bit easier (mikade insisted). Also, try flipping dust for a bit more variety.
nemo
parents: 7543
diff changeset
   202
                               DrawSpriteRotatedF(sprDust, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame, Gear^.Tag, Gear^.Angle);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   203
                  vgtFire: if (Gear^.State and gstTmpFlag) = 0 then
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   204
                               DrawSprite(sprFlame, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy, (RealTicks shr 6 + Gear^.Frame) mod 8)
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   205
                           else
6322
b310f0bc8dde If I'm going to be arbitrary about it, might as well go for the more minimal arbitrariness
nemo
parents: 6318
diff changeset
   206
                               DrawTextureF(SpritesData[sprFlame].Texture, Gear^.FrameTicks / 900, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, (RealTicks shr 7 + Gear^.Frame) mod 8, 1, 16, 16);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   207
                  vgtSplash: if SuddenDeathDmg then
6803
0e70f3ea3bf8 bit of an experiment in variable splash sizes based on object/speed. not sure if it looks good yet. need to drown more stuff.
nemo
parents: 6700
diff changeset
   208
                                 //DrawSprite(sprSDSplash, round(Gear^.X) + WorldDx - 40, round(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37))
7372
fcc002658832 Spread the droplets around more so it looks less square (looked especially bad with piano). Slow down large splashes a bit for dramatic purposes, also taking low-g into account. Small splashes you can't really tell anyway.
nemo
parents: 7276
diff changeset
   209
                                 DrawTextureF(SpritesData[sprSDSplash].Texture, Gear^.scale, round(Gear^.X + WorldDx), round(Gear^.Y + WorldDy - ((SpritesData[sprSDSplash].Height+8)*Gear^.Scale)/2), 19 - (Gear^.FrameTicks div Gear^.Timer div 37), 1, SpritesData[sprSDSplash].Width, SpritesData[sprSDSplash].Height)
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   210
                             else
6803
0e70f3ea3bf8 bit of an experiment in variable splash sizes based on object/speed. not sure if it looks good yet. need to drown more stuff.
nemo
parents: 6700
diff changeset
   211
                                 //DrawSprite(sprSplash, round(Gear^.X) + WorldDx - 40, round(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37));
7372
fcc002658832 Spread the droplets around more so it looks less square (looked especially bad with piano). Slow down large splashes a bit for dramatic purposes, also taking low-g into account. Small splashes you can't really tell anyway.
nemo
parents: 7276
diff changeset
   212
                                 DrawTextureF(SpritesData[sprSplash].Texture, Gear^.scale, round(Gear^.X + WorldDx), round(Gear^.Y + WorldDy - ((SpritesData[sprSplash].Height+8)*Gear^.Scale)/2), 19 - (Gear^.FrameTicks div Gear^.Timer div 37), 1, SpritesData[sprSplash].Width, SpritesData[sprSplash].Height);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   213
                  vgtDroplet: if SuddenDeathDmg then
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   214
                                  DrawSprite(sprSDDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame)
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   215
                              else
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   216
                                  DrawSprite(sprDroplet, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   217
                  vgtBubble: DrawSprite(sprBubbles, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8);
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9998 9950
diff changeset
   218
               vgtStraightShot: 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: 9768
diff changeset
   219
                                if Gear^.dX < 0 then
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9768
diff changeset
   220
                                    i:= -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: 9768
diff changeset
   221
                                else
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9768
diff changeset
   222
                                    i:= 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: 9768
diff changeset
   223
                                DrawTextureRotatedF(SpritesData[TSprite(Gear^.State)].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, i, SpritesData[TSprite(Gear^.State)].Width, SpritesData[TSprite(Gear^.State)].Height, Gear^.Angle);
5814e0c47c99 Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents: 9768
diff changeset
   224
                                end;
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   225
              end;
9666
8dcb25112d96 - Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents: 9285
diff changeset
   226
          //if (Gear^.Tint <> $FFFFFFFF) or tinted then untint;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   227
          if (Gear^.Tint <> $FFFFFFFF) then
9666
8dcb25112d96 - Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents: 9285
diff changeset
   228
              untint;
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   229
          Gear:= Gear^.NextGear
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   230
          end
5256
e3fada9358b0 fix water bubbles like sheepluva wanted (also code formatting)
koda
parents: 5179
diff changeset
   231
       end;
e3fada9358b0 fix water bubbles like sheepluva wanted (also code formatting)
koda
parents: 5179
diff changeset
   232
    // this layer is on the screen plane (depth = 0) when stereo
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   233
    3: begin
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   234
       Gear:= VisualGearLayers[3];
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   235
       while Gear <> nil do
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   236
           begin
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   237
           tinted:= false;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   238
           if Gear^.Tint <> $FFFFFFFF then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   239
               Tint(Gear^.Tint);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   240
           case Gear^.Kind of
6302
db8bdbb34e03 Spread flakes out over 5 layers now (far back, mid distance, just behind land, just in front of lands and hog, near distance). Spread clouds out over 3 layers (far back, mid distance, just behind land). Add a flatten clouds option, use
nemo
parents: 6291
diff changeset
   241
(*
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   242
              vgtFlake: if SuddenDeathDmg then
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   243
                             if vobSDVelocity = 0 then
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   244
                                 DrawSprite(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   245
                             else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   246
                                 DrawSpriteRotatedF(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle)
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   247
                         else
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   248
                             if vobVelocity = 0 then
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   249
                                 DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   250
                             else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   251
                                 DrawSpriteRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);*)
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   252
               vgtSpeechBubble: begin
9764
8dc9d268330f revert r938d1c08d0d1 in favour of putting it in the chat log. I think this addresses main concern about missing text. There've been complaints in past too about conversation in bubbles not being visible in history. If the objection is that r938d1c08d0d1 offers a more æsthetic solution, I think it should augment this, be flagged, and fix the visual issues first.
nemo
parents: 9762
diff changeset
   253
                                if (Gear^.Tex <> nil) and (((Gear^.State = 0) and (Gear^.Hedgehog^.Team <> CurrentTeam)) or (Gear^.State = 1)) then
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   254
                                    begin
9764
8dc9d268330f revert r938d1c08d0d1 in favour of putting it in the chat log. I think this addresses main concern about missing text. There've been complaints in past too about conversation in bubbles not being visible in history. If the objection is that r938d1c08d0d1 offers a more æsthetic solution, I think it should augment this, be flagged, and fix the visual issues first.
nemo
parents: 9762
diff changeset
   255
                                    tinted:= true;
8dc9d268330f revert r938d1c08d0d1 in favour of putting it in the chat log. I think this addresses main concern about missing text. There've been complaints in past too about conversation in bubbles not being visible in history. If the objection is that r938d1c08d0d1 offers a more æsthetic solution, I think it should augment this, be flagged, and fix the visual issues first.
nemo
parents: 9762
diff changeset
   256
                                    Tint($FF, $FF, $FF,  $66);
8dc9d268330f revert r938d1c08d0d1 in favour of putting it in the chat log. I think this addresses main concern about missing text. There've been complaints in past too about conversation in bubbles not being visible in history. If the objection is that r938d1c08d0d1 offers a more æsthetic solution, I think it should augment this, be flagged, and fix the visual issues first.
nemo
parents: 9762
diff changeset
   257
                                    DrawTextureCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex)
8dc9d268330f revert r938d1c08d0d1 in favour of putting it in the chat log. I think this addresses main concern about missing text. There've been complaints in past too about conversation in bubbles not being visible in history. If the objection is that r938d1c08d0d1 offers a more æsthetic solution, I think it should augment this, be flagged, and fix the visual issues first.
nemo
parents: 9762
diff changeset
   258
                                    end
8dc9d268330f revert r938d1c08d0d1 in favour of putting it in the chat log. I think this addresses main concern about missing text. There've been complaints in past too about conversation in bubbles not being visible in history. If the objection is that r938d1c08d0d1 offers a more æsthetic solution, I think it should augment this, be flagged, and fix the visual issues first.
nemo
parents: 9762
diff changeset
   259
                                else if (Gear^.Tex <> nil) and (((Gear^.State = 0) and (Gear^.Hedgehog^.Team = CurrentTeam)) or (Gear^.State = 2)) then
8dc9d268330f revert r938d1c08d0d1 in favour of putting it in the chat log. I think this addresses main concern about missing text. There've been complaints in past too about conversation in bubbles not being visible in history. If the objection is that r938d1c08d0d1 offers a more æsthetic solution, I think it should augment this, be flagged, and fix the visual issues first.
nemo
parents: 9762
diff changeset
   260
                                    DrawTextureCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   261
                                end;
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   262
               vgtSmallDamageTag: DrawTextureCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex);
8330
aaefa587e277 update branch with default
koda
parents: 8026 8204
diff changeset
   263
               vgtHealthTag: if Gear^.Tex <> nil then
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   264
                               begin
8330
aaefa587e277 update branch with default
koda
parents: 8026 8204
diff changeset
   265
                               if Gear^.Frame = 0 then
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   266
                                   DrawTextureCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex)
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   267
                               else
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   268
                                   begin
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   269
                                   SetScale(cDefaultZoomLevel);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   270
                                   if Gear^.Angle = 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   271
                                       DrawTexture(round(Gear^.X), round(Gear^.Y), Gear^.Tex)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   272
                                   else
8330
aaefa587e277 update branch with default
koda
parents: 8026 8204
diff changeset
   273
                                       DrawTexture(round(Gear^.X), round(Gear^.Y), Gear^.Tex, Gear^.Angle);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   274
                                   SetScale(zoom)
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   275
                                   end
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   276
                               end;
8330
aaefa587e277 update branch with default
koda
parents: 8026 8204
diff changeset
   277
               vgtStraightShot: begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   278
                                if Gear^.dX < 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   279
                                    i:= -1
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   280
                                else
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   281
                                    i:= 1;
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   282
                                DrawTextureRotatedF(SpritesData[TSprite(Gear^.State)].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, i, SpritesData[TSprite(Gear^.State)].Width, SpritesData[TSprite(Gear^.State)].Height, Gear^.Angle);
5748
70d7f8e40f53 Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents: 5690
diff changeset
   283
                                end;
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   284
           end;
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   285
           if (cReducedQuality and rqAntiBoom) = 0 then
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   286
               case Gear^.Kind of
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   287
                   vgtChunk: DrawSpriteRotatedF(sprChunk, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   288
               end;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   289
           if (Gear^.Tint <> $FFFFFFFF) or tinted then
9666
8dcb25112d96 - Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents: 9285
diff changeset
   290
               untint;
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   291
           Gear:= Gear^.NextGear
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   292
           end
4818
202eef454354 rename "frame alternate" to "wiggle" as it's more appropriate
koda
parents: 4809
diff changeset
   293
       end;
5256
e3fada9358b0 fix water bubbles like sheepluva wanted (also code formatting)
koda
parents: 5179
diff changeset
   294
    // this layer is outside the screen when stereo
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   295
    2: begin
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   296
       Gear:= VisualGearLayers[2];
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   297
       while Gear <> nil do
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   298
           begin
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   299
           tinted:= false;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   300
           if Gear^.Tint <> $FFFFFFFF then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   301
               Tint(Gear^.Tint);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   302
           case Gear^.Kind of
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   303
               vgtExplosion: DrawSprite(sprExplosion50, round(Gear^.X) - 32 + WorldDx, round(Gear^.Y) - 32 + WorldDy, Gear^.State);
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   304
               vgtBigExplosion: begin
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   305
                                tinted:= true;
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   306
                                Tint($FF, $FF, $FF, round($FF * (1 - power(Gear^.Timer / 250, 4))));
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   307
                                DrawTextureRotatedF(SpritesData[sprBigExplosion].Texture, 0.85 * (-power(2, -10 * Int(Gear^.Timer)/250) + 1) + 0.4, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 385, 385, Gear^.Angle);
4818
202eef454354 rename "frame alternate" to "wiggle" as it's more appropriate
koda
parents: 4809
diff changeset
   308
                                end;
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   309
           end;
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   310
           if (cReducedQuality and rqAntiBoom) = 0 then
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   311
               case Gear^.Kind of
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   312
                   vgtExplPart: DrawSprite(sprExplPart, round(Gear^.X) + WorldDx - 16, round(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   313
                   vgtExplPart2: DrawSprite(sprExplPart2, round(Gear^.X) + WorldDx - 16, round(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   314
                   vgtSteam: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   315
                   vgtAmmo: begin
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   316
                            tinted:= true;
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   317
                            Tint($FF, $FF, $FF, round(Gear^.alpha * $FF));
6322
b310f0bc8dde If I'm going to be arbitrary about it, might as well go for the more minimal arbitrariness
nemo
parents: 6318
diff changeset
   318
                            DrawTextureF(ropeIconTex, Gear^.scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 32, 32);
b310f0bc8dde If I'm going to be arbitrary about it, might as well go for the more minimal arbitrariness
nemo
parents: 6318
diff changeset
   319
                            DrawTextureF(SpritesData[sprAMAmmos].Texture, Gear^.scale * 0.90, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame - 1, 1, 32, 32);
3115
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   320
                            end;
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   321
                   vgtShell: begin
5256
e3fada9358b0 fix water bubbles like sheepluva wanted (also code formatting)
koda
parents: 5179
diff changeset
   322
                             if Gear^.FrameTicks < $FF then
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   323
                                 begin
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   324
                                 Tint($FF, $FF, $FF, Gear^.FrameTicks);
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   325
                                 tinted:= true
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   326
                                 end;
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   327
                             DrawSpriteRotatedF(sprShell, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   328
                             end;
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   329
                   vgtFeather: begin
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   330
                               if Gear^.FrameTicks < 255 then
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   331
                                   begin
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   332
                                   Tint($FF, $FF, $FF, Gear^.FrameTicks);
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   333
                                   tinted:= true
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   334
                                   end;
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   335
                               DrawSpriteRotatedF(sprFeather, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
5256
e3fada9358b0 fix water bubbles like sheepluva wanted (also code formatting)
koda
parents: 5179
diff changeset
   336
                             end;
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   337
                   vgtEgg: DrawSpriteRotatedF(sprEgg, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   338
                   vgtBeeTrace: begin
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   339
                                if Gear^.FrameTicks < $FF then
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   340
                                    Tint($FF, $FF, $FF, Gear^.FrameTicks div 2)
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   341
                                else
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   342
                                    Tint($FF, $FF, $FF, $80);
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   343
                                tinted:= true;
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   344
                                DrawSpriteRotatedF(sprBeeTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, (RealTicks shr 4) mod cMaxAngle);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   345
                                end;
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   346
                   vgtSmokeRing: begin
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   347
                                 tinted:= true;
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   348
                                 Tint($FF, $FF, $FF, round(Gear^.alpha * $FF));
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   349
                                 DrawTextureRotatedF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   350
                                 end;
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   351
                   vgtNote: DrawSpriteRotatedF(sprNote, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   352
                   vgtBulletHit: DrawSpriteRotatedF(sprBulletHit, round(Gear^.X) + WorldDx - 0, round(Gear^.Y) + WorldDy - 0, 7 - (Gear^.FrameTicks div 50), 1, Gear^.Angle);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   353
               end;
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   354
           case Gear^.Kind of
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   355
               vgtFlake: if SuddenDeathDmg then
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   356
                             if vobSDVelocity = 0 then
6553
91365db8b82c Slow down flakes/clouds that are farther away. Also unbreak NTPX w/ SDL 1.2
nemo
parents: 6453
diff changeset
   357
                                 DrawTextureF(SpritesData[sprSDFlake].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   358
                             else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   359
                                 DrawTextureRotatedF(SpritesData[sprSDFlake].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   360
                         else
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   361
                             if vobVelocity = 0 then
6553
91365db8b82c Slow down flakes/clouds that are farther away. Also unbreak NTPX w/ SDL 1.2
nemo
parents: 6453
diff changeset
   362
                                 DrawTextureF(SpritesData[sprFlake].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   363
                             else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   364
                                 DrawTextureRotatedF(SpritesData[sprFlake].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   365
               vgtCircle: if gear^.Angle = 1 then
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   366
                              begin
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   367
                              tmp:= Gear^.State / 100;
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   368
                              DrawTexture(round(Gear^.X-24*tmp) + WorldDx, round(Gear^.Y-24*tmp) + WorldDy, SpritesData[sprVampiric].Texture, tmp)
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   369
                              end
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   370
                          else
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   371
                              DrawCircle(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.State, Gear^.Timer);
5585
c09f5b41644a Break visual gears list up into 4, to avoid iterating over entire list to draw a single layer. Also fix error in tag zoom.
nemo
parents: 5583
diff changeset
   372
           end;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   373
           if (Gear^.Tint <> $FFFFFFFF) or tinted then
9666
8dcb25112d96 - Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents: 9285
diff changeset
   374
               untint;
6302
db8bdbb34e03 Spread flakes out over 5 layers now (far back, mid distance, just behind land, just in front of lands and hog, near distance). Spread clouds out over 3 layers (far back, mid distance, just behind land). Add a flatten clouds option, use
nemo
parents: 6291
diff changeset
   375
           Gear:= Gear^.NextGear
db8bdbb34e03 Spread flakes out over 5 layers now (far back, mid distance, just behind land, just in front of lands and hog, near distance). Spread clouds out over 3 layers (far back, mid distance, just behind land). Add a flatten clouds option, use
nemo
parents: 6291
diff changeset
   376
           end
db8bdbb34e03 Spread flakes out over 5 layers now (far back, mid distance, just behind land, just in front of lands and hog, near distance). Spread clouds out over 3 layers (far back, mid distance, just behind land). Add a flatten clouds option, use
nemo
parents: 6291
diff changeset
   377
       end;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   378
     // this layer is half-way between the screen plane (depth = 0) when in stereo, and the land
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   379
     4: begin
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   380
        Gear:= VisualGearLayers[4];
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   381
        while Gear <> nil do
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   382
            begin
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   383
            if Gear^.Tint <> $FFFFFFFF then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   384
                Tint(Gear^.Tint);
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   385
            case Gear^.Kind of
6302
db8bdbb34e03 Spread flakes out over 5 layers now (far back, mid distance, just behind land, just in front of lands and hog, near distance). Spread clouds out over 3 layers (far back, mid distance, just behind land). Add a flatten clouds option, use
nemo
parents: 6291
diff changeset
   386
               vgtCloud: if SuddenDeathDmg then
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   387
                            DrawTextureF(SpritesData[sprSDCloud].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 2, SpritesData[sprCloud].Width, SpritesData[sprCloud].Height)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   388
                        else
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   389
                            DrawTextureF(SpritesData[sprCloud].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 2, SpritesData[sprCloud].Width, SpritesData[sprCloud].Height);
6302
db8bdbb34e03 Spread flakes out over 5 layers now (far back, mid distance, just behind land, just in front of lands and hog, near distance). Spread clouds out over 3 layers (far back, mid distance, just behind land). Add a flatten clouds option, use
nemo
parents: 6291
diff changeset
   390
              vgtFlake: if SuddenDeathDmg then
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   391
                            if vobSDVelocity = 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   392
                                DrawTextureF(SpritesData[sprSDFlake].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   393
                            else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   394
                                DrawTextureRotatedF(SpritesData[sprSDFlake].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   395
                        else
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   396
                            if vobVelocity = 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   397
                                DrawTextureF(SpritesData[sprFlake].Texture, Gear^.Scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   398
                            else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   399
                                DrawTextureRotatedF(SpritesData[sprFlake].Texture, Gear^.Scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   400
            end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   401
            if (Gear^.Tint <> $FFFFFFFF) then
9666
8dcb25112d96 - Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents: 9285
diff changeset
   402
                untint;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   403
            Gear:= Gear^.NextGear
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   404
            end
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   405
        end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   406
     // this layer is on the screen plane (depth = 0) when stereo, but just behind the land
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   407
     5: begin
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   408
        Gear:= VisualGearLayers[5];
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   409
        while Gear <> nil do
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   410
            begin
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   411
            if Gear^.Tint <> $FFFFFFFF then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   412
                Tint(Gear^.Tint);
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   413
            case Gear^.Kind of
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   414
                vgtCloud: if SuddenDeathDmg then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   415
                            DrawSprite(sprSDCloud, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   416
                          else
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   417
                            DrawSprite(sprCloud, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame);
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   418
              vgtFlake: if SuddenDeathDmg then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   419
                            if vobSDVelocity = 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   420
                                DrawSprite(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   421
                            else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   422
                                DrawSpriteRotatedF(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle)
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   423
                          else
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   424
                            if vobVelocity = 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   425
                                DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   426
                            else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   427
                                DrawSpriteRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   428
                end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   429
            if (Gear^.Tint <> $FFFFFFFF) then
9666
8dcb25112d96 - Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents: 9285
diff changeset
   430
                untint;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   431
            Gear:= Gear^.NextGear
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   432
            end
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   433
        end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   434
     // this layer is on the screen plane (depth = 0) when stereo, but just in front of the land
6302
db8bdbb34e03 Spread flakes out over 5 layers now (far back, mid distance, just behind land, just in front of lands and hog, near distance). Spread clouds out over 3 layers (far back, mid distance, just behind land). Add a flatten clouds option, use
nemo
parents: 6291
diff changeset
   435
    6: begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   436
        Gear:= VisualGearLayers[6];
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   437
        while Gear <> nil do
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   438
            begin
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   439
            if Gear^.Tint <> $FFFFFFFF then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   440
                Tint(Gear^.Tint);
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   441
            case Gear^.Kind of
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   442
                vgtFlake: if SuddenDeathDmg then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   443
                            if vobSDVelocity = 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   444
                                DrawSprite(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   445
                            else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   446
                                DrawSpriteRotatedF(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle)
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   447
                          else
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   448
                            if vobVelocity = 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   449
                                DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   450
                            else
6999
486db9d26e4b rename a few Draw* routines
koda
parents: 6986
diff changeset
   451
                                DrawSpriteRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   452
                end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   453
            if (Gear^.Tint <> $FFFFFFFF) then
9666
8dcb25112d96 - Bring back white dot in the center of crosshair. Crosshair is blurred now!
unc0rr
parents: 9285
diff changeset
   454
                untint;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   455
            Gear:= Gear^.NextGear
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   456
            end
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   457
        end;
4452
258945553b18 make Tint(longword) use RGBA
nemo
parents: 4451
diff changeset
   458
    end;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   459
end;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   460
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   461
procedure AddClouds;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   462
var i: LongInt;
803
3f73901a350a - Use cloud as 'visual gear'
unc0rr
parents: 802
diff changeset
   463
begin
1132
b4c0698fbb6b - Fix problem when clouds number is 0
unc0rr
parents: 1079
diff changeset
   464
for i:= 0 to cCloudsNumber - 1 do
5179
8d64dcb566ea Fix "Mixing signed expressions and longwords gives a 64bit result" warnings
unc0rr
parents: 5151
diff changeset
   465
    AddVisualGear(cLeftScreenBorder + i * LongInt(cScreenSpace div (cCloudsNumber + 1)), LAND_HEIGHT-1184, vgtCloud)
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   466
end;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   467
4792
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   468
procedure ChangeToSDClouds;
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   469
var       i: LongInt;
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   470
    vg, tmp: PVisualGear;
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   471
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   472
if cCloudsNumber = cSDCloudsNumber then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   473
    exit;
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   474
vg:= VisualGearLayers[0];
4792
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   475
while vg <> nil do
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   476
    if vg^.Kind = vgtCloud then
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   477
        begin
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   478
        tmp:= vg^.NextGear;
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   479
        DeleteVisualGear(vg);
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   480
        vg:= tmp
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   481
        end
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   482
    else vg:= vg^.NextGear;
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   483
for i:= 0 to cSDCloudsNumber - 1 do
5179
8d64dcb566ea Fix "Mixing signed expressions and longwords gives a 64bit result" warnings
unc0rr
parents: 5151
diff changeset
   484
    AddVisualGear(cLeftScreenBorder + i * LongInt(cScreenSpace div (cSDCloudsNumber + 1)), LAND_HEIGHT-1184, vgtCloud)
4792
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   485
end;
68f9b331014a sudden death changes: only change visual bit on health decrease and support for water transparancy change and clouds number change
Henek
parents: 4782
diff changeset
   486
4806
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   487
procedure AddFlakes;
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   488
var i: LongInt;
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   489
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   490
if (cReducedQuality and rqKillFlakes) <> 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   491
    exit;
4806
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   492
9768
08799c901a42 Add rubber utility. Graphics are still incomplete. Also flag snow/ice in theme config.
nemo
parents: 9764
diff changeset
   493
if hasBorder or (not cSnow) then
7543
a0dc770538e1 Poor visual gear value in theme now bears little resemblance to the number of gears actually spawned. But, it certainly shouldn't be related to LAND_WIDTH.
nemo
parents: 7420
diff changeset
   494
    for i:= 0 to Pred(vobCount * cScreenSpace div 4096) do
4806
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   495
        AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake)
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   496
else
7543
a0dc770538e1 Poor visual gear value in theme now bears little resemblance to the number of gears actually spawned. But, it certainly shouldn't be related to LAND_WIDTH.
nemo
parents: 7420
diff changeset
   497
    for i:= 0 to Pred((vobCount * cScreenSpace div 4096) div 3) do
4806
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   498
        AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake);
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   499
end;
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   500
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   501
procedure ChangeToSDFlakes;
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   502
var       i: LongInt;
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   503
    vg, tmp: PVisualGear;
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   504
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   505
if (cReducedQuality and rqKillFlakes) <> 0 then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   506
    exit;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   507
if vobCount = vobSDCount then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6553
diff changeset
   508
    exit;
6302
db8bdbb34e03 Spread flakes out over 5 layers now (far back, mid distance, just behind land, just in front of lands and hog, near distance). Spread clouds out over 3 layers (far back, mid distance, just behind land). Add a flatten clouds option, use
nemo
parents: 6291
diff changeset
   509
for i:= 0 to 6 do
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   510
    begin
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   511
    vg:= VisualGearLayers[i];
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   512
    while vg <> nil do
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   513
        if vg^.Kind = vgtFlake then
4806
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   514
        begin
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   515
        tmp:= vg^.NextGear;
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   516
        DeleteVisualGear(vg);
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   517
        vg:= tmp
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   518
        end
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   519
        else vg:= vg^.NextGear;
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   520
    end;
9768
08799c901a42 Add rubber utility. Graphics are still incomplete. Also flag snow/ice in theme config.
nemo
parents: 9764
diff changeset
   521
if hasBorder or (not cSnow) then
7822
61ff669d610f missed this one when fixing regular flakes. issue #444
nemo
parents: 7615
diff changeset
   522
    for i:= 0 to Pred(vobSDCount * cScreenSpace div 4096) do
4806
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   523
        AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake)
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   524
else
7822
61ff669d610f missed this one when fixing regular flakes. issue #444
nemo
parents: 7615
diff changeset
   525
    for i:= 0 to Pred((vobSDCount * cScreenSpace div 4096) div 3) do
4806
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   526
        AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake);
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   527
end;
48c1a395f0a7 added flake configuration also in sudden death and SDClouds for underwater
Henek
parents: 4792
diff changeset
   528
3038
4e48c276a468 In pascal unit is a namespace
unc0rr
parents: 3032
diff changeset
   529
procedure initModule;
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   530
var i: LongWord;
2699
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
   531
begin
6982
8d41d22a291d breaking news, we don't support typed consts anymore
koda
parents: 6913
diff changeset
   532
VGCounter:= 0;
6302
db8bdbb34e03 Spread flakes out over 5 layers now (far back, mid distance, just behind land, just in front of lands and hog, near distance). Spread clouds out over 3 layers (far back, mid distance, just behind land). Add a flatten clouds option, use
nemo
parents: 6291
diff changeset
   533
for i:= 0 to 6 do
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   534
    VisualGearLayers[i]:= nil;
2699
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
   535
end;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   536
3038
4e48c276a468 In pascal unit is a namespace
unc0rr
parents: 3032
diff changeset
   537
procedure freeModule;
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   538
var i: LongWord;
2715
0e4e0db79e2a Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents: 2713
diff changeset
   539
begin
6982
8d41d22a291d breaking news, we don't support typed consts anymore
koda
parents: 6913
diff changeset
   540
VGCounter:= 0;
6302
db8bdbb34e03 Spread flakes out over 5 layers now (far back, mid distance, just behind land, just in front of lands and hog, near distance). Spread clouds out over 3 layers (far back, mid distance, just behind land). Add a flatten clouds option, use
nemo
parents: 6291
diff changeset
   541
for i:= 0 to 6 do
6179
b529f88d37d0 Bit of an experiment with giving flakes a bit more depth. Might need to be theme flagged, or theme flakes reworked on some themes. Looks neat in stereo. Also finally use an array for the layers
nemo
parents: 6117
diff changeset
   542
    while VisualGearLayers[i] <> nil do DeleteVisualGear(VisualGearLayers[i]);
2715
0e4e0db79e2a Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents: 2713
diff changeset
   543
end;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   544
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   545
end.