Skip to content

Commit d62def1

Browse files
committed
Damage Control Constants and Corrections
* Add script access to player and enemy damage control contants. * Add missed logic changes from boss slow and damage control.
1 parent 494a3da commit d62def1

2 files changed

Lines changed: 38 additions & 17 deletions

File tree

engine/openbor.c

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14025,18 +14025,19 @@ void load_level(char *filename)
1402514025
level->spawn[i].y = videomodes.vRes + 60;
1402614026
}
1402714027

14028-
level->settime = 100; // Feb 25, 2005 - Default time limit set to 100
14029-
level->nospecial = 0; // Default set to specials can be used during bonus levels
14030-
level->nohurt = 0; // Default set to players can hurt each other during bonus levels
14031-
level->nohit = 0; // Default able to hit the other player
14028+
level->settime = 100; // Feb 25, 2005 - Default time limit set to 100
14029+
level->nospecial = 0; // Default set to specials can be used during bonus levels
14030+
level->nohurt = DAMAGE_FROM_ENEMY_ON;
14031+
level->nohit = DAMAGE_FROM_PLAYER_ON; // Default able to hit the other player
1403214032
level->setweap = 0;
1403314033
level->maxtossspeed = default_level_maxtossspeed;
1403414034
level->maxfallspeed = default_level_maxfallspeed;
1403514035
level->gravity = default_level_gravity;
1403614036
level->scrolldir = SCROLL_RIGHT;
1403714037
level->scrollspeed = 1;
1403814038
level->cameraxoffset = 0;
14039-
level->camerazoffset = 0;
14039+
level->camerazoffset = 0;
14040+
level->boss_slow = BOSS_SLOW_ON;
1404014041
level->bosses = 0;
1404114042
blendfx[BLEND_MULTIPLY] = 1;
1404214043
bgtravelled = 0;
@@ -14389,17 +14390,31 @@ void load_level(char *filename)
1438914390
// Flag to if the time should be reset when players respawn 1 = no, else yes
1439014391
level->noreset = GET_INT_ARG(1);
1439114392
break;
14392-
case CMD_LEVEL_NOSLOW:
14393-
// If set, level will not slow down when bosses are defeated
14394-
level->noslow = GET_INT_ARG(1);
14393+
case CMD_LEVEL_NOSLOW:
14394+
14395+
if(GET_INT_ARG(1))
14396+
{
14397+
level->boss_slow = BOSS_SLOW_OFF;
14398+
}
14399+
1439514400
break;
1439614401
case CMD_LEVEL_TYPE:
1439714402
level->type = GET_INT_ARG(1); // Level type - 1 = bonus, else regular
1439814403
level->nospecial = GET_INT_ARG(2); // Can use specials during bonus levels (default 0 - yes)
14399-
level->nohurt = GET_INT_ARG(3); // Can hurt other players during bonus levels (default 0 - yes)
14404+
14405+
if(GET_INT_ARG(3))
14406+
{
14407+
level->nohurt = DAMAGE_FROM_ENEMY_OFF;
14408+
}
14409+
1440014410
break;
14401-
case CMD_LEVEL_NOHIT:
14402-
level->nohit = GET_INT_ARG(1);
14411+
case CMD_LEVEL_NOHIT:
14412+
14413+
if(GET_INT_ARG(1))
14414+
{
14415+
level->nohit = DAMAGE_FROM_PLAYER_OFF;
14416+
}
14417+
1440314418
break;
1440414419
case CMD_LEVEL_GRAVITY:
1440514420
level->gravity = GET_FLOAT_ARG(1);
@@ -17790,7 +17805,7 @@ entity *spawn(float x, float z, float a, int direction, char *name, int index, s
1779017805
e->speedmul = 1;
1779117806
ent_set_colourmap(e, 0);
1779217807
e->lifespancountdown = model->lifespan; // new life span countdown
17793-
if((e->modeldata.type & TYPE_PLAYER) && ((level && level->nohit) || savedata.mode))
17808+
if((e->modeldata.type & TYPE_PLAYER) && ((level && level->nohit == DAMAGE_FROM_PLAYER_ON) || savedata.mode))
1779417809
{
1779517810
e->modeldata.hostile &= ~TYPE_PLAYER;
1779617811
e->modeldata.candamage &= ~TYPE_PLAYER;
@@ -19428,7 +19443,7 @@ void do_attack(entity *e)
1942819443

1942919444
// New blocking checks
1943019445
//04/27/2008 Damon Caskey: Added checks for defense property specfic blockratio and type. Could probably use some cleaning.
19431-
if(didblock && !level->nohurt)
19446+
if(didblock && level->nohurt == DAMAGE_FROM_ENEMY_ON)
1943219447
{
1943319448
if(blockratio || def->defense[attack->attack_type].blockratio) // Is damage reduced?
1943419449
{
@@ -29274,7 +29289,7 @@ int player_takedamage(entity *other, s_collision_attack *attack)
2927429289
{
2927529290
s_collision_attack atk = *attack;
2927629291
//printf("damaged by: '%s' %d\n", other->name, attack->attack_force);
29277-
if(healthcheat || (level->nohurt && (other->modeldata.type & TYPE_ENEMY)))
29292+
if(healthcheat || (level->nohurt == DAMAGE_FROM_ENEMY_OFF && (other->modeldata.type & TYPE_ENEMY)))
2927829293
{
2927929294
atk.attack_force = 0;
2928029295
}
@@ -29577,7 +29592,7 @@ entity *knife_spawn(char *name, int index, float x, float z, float a, int direct
2957729592
{
2957829593
e->modeldata.candamage = self->modeldata.candamage;
2957929594
}
29580-
if((self->modeldata.type & TYPE_PLAYER) && ((level && level->nohit) || savedata.mode))
29595+
if((self->modeldata.type & TYPE_PLAYER) && ((level && level->nohit == DAMAGE_FROM_PLAYER_ON) || savedata.mode))
2958129596
{
2958229597
e->modeldata.hostile &= ~TYPE_PLAYER;
2958329598
e->modeldata.candamage &= ~TYPE_PLAYER;
@@ -31722,7 +31737,7 @@ void update(int ingame, int usevwait)
3172231737
execute_keyscripts();
3172331738
}
3172431739

31725-
if((level_completed && !level->noslow && !tospeedup) || slowmotion.toggle > SLOW_MOTION_OFF)
31740+
if((level_completed && level->boss_slow == BOSS_SLOW_ON && !tospeedup) || slowmotion.toggle > SLOW_MOTION_OFF)
3172631741
{
3172731742
if(slowmotion.duration == slowmotion.counter)
3172831743
{

engine/source/scriptlib/constant.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,13 @@ int mapstrings_transconst(ScriptVariant **varlist, int paramCount)
103103
ICMPCONST(BOSS_SLOW_OFF)
104104
ICMPCONST(BOSS_SLOW_ON)
105105

106-
// Level Properties.
106+
// Damage control flags.
107+
ICMPCONST(DAMAGE_FROM_ENEMY_OFF)
108+
ICMPCONST(DAMAGE_FROM_ENEMY_ON)
109+
ICMPCONST(DAMAGE_FROM_PLAYER_OFF)
110+
ICMPCONST(DAMAGE_FROM_PLAYER_ON)
111+
112+
// Level properties
107113
ICMPCONST(LEVEL_PROP_AUTO_SCROLL_DIRECTION)
108114
ICMPCONST(LEVEL_PROP_AUTO_SCROLL_X)
109115
ICMPCONST(LEVEL_PROP_AUTO_SCROLL_Y)

0 commit comments

Comments
 (0)