本文整理汇总了C++中GetElementStarShip函数的典型用法代码示例。如果您正苦于以下问题:C++ GetElementStarShip函数的具体用法?C++ GetElementStarShip怎么用?C++ GetElementStarShip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetElementStarShip函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: syreen_intelligence
static void
syreen_intelligence (ELEMENT *ShipPtr, EVALUATE_DESC *ObjectsOfConcern,
COUNT ConcernCounter)
{
EVALUATE_DESC *lpEvalDesc;
ship_intelligence (ShipPtr,
ObjectsOfConcern, ConcernCounter);
lpEvalDesc = &ObjectsOfConcern[ENEMY_SHIP_INDEX];
if (lpEvalDesc->ObjectPtr != NULL)
{
STARSHIP *StarShipPtr;
STARSHIP *EnemyStarShipPtr;
GetElementStarShip (ShipPtr, &StarShipPtr);
GetElementStarShip (lpEvalDesc->ObjectPtr, &EnemyStarShipPtr);
if (!(EnemyStarShipPtr->RaceDescPtr->ship_info.ship_flags & CREW_IMMUNE)
&& StarShipPtr->special_counter == 0
&& lpEvalDesc->ObjectPtr->crew_level > 1
&& lpEvalDesc->which_turn <= 14)
StarShipPtr->ship_input_state |= SPECIAL;
else
StarShipPtr->ship_input_state &= ~SPECIAL;
}
}
开发者ID:jurchik,项目名称:project6014,代码行数:26,代码来源:syreen.c
示例2: arilou_intelligence
static void
arilou_intelligence (ELEMENT *ShipPtr, EVALUATE_DESC *ObjectsOfConcern,
COUNT ConcernCounter)
{
STARSHIP *StarShipPtr;
GetElementStarShip (ShipPtr, &StarShipPtr);
StarShipPtr->ship_input_state |= THRUST;
ObjectsOfConcern[ENEMY_SHIP_INDEX].MoveState = ENTICE;
ship_intelligence (ShipPtr, ObjectsOfConcern, ConcernCounter);
if (StarShipPtr->special_counter == 0)
{
EVALUATE_DESC *lpEvalDesc;
StarShipPtr->ship_input_state &= ~SPECIAL;
lpEvalDesc = &ObjectsOfConcern[ENEMY_WEAPON_INDEX];
if (lpEvalDesc->ObjectPtr && lpEvalDesc->which_turn <= 6)
{
BOOLEAN IsTrackingWeapon;
STARSHIP *EnemyStarShipPtr;
GetElementStarShip (lpEvalDesc->ObjectPtr, &EnemyStarShipPtr);
if (((EnemyStarShipPtr->RaceDescPtr->ship_info.ship_flags
& SEEKING_WEAPON) &&
lpEvalDesc->ObjectPtr->next.image.farray ==
EnemyStarShipPtr->RaceDescPtr->ship_data.weapon) ||
((EnemyStarShipPtr->RaceDescPtr->ship_info.ship_flags
& SEEKING_SPECIAL) &&
lpEvalDesc->ObjectPtr->next.image.farray ==
EnemyStarShipPtr->RaceDescPtr->ship_data.special))
IsTrackingWeapon = TRUE;
else
IsTrackingWeapon = FALSE;
// JMS: Added the GASSY_SUBSTANCE clauses to prevent 'long teleport' if Baul gas is sticking to the Arilou ship.
if (((lpEvalDesc->ObjectPtr->state_flags & PLAYER_SHIP) /* means IMMEDIATE WEAPON */
|| (IsTrackingWeapon && (lpEvalDesc->which_turn == 1
|| (lpEvalDesc->ObjectPtr->state_flags & CREW_OBJECT))) /* FIGHTERS!!! */
|| (PlotIntercept (lpEvalDesc->ObjectPtr, ShipPtr, 3, 0)
&& (!(lpEvalDesc->ObjectPtr->state_flags & GASSY_SUBSTANCE) // Ignore stuck gas
|| (lpEvalDesc->ObjectPtr->state_flags & GASSY_SUBSTANCE && EnemyStarShipPtr->ship_input_state & WEAPON
&& ObjectsOfConcern[ENEMY_SHIP_INDEX].which_turn <= 20) // If sticking to gas, teleport when Baul is near&firing primary
|| (lpEvalDesc->ObjectPtr->state_flags & GASSY_SUBSTANCE && lpEvalDesc->ObjectPtr->state_flags & IGNORE_VELOCITY))) // non-stuck gas
)
&& !(TFB_Random () & 3))
{
StarShipPtr->ship_input_state &= ~(LEFT | RIGHT | THRUST | WEAPON);
StarShipPtr->ship_input_state |= SPECIAL;
}
}
}
if (StarShipPtr->RaceDescPtr->ship_info.energy_level <= SPECIAL_ENERGY_COST << 1)
StarShipPtr->ship_input_state &= ~WEAPON;
}
开发者ID:jurchik,项目名称:project6014,代码行数:57,代码来源:arilou.c
示例3: druuge_intelligence
static void
druuge_intelligence (ELEMENT *ShipPtr, EVALUATE_DESC *ObjectsOfConcern,
COUNT ConcernCounter)
{
UWORD ship_flags;
STARSHIP *StarShipPtr;
STARSHIP *EnemyStarShipPtr;
EVALUATE_DESC *lpEvalDesc;
GetElementStarShip (ShipPtr, &StarShipPtr);
ship_flags = 0;
lpEvalDesc = &ObjectsOfConcern[ENEMY_SHIP_INDEX];
if (StarShipPtr->cur_status_flags & SHIP_BEYOND_MAX_SPEED)
lpEvalDesc->MoveState = ENTICE;
else if (lpEvalDesc->ObjectPtr
&& lpEvalDesc->which_turn <= WORLD_TO_TURN (MISSILE_RANGE * 3 / 4))
{
GetElementStarShip (lpEvalDesc->ObjectPtr, &EnemyStarShipPtr);
ship_flags = EnemyStarShipPtr->RaceDescPtr->ship_info.ship_flags;
EnemyStarShipPtr->RaceDescPtr->ship_info.ship_flags &=
~(FIRES_FORE | FIRES_RIGHT | FIRES_AFT | FIRES_LEFT);
lpEvalDesc->MoveState = PURSUE;
if (ShipPtr->thrust_wait == 0)
++ShipPtr->thrust_wait;
}
ship_intelligence (ShipPtr, ObjectsOfConcern, ConcernCounter);
if (ship_flags)
{
EnemyStarShipPtr->RaceDescPtr->ship_info.ship_flags = ship_flags;
}
if (!(StarShipPtr->cur_status_flags & SHIP_BEYOND_MAX_SPEED)
&& (lpEvalDesc->which_turn <= 12
|| (
ObjectsOfConcern[ENEMY_WEAPON_INDEX].ObjectPtr
&& ObjectsOfConcern[ENEMY_WEAPON_INDEX].which_turn <= 6
)))
{
StarShipPtr->ship_input_state |= WEAPON;
if (ShipPtr->thrust_wait < WEAPON_WAIT + 1)
ShipPtr->thrust_wait = WEAPON_WAIT + 1;
}
if ((StarShipPtr->ship_input_state & WEAPON)
&& StarShipPtr->RaceDescPtr->ship_info.energy_level < WEAPON_ENERGY_COST
&& ShipPtr->crew_level > 1)
StarShipPtr->ship_input_state |= SPECIAL;
else
StarShipPtr->ship_input_state &= ~SPECIAL;
}
开发者ID:0xDEC0DE,项目名称:uqm-0.6.4-ee,代码行数:53,代码来源:druuge.c
示例4: arilou_intelligence
static void
arilou_intelligence (ELEMENT *ShipPtr, EVALUATE_DESC *ObjectsOfConcern,
COUNT ConcernCounter)
{
STARSHIP *StarShipPtr;
GetElementStarShip (ShipPtr, &StarShipPtr);
StarShipPtr->ship_input_state |= THRUST;
ObjectsOfConcern[ENEMY_SHIP_INDEX].MoveState = ENTICE;
ship_intelligence (ShipPtr, ObjectsOfConcern, ConcernCounter);
if (StarShipPtr->special_counter == 0)
{
EVALUATE_DESC *lpEvalDesc;
StarShipPtr->ship_input_state &= ~SPECIAL;
lpEvalDesc = &ObjectsOfConcern[ENEMY_WEAPON_INDEX];
if (lpEvalDesc->ObjectPtr && lpEvalDesc->which_turn <= 6)
{
BOOLEAN IsTrackingWeapon;
STARSHIP *EnemyStarShipPtr;
GetElementStarShip (lpEvalDesc->ObjectPtr, &EnemyStarShipPtr);
if (((EnemyStarShipPtr->RaceDescPtr->ship_info.ship_flags
& SEEKING_WEAPON) &&
lpEvalDesc->ObjectPtr->next.image.farray ==
EnemyStarShipPtr->RaceDescPtr->ship_data.weapon) ||
((EnemyStarShipPtr->RaceDescPtr->ship_info.ship_flags
& SEEKING_SPECIAL) &&
lpEvalDesc->ObjectPtr->next.image.farray ==
EnemyStarShipPtr->RaceDescPtr->ship_data.special))
IsTrackingWeapon = TRUE;
else
IsTrackingWeapon = FALSE;
if (((lpEvalDesc->ObjectPtr->state_flags & PLAYER_SHIP) /* means IMMEDIATE WEAPON */
|| (IsTrackingWeapon && (lpEvalDesc->which_turn == 1
|| (lpEvalDesc->ObjectPtr->state_flags & CREW_OBJECT))) /* FIGHTERS!!! */
|| PlotIntercept (lpEvalDesc->ObjectPtr, ShipPtr, 3, 0))
&& !(TFB_Random () & 3))
{
StarShipPtr->ship_input_state &= ~(LEFT | RIGHT | THRUST | WEAPON);
StarShipPtr->ship_input_state |= SPECIAL;
}
}
}
if (StarShipPtr->RaceDescPtr->ship_info.energy_level <= SPECIAL_ENERGY_COST << 1)
StarShipPtr->ship_input_state &= ~WEAPON;
}
开发者ID:mikeakers,项目名称:UQM-emscripten,代码行数:51,代码来源:arilou.c
示例5: pkunk_postprocess
static void
pkunk_postprocess (ELEMENT *ElementPtr)
{
STARSHIP *StarShipPtr;
GetElementStarShip (ElementPtr, &StarShipPtr);
if (StarShipPtr->RaceDescPtr->characteristics.special_wait)
--StarShipPtr->RaceDescPtr->characteristics.special_wait;
else if ((StarShipPtr->cur_status_flags & SPECIAL)
&& StarShipPtr->RaceDescPtr->ship_info.energy_level <
StarShipPtr->RaceDescPtr->ship_info.max_energy)
{
COUNT CurSound;
do
{
CurSound =
2 + ((COUNT)TFB_Random ()
% (GetSoundCount (StarShipPtr->RaceDescPtr->ship_data.ship_sounds) - 2));
} while (CurSound == LastSound);
ProcessSound (SetAbsSoundIndex (
StarShipPtr->RaceDescPtr->ship_data.ship_sounds, CurSound
), ElementPtr);
LastSound = CurSound;
DeltaEnergy (ElementPtr, SPECIAL_ENERGY_COST);
StarShipPtr->RaceDescPtr->characteristics.special_wait = SPECIAL_WAIT;
}
}
开发者ID:mikeakers,项目名称:UQM-emscripten,代码行数:30,代码来源:pkunk.c
示例6: intercept_pkunk_death
static void
intercept_pkunk_death (ELEMENT *ElementPtr)
{
STARSHIP *StarShipPtr;
ElementPtr->state_flags &= ~DISAPPEARING;
ElementPtr->life_span = 1;
GetElementStarShip (ElementPtr, &StarShipPtr);
if (StarShipPtr->RaceDescPtr->ship_info.crew_level == 0)
{
ELEMENT *ShipPtr;
LockElement (StarShipPtr->hShip, &ShipPtr);
if (GRAVITY_MASS (ShipPtr->mass_points + 1))
{
ElementPtr->state_flags |= DISAPPEARING;
ElementPtr->life_span = 0;
}
else
{
ShipPtr->mass_points = MAX_SHIP_MASS + 1;
StarShipPtr->RaceDescPtr->preprocess_func = ShipPtr->preprocess_func;
StarShipPtr->RaceDescPtr->postprocess_func = ShipPtr->postprocess_func;
StarShipPtr->RaceDescPtr->init_weapon_func =
(COUNT (*) (ELEMENT *ElementPtr, HELEMENT Weapon[]))
ShipPtr->death_func;
ElementPtr->death_func = new_pkunk;
}
UnlockElement (StarShipPtr->hShip);
}
}
开发者ID:mikeakers,项目名称:UQM-emscripten,代码行数:33,代码来源:pkunk.c
示例7: pkunk_intelligence
static void
pkunk_intelligence (ELEMENT *ShipPtr, EVALUATE_DESC *ObjectsOfConcern,
COUNT ConcernCounter)
{
STARSHIP *StarShipPtr;
HELEMENT hPhoenix;
GetElementStarShip (ShipPtr, &StarShipPtr);
hPhoenix = (HELEMENT) StarShipPtr->RaceDescPtr->data;
if (hPhoenix && (StarShipPtr->control & STANDARD_RATING))
{
RemoveElement (hPhoenix);
FreeElement (hPhoenix);
StarShipPtr->RaceDescPtr->data = 0;
}
if (StarShipPtr->RaceDescPtr->ship_info.energy_level <
StarShipPtr->RaceDescPtr->ship_info.max_energy
&& (StarShipPtr->special_counter == 0
|| (BYTE)TFB_Random () < 20))
StarShipPtr->ship_input_state |= SPECIAL;
else
StarShipPtr->ship_input_state &= ~SPECIAL;
ship_intelligence (ShipPtr, ObjectsOfConcern, ConcernCounter);
}
开发者ID:mikeakers,项目名称:UQM-emscripten,代码行数:25,代码来源:pkunk.c
示例8: initialize_test_pump_up
static COUNT
initialize_test_pump_up (ELEMENT *ShipPtr, HELEMENT PumpUpArray[])
{
STARSHIP *StarShipPtr;
MISSILE_BLOCK MissileBlock;
//ELEMENT *PumpUpPtr;
GetElementStarShip (ShipPtr, &StarShipPtr);
MissileBlock.cx = ShipPtr->next.location.x;
MissileBlock.cy = ShipPtr->next.location.y;
MissileBlock.farray = StarShipPtr->RaceDescPtr->ship_data.weapon;
MissileBlock.face = StarShipPtr->ShipFacing;
MissileBlock.index = 0;
MissileBlock.sender = ShipPtr->playerNr;
MissileBlock.flags = IGNORE_SIMILAR;
MissileBlock.pixoffs = MELNORME_OFFSET;
MissileBlock.speed = RES_SCALE(PUMPUP_SPEED);
MissileBlock.hit_points = PUMPUP_DAMAGE;
MissileBlock.damage = PUMPUP_DAMAGE;
MissileBlock.life = PUMPUP_LIFE;
MissileBlock.preprocess_func = 0;
MissileBlock.blast_offs = 0;
PumpUpArray[0] = initialize_missile (&MissileBlock);
return (1);
}
开发者ID:Serosis,项目名称:UQM-MegaMod,代码行数:26,代码来源:melnorme.c
示例9: initialize_confusion
static COUNT
initialize_confusion (ELEMENT *ShipPtr, HELEMENT ConfusionArray[])
{
STARSHIP *StarShipPtr;
MISSILE_BLOCK ConfusionBlock;
GetElementStarShip (ShipPtr, &StarShipPtr);
ConfusionBlock.cx = ShipPtr->next.location.x;
ConfusionBlock.cy = ShipPtr->next.location.y;
ConfusionBlock.farray = StarShipPtr->RaceDescPtr->ship_data.special;
ConfusionBlock.index = 0;
ConfusionBlock.face = StarShipPtr->ShipFacing;
ConfusionBlock.sender = ShipPtr->playerNr;
ConfusionBlock.flags = IGNORE_SIMILAR;
ConfusionBlock.pixoffs = MELNORME_OFFSET;
ConfusionBlock.speed = CMISSILE_SPEED;
ConfusionBlock.hit_points = CMISSILE_HITS;
ConfusionBlock.damage = CMISSILE_DAMAGE;
ConfusionBlock.life = CMISSILE_LIFE;
ConfusionBlock.preprocess_func = confuse_preprocess;
ConfusionBlock.blast_offs = CMISSILE_OFFSET;
ConfusionArray[0] = initialize_missile (&ConfusionBlock);
if (ConfusionArray[0])
{
ELEMENT *CMissilePtr;
LockElement (ConfusionArray[0], &CMissilePtr);
CMissilePtr->collision_func = confusion_collision;
SetElementStarShip (CMissilePtr, StarShipPtr);
UnlockElement (ConfusionArray[0]);
}
return (1);
}
开发者ID:Serosis,项目名称:UQM-MegaMod,代码行数:34,代码来源:melnorme.c
示例10: druuge_preprocess
static void
druuge_preprocess (ELEMENT *ElementPtr)
{
STARSHIP *StarShipPtr;
GetElementStarShip (ElementPtr, &StarShipPtr);
if (StarShipPtr->cur_status_flags & SPECIAL)
{
if (StarShipPtr->special_counter
|| ElementPtr->crew_level == 1
|| StarShipPtr->RaceDescPtr->ship_info.energy_level
== StarShipPtr->RaceDescPtr->ship_info.max_energy)
StarShipPtr->cur_status_flags &= ~SPECIAL;
else
{
ProcessSound (SetAbsSoundIndex (
/* BURN UP CREW */
StarShipPtr->RaceDescPtr->ship_data.ship_sounds, 1), ElementPtr);
DeltaCrew (ElementPtr, -1);
DeltaEnergy (ElementPtr, SPECIAL_ENERGY_COST);
StarShipPtr->special_counter =
StarShipPtr->RaceDescPtr->characteristics.special_wait;
}
}
}
开发者ID:intgr,项目名称:sc2-uqm,代码行数:27,代码来源:druuge.c
示例11: human_intelligence
static void
human_intelligence (ELEMENT *ShipPtr, EVALUATE_DESC *ObjectsOfConcern,
COUNT ConcernCounter)
{
STARSHIP *StarShipPtr;
GetElementStarShip (ShipPtr, &StarShipPtr);
if (StarShipPtr->special_counter == 0
&& ((ObjectsOfConcern[ENEMY_WEAPON_INDEX].ObjectPtr != NULL
&& ObjectsOfConcern[ENEMY_WEAPON_INDEX].which_turn <= 2)
|| (ObjectsOfConcern[ENEMY_SHIP_INDEX].ObjectPtr != NULL
&& ObjectsOfConcern[ENEMY_SHIP_INDEX].which_turn <= 4)))
StarShipPtr->ship_input_state |= SPECIAL;
else
StarShipPtr->ship_input_state &= ~SPECIAL;
ObjectsOfConcern[ENEMY_WEAPON_INDEX].ObjectPtr = NULL;
ship_intelligence (ShipPtr,
ObjectsOfConcern, ConcernCounter);
if (StarShipPtr->weapon_counter == 0)
{
if (ObjectsOfConcern[ENEMY_SHIP_INDEX].ObjectPtr
&& (!(StarShipPtr->ship_input_state & (LEFT | RIGHT /* | THRUST */))
|| ObjectsOfConcern[ENEMY_SHIP_INDEX].which_turn <= 12))
StarShipPtr->ship_input_state |= WEAPON;
}
}
开发者ID:jurchik,项目名称:project6014,代码行数:28,代码来源:human.c
示例12: melnorme_postprocess
static void
melnorme_postprocess (ELEMENT *ElementPtr)
{
STARSHIP *StarShipPtr;
GetElementStarShip (ElementPtr, &StarShipPtr);
if ((StarShipPtr->cur_status_flags & SPECIAL)
&& StarShipPtr->special_counter == 0
&& DeltaEnergy (ElementPtr, -SPECIAL_ENERGY_COST))
{
HELEMENT Confusion;
initialize_confusion (ElementPtr, &Confusion);
if (Confusion)
{
ELEMENT *CMissilePtr;
LockElement (Confusion, &CMissilePtr);
ProcessSound (SetAbsSoundIndex (
StarShipPtr->RaceDescPtr->ship_data.ship_sounds, 1), CMissilePtr);
UnlockElement (Confusion);
PutElement (Confusion);
StarShipPtr->special_counter =
StarShipPtr->RaceDescPtr->characteristics.special_wait;
}
}
}
开发者ID:xaionaro,项目名称:Shiver-Balance-Mod,代码行数:28,代码来源:melnorme.c
示例13: findPlayerShip
// playerNr should be 0 or 1
STARSHIP*
findPlayerShip (SIZE playerNr)
{
HELEMENT hElement, hNextElement;
for (hElement = GetHeadElement (); hElement; hElement = hNextElement)
{
ELEMENT *ElementPtr;
LockElement (hElement, &ElementPtr);
hNextElement = GetSuccElement (ElementPtr);
if ((ElementPtr->state_flags & PLAYER_SHIP) &&
ElementPtr->playerNr == playerNr)
{
STARSHIP *StarShipPtr;
GetElementStarShip (ElementPtr, &StarShipPtr);
UnlockElement (hElement);
return StarShipPtr;
}
UnlockElement (hElement);
}
return NULL;
}
开发者ID:intgr,项目名称:sc2-uqm,代码行数:26,代码来源:uqmdebug.c
示例14: baul_preprocess
static void
baul_preprocess (ELEMENT *ElementPtr)
{
STARSHIP *StarShipPtr;
GetElementStarShip (ElementPtr, &StarShipPtr);
}
开发者ID:jurchik,项目名称:project6014,代码行数:7,代码来源:baul.c
示例15: spin_preprocess
static void
spin_preprocess (ELEMENT *ElementPtr)
{
ELEMENT *ShipPtr;
STARSHIP *StarShipPtr;
GetElementStarShip (ElementPtr, &StarShipPtr);
LockElement (StarShipPtr->hShip, &ShipPtr);
if (ShipPtr->crew_level && ++StarShipPtr->RaceDescPtr->characteristics.special_wait > MAX_SAWS)
{
ElementPtr->life_span = 1;
ElementPtr->state_flags |= DISAPPEARING;
}
else
{
++ElementPtr->life_span;
if (ElementPtr->turn_wait)
--ElementPtr->turn_wait;
else
{
#define LAST_SPIN_INDEX 1
if (GetFrameIndex (ElementPtr->current.image.frame) < LAST_SPIN_INDEX)
ElementPtr->next.image.frame = IncFrameIndex (ElementPtr->current.image.frame);
else
ElementPtr->next.image.frame = SetAbsFrameIndex (ElementPtr->current.image.frame, 0);
ElementPtr->state_flags |= CHANGING;
ElementPtr->turn_wait = SAW_RATE;
}
}
UnlockElement (StarShipPtr->hShip);
}
开发者ID:jurchik,项目名称:project6014,代码行数:32,代码来源:slykohr.c
示例16: initialize_dagger
static COUNT
initialize_dagger (ELEMENT *ShipPtr, HELEMENT DaggerArray[])
{
#define SYREEN_OFFSET (30 << RESOLUTION_FACTOR) // JMS_GFX
#define MISSILE_HITS 1
#define MISSILE_DAMAGE 2
#define MISSILE_OFFSET (3 << RESOLUTION_FACTOR) // JMS_GFX
STARSHIP *StarShipPtr;
MISSILE_BLOCK MissileBlock;
GetElementStarShip (ShipPtr, &StarShipPtr);
MissileBlock.cx = ShipPtr->next.location.x;
MissileBlock.cy = ShipPtr->next.location.y;
MissileBlock.farray = StarShipPtr->RaceDescPtr->ship_data.weapon;
MissileBlock.face = MissileBlock.index = StarShipPtr->ShipFacing;
MissileBlock.sender = ShipPtr->playerNr;
MissileBlock.flags = IGNORE_SIMILAR;
MissileBlock.pixoffs = SYREEN_OFFSET;
MissileBlock.speed = MISSILE_SPEED << RESOLUTION_FACTOR; // JMS_GFX
MissileBlock.hit_points = MISSILE_HITS;
MissileBlock.damage = MISSILE_DAMAGE;
MissileBlock.life = MISSILE_LIFE;
MissileBlock.preprocess_func = NULL;
MissileBlock.blast_offs = MISSILE_OFFSET;
DaggerArray[0] = initialize_missile (&MissileBlock);
return (1);
}
开发者ID:jurchik,项目名称:project6014,代码行数:28,代码来源:syreen.c
示例17: initialize_autoaim_laser
static COUNT
initialize_autoaim_laser (ELEMENT *ShipPtr, HELEMENT LaserArray[])
{
COUNT orig_facing;
SIZE delta_facing;
STARSHIP *StarShipPtr;
LASER_BLOCK LaserBlock;
GetElementStarShip (ShipPtr, &StarShipPtr);
LaserBlock.face = orig_facing = StarShipPtr->ShipFacing;
if ((delta_facing = TrackShip (ShipPtr, &LaserBlock.face)) > 0)
LaserBlock.face = NORMALIZE_FACING (orig_facing + delta_facing);
ShipPtr->hTarget = 0;
LaserBlock.cx = ShipPtr->next.location.x;
LaserBlock.cy = ShipPtr->next.location.y;
LaserBlock.ex = COSINE (FACING_TO_ANGLE (LaserBlock.face), LASER_RANGE);
LaserBlock.ey = SINE (FACING_TO_ANGLE (LaserBlock.face), LASER_RANGE);
LaserBlock.sender = ShipPtr->playerNr;
LaserBlock.flags = IGNORE_SIMILAR;
LaserBlock.pixoffs = ARILOU_OFFSET;
LaserBlock.color = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x0A), 0x0E);
LaserArray[0] = initialize_laser (&LaserBlock);
return (1);
}
开发者ID:mikeakers,项目名称:UQM-emscripten,代码行数:26,代码来源:arilou.c
示例18: druuge_postprocess
static void
druuge_postprocess (ELEMENT *ElementPtr)
{
STARSHIP *StarShipPtr;
GetElementStarShip (ElementPtr, &StarShipPtr);
/* if just fired cannon */
if ((StarShipPtr->cur_status_flags & WEAPON)
&& StarShipPtr->weapon_counter ==
StarShipPtr->RaceDescPtr->characteristics.weapon_wait)
{
COUNT angle;
SIZE cur_delta_x, cur_delta_y;
StarShipPtr->cur_status_flags &= ~SHIP_AT_MAX_SPEED;
angle = FACING_TO_ANGLE (StarShipPtr->ShipFacing) + HALF_CIRCLE;
DeltaVelocityComponents (&ElementPtr->velocity,
COSINE (angle, RECOIL_VELOCITY),
SINE (angle, RECOIL_VELOCITY));
GetCurrentVelocityComponents (&ElementPtr->velocity,
&cur_delta_x, &cur_delta_y);
if ((long)cur_delta_x * (long)cur_delta_x
+ (long)cur_delta_y * (long)cur_delta_y
> (long)MAX_RECOIL_VELOCITY * (long)MAX_RECOIL_VELOCITY)
{
angle = ARCTAN (cur_delta_x, cur_delta_y);
SetVelocityComponents (&ElementPtr->velocity,
COSINE (angle, MAX_RECOIL_VELOCITY),
SINE (angle, MAX_RECOIL_VELOCITY));
}
}
}
开发者ID:intgr,项目名称:sc2-uqm,代码行数:33,代码来源:druuge.c
示例19: initialize_cannon
static COUNT
initialize_cannon (ELEMENT *ShipPtr, HELEMENT CannonArray[])
{
STARSHIP *StarShipPtr;
MISSILE_BLOCK MissileBlock;
GetElementStarShip (ShipPtr, &StarShipPtr);
MissileBlock.cx = ShipPtr->next.location.x;
MissileBlock.cy = ShipPtr->next.location.y;
MissileBlock.farray = StarShipPtr->RaceDescPtr->ship_data.weapon;
MissileBlock.face = StarShipPtr->ShipFacing;
MissileBlock.index = MissileBlock.face;
MissileBlock.sender = ShipPtr->playerNr;
MissileBlock.flags = IGNORE_SIMILAR;
MissileBlock.pixoffs = DRUUGE_OFFSET;
MissileBlock.speed = MISSILE_SPEED;
MissileBlock.hit_points = MISSILE_HITS;
MissileBlock.damage = MISSILE_DAMAGE;
MissileBlock.life = MISSILE_LIFE;
MissileBlock.preprocess_func = NULL;
MissileBlock.blast_offs = MISSILE_OFFSET;
CannonArray[0] = initialize_missile (&MissileBlock);
if (CannonArray[0])
{
ELEMENT *CannonPtr;
LockElement (CannonArray[0], &CannonPtr);
CannonPtr->collision_func = cannon_collision;
UnlockElement (CannonArray[0]);
}
return (1);
}
开发者ID:intgr,项目名称:sc2-uqm,代码行数:34,代码来源:druuge.c
示例20: initialize_test_gas
// This is used by AI for testing would it hit the enemy ship with gas.
static COUNT
initialize_test_gas (ELEMENT *ElementPtr, HELEMENT GasArray[])
{
STARSHIP *StarShipPtr;
MISSILE_BLOCK MissileBlock;
GetElementStarShip (ElementPtr, &StarShipPtr);
MissileBlock.cx = ElementPtr->next.location.x;
MissileBlock.cy = ElementPtr->next.location.y;
MissileBlock.farray = StarShipPtr->RaceDescPtr->ship_data.special;
MissileBlock.face = StarShipPtr->ShipFacing;
MissileBlock.index = LAST_DISSOLVE_INDEX;
MissileBlock.sender = ElementPtr->playerNr;
MissileBlock.flags = GASSY_SUBSTANCE | IGNORE_VELOCITY;
MissileBlock.pixoffs = GAS_OFFSET;
MissileBlock.speed = GAS_INIT_SPEED;
MissileBlock.hit_points = GAS_HITS;
MissileBlock.damage = GAS_DAMAGE;
MissileBlock.life = 20; // Not GAS_LIFE because this test gas doesn't slow down at all -> life has to be short.
MissileBlock.preprocess_func = gas_preprocess;
MissileBlock.blast_offs = 0;
GasArray[0] = initialize_missile (&MissileBlock);
return (1);
}
开发者ID:jurchik,项目名称:project6014,代码行数:27,代码来源:baul.c
注:本文中的GetElementStarShip函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论