[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src include/missile.h include/unittyp...
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src include/missile.h include/unittyp... |
Date: |
11 Jan 2004 07:54:04 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 04/01/11 07:54:03
Modified files:
src/include : missile.h unittype.h
src/missile : missile.c
src/unit : ccl_unittype.c unit_draw.c unittype.c
Log message:
Drawing mirror images for units and missiles facing left is optional
Patches:
Index: stratagus/src/include/missile.h
diff -u stratagus/src/include/missile.h:1.78
stratagus/src/include/missile.h:1.79
--- stratagus/src/include/missile.h:1.78 Mon Dec 22 15:54:06 2003
+++ stratagus/src/include/missile.h Sun Jan 11 07:53:59 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: missile.h,v 1.78 2003/12/22 04:54:06 wizzard Exp $
+// $Id: missile.h,v 1.79 2004/01/10 20:53:59 jsalmon3 Exp $
#ifndef __MISSILE_H__
#define __MISSILE_H__
@@ -411,8 +411,9 @@
SoundConfig FiredSound; /// fired sound
SoundConfig ImpactSound; /// impact sound for this missile-type
- unsigned CanHitOwner:1; /// missile can hit the owner
- unsigned FriendlyFire:1; /// missile can't hit own units
+ unsigned Flip : 1; /// flip image when facing left
+ unsigned CanHitOwner : 1; /// missile can hit the owner
+ unsigned FriendlyFire : 1;/// missile can't hit own units
MissileClass Class; /// missile class
int NumBounces; /// number of bounces
Index: stratagus/src/include/unittype.h
diff -u stratagus/src/include/unittype.h:1.136
stratagus/src/include/unittype.h:1.137
--- stratagus/src/include/unittype.h:1.136 Sat Dec 20 16:33:28 2003
+++ stratagus/src/include/unittype.h Sun Jan 11 07:53:59 2004
@@ -5,12 +5,12 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
-// T H E W A R B E G I N S
-// Stratagus - A free fantasy real time strategy game engine
+// T H E W A R B E G I N S
+// Stratagus - A free fantasy real time strategy game engine
//
/address@hidden unittype.h - The unit-types headerfile. */
//
-// (c) Copyright 1998-2003 by Lutz Sammer and Jimmy Salmon
+// (c) Copyright 1998-2004 by Lutz Sammer and Jimmy Salmon
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.h,v 1.136 2003/12/20 05:33:28 jsalmon3 Exp $
+// $Id: unittype.h,v 1.137 2004/01/10 20:53:59 jsalmon3 Exp $
#ifndef __UNITTYPE_H__
#define __UNITTYPE_H__
@@ -543,7 +543,7 @@
*/
/*----------------------------------------------------------------------------
--- Includes
+-- Includes
----------------------------------------------------------------------------*/
#include "video.h"
@@ -555,36 +555,35 @@
#include "etlib/hash.h"
/*----------------------------------------------------------------------------
--- Declarations
+-- Declarations
----------------------------------------------------------------------------*/
/**
-** Defines the animation for different actions.
+** Defines the animation for different actions.
*/
typedef struct _animation_ {
- unsigned char Flags; /// Flags for
actions
- signed char Pixel;
/// Change the position in pixels
- unsigned char Sleep; /// Wait for
next animation
- int Frame;
/// Sprite-frame to display
+ unsigned char Flags; /// Flags for actions
+ signed char Pixel; /// Change the position in pixels
+ unsigned char Sleep; /// Wait for next animation
+ int Frame; /// Sprite-frame to display
} Animation;
-#define AnimationRestart 1 /// Restart animation
-#define AnimationReset 2 /// Animation
could here be aborted
-#define AnimationSound 4 /// Play sound
-#define AnimationMissile 8 /// Fire projectil
-#define AnimationEnd 0x80 /// Animation
end in memory
+#define AnimationRestart 1 /// Restart animation
+#define AnimationReset 2 /// Animation could here be aborted
+#define AnimationSound 4 /// Play sound
+#define AnimationMissile 8 /// Fire projectil
+#define AnimationEnd 0x80 /// Animation end in memory
/**
-** Define all animations scripts of an unittype.
+** Define all animations scripts of an unittype.
*/
typedef struct __animations__ {
- Animation* Still;
/// Standing still
- Animation* Move;
/// Unit moving
- Animation* Attack;
/// Unit attacking/working
- Animation* Repair;
/// Unit repairing
- Animation* Harvest[MaxCosts]; /// Unit
harvesting
- Animation* Die;
/// Unit dieing
- Animation** Extend;
/// For future extensions
+ Animation* Still; /// Standing still
+ Animation* Move; /// Unit moving
+ Animation* Attack; /// Unit attacking/working
+ Animation* Repair; /// Unit repairing
+ Animation* Harvest[MaxCosts]; /// Unit harvesting
+ Animation* Die; /// Unit dying
} Animations;
#define ANIMATIONS_MAXANIM 1024
@@ -594,227 +593,228 @@
extern _AnimationsHash AnimationsHash;
/**
-** Missile type definition (used in config tables)
+** Missile type definition (used in config tables)
**
-** @todo Shouldn't I move this into missle.h?
+** @todo Move this to missle.h?
*/
typedef struct _missile_config_ {
- char* Name; ///
Config missile name
- MissileType*Missile; /// Identifier to use
to run time
+ char* Name; /// Config missile name
+ MissileType* Missile; /// Identifier to use to run time
} MissileConfig;
typedef struct _resource_info_ {
- char* FileWhenLoaded;
/// Change the graphic when the unit is loaded.
- char* FileWhenEmpty;
/// Change the graphic when the unit is empty.
- unsigned HarvestFromOutside;
/// Unit harvests without entering the building.
- unsigned WaitAtResource;
/// Cycles the unit waits while mining.
- unsigned ResourceStep;
/// Resources the unit gains per mining cycle.
- int ResourceCapacity; /// Max
amount of resources to carry.
- unsigned WaitAtDepot;
/// Cycles the unit waits while returning.
- unsigned ResourceId;
/// Id of the resource harvested. Redundant.
- unsigned FinalResource;
/// Convert resource when delivered.
- unsigned TerrainHarvester;
/// Unit will harvest terrain(wood only for now).
- unsigned LoseResources;
/// The unit will lose it's resource when distracted.
+ char* FileWhenLoaded; /// Change the graphic when the unit is
loaded.
+ char* FileWhenEmpty; /// Change the graphic when the unit is
empty.
+ unsigned HarvestFromOutside; /// Unit harvests without entering the
building.
+ unsigned WaitAtResource; /// Cycles the unit waits while mining.
+ unsigned ResourceStep; /// Resources the unit gains per mining
cycle.
+ int ResourceCapacity; /// Max amount of resources to carry.
+ unsigned WaitAtDepot; /// Cycles the unit waits while
returning.
+ unsigned ResourceId; /// Id of the resource harvested.
Redundant.
+ unsigned FinalResource; /// Convert resource when delivered.
+ unsigned TerrainHarvester; /// Unit will harvest terrain(wood only
for now).
+ unsigned LoseResources; /// The unit will lose it's resource
when distracted.
// Runtime info:
- Graphic * SpriteWhenLoaded; /// The graphic
corresponding to FileWhenLoaded.
- Graphic * SpriteWhenEmpty; /// The graphic
corresponding to FileWhenEmpty
+ Graphic* SpriteWhenLoaded; /// The graphic corresponding to
FileWhenLoaded.
+ Graphic* SpriteWhenEmpty; /// The graphic corresponding to
FileWhenEmpty
} ResourceInfo;
/**
-** Typedef of base structure of unit-type
+** Typedef of base structure of unit-type
*/
typedef struct _unit_type_ UnitType;
/// Base structure of unit-type
struct _unit_type_ {
- char* Ident; ///
Identifier
- char* Name; ///
Pretty name shown from the engine
- char* SameSprite; /// Unit-type
shared sprites
- char* File[TilesetMax]; /// Sprite files
- char* ShadowFile; /// Shadow file
-
- int Width;
/// Sprite width
- int Height;
/// Sprite height
- int DrawLevel;
/// Level to Draw UnitType at
- int ShadowWidth;
/// Shadow sprite width
- int ShadowHeight;
/// Shadow sprite height
- int ShadowOffsetX;
/// Shadow horizontal offset
- int ShadowOffsetY;
/// Shadow vertical offset
-
- Animations* Animations; ///
Animation scripts
-
- IconConfig Icon;
/// Icon to display for this unit
- MissileConfig Missile; /// Missile weapon
- MissileConfig Explosion; /// Missile for
unit explosion
-
- char* CorpseName; /// Corpse type
name
- UnitType* CorpseType; ///
Corpse unit-type
- int CorpseScript;
/// Corpse script start
-
- int _Speed;
/// Movement speed
-
-// this is taken from the UDTA section
- Construction*Construction; /// What is
shown in construction phase
- int _SightRange;
/// Sight range
- int _HitPoints;
/// Maximum hit points
- int _MaxMana;
/// Maximum mana points
-
- int _Costs[MaxCosts]; /// How
many resources needed
- int RepairHP;
/// Amount of HP per repair
- int RepairCosts[MaxCosts]; /// How much it
costs to repair
-
- int TileWidth;
/// Tile size on map width
- int TileHeight;
/// Tile size on map height
- int BoxWidth;
/// Selected box size width
- int BoxHeight;
/// Selected box size height
- int NumDirections;
/// Number of directions unit can face
- int MinAttackRange;
/// Minimal attack range
- int _AttackRange;
/// How far can the unit attack
- int ReactRangeComputer; ///
Reacts on enemy for computer
- int ReactRangePerson; ///
Reacts on enemy for person player
- int _Armor;
/// Amount of armor this unit has
- int Priority;
/// Priority value / AI Treatment
- int _BasicDamage;
/// Basic damage dealt
- int _PiercingDamage; ///
Piercing damage dealt
- int _RegenerationRate; /// HP
regeneration rate per sec
- int BurnPercent;
/// Burning percent.
- int BurnDamageRate;
/// HP burn rate per sec
- int RepairRange; /// Units
repair range.
- char *CanCastSpell; /// Unit is
able to use spells.
+ char* Ident; /// Identifier
+ char* Name; /// Pretty name shown from the engine
+ char* SameSprite; /// Unit-type shared sprites
+ char* File[TilesetMax]; /// Sprite files
+ char* ShadowFile; /// Shadow file
+
+ int Width; /// Sprite width
+ int Height; /// Sprite height
+ int DrawLevel; /// Level to Draw UnitType at
+ int ShadowWidth; /// Shadow sprite width
+ int ShadowHeight; /// Shadow sprite height
+ int ShadowOffsetX; /// Shadow horizontal offset
+ int ShadowOffsetY; /// Shadow vertical offset
+
+ Animations* Animations; /// Animation scripts
+
+ IconConfig Icon; /// Icon to display for this unit
+ MissileConfig Missile; /// Missile weapon
+ MissileConfig Explosion; /// Missile for unit explosion
+
+ char* CorpseName; /// Corpse type name
+ UnitType* CorpseType; /// Corpse unit-type
+ int CorpseScript; /// Corpse script start
+
+ int _Speed; /// Movement speed
+
+ // this is taken from the UDTA section
+ Construction* Construction; /// What is shown in construction phase
+ int _SightRange; /// Sight range
+ int _HitPoints; /// Maximum hit points
+ int _MaxMana; /// Maximum mana points
+
+ int _Costs[MaxCosts]; /// How many resources needed
+ int RepairHP; /// Amount of HP per repair
+ int RepairCosts[MaxCosts]; /// How much it costs to repair
+
+ int TileWidth; /// Tile size on map width
+ int TileHeight; /// Tile size on map height
+ int BoxWidth; /// Selected box size width
+ int BoxHeight; /// Selected box size height
+ int NumDirections; /// Number of directions unit can face
+ int MinAttackRange; /// Minimal attack range
+ int _AttackRange; /// How far can the unit attack
+ int ReactRangeComputer; /// Reacts on enemy for computer
+ int ReactRangePerson; /// Reacts on enemy for person player
+ int _Armor; /// Amount of armor this unit has
+ int Priority; /// Priority value / AI Treatment
+ int _BasicDamage; /// Basic damage dealt
+ int _PiercingDamage; /// Piercing damage dealt
+ int _RegenerationRate; /// HP regeneration rate per sec
+ int BurnPercent; /// Burning percent.
+ int BurnDamageRate; /// HP burn rate per sec
+ int RepairRange; /// Units repair range.
+ char *CanCastSpell; /// Unit is able to use spells.
// FIXME: n0body: AutoBuildRate not implemented.
- int AutoBuildRate;
/// The rate at which the building builds itself
- int RandomMovementProbability; /// Probability
to move randomly.
- int ClicksToExplode; ///
Number of consecutive clicks until unit suicides.
- int MaxOnBoard;
/// Number of Transporter slots.
+ int AutoBuildRate; /// The rate at which the building
builds itself
+ int RandomMovementProbability; /// Probability to move randomly.
+ int ClicksToExplode; /// Number of consecutive clicks until
unit suicides.
+ int MaxOnBoard; /// Number of Transporter slots.
// FIXME: original only visual effect, we do more with this!
enum {
- UnitTypeLand, ///
Unit lives on land
- UnitTypeFly, ///
Unit lives in air
- UnitTypeNaval, ///
Unit lives on water
- } UnitType;
/// Land / fly / naval
- int DecayRate;
/// Decay rate in 1/6 seconds
+ UnitTypeLand, /// Unit lives on land
+ UnitTypeFly, /// Unit lives in air
+ UnitTypeNaval, /// Unit lives on water
+ } UnitType; /// Land / fly / naval
+ int DecayRate; /// Decay rate in 1/6 seconds
// FIXME: not used
- int AnnoyComputerFactor; /// How
much this annoys the computer
- int MouseAction;
/// Right click action
-#define MouseActionNone 0
/// Nothing
-#define MouseActionAttack 1 ///
Attack
-#define MouseActionMove 2
/// Move
-#define MouseActionHarvest 3 ///
Harvest resources
-#define MouseActionSpellCast 5 ///
Cast the first spell known
-#define MouseActionSail 6
/// Sail
- int Points;
/// How many points you get for unit
- int CanTarget;
/// Which units can it attack
-#define CanTargetLand 1
/// Can attack land units
-#define CanTargetSea 2
/// Can attack sea units
-#define CanTargetAir 4
/// Can attack air units
-
- unsigned Revealer : 1; /// reveal the fog of
war
- unsigned LandUnit : 1; /// Land animated
- unsigned AirUnit : 1; /// Air animated
- unsigned SeaUnit : 1; /// Sea animated
- unsigned ExplodeWhenKilled : 1; /// Death explosion animated
- unsigned Building : 1; /// Building
- unsigned VisibleUnderFog : 1; /// Unit is visible under fog
of war.
- unsigned PermanentCloak : 1; /// Is only visible by
CloakDetectors.
- unsigned DetectCloak : 1; /// Can see
Cloaked units.
- unsigned Coward : 1; /// Unit will only
attack if instructed.
- unsigned Transporter : 1; /// Can
transport units
- unsigned Vanishes : 1; /// Corpes & destroyed
places.
- unsigned GroundAttack : 1; /// Can do
command ground attack.
- unsigned ShoreBuilding : 1; /// Building
must be build on coast.
- unsigned CanAttack : 1; /// Unit can attack.
- unsigned BuilderOutside : 1; /// The builder stays outside
during the build.
- unsigned BuilderLost : 1; /// The builder
is lost after the build.
- unsigned CanHarvest : 1; /// Resource
can be harvested.
- unsigned Harvester : 1; /// unit is a resource
harvester.
- unsigned char *BoolFlag; /// User
defined flag. Used for (dis)allow target.
- unsigned char *CanTargetFlag; /// Flag needed to target with
missile.
-
- unsigned SelectableByRectangle : 1; /// Selectable with
mouse rectangle.
- unsigned Selectable : 1; /// Unit Is
Selectable at all.
- unsigned Teleporter : 1; /// Can
teleport other units.
-
- int CanStore[MaxCosts]; ///
Resources that we can store here.
- int GivesResource;
/// The resource this unit gives.
- ResourceInfo* ResInfo[MaxCosts]; /// Resource
information.
- UnitType* MustBuildOnTop; ///
Must be built on top of something.
+ int AnnoyComputerFactor; /// How much this annoys the computer
+ int MouseAction; /// Right click action
+#define MouseActionNone 0 /// Nothing
+#define MouseActionAttack 1 /// Attack
+#define MouseActionMove 2 /// Move
+#define MouseActionHarvest 3 /// Harvest resources
+#define MouseActionSpellCast 5 /// Cast the first spell known
+#define MouseActionSail 6 /// Sail
+ int Points; /// How many points you get for unit
+ int CanTarget; /// Which units can it attack
+#define CanTargetLand 1 /// Can attack land units
+#define CanTargetSea 2 /// Can attack sea units
+#define CanTargetAir 4 /// Can attack air units
+
+ unsigned Flip : 1; /// Flip image when facing left
+ unsigned Revealer : 1; /// reveal the fog of war
+ unsigned LandUnit : 1; /// Land animated
+ unsigned AirUnit : 1; /// Air animated
+ unsigned SeaUnit : 1; /// Sea animated
+ unsigned ExplodeWhenKilled : 1; /// Death explosion animated
+ unsigned Building : 1; /// Building
+ unsigned VisibleUnderFog : 1; /// Unit is visible under fog of war.
+ unsigned PermanentCloak : 1; /// Is only visible by CloakDetectors.
+ unsigned DetectCloak : 1; /// Can see Cloaked units.
+ unsigned Coward : 1; /// Unit will only attack if instructed.
+ unsigned Transporter : 1; /// Can transport units
+ unsigned Vanishes : 1; /// Corpes & destroyed places.
+ unsigned GroundAttack : 1; /// Can do command ground attack.
+ unsigned ShoreBuilding : 1; /// Building must be build on coast.
+ unsigned CanAttack : 1; /// Unit can attack.
+ unsigned BuilderOutside : 1; /// The builder stays outside during
the build.
+ unsigned BuilderLost : 1; /// The builder is lost after the build.
+ unsigned CanHarvest : 1; /// Resource can be harvested.
+ unsigned Harvester : 1; /// unit is a resource harvester.
+ unsigned char *BoolFlag; /// User defined flag. Used for
(dis)allow target.
+ unsigned char *CanTargetFlag; /// Flag needed to target with missile.
+
+ unsigned SelectableByRectangle : 1; /// Selectable with mouse rectangle.
+ unsigned Selectable : 1; /// Unit Is Selectable at all.
+ unsigned Teleporter : 1; /// Can teleport other units.
+
+ int CanStore[MaxCosts]; /// Resources that we can store
here.
+ int GivesResource; /// The resource this unit gives.
+ ResourceInfo* ResInfo[MaxCosts]; /// Resource information.
+ UnitType* MustBuildOnTop; /// Must be built on top of
something.
#ifdef USE_SDL_SURFACE
- SDL_Color NeutralMinimapColorRGB; /// Minimap
Color for Neutral Units.
+ SDL_Color NeutralMinimapColorRGB; /// Minimap Color for Neutral Units.
#else
- VMemType NeutralMinimapColorRGB; /// Minimap
Color for Neutral Units.
+ VMemType NeutralMinimapColorRGB; /// Minimap Color for Neutral Units.
#endif
- UnitSound Sound; ///
Sounds for events
+ UnitSound Sound; /// Sounds for events
// FIXME: temporary solution
- WeaponSound Weapon; /// Currently sound
for weapon
+ WeaponSound Weapon; /// Currently sound for weapon
- int Supply;
/// Food supply
- int Demand;
/// Food demand
+ int Supply; /// Food supply
+ int Demand; /// Food demand
// --- FILLED UP ---
- int ImproveIncomes[MaxCosts];/// Gives
player an improved income
+ int ImproveIncomes[MaxCosts]; /// Gives player an improved income
- unsigned FieldFlags; ///
Unit map field flags
- unsigned MovementMask; ///
Unit check this map flags for move
+ unsigned FieldFlags; /// Unit map field flags
+ unsigned MovementMask; /// Unit check this map flags for move
- // FIXME: This stats should? be moved into the player struct
- UnitStats Stats[PlayerMax]; /// Unit status
for each player
+ // FIXME: This stats should? be moved into the player struct
+ UnitStats Stats[PlayerMax]; /// Unit status for each player
- // FIXME: Should us a general name f.e. Slot here?
- int Type;
/// Type as number
+ // FIXME: Should use a general name f.e. Slot here?
+ int Type; /// Type as number
- Graphic* Sprite;
/// Sprite images
- Graphic* ShadowSprite; ///
Shadow sprite image
+ Graphic* Sprite; /// Sprite images
+ Graphic* ShadowSprite; /// Shadow sprite image
#ifdef USE_OPENGL
- Graphic* PlayerColorSprite[PlayerMax]; ///
Sprites with player colors
+ Graphic* PlayerColorSprite[PlayerMax]; /// Sprites with player colors
#endif
};
// FIXME: ARI: should be dynamic (ccl..), JOHNS: Pud only supports 255.
/// How many unit-types are currently supported
-#define UnitTypeMax 257
+#define UnitTypeMax 257
/*----------------------------------------------------------------------------
--- Variables
+-- Variables
----------------------------------------------------------------------------*/
-extern UnitType* UnitTypes[UnitTypeMax]; /// All unit-types
-extern int NumUnitTypes; ///
Number of unit-types made
+extern UnitType* UnitTypes[UnitTypeMax]; /// All unit-types
+extern int NumUnitTypes; /// Number of unit-types made
// FIXME: this hardcoded unit-types must be removed!!
-extern UnitType*UnitTypeHumanWall; /// Human wall
-extern UnitType*UnitTypeOrcWall; /// Orc wall
+extern UnitType*UnitTypeHumanWall; /// Human wall
+extern UnitType*UnitTypeOrcWall; /// Orc wall
-extern char** UnitTypeWcNames; ///
Mapping wc-number 2 symbol
+extern char** UnitTypeWcNames; /// Mapping wc-number 2 symbol
-extern char **BoolFlagName; ///
Array of name of user defined bool flag.
-extern int NumberBoolFlag; ///
Number of user defined bool flag.
+extern char **BoolFlagName; /// Array of name of user defined
bool flag.
+extern int NumberBoolFlag; /// Number of user defined bool
flag.
/*----------------------------------------------------------------------------
--- Functions
+-- Functions
----------------------------------------------------------------------------*/
-extern void UnitTypeCclRegister(void); /// Register
ccl features
+extern void UnitTypeCclRegister(void); /// Register ccl features
-extern void UpdateStats(int reset_to_default); ///
Update unit stats
-extern void ParsePudUDTA(const char*,int); ///
Parse pud udta table
-extern UnitType* UnitTypeByIdent(const char*); /// Get
unit-type by ident
-extern UnitType* UnitTypeByWcNum(unsigned); /// Get
unit-type by wc number
+extern void UpdateStats(int reset_to_default); /// Update unit stats
+extern void ParsePudUDTA(const char*,int); /// Parse pud udta table
+extern UnitType* UnitTypeByIdent(const char*); /// Get unit-type by ident
+extern UnitType* UnitTypeByWcNum(unsigned); /// Get unit-type by wc number
/// Get the animations structure by ident
extern Animations* AnimationsByIdent(const char* ident);
-extern void SaveFlags(CLFile* file);
/// Save declaration of user defined flas.
-extern void SaveUnitTypeDefs(CLFile* file); ///
Declare the unit-type table first.
-extern void SaveUnitTypes(CLFile* file); ///
Save the unit-type table
-extern UnitType* NewUnitTypeSlot(char*); ///
Allocate an empty unit-type slot
+extern void SaveFlags(CLFile* file); /// Save declaration of user
defined flas.
+extern void SaveUnitTypeDefs(CLFile* file); /// Declare the unit-type
table first.
+extern void SaveUnitTypes(CLFile* file); /// Save the unit-type table
+extern UnitType* NewUnitTypeSlot(char*); /// Allocate an empty
unit-type slot
/// Draw the sprite frame of unit-type
extern void DrawUnitType(const UnitType* type, Graphic* sprite, int frame, int
x, int y);
-extern void InitUnitTypes(int reset_player_stats); /// Init
unit-type table
-extern void LoadUnitTypes(void);
/// Load the unit-type data
-extern void CleanUnitTypes(void);
/// Cleanup unit-type module
+extern void InitUnitTypes(int reset_player_stats); /// Init unit-type table
+extern void LoadUnitTypes(void); /// Load the unit-type data
+extern void CleanUnitTypes(void); /// Cleanup unit-type
module
//@}
Index: stratagus/src/missile/missile.c
diff -u stratagus/src/missile/missile.c:1.122
stratagus/src/missile/missile.c:1.123
--- stratagus/src/missile/missile.c:1.122 Sat Jan 3 09:53:28 2004
+++ stratagus/src/missile/missile.c Sun Jan 11 07:54:00 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: missile.c,v 1.122 2004/01/02 22:53:28 jsalmon3 Exp $
+// $Id: missile.c,v 1.123 2004/01/10 20:54:00 jsalmon3 Exp $
//@{
@@ -185,7 +185,6 @@
{
MissileType* const* mtype;
- DebugCheck(ident == NULL);
mtype = (MissileType**)hash_find(MissileTypeHash, (char*)ident);
if (mtype) {
return *mtype;
@@ -214,7 +213,6 @@
MissileType* mtype;
int i;
- DebugCheck(ident == NULL);
//
// Allocate new memory. (+2 for start end empty last entry.)
//
@@ -303,8 +301,6 @@
local Missile* InitMissile(Missile* missile, MissileType* mtype, int sx,
int sy, int dx, int dy)
{
- DebugCheck(!mtype);
- DebugCheck(!missile);
missile->X = sx - mtype->Width / 2;
missile->Y = sy - mtype->Height / 2;
missile->DX = dx - mtype->Width / 2;
@@ -343,11 +339,9 @@
{
Missile* missile;
- DebugCheck(!mtype);
DebugLevel3Fn("type %d(%s) at %d,%d to %d,%d\n" _C_
mtype - MissileTypes _C_ mtype->Ident _C_ sx _C_ sy _C_ dx _C_
dy);
-
if (!(missile = NewGlobalMissile())) {
return missile;
}
@@ -370,7 +364,6 @@
{
Missile* missile;
- DebugCheck(!mtype);
DebugLevel3Fn("type %d(%s) at %d,%d to %d,%d\n" _C_
mtype - MissileTypes _C_ mtype->Ident _C_ sx _C_ sy _C_ dx _C_
dy);
@@ -391,7 +384,6 @@
Missile* temp;
Unit* unit;
- DebugCheck(missile == NULL);
//
// Release all unit references.
//
@@ -446,8 +438,6 @@
int basic_damage;
int piercing_damage;
- DebugCheck(attacker_stats == NULL);
- DebugCheck(goal_stats == NULL);
basic_damage = attacker_stats->BasicDamage + isqrt(xp / 100) * XpDamage;
piercing_damage = attacker_stats->PiercingDamage;
if (bloodlust) {
@@ -479,8 +469,6 @@
local int CalculateDamage(const UnitStats* attacker_stats,
const Unit* goal, int bloodlust, int xp)
{
- DebugCheck(attacker_stats == NULL);
- DebugCheck(goal == NULL);
return CalculateDamageStats(attacker_stats, goal->Stats, bloodlust, xp);
}
@@ -498,7 +486,6 @@
Unit* goal;
Missile* missile;
- DebugCheck(unit == NULL);
//
// Goal dead?
//
@@ -608,14 +595,6 @@
int* ex, int* ey)
{
#define Bound(x, y) (x) < 0 ? 0 : ((x) > (y) ? (y) : (x))
- DebugCheck(missile == NULL);
- DebugCheck(sx == NULL);
- DebugCheck(sy == NULL);
- DebugCheck(ex == NULL);
- DebugCheck(ey == NULL);
- DebugCheck(TileSizeX <= 0);
- DebugCheck(TileSizeY <= 0);
- DebugCheck(missile->Type == NULL);
*sx = Bound(missile->X / TileSizeX, TheMap.Width - 1);
*sy = Bound(missile->Y / TileSizeY, TheMap.Height - 1);
*ex = Bound((missile->X + missile->Type->Width) / TileSizeX,
TheMap.Width - 1);
@@ -640,8 +619,6 @@
int x;
int y;
- DebugCheck(vp == NULL);
- DebugCheck(missile == NULL);
GetMissileMapArea(missile, &min_x, &min_y, &max_x, &max_y);
if (!AnyMapAreaVisibleInViewport(vp, min_x, min_y, max_x, max_y)) {
return 0;
@@ -672,7 +649,6 @@
int ex;
int ey;
- DebugCheck(missile == NULL);
GetMissileMapArea(missile, &sx, &sy, &ex, &ey);
return MarkDrawAreaMap(sx, sy, ex, ey);
}
@@ -687,17 +663,31 @@
*/
global void DrawMissile(const MissileType* mtype, int frame, int x, int y)
{
- DebugCheck(mtype == NULL);
- // FIXME: This is a hack for mirrored sprites
- if (mtype->Transparency == 50) {
+ if (mtype->Flip) {
if (frame < 0) {
- VideoDrawClipXTrans50(mtype->Sprite, -frame, x, y);
+ if (mtype->Transparency == 50) {
+ VideoDrawClipXTrans50(mtype->Sprite, -frame, x,
y);
+ } else {
+ VideoDrawClipX(mtype->Sprite, -frame, x, y);
+ }
} else {
- VideoDrawClipTrans50(mtype->Sprite, frame, x, y);
+ if (mtype->Transparency == 50) {
+ VideoDrawClipTrans50(mtype->Sprite, frame, x,
y);
+ } else {
+ VideoDrawClip(mtype->Sprite, frame, x, y);
+ }
}
} else {
+ int row;
+
+ row = mtype->NumDirections / 2 + 1;
if (frame < 0) {
- VideoDrawClipX(mtype->Sprite, -frame, x, y);
+ frame = (-frame / row) * mtype->NumDirections +
mtype->NumDirections - -frame % row;
+ } else {
+ frame = (frame / row) * mtype->NumDirections + frame %
row;
+ }
+ if (mtype->Transparency == 50) {
+ VideoDrawClipTrans50(mtype->Sprite, frame, x, y);
} else {
VideoDrawClip(mtype->Sprite, frame, x, y);
}
@@ -716,16 +706,9 @@
const Missile* c1;
const Missile* c2;
- DebugCheck(v1 == NULL);
- DebugCheck(v2 == NULL);
-
c1 = *(Missile**)v1;
c2 = *(Missile**)v2;
- DebugCheck(c1 == NULL);
- DebugCheck(c2 == NULL);
- DebugCheck(c1->Type == NULL);
- DebugCheck(c2->Type == NULL);
if (c1->Type->DrawLevel == c2->Type->DrawLevel) {
return c1->MissileSlot < c2->MissileSlot ? -1 : 1;
} else {
@@ -748,8 +731,6 @@
int flag;
int nmissiles;
- DebugCheck(vp == NULL);
- DebugCheck(table == NULL);
//
// Loop through global missiles, then through locals.
//
@@ -791,15 +772,12 @@
int dir;
int nextdir;
- DebugCheck(missile == NULL);
- DebugCheck(missile->Type == NULL);
- DebugCheck(!(missile->Type->NumDirections & 1)); // Only support for
impair number of directions.
if (missile->Type->NumDirections == 1 || (dx == 0 && dy == 0)) {
return;
}
// reinitialise the direction but with skipping Animation step.
if (missile->SpriteFrame < 0) {
- missile->SpriteFrame = -missile->SpriteFrame;
+ missile->SpriteFrame = -missile->SpriteFrame;
}
missile->SpriteFrame /= missile->Type->NumDirections / 2 + 1;
missile->SpriteFrame *= missile->Type->NumDirections / 2 + 1;
@@ -826,7 +804,6 @@
int dx;
int dy;
- DebugCheck(missile == 0);
dx = missile->DX - missile->X;
dy = missile->DY - missile->Y;
MissileNewHeadingFromXY(missile, dx, dy);
@@ -865,7 +842,6 @@
int x;
int y;
- DebugCheck(missile == NULL);
if (MissileInitMove(missile) == 1) {
return 1;
}
@@ -906,7 +882,6 @@
int x;
int y;
- DebugCheck(missile == NULL);
K = -2048; //-1024; // Should be initialised by an other method
(computed with distance...)
ZprojToX = 4;
ZprojToY = 1024;
@@ -946,9 +921,6 @@
*/
local void MissileHitsGoal(const Missile* missile, Unit* goal, int splash)
{
- DebugCheck(missile == NULL);
- DebugCheck(goal == NULL);
- DebugCheck(missile->Type == NULL);
if (!missile->Type->CanHitOwner && goal == missile->SourceUnit) {
return; // blizzard cannot hit owner unit
}
@@ -977,7 +949,6 @@
*/
local void MissileHitsWall(const Missile* missile, int x, int y, int splash)
{
- DebugCheck(missile == NULL);
if (WallOnMap(x, y)) {
DebugLevel3Fn("Missile on wall?\n");
if (HumanWallOnMap(x, y)) {
@@ -1017,8 +988,6 @@
int i;
int splash;
- DebugCheck(missile == NULL);
- DebugCheck(missile->Type == NULL);
if (missile->Type->ImpactSound.Sound) {
PlayMissileSound(missile, missile->Type->ImpactSound.Sound);
}
@@ -1137,9 +1106,6 @@
int AnimationIsFinished; // returned value.
int NumDirections; // Number of direction of the missile.
- DebugCheck(missile == NULL);
- DebugCheck(missile->Type == NULL);
- DebugCheck(sign != 1 && sign != -1);
//
// Animate missile, cycle through frames
//
@@ -1295,10 +1261,6 @@
int x;
int y;
- DebugCheck(missile == NULL);
- DebugCheck(missile->Type == NULL);
- DebugCheck(TileSizeX <= 0);
- DebugCheck(TileSizeY <= 0);
x = (missile->X + missile->Type->Width / 2) / TileSizeX;
y = (missile->Y + missile->Type->Height / 2) / TileSizeY; // pixel ->
tile
@@ -1345,7 +1307,7 @@
DebugCheck(file == NULL);
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.122
2004/01/02 22:53:28 jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: missile-types $Id: missile.c,v 1.123
2004/01/10 20:54:00 jsalmon3 Exp $\n\n");
//
// Original number to internal missile-type name.
@@ -1467,7 +1429,7 @@
Missile* const* missiles;
CLprintf(file,"\n--- -----------------------------------------\n");
- CLprintf(file,"--- MODULE: missiles $Id: missile.c,v 1.122 2004/01/02
22:53:28 jsalmon3 Exp $\n\n");
+ CLprintf(file,"--- MODULE: missiles $Id: missile.c,v 1.123 2004/01/10
20:54:00 jsalmon3 Exp $\n\n");
for (missiles = GlobalMissiles; *missiles; ++missiles) {
SaveMissile(*missiles, file);
@@ -1595,7 +1557,6 @@
*/
void MissileActionNone(Missile* missile)
{
- DebugCheck(missile == NULL);
missile->Wait = missile->Type->Sleep;
return; // Busy doing nothing.
}
@@ -1624,7 +1585,6 @@
*/
void MissileActionPointToPointWithHit(Missile* missile)
{
- DebugCheck(missile == NULL);
missile->Wait = missile->Type->Sleep;
if (PointToPointMissile(missile)) {
if (NextMissileFrame(missile, 1, 0)) {
@@ -1641,7 +1601,6 @@
*/
void MissileActionPointToPointCycleOnce(Missile* missile)
{
- DebugCheck(missile == NULL);
missile->Wait = missile->Type->Sleep;
if (PointToPointMissile(missile)) {
MissileHit(missile);
@@ -1658,7 +1617,6 @@
*/
void MissileActionStay(Missile* missile)
{
- DebugCheck(missile == NULL);
missile->Wait = missile->Type->Sleep;
if (NextMissileFrame(missile, 1, 0)) {
MissileHit(missile);
@@ -1673,7 +1631,6 @@
*/
void MissileActionPointToPointBounce(Missile* missile)
{
- DebugCheck(missile == NULL);
missile->Wait = missile->Type->Sleep;
if (PointToPointMissile(missile)) {
if (missile->State < 2 * missile->Type->NumBounces - 1 &&
missile->TotalStep) {
@@ -1711,8 +1668,6 @@
*/
void MissileActionCycleOnce(Missile* missile)
{
- DebugCheck(missile == NULL);
-
missile->Wait = missile->Type->Sleep;
switch (missile->State) {
case 0:
@@ -1742,7 +1697,6 @@
{
Unit* unit;
- DebugCheck(missile == NULL);
unit = missile->SourceUnit;
missile->Wait = missile->Type->Sleep;
if (unit->Destroyed || !unit->HP) {
@@ -1778,7 +1732,6 @@
*/
void MissileActionHit(Missile* missile)
{
- DebugCheck(missile == NULL);
missile->Wait = missile->Type->Sleep;
if (PointToPointMissile(missile)) {
MissileHit(missile);
@@ -1793,7 +1746,6 @@
*/
void MissileActionParabolic(Missile* missile)
{
- DebugCheck(missile == NULL);
missile->Wait = missile->Type->Sleep;
if (ParabolicMissile(missile)) {
MissileHit(missile);
@@ -1829,7 +1781,6 @@
int uw;
int uh;
- DebugCheck(missile == NULL);
missile->Wait = missile->Type->Sleep;
i = missile->TTL % 36; // 36 positions on the circle
dx = fs_dc[i * 2];
@@ -1895,10 +1846,6 @@
int x;
int y;
- DebugCheck(missile == NULL);
- DebugCheck(TileSizeX <= 0);
- DebugCheck(TileSizeY <= 0);
-
x = missile->X / TileSizeX;
y = missile->Y / TileSizeY;
@@ -1931,8 +1878,6 @@
int x;
int y;
- DebugCheck(missile == NULL);
-
//
// Animate, move.
//
@@ -2023,7 +1968,6 @@
int n;
Unit* source;
- DebugCheck(missile == NULL);
missile->Wait = missile->Type->Sleep;
if (PointToPointMissile(missile)) {
source = missile->SourceUnit;
Index: stratagus/src/unit/ccl_unittype.c
diff -u stratagus/src/unit/ccl_unittype.c:1.127
stratagus/src/unit/ccl_unittype.c:1.128
--- stratagus/src/unit/ccl_unittype.c:1.127 Fri Jan 2 08:24:20 2004
+++ stratagus/src/unit/ccl_unittype.c Sun Jan 11 07:54:01 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_unittype.c,v 1.127 2004/01/01 21:24:20 jsalmon3 Exp $
+// $Id: ccl_unittype.c,v 1.128 2004/01/10 20:54:01 jsalmon3 Exp $
//@{
@@ -141,7 +141,8 @@
type->CanTargetFlag = realloc(type->CanTargetFlag, NumberBoolFlag *
sizeof (*type->CanTargetFlag));
memset(type->CanTargetFlag, 0, NumberBoolFlag * sizeof
(*type->CanTargetFlag));
- type->NumDirections = 8;
+ type->NumDirections = 8;
+ type->Flip = 1;
//
// Parse the list: (still everything could be
changed!)
@@ -255,6 +256,8 @@
lua_rawgeti(l, -1, 2);
type->Height = LuaToNumber(l, -1);
lua_pop(l, 1);
+ } else if (!strcmp(value, "Flip")) {
+ type->Flip = LuaToBoolean(l, -1);
} else if (!strcmp(value, "Animations")) {
type->Animations = AnimationsByIdent(LuaToString(l,
-1));
} else if (!strcmp(value, "Icon")) {
Index: stratagus/src/unit/unit_draw.c
diff -u stratagus/src/unit/unit_draw.c:1.200
stratagus/src/unit/unit_draw.c:1.201
--- stratagus/src/unit/unit_draw.c:1.200 Sat Jan 10 07:15:07 2004
+++ stratagus/src/unit/unit_draw.c Sun Jan 11 07:54:01 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit_draw.c,v 1.200 2004/01/09 20:15:07 jsalmon3 Exp $
+// $Id: unit_draw.c,v 1.201 2004/01/10 20:54:01 jsalmon3 Exp $
//@{
@@ -744,7 +744,7 @@
{
#if 0
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.200
2004/01/09 20:15:07 jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: decorations $Id: unit_draw.c,v 1.201
2004/01/10 20:54:01 jsalmon3 Exp $\n\n");
CLprintf(file, "(mana-sprite \"%s\" %d %d %d %d)\n",
ManaSprite.File, ManaSprite.HotX, ManaSprite.HotY,
@@ -1301,8 +1301,8 @@
DebugCheck(unit && type && unit->Type != type);
//
- // A building can be under construction and is drawn with
construction
- // frames.
+ // A building can be under construction and is drawn with construction
+ // frames.
//
if (type->Building) {
// Draw normal shadow
@@ -1313,11 +1313,23 @@
y -= (type->ShadowHeight -
type->TileHeight * TileSizeY) / 2;
x += type->ShadowOffsetX;
- y += type->ShadowOffsetY;
- if (frame < 0) {
- VideoDrawShadowClipX(type->ShadowSprite,
-frame, x, y);
- } else {
- VideoDrawShadowClip(type->ShadowSprite, frame,
x, y);
+ y += type->ShadowOffsetY;
+ if (type->Flip) {
+ if (frame < 0) {
+
VideoDrawShadowClipX(type->ShadowSprite, -frame, x, y);
+ } else {
+ VideoDrawShadowClip(type->ShadowSprite,
frame, x, y);
+ }
+ } else {
+ int row;
+
+ row = type->NumDirections / 2 + 1;
+ if (frame < 0) {
+ frame = (-frame / row) *
type->NumDirections + type->NumDirections - -frame % row;
+ } else {
+ frame = (frame / row) *
type->NumDirections + frame % row;
+ }
+ VideoDrawShadowClip(type->ShadowSprite, frame,
x, y);
}
}
return;
@@ -1335,11 +1347,23 @@
type->TileHeight * TileSizeY) / 2;
x += type->ShadowOffsetX;
y += type->ShadowOffsetY;
-
- if (frame < 0) {
- VideoDrawShadowClipX(type->ShadowSprite, -frame, x, y);
- } else {
- VideoDrawShadowClip(type->ShadowSprite, frame, x, y);
+
+ if (type->Flip) {
+ if (frame < 0) {
+ VideoDrawShadowClipX(type->ShadowSprite,
-frame, x, y);
+ } else {
+ VideoDrawShadowClip(type->ShadowSprite, frame,
x, y);
+ }
+ } else {
+ int row;
+
+ row = type->NumDirections / 2 + 1;
+ if (frame < 0) {
+ frame = (-frame / row) * type->NumDirections +
type->NumDirections - -frame % row;
+ } else {
+ frame = (frame / row) * type->NumDirections +
frame % row;
+ }
+ VideoDrawShadowClip(type->ShadowSprite, frame, x, y);
}
return;
}
@@ -1831,7 +1855,13 @@
{
if (!type->PlayerColorSprite[player] ||
!type->PlayerColorSprite[player]->TextureNames[
- frame < 0 ? -frame : frame]) {
+ type->Flip ?
+ (frame < 0 ? -frame : frame) :
+ (frame < 0 ?
+ (-frame / (type->NumDirections
/ 2 + 1)) * type->NumDirections +
+ type->NumDirections -
-frame % (type->NumDirections / 2 + 1) :
+ (frame / (type->NumDirections /
2 + 1)) * type->NumDirections +
+ frame %
(type->NumDirections / 2 + 1))]) {
unsigned char mapping[4 * 2];
int i;
@@ -1855,11 +1885,22 @@
x -= (type->Width - type->TileWidth * TileSizeX) / 2;
y -= (type->Height - type->TileHeight * TileSizeY) / 2;
- // FIXME: This is a hack for mirrored sprites
- if (frame < 0) {
- VideoDrawClipX(type->PlayerColorSprite[player], -frame, x, y);
- } else {
- VideoDrawClip(type->PlayerColorSprite[player],frame, x, y);
+ if (type->Flip) {
+ if (frame < 0) {
+ VideoDrawClipX(type->PlayerColorSprite[player], -frame,
x, y);
+ } else {
+ VideoDrawClip(type->PlayerColorSprite[player], frame,
x, y);
+ }
+ } else {
+ int row;
+
+ row = type->NumDirections / 2 + 1;
+ if (frame < 0) {
+ frame = (-frame / row) * type->NumDirections +
type->NumDirections - -frame % row;
+ } else {
+ frame = (frame / row) * type->NumDirections + frame %
row;
+ }
+ VideoDrawClip(type->PlayerColorSprite[player], frame, x, y);
}
}
#endif
@@ -1882,13 +1923,26 @@
x -= (unit->Type->Construction->Width -
unit->Type->TileWidth * TileSizeX) / 2;
y -= (unit->Type->Construction->Height -
unit->Type->TileHeight * TileSizeY )/ 2;
// x += type->ShadowOffsetX;
-// y += type->ShadowOffsetY;
- if (frame < 0) {
-
VideoDrawShadowClipX(unit->Type->Construction->ShadowSprite,
- -frame, x, y);
- } else {
-
VideoDrawShadowClip(unit->Type->Construction->ShadowSprite,
- frame, x, y);
+// y += type->ShadowOffsetY;
+ if (unit->Type->Flip) {
+ if (frame < 0) {
+
VideoDrawShadowClipX(unit->Type->Construction->ShadowSprite,
+ -frame, x, y);
+ } else {
+
VideoDrawShadowClip(unit->Type->Construction->ShadowSprite,
+ frame, x, y);
+ }
+ } else {
+ int row;
+
+ row = unit->Type->NumDirections / 2 + 1;
+ if (frame < 0) {
+ frame = (-frame / row) *
unit->Type->NumDirections + unit->Type->NumDirections - -frame % row;
+ } else {
+ frame = (frame / row) *
unit->Type->NumDirections + frame % row;
+ }
+
VideoDrawShadowClip(unit->Type->Construction->ShadowSprite, frame,
+ x, y);
}
}
} else {
@@ -1896,11 +1950,23 @@
x -= (unit->Type->ShadowWidth - unit->Type->TileWidth *
TileSizeX) / 2;
y -= (unit->Type->ShadowHeight - unit->Type->TileHeight
* TileSizeY) / 2;
x += unit->Type->ShadowOffsetX;
- y += unit->Type->ShadowOffsetY;
- if (frame < 0) {
- VideoDrawShadowClipX(unit->Type->ShadowSprite,
-frame, x, y);
- } else {
- VideoDrawShadowClip(unit->Type->ShadowSprite,
frame, x, y);
+ y += unit->Type->ShadowOffsetY;
+ if (unit->Type->Flip) {
+ if (frame < 0) {
+
VideoDrawShadowClipX(unit->Type->ShadowSprite, -frame, x, y);
+ } else {
+
VideoDrawShadowClip(unit->Type->ShadowSprite, frame, x, y);
+ }
+ } else {
+ int row;
+
+ row = unit->Type->NumDirections / 2 + 1;
+ if (frame < 0) {
+ frame = (-frame / row) *
unit->Type->NumDirections + unit->Type->NumDirections - -frame % row;
+ } else {
+ frame = (frame / row) *
unit->Type->NumDirections + frame % row;
+ }
+ VideoDrawShadowClip(unit->Type->ShadowSprite,
frame, x, y);
}
}
}
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.134 stratagus/src/unit/unittype.c:1.135
--- stratagus/src/unit/unittype.c:1.134 Sat Jan 3 11:33:02 2004
+++ stratagus/src/unit/unittype.c Sun Jan 11 07:54:02 2004
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.c,v 1.134 2004/01/03 00:33:02 jsalmon3 Exp $
+// $Id: unittype.c,v 1.135 2004/01/10 20:54:02 jsalmon3 Exp $
//@{
@@ -1193,7 +1193,7 @@
// char** sp;
CLprintf(file, "\n--- -----------------------------------------\n");
- CLprintf(file, "--- MODULE: unittypes $Id: unittype.c,v 1.134
2004/01/03 00:33:02 jsalmon3 Exp $\n\n");
+ CLprintf(file, "--- MODULE: unittypes $Id: unittype.c,v 1.135
2004/01/10 20:54:02 jsalmon3 Exp $\n\n");
#if 0
// Original number to internal unit-type name.
@@ -1311,12 +1311,23 @@
x -= (type->Width - type->TileWidth * TileSizeX) / 2;
y -= (type->Height - type->TileHeight * TileSizeY) / 2;
- // FIXME: This is a hack for mirrored sprites
- if (frame < 0) {
- VideoDrawClipX(sprite, -frame, x, y);
- } else {
- VideoDrawClip(sprite, frame, x, y);
- }
+ if (type->Flip) {
+ if (frame < 0) {
+ VideoDrawClipX(sprite, -frame, x, y);
+ } else {
+ VideoDrawClip(sprite, frame, x, y);
+ }
+ } else {
+ int row;
+
+ row = type->NumDirections / 2 + 1;
+ if (frame < 0) {
+ frame = (-frame / row) * type->NumDirections +
type->NumDirections - -frame % row;
+ } else {
+ frame = (frame / row) * type->NumDirections + frame %
row;
+ }
+ VideoDrawClip(sprite, frame, x, y);
+ }
}
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus/src include/missile.h include/unittyp...,
address@hidden <=