hedgewars/uVisualGears.pas
author sheepluva
Thu, 06 May 2010 22:02:56 +0000
changeset 3440 dee31c5149e0
parent 3420 c89c2ba31da8
child 3443 14d12df0d363
permissions -rw-r--r--
* gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*) * moved virtual gear steps into new file
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
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
     3
 * Copyright (c) 2008 Andrey Korotaev <unC0Rr@gmail.com>
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
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
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;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    22
interface
3407
dcc129c4352e Engine:
smxx
parents: 3390
diff changeset
    23
uses uConsts, uFloat, Math, GLunit;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    24
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    25
type PVisualGear = ^TVisualGear;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    26
    TVGearStepProcedure = procedure (Gear: PVisualGear; Steps: Longword);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    27
    TVisualGear = record
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    28
        NextGear, PrevGear: PVisualGear;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    29
        Frame,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    30
        FrameTicks: Longword;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    31
        X : hwFloat;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    32
        Y : hwFloat;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    33
        dX: hwFloat;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    34
        dY: hwFloat;
2985
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
    35
        tdX: hwFloat;
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
    36
        tdY: hwFloat;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    37
        mdY: QWord;
3440
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
    38
        State : Longword;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    39
        Timer: Longword;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    40
        Angle, dAngle: real;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    41
        Kind: TVisualGearType;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    42
        doStep: TVGearStepProcedure;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    43
        Tex: PTexture;
2972
82828fd23dea Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents: 2948
diff changeset
    44
        alpha, scale: GLfloat;
2042
905c554d62e6 Move Speech to visual gears. This checkin CRASHES on deletion of visual gear outside the doStep
nemo
parents: 2014
diff changeset
    45
        Hedgehog: pointer;
905c554d62e6 Move Speech to visual gears. This checkin CRASHES on deletion of visual gear outside the doStep
nemo
parents: 2014
diff changeset
    46
        Text: shortstring
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    47
        end;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    48
3038
4e48c276a468 In pascal unit is a namespace
unc0rr
parents: 3032
diff changeset
    49
procedure initModule;
4e48c276a468 In pascal unit is a namespace
unc0rr
parents: 3032
diff changeset
    50
procedure freeModule;
2716
b9ca1bfca24f complete the replacement of init/free wrappers for every unit
koda
parents: 2715
diff changeset
    51
3440
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
    52
function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord = 0): PVisualGear;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    53
procedure ProcessVisualGears(Steps: Longword);
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
    54
procedure KickFlakes(Radius, X, Y: LongInt);
1045
ea195268734f Testing explosion particles implementation
unc0rr
parents: 1041
diff changeset
    55
procedure DrawVisualGears(Layer: LongWord);
1041
362b95d49cf4 - Fix previous commit
unc0rr
parents: 945
diff changeset
    56
procedure DeleteVisualGear(Gear: PVisualGear);
803
3f73901a350a - Use cloud as 'visual gear'
unc0rr
parents: 802
diff changeset
    57
procedure AddClouds;
1505
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
    58
procedure AddDamageTag(X, Y, Damage, Color: LongWord);
3045
41732f986b4f Clean Augean stables
unc0rr
parents: 3038
diff changeset
    59
procedure FreeVisualGears;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    60
2699
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
    61
var VisualGearsList: PVisualGear;
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
    62
    vobFrameTicks, vobFramesCount, vobCount: Longword;
2699
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
    63
    vobVelocity, vobFallSpeed: LongInt;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    64
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    65
implementation
2143
ad05f6b2d1c0 New baseball bat sound, steam when fire lands on water (needs new hiss sound), bubbles when hedgehog drowns, more messages on
nemo
parents: 2051
diff changeset
    66
uses uWorld, uMisc, uStore, uTeams, uSound;
1047
ca7078116c0c Update explosion graphics
unc0rr
parents: 1046
diff changeset
    67
const cExplFrameTicks = 110;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    68
3440
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
    69
{$INCLUDE "VGSHandlers.inc"}
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
    70
1505
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
    71
procedure AddDamageTag(X, Y, Damage, Color: LongWord);
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
    72
var s: shortstring;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    73
    Gear: PVisualGear;
1505
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
    74
begin
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
    75
if cAltDamage then
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    76
    begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    77
    Gear:= AddVisualGear(X, Y, vgtSmallDamageTag);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    78
    if Gear <> nil then
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    79
        with Gear^ do
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    80
            begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    81
            str(Damage, s);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    82
            Tex:= RenderStringTex(s, Color, fntSmall);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    83
            end
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    84
    end
1505
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
    85
end;
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
    86
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
    87
803
3f73901a350a - Use cloud as 'visual gear'
unc0rr
parents: 802
diff changeset
    88
// ==================================================================
2042
905c554d62e6 Move Speech to visual gears. This checkin CRASHES on deletion of visual gear outside the doStep
nemo
parents: 2014
diff changeset
    89
803
3f73901a350a - Use cloud as 'visual gear'
unc0rr
parents: 802
diff changeset
    90
// ==================================================================
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
    91
const doStepHandlers: array[TVisualGearType] of TVGearStepProcedure =
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    92
        (
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    93
            @doStepFlake,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    94
            @doStepCloud,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    95
            @doStepExpl,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    96
            @doStepExpl,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    97
            @doStepFire,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    98
            @doStepSmallDamage,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
    99
            @doStepTeamHealthSorter,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   100
            @doStepSpeechBubble,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   101
            @doStepBubble,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   102
            @doStepSteam,
2972
82828fd23dea Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents: 2948
diff changeset
   103
            @doStepAmmo,
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   104
            @doStepSmoke,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   105
            @doStepSmoke,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   106
            @doStepHealth,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   107
            @doStepShell,
2974
f3fa665f0874 Engine:
smxx
parents: 2972
diff changeset
   108
            @doStepDust,
2982
4213c6a8aceb Palewolf adds droplets to his splashes
nemo
parents: 2974
diff changeset
   109
            @doStepSplash,
3032
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   110
            @doStepDroplet,
3080
b7fa8ad60e3b Engine:
smxx
parents: 3062
diff changeset
   111
            @doStepSmokeRing,
3115
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   112
            @doStepBeeTrace,
3145
a9af6bf223cf Birdy's falling feathers
mbait
parents: 3118
diff changeset
   113
            @doStepEgg,
3440
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   114
            @doStepFeather,
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   115
            @doStepHealthTag,
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   116
            @doStepSmokeTrace,
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   117
            @doStepSmokeTrace,
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   118
            @doStepExplosion,
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   119
            @doStepBigExplosion
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   120
        );
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   121
3440
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   122
function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord = 0): PVisualGear;
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2671
diff changeset
   123
var gear: PVisualGear;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   124
    t: Longword;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   125
    sp: hwFloat;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   126
begin
2671
7e0f88013fe8 smaller patches, one missing Sky-lowres, IMG_Init and Mix_Init (might require newer libraries), updates to SDL bindings, code cleanup, new compile flags
koda
parents: 2599
diff changeset
   127
if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then // we are scrolling now
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   128
    if Kind <> vgtCloud then
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   129
        begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   130
        AddVisualGear:= nil;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   131
        exit
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   132
        end;
1642
177b440773de Disable visual gears when quick replaying
unc0rr
parents: 1505
diff changeset
   133
2376
ece7b87f1334 Strip trailing spaces
nemo
parents: 2152
diff changeset
   134
if cReducedQuality and
ece7b87f1334 Strip trailing spaces
nemo
parents: 2152
diff changeset
   135
   (Kind <> vgtTeamHealthSorter) and
ece7b87f1334 Strip trailing spaces
nemo
parents: 2152
diff changeset
   136
   (Kind <> vgtSmallDamageTag) and
2047
805f7b62cff6 Allow speech bubble/small damage tags in "reduced quality"
nemo
parents: 2045
diff changeset
   137
   (Kind <> vgtSpeechBubble) then
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   138
    begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   139
    AddVisualGear:= nil;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   140
    exit
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   141
    end;
1812
3d4692e825e7 'Reduce quality' patch by nemo
unc0rr
parents: 1801
diff changeset
   142
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2671
diff changeset
   143
New(gear);
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2671
diff changeset
   144
FillChar(gear^, sizeof(TVisualGear), 0);
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2671
diff changeset
   145
gear^.X:= int2hwFloat(X);
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2671
diff changeset
   146
gear^.Y:= int2hwFloat(Y);
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2671
diff changeset
   147
gear^.Kind := Kind;
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2671
diff changeset
   148
gear^.doStep:= doStepHandlers[Kind];
3440
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   149
gear^.State:= 0;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   150
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2671
diff changeset
   151
with gear^ do
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   152
    case Kind of
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   153
    vgtFlake: begin
2985
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   154
                Timer:= 0;
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   155
                tdX:= _0;
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   156
                tdY:= _0;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   157
                FrameTicks:= random(vobFrameTicks);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   158
                Frame:= random(vobFramesCount);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   159
                Angle:= random * 360;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   160
                dx.isNegative:= random(2) = 0;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   161
                dx.QWordValue:= random(100000000);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   162
                dy.isNegative:= false;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   163
                dy.QWordValue:= random(70000000);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   164
                dAngle:= (random(2) * 2 - 1) * (1 + random) * vobVelocity / 1000
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   165
                end;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   166
    vgtCloud: begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   167
                Frame:= random(4);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   168
                dx.isNegative:= random(2) = 0;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   169
                dx.QWordValue:= random(214748364);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   170
                dy.isNegative:= random(2) = 0;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   171
                dy.QWordValue:= 21474836 + random(64424509);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   172
                mdY:= dy.QWordValue
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   173
                end;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   174
    vgtExplPart,
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   175
    vgtExplPart2: begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   176
                t:= random(1024);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   177
                sp:= _0_001 * (random(95) + 70);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   178
                dx:= AngleSin(t) * sp;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   179
                dx.isNegative:= random(2) = 0;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   180
                dy:= AngleCos(t) * sp;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   181
                dy.isNegative:= random(2) = 0;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   182
                Frame:= 7 - random(3);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   183
                FrameTicks:= cExplFrameTicks
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   184
                end;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   185
        vgtFire: begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   186
                t:= random(1024);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   187
                sp:= _0_001 * (random(85) + 95);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   188
                dx:= AngleSin(t) * sp;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   189
                dx.isNegative:= random(2) = 0;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   190
                dy:= AngleCos(t) * sp;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   191
                dy.isNegative:= random(2) = 0;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   192
                FrameTicks:= 650 + random(250);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   193
                Frame:= random(8)
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   194
                end;
3115
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   195
         vgtEgg: begin
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   196
                t:= random(1024);
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   197
                sp:= _0_001 * (random(85) + 95);
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   198
                dx:= AngleSin(t) * sp;
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   199
                dx.isNegative:= random(2) = 0;
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   200
                dy:= AngleCos(t) * sp;
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   201
                dy.isNegative:= random(2) = 0;
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   202
                FrameTicks:= 650 + random(250);
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   203
                Frame:= 1
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   204
                end;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   205
        vgtShell: FrameTicks:= 500;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   206
    vgtSmallDamageTag: begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   207
                gear^.FrameTicks:= 1100
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   208
                end;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   209
    vgtBubble: begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   210
                dx.isNegative:= random(2) = 0;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   211
                dx.QWordValue:= random(100000000);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   212
                dy:= _0_001 * (random(85) + 95);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   213
                dy.isNegative:= false;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   214
                FrameTicks:= 250 + random(1751);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   215
                Frame:= random(5)
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   216
                end;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   217
    vgtSteam: begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   218
                dx.isNegative:= random(2) = 0;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   219
                dx.QWordValue:= random(100000000);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   220
                dy:= _0_001 * (random(85) + 95);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   221
                dy.isNegative:= false;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   222
                Frame:= 7 - random(3);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   223
                FrameTicks:= cExplFrameTicks * 2;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   224
                end;
2972
82828fd23dea Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents: 2948
diff changeset
   225
    vgtAmmo: begin
82828fd23dea Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents: 2948
diff changeset
   226
                alpha:= 1.0;
82828fd23dea Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents: 2948
diff changeset
   227
                scale:= 1.0
82828fd23dea Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents: 2948
diff changeset
   228
                end;
2941
566f967ec22f White/Black smoke, break out rolling barrel into its own routine, adjust rolling barrel impact damage. NEEDS TESTING
nemo
parents: 2848
diff changeset
   229
  vgtSmokeWhite, 
2713
71250942e95b Palewolf's smoke traces for fire.
nemo
parents: 2699
diff changeset
   230
  vgtSmoke: begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   231
                dx:= _0_0002 * (random(45) + 10);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   232
                dx.isNegative:= random(2) = 0;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   233
                dy:= _0_0002 * (random(45) + 10);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   234
                dy.isNegative:= false;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   235
                Frame:= 7 - random(2);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   236
                FrameTicks:= cExplFrameTicks * 2;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   237
                end;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   238
    vgtHealth: begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   239
                dx:= _0_001 * random(45);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   240
                dx.isNegative:= random(2) = 0;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   241
                dy:= _0_001 * (random(20) + 25);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   242
                Frame:= 0;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   243
                FrameTicks:= random(750) + 1250;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   244
                end;
2848
8a1725b4f724 Engine:
smxx
parents: 2827
diff changeset
   245
  vgtDust: begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   246
                dx:= _0_005 * (random(15) + 10);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   247
                dx.isNegative:= random(2) = 0;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   248
                dy:= _0_001 * (random(40) + 20);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   249
                Frame:= 7 - random(2);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   250
                FrameTicks:= random(20) + 15;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   251
                end;
2974
f3fa665f0874 Engine:
smxx
parents: 2972
diff changeset
   252
  vgtSplash: begin
f3fa665f0874 Engine:
smxx
parents: 2972
diff changeset
   253
                dx:= _0;
f3fa665f0874 Engine:
smxx
parents: 2972
diff changeset
   254
                dx.isNegative:= false;
f3fa665f0874 Engine:
smxx
parents: 2972
diff changeset
   255
                dy:= _0;
f3fa665f0874 Engine:
smxx
parents: 2972
diff changeset
   256
                FrameTicks:= 740;
f3fa665f0874 Engine:
smxx
parents: 2972
diff changeset
   257
                Frame:= 19;
f3fa665f0874 Engine:
smxx
parents: 2972
diff changeset
   258
                end;
2982
4213c6a8aceb Palewolf adds droplets to his splashes
nemo
parents: 2974
diff changeset
   259
    vgtDroplet: begin
4213c6a8aceb Palewolf adds droplets to his splashes
nemo
parents: 2974
diff changeset
   260
                dx:= _0_001 * (random(75) + 15);
4213c6a8aceb Palewolf adds droplets to his splashes
nemo
parents: 2974
diff changeset
   261
                dx.isNegative:= random(2) = 0;
4213c6a8aceb Palewolf adds droplets to his splashes
nemo
parents: 2974
diff changeset
   262
                dy:= _0_001 * (random(80) + 120);
4213c6a8aceb Palewolf adds droplets to his splashes
nemo
parents: 2974
diff changeset
   263
                dy.isNegative:= true;
4213c6a8aceb Palewolf adds droplets to his splashes
nemo
parents: 2974
diff changeset
   264
                FrameTicks:= 250 + random(1751);
4213c6a8aceb Palewolf adds droplets to his splashes
nemo
parents: 2974
diff changeset
   265
                Frame:= random(3)
4213c6a8aceb Palewolf adds droplets to his splashes
nemo
parents: 2974
diff changeset
   266
                end;
3080
b7fa8ad60e3b Engine:
smxx
parents: 3062
diff changeset
   267
   vgtBeeTrace: begin
b7fa8ad60e3b Engine:
smxx
parents: 3062
diff changeset
   268
                FrameTicks:= 1000;
b7fa8ad60e3b Engine:
smxx
parents: 3062
diff changeset
   269
                Frame:= random(16);
b7fa8ad60e3b Engine:
smxx
parents: 3062
diff changeset
   270
                end;
3032
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   271
    vgtSmokeRing: begin
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   272
                dx:= _0;
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   273
                dx.isNegative:= false;
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   274
                dy:= _0;
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   275
                dy.isNegative:= false;
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   276
                FrameTicks:= 600;
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   277
                Timer:= 0;
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   278
                Frame:= 0;
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   279
                scale:= 0.6;
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   280
                alpha:= 1;
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   281
                angle:= random(360);
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   282
                end;
3145
a9af6bf223cf Birdy's falling feathers
mbait
parents: 3118
diff changeset
   283
     vgtFeather: begin
a9af6bf223cf Birdy's falling feathers
mbait
parents: 3118
diff changeset
   284
                t:= random(1024);
a9af6bf223cf Birdy's falling feathers
mbait
parents: 3118
diff changeset
   285
                sp:= _0_001 * (random(85) + 95);
a9af6bf223cf Birdy's falling feathers
mbait
parents: 3118
diff changeset
   286
                dx:= AngleSin(t) * sp;
a9af6bf223cf Birdy's falling feathers
mbait
parents: 3118
diff changeset
   287
                dx.isNegative:= random(2) = 0;
a9af6bf223cf Birdy's falling feathers
mbait
parents: 3118
diff changeset
   288
                dy:= AngleCos(t) * sp;
a9af6bf223cf Birdy's falling feathers
mbait
parents: 3118
diff changeset
   289
                dy.isNegative:= random(2) = 0;
a9af6bf223cf Birdy's falling feathers
mbait
parents: 3118
diff changeset
   290
                FrameTicks:= 650 + random(250);
a9af6bf223cf Birdy's falling feathers
mbait
parents: 3118
diff changeset
   291
                Frame:= 1
a9af6bf223cf Birdy's falling feathers
mbait
parents: 3118
diff changeset
   292
                end;
3440
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   293
  vgtHealthTag: begin
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   294
                gear^.Timer:= 1500;
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   295
                //gear^.Z:= 2002;
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   296
                end;
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   297
  vgtSmokeTrace,
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   298
  vgtEvilTrace: begin
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   299
                gear^.X:= gear^.X - _16;
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   300
                gear^.Y:= gear^.Y - _16;
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   301
                gear^.State:= 8;
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   302
                //gear^.Z:= cSmokeZ
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   303
                end;
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   304
vgtBigExplosion: begin
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   305
                gear^.Angle:= random(360);
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   306
                end;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   307
        end;
803
3f73901a350a - Use cloud as 'visual gear'
unc0rr
parents: 802
diff changeset
   308
3440
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   309
if State <> 0 then gear^.State:= State;
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   310
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   311
if VisualGearsList <> nil then
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   312
    begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   313
    VisualGearsList^.PrevGear:= gear;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   314
    gear^.NextGear:= VisualGearsList
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   315
    end;
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2671
diff changeset
   316
VisualGearsList:= gear;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   317
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2671
diff changeset
   318
AddVisualGear:= gear;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   319
end;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   320
1041
362b95d49cf4 - Fix previous commit
unc0rr
parents: 945
diff changeset
   321
procedure DeleteVisualGear(Gear: PVisualGear);
362b95d49cf4 - Fix previous commit
unc0rr
parents: 945
diff changeset
   322
begin
1505
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
   323
if Gear^.Tex <> nil then
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   324
    FreeTexture(Gear^.Tex);
1505
3a96e93572cb - Convert small damage tag to visual gears
unc0rr
parents: 1132
diff changeset
   325
1041
362b95d49cf4 - Fix previous commit
unc0rr
parents: 945
diff changeset
   326
if Gear^.NextGear <> nil then Gear^.NextGear^.PrevGear:= Gear^.PrevGear;
362b95d49cf4 - Fix previous commit
unc0rr
parents: 945
diff changeset
   327
if Gear^.PrevGear <> nil then Gear^.PrevGear^.NextGear:= Gear^.NextGear
362b95d49cf4 - Fix previous commit
unc0rr
parents: 945
diff changeset
   328
   else VisualGearsList:= Gear^.NextGear;
362b95d49cf4 - Fix previous commit
unc0rr
parents: 945
diff changeset
   329
362b95d49cf4 - Fix previous commit
unc0rr
parents: 945
diff changeset
   330
Dispose(Gear)
362b95d49cf4 - Fix previous commit
unc0rr
parents: 945
diff changeset
   331
end;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   332
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   333
procedure ProcessVisualGears(Steps: Longword);
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   334
var Gear, t: PVisualGear;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   335
begin
803
3f73901a350a - Use cloud as 'visual gear'
unc0rr
parents: 802
diff changeset
   336
if Steps = 0 then exit;
3f73901a350a - Use cloud as 'visual gear'
unc0rr
parents: 802
diff changeset
   337
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   338
t:= VisualGearsList;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   339
while t <> nil do
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   340
      begin
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   341
      Gear:= t;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   342
      t:= Gear^.NextGear;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   343
      Gear^.doStep(Gear, Steps)
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   344
      end
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   345
end;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   346
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
   347
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
   348
var Gear, t: PVisualGear;
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   349
    dmg: LongInt;
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   350
begin
3118
1320933fd651 New impact sounds for HHG
nemo
parents: 3115
diff changeset
   351
if (vobCount = 0) or (vobCount > 200) or cReducedQuality then exit;
2985
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   352
t:= VisualGearsList;
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   353
while t <> nil do
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   354
      begin
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   355
      Gear:= t;
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   356
      if Gear^.Kind = vgtFlake then
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   357
          begin
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   358
          // Damage calc from doMakeExplosion
3096
9330eead14fa Remove Distance from flake kick, reduce calls to Random() in flame replacing w/ checks on game tick and a little randomness.
nemo
parents: 3083
diff changeset
   359
          dmg:= min(100,Radius  + cHHRadius div 2 - (hwRound(hwAbs(Gear^.X - int2hwFloat(X))+hwAbs(Gear^.Y - int2hwFloat(Y))) div 5));
2985
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   360
          if dmg > 1 then
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   361
              begin
3096
9330eead14fa Remove Distance from flake kick, reduce calls to Random() in flame replacing w/ checks on game tick and a little randomness.
nemo
parents: 3083
diff changeset
   362
              Gear^.tdX:= SignAs(_0_02 * dmg + cHHKick, Gear^.X - int2hwFloat(X));
9330eead14fa Remove Distance from flake kick, reduce calls to Random() in flame replacing w/ checks on game tick and a little randomness.
nemo
parents: 3083
diff changeset
   363
              Gear^.tdY:= SignAs(_0_02 * dmg + cHHKick, Gear^.Y - int2hwFloat(Y));
2986
c0c91cd3f423 Trying to tweak kicks a bit
nemo
parents: 2985
diff changeset
   364
              Gear^.Timer:= 200
2985
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   365
              end
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   366
          end;
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   367
      t:= Gear^.NextGear
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   368
      end
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   369
end;
d268a7fbb868 Kick flakes a bit when an explosion is nearby. Needs testing / review by those more artistically inclined
nemo
parents: 2982
diff changeset
   370
1045
ea195268734f Testing explosion particles implementation
unc0rr
parents: 1041
diff changeset
   371
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
   372
var Gear: PVisualGear;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   373
begin
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   374
Gear:= VisualGearsList;
1045
ea195268734f Testing explosion particles implementation
unc0rr
parents: 1041
diff changeset
   375
case Layer of
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   376
    0: while Gear <> nil do
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   377
        begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   378
        case Gear^.Kind of
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   379
            vgtFlake: if vobVelocity = 0 then
3248
8d4c61f6f30c - Added SkyOffset, HorizontOffset as global vars
palewolf
parents: 3165
diff changeset
   380
                        DrawSprite(sprFlake, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   381
                    else
3248
8d4c61f6f30c - Added SkyOffset, HorizontOffset as global vars
palewolf
parents: 3165
diff changeset
   382
                        DrawRotatedF(sprFlake, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle);
8d4c61f6f30c - Added SkyOffset, HorizontOffset as global vars
palewolf
parents: 3165
diff changeset
   383
            vgtCloud: DrawSprite(sprCloud, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   384
            end;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   385
        Gear:= Gear^.NextGear
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   386
        end;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   387
    1: while Gear <> nil do
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   388
        begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   389
            if not cReducedQuality then
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   390
                case Gear^.Kind of
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   391
                    vgtSmoke: DrawSprite(sprSmoke, hwRound(Gear^.X) + WorldDx - 11, hwRound(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   392
                    vgtSmokeWhite: DrawSprite(sprSmokeWhite, hwRound(Gear^.X) + WorldDx - 11, hwRound(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   393
                    vgtDust: DrawSprite(sprDust, hwRound(Gear^.X) + WorldDx - 11, hwRound(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
3148
3e28a12be5ac Feather: sprites was moved to another layer
mbait
parents: 3145
diff changeset
   394
                    vgtFeather: begin
3376
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   395
                            if Gear^.FrameTicks < 255 then
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   396
                                Tint($FF, $FF, $FF, Gear^.FrameTicks);
3148
3e28a12be5ac Feather: sprites was moved to another layer
mbait
parents: 3145
diff changeset
   397
                            DrawRotatedF(sprFeather, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
3376
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   398
                            if Gear^.FrameTicks < 255 then
3390
1d4926d10a9e Engine:
smxx
parents: 3376
diff changeset
   399
                                Tint($FF, $FF, $FF, $FF);
3148
3e28a12be5ac Feather: sprites was moved to another layer
mbait
parents: 3145
diff changeset
   400
                            end;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   401
                end;
3440
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   402
            case Gear^.Kind of
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   403
                vgtSmokeTrace: if Gear^.State < 8 then DrawSprite(sprSmokeTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State);
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   404
                vgtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State);                
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   405
                vgtExplosion: DrawSprite(sprExplosion50, hwRound(Gear^.X) - 32 + WorldDx, hwRound(Gear^.Y) - 32 + WorldDy, Gear^.State);
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   406
                vgtBigExplosion: begin
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   407
                                 Tint($FF, $FF, $FF, floor($FF * (1 - power(Gear^.Timer / 250, 4))));
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   408
                                 DrawRotatedTextureF(SpritesData[sprBigExplosion].Texture, 0.85 * (-power(2, -10 * Int(Gear^.Timer)/250) + 1) + 0.4, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 385, 385, Gear^.Angle);
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   409
                                 Tint($FF, $FF, $FF, $FF);
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   410
                                 end;
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   411
            end;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   412
        Gear:= Gear^.NextGear
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   413
        end;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   414
    2: while Gear <> nil do
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   415
        begin
2047
805f7b62cff6 Allow speech bubble/small damage tags in "reduced quality"
nemo
parents: 2045
diff changeset
   416
        if not cReducedQuality then
805f7b62cff6 Allow speech bubble/small damage tags in "reduced quality"
nemo
parents: 2045
diff changeset
   417
            case Gear^.Kind of
2428
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2376
diff changeset
   418
                vgtExplPart: DrawSprite(sprExplPart, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2376
diff changeset
   419
                vgtExplPart2: DrawSprite(sprExplPart2, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
6800f8aa0184 Huge Smaxx patch with some fixes by me:
unc0rr
parents: 2376
diff changeset
   420
                vgtFire: DrawSprite(sprFlame, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy, (RealTicks div 64 + Gear^.Frame) mod 8);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   421
                vgtBubble: DrawSprite(sprBubbles, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   422
                vgtSteam: DrawSprite(sprExplPart, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
2972
82828fd23dea Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents: 2948
diff changeset
   423
                vgtAmmo: begin
3376
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   424
                        Tint($FF, $FF, $FF, floor(Gear^.alpha * $FF));
2972
82828fd23dea Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents: 2948
diff changeset
   425
                        DrawTextureF(ropeIconTex, Gear^.scale, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 32, 32);
82828fd23dea Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents: 2948
diff changeset
   426
                        DrawTextureF(SpritesData[sprAMAmmos].Texture, Gear^.scale * 0.90, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame - 1, 1, 32, 32);
3390
1d4926d10a9e Engine:
smxx
parents: 3376
diff changeset
   427
                        Tint($FF, $FF, $FF, $FF);
2972
82828fd23dea Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents: 2948
diff changeset
   428
                        end;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   429
                vgtHealth:  begin
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   430
                            case Gear^.Frame div 10 of
3376
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   431
                                0:Tint(0, $FF, 0, floor(Gear^.FrameTicks * $FF / 1000));
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   432
                                1:Tint($FF, 0, 0, floor(Gear^.FrameTicks * $FF / 1000));
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   433
                            end;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   434
                            DrawSprite(sprHealth, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, 0);
3390
1d4926d10a9e Engine:
smxx
parents: 3376
diff changeset
   435
                            Tint($FF, $FF, $FF, $FF);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   436
                            end;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   437
                vgtShell: begin
3376
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   438
                            if Gear^.FrameTicks < $FF then
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   439
                                Tint($FF, $FF, $FF, Gear^.FrameTicks);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   440
                            DrawRotatedF(sprShell, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
3376
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   441
                            if Gear^.FrameTicks < $FF then
3390
1d4926d10a9e Engine:
smxx
parents: 3376
diff changeset
   442
                                Tint($FF, $FF, $FF, $FF);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   443
                            end;
3115
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   444
                  vgtEgg: begin
3376
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   445
                            if Gear^.FrameTicks < $FF then
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   446
                                Tint($FF, $FF, $FF, Gear^.FrameTicks);
3115
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   447
                            DrawRotatedF(sprEgg, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
3376
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   448
                            if Gear^.FrameTicks < $FF then
3390
1d4926d10a9e Engine:
smxx
parents: 3376
diff changeset
   449
                                Tint($FF, $FF, $FF, $FF);
3115
831bd0f7050d Engine:
smxx
parents: 3096
diff changeset
   450
                            end;
3326
7f57fc2bf630 Fix splashes for older graphics cards
palewolf
parents: 3267
diff changeset
   451
                vgtSplash: DrawSprite(sprSplash, hwRound(Gear^.X) + WorldDx - 40, hwRound(Gear^.Y) + WorldDy - 58, 19 - (Gear^.FrameTicks div 37));
2982
4213c6a8aceb Palewolf adds droplets to his splashes
nemo
parents: 2974
diff changeset
   452
                vgtDroplet: DrawSprite(sprDroplet, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, Gear^.Frame);
3080
b7fa8ad60e3b Engine:
smxx
parents: 3062
diff changeset
   453
               vgtBeeTrace: begin
3376
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   454
                            if Gear^.FrameTicks < $FF then
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   455
                                Tint($FF, $FF, $FF, Gear^.FrameTicks div 2)
3080
b7fa8ad60e3b Engine:
smxx
parents: 3062
diff changeset
   456
                            else
3390
1d4926d10a9e Engine:
smxx
parents: 3376
diff changeset
   457
                                Tint($FF, $FF, $FF, $80);
3080
b7fa8ad60e3b Engine:
smxx
parents: 3062
diff changeset
   458
                            DrawRotatedF(sprBeeTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, (RealTicks shr 4) mod cMaxAngle);
3390
1d4926d10a9e Engine:
smxx
parents: 3376
diff changeset
   459
                            Tint($FF, $FF, $FF, $FF);
3080
b7fa8ad60e3b Engine:
smxx
parents: 3062
diff changeset
   460
                            end;
3032
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   461
                vgtSmokeRing: begin
3376
faee68a28b82 Engine:
smxx
parents: 3326
diff changeset
   462
                            Tint($FF, $FF, $FF, floor(Gear^.alpha * $FF));
3032
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   463
                            DrawRotatedTextureF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle);
3390
1d4926d10a9e Engine:
smxx
parents: 3376
diff changeset
   464
                            Tint($FF, $FF, $FF, $FF);
3032
9c190d3c165b Insert commit message here
palewolf
parents: 2986
diff changeset
   465
                            end;
2047
805f7b62cff6 Allow speech bubble/small damage tags in "reduced quality"
nemo
parents: 2045
diff changeset
   466
            end;
805f7b62cff6 Allow speech bubble/small damage tags in "reduced quality"
nemo
parents: 2045
diff changeset
   467
        case Gear^.Kind of
805f7b62cff6 Allow speech bubble/small damage tags in "reduced quality"
nemo
parents: 2045
diff changeset
   468
            vgtSmallDamageTag: DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
2042
905c554d62e6 Move Speech to visual gears. This checkin CRASHES on deletion of visual gear outside the doStep
nemo
parents: 2014
diff changeset
   469
            vgtSpeechBubble: if Gear^.Tex <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
3440
dee31c5149e0 * gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents: 3420
diff changeset
   470
            vgtHealthTag: if Gear^.Tex <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
2047
805f7b62cff6 Allow speech bubble/small damage tags in "reduced quality"
nemo
parents: 2045
diff changeset
   471
        end;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   472
        Gear:= Gear^.NextGear
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   473
        end
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   474
    end
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   475
end;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   476
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   477
procedure AddClouds;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   478
var i: LongInt;
803
3f73901a350a - Use cloud as 'visual gear'
unc0rr
parents: 802
diff changeset
   479
begin
1132
b4c0698fbb6b - Fix problem when clouds number is 0
unc0rr
parents: 1079
diff changeset
   480
for i:= 0 to cCloudsNumber - 1 do
1801
bc0c5c21376e Clouds fixes by nemo
unc0rr
parents: 1792
diff changeset
   481
    AddVisualGear( - cScreenWidth + i * ((cScreenWidth * 2 + (LAND_WIDTH+256)) 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
   482
end;
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   483
3045
41732f986b4f Clean Augean stables
unc0rr
parents: 3038
diff changeset
   484
procedure FreeVisualGears;
41732f986b4f Clean Augean stables
unc0rr
parents: 3038
diff changeset
   485
begin
41732f986b4f Clean Augean stables
unc0rr
parents: 3038
diff changeset
   486
    while VisualGearsList <> nil do DeleteVisualGear(VisualGearsList);
41732f986b4f Clean Augean stables
unc0rr
parents: 3038
diff changeset
   487
end;
41732f986b4f Clean Augean stables
unc0rr
parents: 3038
diff changeset
   488
3038
4e48c276a468 In pascal unit is a namespace
unc0rr
parents: 3032
diff changeset
   489
procedure initModule;
2699
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
   490
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2941
diff changeset
   491
    VisualGearsList:= nil;
2699
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
   492
end;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   493
3038
4e48c276a468 In pascal unit is a namespace
unc0rr
parents: 3032
diff changeset
   494
procedure freeModule;
2715
0e4e0db79e2a Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents: 2713
diff changeset
   495
begin
0e4e0db79e2a Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents: 2713
diff changeset
   496
end;
802
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   497
ed5450a89b96 Start implementing 'visual gears' - gears, that don't need to be synchronized (clouds and flakes)
unc0rr
parents:
diff changeset
   498
end.