~ubuntu-branches/ubuntu/wily/hedgewars/wily

« back to all changes in this revision

Viewing changes to hedgewars/uTypes.pas

  • Committer: Package Import Robot
  • Author(s): Dmitry E. Oboukhov
  • Date: 2011-09-23 10:16:55 UTC
  • mfrom: (1.2.11 upstream)
  • Revision ID: package-import@ubuntu.com-20110923101655-3977th2gc5n0a3pv
Tags: 0.9.16-1
* New upstream version.
 + Downloadable content! Simply click to install any content.
   New voices, hats, maps, themes, translations, music, scripts...
   Hedgewars is now more customisable than ever before! As time goes
   by we will be soliciting community content to feature on this page,
   so remember to check it from time to time. If you decide you want
   to go back to standard Hedgewars, just remove the Data directory
   from your Hedgewars config directory.
 + 3-D rendering! Diorama-like rendering of the game in a variety
   of 3D modes. Let us know which ones work best for you, we didn't
   really have the equipment to test them all.
 + Resizable game window.
 + New utilities! The Time Box will remove one of your hedgehogs
   from the game for a while, protecting from attack until it returns,
   somewhere else on the map. Land spray will allow you to build bridges,
   seal up holes, or just make life unpleasant for your enemies.
 + New single player: Bamboo Thicket, That Sinking Feeling, Newton and
   the Tree and multi-player: The Specialists, Space Invaders,
   Racer - scripts! And a ton more script hooks for scripters
 + New twists on old weapons. Drill strike, seduction and fire have
   been adjusted. Defective mines have been added, rope can attach to
   hogs/crates/barrels again, grenades now have variable bounce (use
   precise key + 1-5). Portal gun is now more usable in flight and
   all game actions are a lot faster.
 + New theme - Golf, dozens of new community hats and a new
   localised Default voice, Ukranian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(*
 
2
 * Hedgewars, a free turn based strategy game
 
3
 * Copyright (c) 2004-2011 Andrey Korotaev <unC0Rr@gmail.com>
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; version 2 of the License
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
17
 *)
 
18
 
1
19
{$INCLUDE "options.inc"}
2
20
 
3
21
unit uTypes;
 
22
(*
 
23
 * This unit defines various types and enumerations for usage in different
 
24
 * places in the engine code.
 
25
 *)
4
26
interface
5
27
 
6
28
uses SDLh, uFloat, GLunit, uConsts, Math;
7
29
 
 
30
// NOTE: typed const is a variable despite const qualifier
 
31
// in freepascal you may actually use var for the same purpose
 
32
 
8
33
type
9
34
    HwColor4f = record
10
35
        r, g, b, a: byte
11
36
        end;
12
37
 
13
 
    TGameState = (gsLandGen, gsStart, gsGame, gsChat, gsConfirm, gsExit, gsSuspend);
 
38
    // Possible states of the game
 
39
    TGameState = (gsLandGen, gsStart, gsGame, gsChat, gsConfirm, gsExit);
14
40
 
 
41
    // Game types that help determining what the engine is actually supposed to do
15
42
    TGameType = (gmtLocal, gmtDemo, gmtNet, gmtSave, gmtLandPreview, gmtSyntax);
16
43
 
 
44
    // Different files are stored in different folders, this enumeration is used to tell which folder to use
17
45
    TPathType = (ptNone, ptData, ptGraphics, ptThemes, ptCurrTheme, ptTeams, ptMaps,
18
46
            ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts,
19
 
            ptLocale, ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps);
 
47
            ptLocale, ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps, ptSuddenDeath);
20
48
 
 
49
    // Available sprites for displaying stuff
21
50
    TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame,
22
51
            sprLag, sprArrow, sprBazookaShell, sprTargetP, sprBee,
23
52
            sprSmokeTrace, sprRopeHook, sprExplosion50, sprMineOff,
43
72
            sprThoughtCorner, sprThoughtEdge, sprThoughtTail,
44
73
            sprShoutCorner, sprShoutEdge, sprShoutTail,
45
74
            sprSniperRifle, sprBubbles, sprJetpack, sprHealth, sprHandMolotov, sprMolotov,
46
 
            sprSmoke, sprSmokeWhite, sprShell, sprDust, sprExplosives, sprExplosivesRoll,
 
75
            sprSmoke, sprSmokeWhite, sprShell, sprDust, sprSnowDust, sprExplosives, sprExplosivesRoll,
47
76
            sprAmTeleport, sprSplash, sprDroplet, sprBirdy, sprHandCake, sprHandConstruction,
48
77
            sprHandGrenade, sprHandMelon, sprHandMortar, sprHandSkip, sprHandCluster,
49
78
            sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp,
52
81
            sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk, sprNote,
53
82
            sprSMineOff, sprSMineOn, sprHandSMine, sprHammer,
54
83
            sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb,
55
 
            sprBulletHit, sprSnowball, sprHandSnowball, sprSnow
 
84
            sprBulletHit, sprSnowball, sprHandSnowball, sprSnow,
 
85
            sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis
56
86
            );
57
87
 
58
88
    // Gears that interact with other Gears and/or Land
59
 
    TGearType = (gtBomb, gtHedgehog, gtShell, gtGrave, gtBee, // 4
 
89
    TGearType = (gtGrenade, gtHedgehog, gtShell, gtGrave, gtBee, // 4
60
90
            gtShotgunShot, gtPickHammer, gtRope, gtMine, gtCase, // 9
61
91
            gtDEagleShot, gtDynamite, gtClusterBomb, gtCluster, gtShover, // 14
62
 
            gtFlame, gtFirePunch, gtATStartGame, gtATSmoothWindCh, // 18
63
 
            gtATFinishGame, gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, // 23
64
 
            gtGirder, gtTeleport, gtSwitcher, gtTarget, gtMortar, // 28
65
 
            gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 34
66
 
            gtHellishBomb, gtWaterUp, gtDrill, gtBallGun, gtBall, gtRCPlane, // 40
67
 
            gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, // 45
68
 
            gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 51
69
 
            gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector, // 56
70
 
            gtNapalmBomb, gtSnowball, gtFlake); // 58
 
92
            gtFlame, gtFirePunch, gtATStartGame, // 17
 
93
            gtATFinishGame, gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, // 22
 
94
            gtGirder, gtTeleport, gtSwitcher, gtTarget, gtMortar, // 27
 
95
            gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 33
 
96
            gtHellishBomb, gtWaterUp, gtDrill, gtBallGun, gtBall, gtRCPlane, // 39
 
97
            gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, // 44
 
98
            gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 50
 
99
            gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector, // 55
 
100
            gtNapalmBomb, gtSnowball, gtFlake, gtStructure, gtLandGun, gtTardis); // 61
71
101
 
72
102
    // Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.)
73
103
    TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
74
104
            vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble,
75
 
            vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtHealth, vgtShell,
 
105
            vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtShell,
76
106
            vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace, vgtEgg,
77
107
            vgtFeather, vgtHealthTag, vgtSmokeTrace, vgtEvilTrace, vgtExplosion,
78
 
            vgtBigExplosion, vgtChunk, vgtNote, vgtLineTrail, vgtBulletHit, vgtCircle);
 
108
            vgtBigExplosion, vgtChunk, vgtNote, vgtLineTrail, vgtBulletHit, vgtCircle,
 
109
            vgtSmoothWindBar, vgtStraightShot);
79
110
 
80
111
    TGearsType = set of TGearType;
81
112
 
 
113
    // Damage can be caused by different sources
82
114
    TDamageSource = (dsUnknown, dsFall, dsBullet, dsExplosion, dsShove, dsPoison);
83
115
 
 
116
    // Available sounds
84
117
    TSound = (sndNone,
85
118
            sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease,
86
119
            sndSplash, sndShotgunReload, sndShotgunFire, sndGraveImpact,
87
 
            sndMineTick, sndPickhammer, sndGun, sndBee, sndJump1, sndJump2,
 
120
            sndMineImpact, sndMineTick, sndMudballImpact,
 
121
            sndPickhammer, sndGun, sndBee, sndJump1, sndJump2,
88
122
            sndJump3, sndYesSir, sndLaugh, sndIllGetYou, sndIncoming,
89
123
            sndMissed, sndStupid, sndFirstBlood, sndBoring, sndByeBye,
90
124
            sndSameTeam, sndNutter, sndReinforce, sndTraitor, sndRegret,
96
130
            sndVaporize, sndWarp, sndSuddenDeath, sndMortar, sndShutter,
97
131
            sndHomerun, sndMolotov, sndCover, sndUhOh, sndOops,
98
132
            sndNooo, sndHello, sndRopeShot, sndRopeAttach, sndRopeRelease,
99
 
            sndSwitchHog, sndVictory, sndSniperReload, sndSteps, sndLowGravity,
 
133
            sndSwitchHog, sndVictory, sndFlawless, sndSniperReload, sndSteps, sndLowGravity,
100
134
            sndHellishImpact1, sndHellishImpact2, sndHellishImpact3, sndHellishImpact4,
101
135
            sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3, sndEggBreak, sndDrillRocket,
102
136
            sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater,
103
137
            sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7, sndPiano8,
104
138
            sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3, sndWhack,
105
 
            sndComeonthen, sndParachute, sndBump, sndResurrector);
 
139
            sndComeonthen, sndParachute, sndBump, sndResurrector, sndPlane, sndTardis);
106
140
 
 
141
    // Available ammo types to be used by hedgehogs
107
142
    TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6
108
143
            amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, // 13
109
144
            amBaseballBat, amParachute, amAirAttack, amMineStrike, amBlowTorch, // 18
112
147
            amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime, // 35
113
148
            amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun, // 42
114
149
            amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer, // 48
115
 
            amResurrector, amDrillStrike, amSnowball);
 
150
            amResurrector, amDrillStrike, amSnowball, amTardis, amStructure, amLandGun); // 54
116
151
 
 
152
    // Different kind of crates that e.g. hedgehogs can pick up
117
153
    TCrateType = (HealthCrate, AmmoCrate, UtilityCrate);
118
154
 
119
155
    THWFont = (fnt16, fntBig, fntSmall {$IFNDEF IPHONEOS}, CJKfnt16, CJKfntBig, CJKfntSmall{$ENDIF});
120
156
 
121
157
    TCapGroup = (capgrpGameState, capgrpAmmoinfo, capgrpVolume,
122
 
            capgrpMessage, capgrpAmmostate);
 
158
            capgrpMessage, capgrpMessage2, capgrpAmmostate);
123
159
 
124
160
    TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs,
125
161
            siClanHealth, siTeamStats, siPlayerKills, siMaxTeamDamage,
126
162
            siMaxTeamKills, siMaxTurnSkips );
127
163
 
 
164
    // Various "emote" animations a hedgehog can do
128
165
    TWave = (waveRollup, waveSad, waveWave, waveHurrah, waveLemonade, waveShrug, waveJuggle);
129
166
 
 
167
    TRenderMode = (rmDefault, rmLeftEye, rmRightEye);
 
168
    TStereoMode = (smNone, smRedCyan, smCyanRed, smRedBlue, smBlueRed, smRedGreen, smGreenRed, smHorizontal, smVertical, smAFR);
 
169
 
130
170
    THHFont = record
131
171
            Handle: PTTF_Font;
132
172
            Height: LongInt;
145
185
            Pos: LongWord;
146
186
            AmmoType: TAmmoType;
147
187
            AttackVoice: TSound;
 
188
            Bounciness: LongWord;
148
189
            end;
149
190
 
150
191
    TVertex2f = record
187
228
            Y : hwFloat;
188
229
            dX: hwFloat;
189
230
            dY: hwFloat;
 
231
            Target : TPoint;
190
232
            Kind: TGearType;
191
233
            Pos: Longword;
192
234
            doStep: TGearStepProcedure;
210
252
            ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
211
253
            nImpactSounds: Word; // count of ImpactSounds
212
254
            SoundChannel: LongInt;
213
 
            PortalCounter: LongWord  // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion.
 
255
            PortalCounter: LongWord;  // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion.
 
256
            LastDamage: PHedgehog;
214
257
        end;
215
258
    TPGearArray = Array of PGear;
216
259
 
234
277
        Tex: PTexture;
235
278
        alpha, scale: GLfloat;
236
279
        Hedgehog: PHedgehog;
 
280
        Tag: LongInt;
237
281
        Text: shortstring;
238
282
        Tint: Longword;
239
283
        uid: Longword;
 
284
        Layer: byte;
240
285
        end;
241
286
 
242
287
    TStatistics = record
253
298
 
254
299
    TTeamStats = record
255
300
        Kills : Longword;
 
301
        Suicides: Longword;
256
302
        AIKills : Longword;
257
303
        TeamKills : Longword;
258
304
        TurnSkips : Longword;
268
314
        chunks: array [TSound] of PMixChunk;
269
315
        end;
270
316
 
 
317
    TVoice = record
 
318
        snd: TSound;
 
319
        voicepack: PVoicePack;
 
320
        end;
 
321
 
271
322
    PHHAmmo = ^THHAmmo;
272
323
    THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo;
273
324
 
274
325
    THedgehog = record
275
326
            Name: string[MAXNAMELEN];
276
327
            Gear: PGear;
 
328
            GearHidden: PGear;
277
329
            SpeechGear: PVisualGear;
278
330
            NameTagTex,
279
331
            HealthTagTex,
327
379
            Color: Longword;
328
380
            Teams: array[0..Pred(cMaxTeams)] of PTeam;
329
381
            TeamsNumber: Longword;
 
382
            TagTeamIndex: Longword;
330
383
            CurrTeam: LongWord;
331
384
            ClanHealth: LongInt;
332
385
            ClanIndex: LongInt;
333
386
            TurnNumber: LongWord;
 
387
            Flawless: boolean;
334
388
            end;
335
389
 
336
 
     TAmmoStrId = (sidNothing, sidGrenade, sidClusterBomb, sidBazooka, sidBee, sidShotgun,
 
390
     TAmmoStrId = (sidGrenade, sidClusterBomb, sidBazooka, sidBee, sidShotgun,
337
391
            sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle,
338
392
            sidDynamite, sidBaseballBat, sidFirePunch, sidSeconds,
339
393
            sidParachute, sidAirAttack, sidMineStrike, sidBlowTorch,
343
397
            sidLowGravity, sidExtraDamage, sidInvulnerable, sidExtraTime,
344
398
            sidLaserSight, sidVampiric, sidSniperRifle, sidJetpack,
345
399
            sidMolotov, sidBirdy, sidPortalGun, sidPiano, sidGasBomb, sidSineGun, sidFlamethrower,
346
 
            sidSMine, sidHammer, sidResurrector, sidDrillStrike, sidSnowball);
 
400
            sidSMine, sidHammer, sidResurrector, sidDrillStrike, sidSnowball, sidNothing, sidTardis, sidStructure, sidLandGun);
347
401
 
348
402
    TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused,
349
403
            sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync,
350
 
            sidNoEndTurn, sidNotYetAvailable, sidRoundSD, sidRoundsSD, sidReady);
 
404
            sidNoEndTurn, sidNotYetAvailable, sidRoundSD, sidRoundsSD, sidReady, 
 
405
            sidBounce1, sidBounce2, sidBounce3, sidBounce4, sidBounce5, sidBounce);
351
406
 
 
407
    // Events that are important for the course of the game or at least interesting for other reasons
352
408
    TEventId = (eidDied, eidDrowned, eidRoundStart, eidRoundWin, eidRoundDraw,
353
409
            eidNewHealthPack, eidNewAmmoPack, eidNewUtilityPack, eidTurnSkipped, eidHurtSelf,
354
410
            eidHomerun, eidGone);
356
412
    TGoalStrId = (gidCaption, gidSubCaption, gidForts, gidLowGravity, gidInvulnerable,
357
413
            gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery,
358
414
            gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer, gidRandomMineTimer,
359
 
            gidDamageModifier, gidResetHealth, gidAISurvival, gidInfAttack, gidResetWeps, gidPerHogAmmo);
 
415
            gidDamageModifier, gidResetHealth, gidAISurvival, gidInfAttack, gidResetWeps, gidPerHogAmmo, gidTagTeam);
360
416
 
361
417
    TLandArray = packed array of array of LongWord;
362
418
    TCollisionArray = packed array of array of Word;