overhault missile code, missile type numbers removed use idents insteed
This commit is contained in:
parent
8bbcc53a9d
commit
e4acb081e3
9 changed files with 347 additions and 352 deletions
action
include
sound
stratagus
ui
unit
|
@ -96,7 +96,7 @@ global void HandleActionStandGround(Unit* unit)
|
|||
if( f>75) {
|
||||
; // No fire for this
|
||||
} else if( f>50 ) {
|
||||
MakeMissile(MissileSmallFire
|
||||
MakeMissile(MissileTypeByIdent("missile-small-fire")
|
||||
,unit->X*TileSizeX
|
||||
+(type->TileWidth*TileSizeX)/2
|
||||
,unit->Y*TileSizeY
|
||||
|
@ -104,7 +104,7 @@ global void HandleActionStandGround(Unit* unit)
|
|||
-TileSizeY
|
||||
,0,0);
|
||||
} else {
|
||||
MakeMissile(MissileBigFire
|
||||
MakeMissile(MissileTypeByIdent("missile-big-fire")
|
||||
,unit->X*TileSizeX
|
||||
+(type->TileWidth*TileSizeX)/2
|
||||
,unit->Y*TileSizeY
|
||||
|
|
|
@ -93,7 +93,7 @@ global void HandleActionStill(Unit* unit)
|
|||
if( f>75) {
|
||||
; // No fire for this
|
||||
} else if( f>50 ) {
|
||||
MakeMissile(MissileSmallFire
|
||||
MakeMissile(MissileTypeByIdent("missile-small-fire")
|
||||
,unit->X*TileSizeX
|
||||
+(type->TileWidth*TileSizeX)/2
|
||||
,unit->Y*TileSizeY
|
||||
|
@ -101,7 +101,7 @@ global void HandleActionStill(Unit* unit)
|
|||
-TileSizeY
|
||||
,0,0);
|
||||
} else {
|
||||
MakeMissile(MissileBigFire
|
||||
MakeMissile(MissileTypeByIdent("missile-big-fire")
|
||||
,unit->X*TileSizeX
|
||||
+(type->TileWidth*TileSizeX)/2
|
||||
,unit->Y*TileSizeY
|
||||
|
|
|
@ -48,6 +48,7 @@ global int UnitShowAnimation(Unit* unit,const Animation* animation)
|
|||
int flags;
|
||||
|
||||
if( !(state=unit->State) ) {
|
||||
unit->Frame=0;
|
||||
UnitUpdateHeading(unit); // FIXME: remove this!!
|
||||
}
|
||||
|
||||
|
|
|
@ -38,10 +38,15 @@
|
|||
-- Missile - type
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
** Missile type typedef.
|
||||
*/
|
||||
typedef struct _missile_type_ MissileType;
|
||||
|
||||
/**
|
||||
** Base structure of missile types
|
||||
*/
|
||||
typedef struct _missile_type_ {
|
||||
struct _missile_type_ {
|
||||
void* OType; /// Object type (future extensions)
|
||||
|
||||
char* Ident; /// missile name
|
||||
|
@ -56,52 +61,18 @@ typedef struct _missile_type_ {
|
|||
int Class; /// missile class
|
||||
int Speed; /// missile speed
|
||||
|
||||
char* ImpactName; /// Impact missile type name
|
||||
MissileType*ImpactMissile; /// Missile produces an impact
|
||||
|
||||
// --- FILLED UP ---
|
||||
unsigned Type; /// missile type as number
|
||||
|
||||
RleSprite* RleSprite; /// missile sprite image
|
||||
} MissileType;
|
||||
|
||||
#if 1
|
||||
/*
|
||||
** Missile types (FIXME: should be removed!!)
|
||||
*/
|
||||
#define MissileLightning 0x00
|
||||
#define MissileGriffonHammer 0x01
|
||||
#define MissileDragonBreath 0x02
|
||||
#define MissileFireball 0x03
|
||||
#define MissileFlameShield 0x04
|
||||
#define MissileBlizzard 0x05
|
||||
#define MissileDeathDecay 0x06
|
||||
#define MissileBigCannon 0x07
|
||||
#define MissileExorcism 0x08
|
||||
#define MissileHealEffect 0x09
|
||||
#define MissileTouchOfDeath 0x0A
|
||||
#define MissileRune 0x0B
|
||||
#define MissileWhirlwind 0x0C
|
||||
#define MissileCatapultRock 0x0D
|
||||
#define MissileBallistaBolt 0x0E
|
||||
#define MissileArrow 0x0F
|
||||
#define MissileAxe 0x10
|
||||
#define MissileSubmarineMissile 0x11
|
||||
#define MissileTurtleMissile 0x12
|
||||
#define MissileSmallFire 0x13
|
||||
#define MissileBigFire 0x14
|
||||
#define MissileImpact 0x15
|
||||
#define MissileNormalSpell 0x16
|
||||
#define MissileExplosion 0x17
|
||||
#define MissileSmallCannon 0x18
|
||||
#define MissileCannonExplosion 0x19
|
||||
#define MissileCannonTowerExplosion 0x1A
|
||||
#define MissileDaemonFire 0x1B
|
||||
#define MissileGreenCross 0x1C
|
||||
#define MissileNone 0x1D
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
/// how many missile type are maximal supported
|
||||
#define MissileTypeMax 0x1E
|
||||
|
||||
#define MissileFree (MissileType*)0 // free missile slot
|
||||
/// mark a free missile slot
|
||||
#define MissileFree (MissileType*)0
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
-- Missile
|
||||
|
@ -147,16 +118,15 @@ extern void LoadMissileSprites(void);
|
|||
/// Get missile type by ident.
|
||||
extern MissileType* MissileTypeByIdent(const char*);
|
||||
/// create a missile
|
||||
extern Missile* MakeMissile(int missile_type,int sx,int sy,int dx,int dy);
|
||||
// FIXME: ^ use pointer
|
||||
extern Missile* MakeMissile(MissileType*,int,int,int,int);
|
||||
/// fire a missile
|
||||
extern void FireMissile(Unit* unit);
|
||||
extern void FireMissile(Unit*);
|
||||
/// draw all missiles
|
||||
extern void DrawMissiles(void);
|
||||
/// handle all missiles
|
||||
extern void MissileActions(void);
|
||||
/// distance from view point to missile
|
||||
extern int ViewPointDistanceToMissile(const Missile* dest);
|
||||
extern int ViewPointDistanceToMissile(const Missile*);
|
||||
|
||||
//@}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ extern void PlayUnitSound(Unit* unit,UnitVoiceGroup unit_voice_group);
|
|||
@param missile the missile (origin of the sound)
|
||||
@param sound the sound to play
|
||||
*/
|
||||
extern void PlayMissileSound(Missile* missile,SoundId sound);
|
||||
extern void PlayMissileSound(const Missile* missile,SoundId sound);
|
||||
|
||||
/** Ask to the sound server to play a sound: low level call.
|
||||
@param sound the sound to play.
|
||||
|
|
|
@ -195,7 +195,7 @@ global void PlayUnitSound(Unit* unit,UnitVoiceGroup unit_voice_group)
|
|||
/**
|
||||
** FIXME: docu
|
||||
*/
|
||||
global void PlayMissileSound(Missile* missile,SoundId sound) {
|
||||
global void PlayMissileSound(const Missile* missile,SoundId sound) {
|
||||
DebugLevel3("Playing %p at volume %u\n",sound,volume);
|
||||
InsertSoundRequest(NULL,
|
||||
0,
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -859,7 +859,8 @@ global void UIHandleButtonDown(int b)
|
|||
CurrentButtonLevel = 0; // reset unit buttons to normal
|
||||
UpdateButtonPanel();
|
||||
MustRedraw|=RedrawButtonPanel|RedrawCursor;
|
||||
MakeMissile(MissileGreenCross
|
||||
// FIXME: slow slow slow slow....
|
||||
MakeMissile(MissileTypeByIdent("missile-green-cross")
|
||||
,Minimap2MapX(CursorX)*TileSizeX+TileSizeX/2
|
||||
,Minimap2MapY(CursorY)*TileSizeY+TileSizeY/2,0,0);
|
||||
SendCommand(Minimap2MapX(CursorX),Minimap2MapY(CursorY));
|
||||
|
@ -933,7 +934,8 @@ global void UIHandleButtonDown(int b)
|
|||
}
|
||||
else
|
||||
{ // if not not click on building -- green cross
|
||||
MakeMissile(MissileGreenCross
|
||||
// FIXME: slow slow slow slow....
|
||||
MakeMissile(MissileTypeByIdent("missile-green-cross")
|
||||
,MapX*TileSizeX+CursorX-TheUI.MapX
|
||||
,MapY*TileSizeY+CursorY-TheUI.MapY,0,0);
|
||||
}
|
||||
|
@ -944,7 +946,8 @@ global void UIHandleButtonDown(int b)
|
|||
MapSetViewpoint(Minimap2MapX(CursorX)-MapWidth/2
|
||||
,Minimap2MapY(CursorY)-MapHeight/2);
|
||||
} else if( MouseButtons&RightButton ) {
|
||||
MakeMissile(MissileGreenCross
|
||||
// FIXME: slow slow slow slow....
|
||||
MakeMissile(MissileTypeByIdent("missile-green-cross")
|
||||
,Minimap2MapX(CursorX)*TileSizeX+TileSizeX/2
|
||||
,Minimap2MapY(CursorY)*TileSizeY+TileSizeY/2,0,0);
|
||||
DoRightButton(Minimap2MapX(CursorX),Minimap2MapY(CursorY));
|
||||
|
|
|
@ -1067,13 +1067,16 @@ global int DirectionToHeading(int delta_x,int delta_y)
|
|||
global void UnitUpdateHeading(Unit* unit)
|
||||
{
|
||||
#ifdef NEW_HEADING
|
||||
// FIXME: depends on the unit directions wc 8, sc 32
|
||||
// FIXME: depends on the possible unit directions wc 8, sc 32
|
||||
unit->Frame&=127;
|
||||
unit->Frame/=5;
|
||||
unit->Frame*=5;
|
||||
if( unit->Direction<=LookingS ) { // north->east->south
|
||||
DebugLevel3(__FUNCTION__": %Zd>%d\n",UnitNumber(unit),unit->Direction);
|
||||
unit->Frame=unit->Direction/32;
|
||||
unit->Frame+=unit->Direction/32;
|
||||
} else {
|
||||
DebugLevel3(__FUNCTION__": %Zd<%d\n",UnitNumber(unit),unit->Direction);
|
||||
unit->Frame=128+256/32-unit->Direction/32;
|
||||
unit->Frame+=128+256/32-unit->Direction/32;
|
||||
}
|
||||
#else
|
||||
switch( unit->Heading ) {
|
||||
|
@ -2291,8 +2294,8 @@ global void DestroyUnit(Unit* unit)
|
|||
// Catapults,... explodes.
|
||||
//
|
||||
if( type->ExplodeWhenKilled ) {
|
||||
// FIXME:
|
||||
MakeMissile(MissileExplosion
|
||||
// FIXME: make it configurable? remove ident lookup
|
||||
MakeMissile(MissileTypeByIdent("missile-explosion")
|
||||
,unit->X*TileSizeX+type->TileWidth*TileSizeX/2
|
||||
,unit->Y*TileSizeY+type->TileHeight*TileSizeY/2
|
||||
,0,0);
|
||||
|
@ -2306,7 +2309,7 @@ global void DestroyUnit(Unit* unit)
|
|||
// Building,... explodes.
|
||||
//
|
||||
if( type->Building ) {
|
||||
MakeMissile(MissileExplosion
|
||||
MakeMissile(MissileTypeByIdent("missile-explosion")
|
||||
,unit->X*TileSizeX+type->TileWidth*TileSizeX/2
|
||||
,unit->Y*TileSizeY+type->TileHeight*TileSizeY/2
|
||||
,0,0);
|
||||
|
|
Loading…
Add table
Reference in a new issue