Fix flame shield. Removed global set-hit-point-regeneration.
This commit is contained in:
parent
0716df68b1
commit
3c0296967e
9 changed files with 46 additions and 69 deletions
|
@ -77,7 +77,6 @@
|
|||
<a href="#set-forest-regeneration!">set-forest-regeneration!</a>
|
||||
<a href="#set-goldmine-depleted!">set-goldmine-depleted!</a>
|
||||
<a href="#set-grab-mouse!">set-grab-mouse!</a>
|
||||
<a href="#set-hitpoint-regeneration!">set-hitpoint-regeneration!</a>
|
||||
<a href="#set-hold-click-delay!">set-hold-click-delay!</a>
|
||||
<a href="#set-key-scroll!">set-key-scroll!</a>
|
||||
<a href="#set-key-scroll-speed!">set-key-scroll-speed!</a>
|
||||
|
@ -769,27 +768,6 @@ of gold. Use 0 to disable using depleted mines.
|
|||
|
||||
<a href="../../data/ccl/stratagus.ccl"> $LIBARYPATH/ccl/stratagus.ccl </a>
|
||||
|
||||
<a name="set-hitpoint-regeneration!"></a>
|
||||
<h3>(set-hitpoint-regeneration! regen)</h3>
|
||||
|
||||
.
|
||||
|
||||
|
||||
<dl>
|
||||
<dt>regen</dt>
|
||||
<dd>.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4>Example</h4>
|
||||
|
||||
<pre>
|
||||
(set-hitpoint-regeneration! #f)
|
||||
</pre>
|
||||
<h4>Used</h4>
|
||||
|
||||
<a href="../../data/ccl/stratagus.ccl"> $LIBARYPATH/ccl/stratagus.ccl </a>
|
||||
|
||||
<a name="set-hold-click-delay!"></a>
|
||||
<h3>(set-hold-click-delay! delay)</h3>
|
||||
|
||||
|
|
|
@ -471,6 +471,10 @@ damage, this is the full damage.
|
|||
the missile is automatically removed from the map. If -1 the
|
||||
missile lives for ever and the lifetime is handled by other means.
|
||||
</dd>
|
||||
<dt>hidden</dt>
|
||||
<dd>This marks the unit as hidden, until the unit is shown again in the
|
||||
controlling function. No parameters.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4>Example</h4>
|
||||
|
|
|
@ -270,14 +270,6 @@ local void IncrementUnitHealth(Unit* unit)
|
|||
{
|
||||
// Unit may not have stats assigned to it
|
||||
if (unit->Stats) {
|
||||
if (HitPointRegeneration && unit->HP<unit->Stats->HitPoints) {
|
||||
++unit->HP;
|
||||
|
||||
if (unit->Selected) {
|
||||
MustRedraw |= RedrawInfoPanel;
|
||||
}
|
||||
}
|
||||
|
||||
if (unit->Stats->RegenerationRate && unit->HP<unit->Stats->HitPoints) {
|
||||
unit->HP += unit->Stats->RegenerationRate;
|
||||
if (unit->HP > unit->Stats->HitPoints) {
|
||||
|
|
|
@ -294,6 +294,10 @@
|
|||
** missile lives for ever and the lifetime is handled by
|
||||
** Missile::Type:MissileType::Class
|
||||
**
|
||||
** Missile::Hidden
|
||||
**
|
||||
** When you set this to 1 the unit becomes hidden for a while.
|
||||
**
|
||||
** Missile::CurrentStep
|
||||
**
|
||||
** Movement step. Used for the different trajectories.
|
||||
|
@ -450,6 +454,7 @@ struct _missile_ {
|
|||
int Damage; /// direct damage that missile applies
|
||||
|
||||
int TTL; /// time to live (ticks) used for spells
|
||||
int Hidden; /// If this is 1 then the missile is invisible
|
||||
|
||||
// Internal use:
|
||||
int CurrentStep; /// Current step (0 <= x < TotalStep).
|
||||
|
|
|
@ -720,7 +720,6 @@ extern int ShowReactionRange; /// Flag: show reaction range
|
|||
extern int ShowAttackRange; /// Flag: show attack range
|
||||
extern int ShowOrders; /// Flag: show orders of unit on map
|
||||
extern unsigned long ShowOrdersCount; /// Show orders for some time
|
||||
extern int HitPointRegeneration; /// Hit point regeneration for all units
|
||||
extern int XpDamage; /// unit XP adds more damage to attacks
|
||||
extern char EnableTrainingQueue; /// Config: training queues enabled
|
||||
extern char EnableBuildingCapture; /// Config: building capture enabled
|
||||
|
|
|
@ -315,6 +315,7 @@ local Missile* InitMissile(Missile* missile, MissileType* mtype, int sx,
|
|||
missile->SourceUnit = NULL;
|
||||
|
||||
missile->Damage = 0;
|
||||
missile->Hidden = 0;
|
||||
missile->TargetUnit = NULL;
|
||||
missile->TTL = -1;
|
||||
|
||||
|
@ -758,8 +759,8 @@ global int FindAndSortMissiles(const Viewport* vp, Missile** table)
|
|||
do {
|
||||
for (; missiles < missiles_end; ++missiles) {
|
||||
missile = *missiles;
|
||||
if (missile->Delay) {
|
||||
continue; // delayed aren't shown
|
||||
if (missile->Delay || missile->Hidden) {
|
||||
continue; // delayed or hidden -> aren't shown
|
||||
}
|
||||
// Draw only visible missiles
|
||||
if (!flag || MissileVisibleInViewport(vp, missile)) {
|
||||
|
@ -1434,6 +1435,9 @@ local void SaveMissile(const Missile* missile,CLFile* file)
|
|||
}
|
||||
CLprintf(file, " 'damage %d", missile->Damage);
|
||||
CLprintf(file, " 'ttl %d", missile->TTL);
|
||||
if (missile->Hidden) {
|
||||
CLprintf(file, " 'hidden ");
|
||||
}
|
||||
CLprintf(file, " 'step '(%d %d)",
|
||||
missile->CurrentStep,
|
||||
missile->TotalStep);
|
||||
|
@ -1787,6 +1791,7 @@ global void MissileActionFlameShield(Missile *missile)
|
|||
-27, -15, -30, -10, -31, -5, -32, 0, -31, 5, -30, 10, -27, 16, -24,
|
||||
20, -20, 24, -15, 27, -10, 30, -5, 31, 0, 32};
|
||||
Unit *table[UnitMax];
|
||||
Unit *unit;
|
||||
int n;
|
||||
int i;
|
||||
int dx;
|
||||
|
@ -1803,22 +1808,35 @@ global void MissileActionFlameShield(Missile *missile)
|
|||
i = missile->TTL % 36; // 36 positions on the circle
|
||||
dx = fs_dc[i * 2];
|
||||
dy = fs_dc[i * 2 + 1];
|
||||
ux = missile->TargetUnit->X;
|
||||
uy = missile->TargetUnit->Y;
|
||||
ix = missile->TargetUnit->IX;
|
||||
iy = missile->TargetUnit->IY;
|
||||
uw = missile->TargetUnit->Type->Width;
|
||||
uh = missile->TargetUnit->Type->Height;
|
||||
missile->X = ux * TileSizeX + ix + uw / 2 + dx - 32;
|
||||
missile->Y = uy * TileSizeY + iy + uh / 2 + dy - 32 - 16;
|
||||
if (missile->TargetUnit->Orders[0].Action == UnitActionDie) {
|
||||
unit = missile->TargetUnit;
|
||||
//
|
||||
// Show around the top most unit.
|
||||
// FIXME: conf, do we hide if the unit is contained or not?
|
||||
//
|
||||
while (unit->Container) {
|
||||
unit=unit->Container;
|
||||
}
|
||||
ux = unit->X;
|
||||
uy = unit->Y;
|
||||
ix = unit->IX;
|
||||
iy = unit->IY;
|
||||
uw = unit->Type->TileWidth;
|
||||
uh = unit->Type->TileHeight;
|
||||
missile->X = ux * TileSizeX + ix + uw * TileSizeX / 2 + dx - 16;
|
||||
missile->Y = uy * TileSizeY + iy + uh * TileSizeY / 2 + dy - 32;
|
||||
if (unit->Orders[0].Action == UnitActionDie) {
|
||||
missile->TTL = i;
|
||||
}
|
||||
if (missile->TTL == 0) {
|
||||
missile->TargetUnit->FlameShield = 0;
|
||||
unit->FlameShield = 0;
|
||||
}
|
||||
|
||||
if (unit->Container) {
|
||||
missile->Hidden = 1;
|
||||
return; /// Hidden missile don't do damage.
|
||||
} else {
|
||||
missile->Hidden = 0;
|
||||
}
|
||||
//vladi: still no have clear idea what is this about :)
|
||||
CheckMissileToBeDrawn(missile);
|
||||
|
||||
// Only hit 1 out of 8 frames
|
||||
if (missile->TTL & 7) {
|
||||
|
@ -1826,7 +1844,7 @@ global void MissileActionFlameShield(Missile *missile)
|
|||
}
|
||||
n = SelectUnits(ux - 1, uy - 1, ux + 1 + 1, uy + 1 + 1, table);
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (table[i] == missile->TargetUnit) {
|
||||
if (table[i] == unit) {
|
||||
// cannot hit target unit
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -311,6 +311,10 @@ local SCM CclMissile(SCM list)
|
|||
DebugCheck(!missile);
|
||||
missile->TTL = gh_scm2int(gh_car(list));
|
||||
list = gh_cdr(list);
|
||||
} else if (gh_eq_p(value, gh_symbol2scm("hidden"))) {
|
||||
DebugCheck(!missile);
|
||||
missile->Hidden = 1;
|
||||
list = gh_cdr(list);
|
||||
} else if (gh_eq_p(value, gh_symbol2scm("step"))) {
|
||||
SCM sublist;
|
||||
|
||||
|
|
|
@ -61,23 +61,6 @@ extern UnitType* CclGetUnitType(SCM ptr);
|
|||
/// Get resource by name
|
||||
extern unsigned CclGetResourceByName(SCM ptr);
|
||||
|
||||
/**
|
||||
** Set hit-point regeneration
|
||||
**
|
||||
** @param flag Flag enabling or disabling it.
|
||||
**
|
||||
** @return The old state of the hit-point regeneration.
|
||||
*/
|
||||
local SCM CclSetHitPointRegeneration(SCM flag)
|
||||
{
|
||||
int old;
|
||||
|
||||
old = HitPointRegeneration;
|
||||
HitPointRegeneration = gh_scm2bool(flag);
|
||||
|
||||
return gh_bool2scm(old);
|
||||
}
|
||||
|
||||
/**
|
||||
** Set xp damage
|
||||
**
|
||||
|
@ -1178,8 +1161,6 @@ local SCM CclSlotUsage(SCM list)
|
|||
*/
|
||||
global void UnitCclRegister(void)
|
||||
{
|
||||
gh_new_procedure1_0("set-hitpoint-regeneration!",
|
||||
CclSetHitPointRegeneration);
|
||||
gh_new_procedure1_0("set-xp-damage!", CclSetXpDamage);
|
||||
gh_new_procedure1_0("set-training-queue!", CclSetTrainingQueue);
|
||||
gh_new_procedure1_0("set-building-capture!", CclSetBuildingCapture);
|
||||
|
|
|
@ -79,7 +79,6 @@ global int NumUnits; /// Number of slots used
|
|||
global Unit* DestroyedBuildings; /// List of DestroyedBuildings
|
||||
global Unit* CorpseList; /// List of Corpses On Map
|
||||
|
||||
global int HitPointRegeneration; /// Hit point regeneration for all units
|
||||
global int XpDamage; /// Hit point regeneration for all units
|
||||
global char EnableTrainingQueue; /// Config: training queues enabled
|
||||
global char EnableBuildingCapture; /// Config: capture buildings enabled
|
||||
|
@ -3744,8 +3743,6 @@ global void SaveUnits(CLFile* file)
|
|||
//
|
||||
// Local variables
|
||||
//
|
||||
CLprintf(file, "(set-hitpoint-regeneration! #%s)\n",
|
||||
HitPointRegeneration ? "t" : "f");
|
||||
CLprintf(file, "(set-xp-damage! #%s)\n",
|
||||
XpDamage ? "t" : "f");
|
||||
CLprintf(file, "(set-fancy-buildings! #%s)\n",
|
||||
|
@ -3836,7 +3833,6 @@ global void CleanUnits(void)
|
|||
|
||||
InitUnitsMemory();
|
||||
|
||||
HitPointRegeneration = 0;
|
||||
XpDamage = 0;
|
||||
FancyBuildings = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue