Skip to content

Commit 9dcd966

Browse files
committed
New command projectile_position_<axis>. Adjust launch position of projectile spawns.
1 parent 311f66c commit 9dcd966

3 files changed

Lines changed: 32 additions & 6 deletions

File tree

engine/openbor.c

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10303,6 +10303,9 @@ s_model *load_cached_model(char *name, char *owner, char unload)
1030310303
newanim->projectile.shootframe = FRAME_NONE;
1030410304
newanim->projectile.throwframe = FRAME_NONE;
1030510305
newanim->projectile.tossframe = FRAME_NONE; // this get 1 of weapons numshots shots in the animation that you want(normaly the last)by tails
10306+
newanim->projectile.position.x = 0;
10307+
newanim->projectile.position.y = 70;
10308+
newanim->projectile.position.z = 0;
1030610309
newanim->flipframe = FRAME_NONE;
1030710310
newanim->attack_one = 0;
1030810311
newanim->subject_to_gravity = 1;
@@ -10319,9 +10322,9 @@ s_model *load_cached_model(char *name, char *owner, char unload)
1031910322
newanim->cancel = ANIMATION_CANCEL_DISABLED; // OX. For cancelling anims into a freespecial.
1032010323
newanim->hit_count = 0; //OX counts hits on a per anim basis for cancels.
1032110324
newanim->sub_entity_model_index = newanim->projectile.bomb = newanim->projectile.knife =
10322-
newanim->projectile.star = newanim->projectile.flash = -1;
10325+
newanim->projectile.star = newanim->projectile.flash = MODEL_INDEX_NONE;
1032310326
newanim->quakeframe.framestart = 0;
10324-
newanim->sync = -1;
10327+
newanim->sync = FRAME_NONE;
1032510328

1032610329
if((ani_id = translate_ani_id(value, newchar, newanim, &attack)) < 0)
1032710330
{
@@ -10455,6 +10458,15 @@ s_model *load_cached_model(char *name, char *owner, char unload)
1045510458
case CMD_MODEL_CUSTSTAR:
1045610459
newanim->projectile.star = get_cached_model_index(GET_ARG(1));
1045710460
break;
10461+
case CMD_MODEL_PROJECTILE_POSITION_X:
10462+
newanim->projectile.position.x = GET_INT_ARG(1);
10463+
break;
10464+
case CMD_MODEL_PROJECTILE_POSITION_Y:
10465+
newanim->projectile.position.y = GET_INT_ARG(1);
10466+
break;
10467+
case CMD_MODEL_PROJECTILE_POSITION_Z:
10468+
newanim->projectile.position.z = GET_INT_ARG(1);
10469+
break;
1045810470

1045910471
// Legacy dive attacks. Turn off animation level subject_to_gravity
1046010472
// and then use jumpframe to fly down at an angle.
@@ -18147,6 +18159,12 @@ void update_frame(entity *ent, unsigned int f)
1814718159
// Perform jumping if on a jumpframe.
1814818160
check_jumpframe(self, f);
1814918161

18162+
int position_x = anim->projectile.position.x;
18163+
18164+
if (self->direction == DIRECTION_LEFT)
18165+
{
18166+
position_x = -position_x;
18167+
}
1815018168

1815118169
if(anim->projectile.throwframe == f)
1815218170
{
@@ -18156,8 +18174,10 @@ void update_frame(entity *ent, unsigned int f)
1815618174
// then if the entity is jumping, check star first, if failed, try knife instead
1815718175
// well, try knife at last, if still failed, try star, or just let if shutdown?
1815818176

18177+
18178+
1815918179
#define __trystar star_spawn(self->position.x + (self->direction == DIRECTION_RIGHT ? 56 : -56), self->position.z, self->position.y+67, self->direction)
18160-
#define __tryknife knife_spawn(NULL, -1, self->position.x, self->position.z, self->position.y + anim->projectile.position.y, self->direction, 0, 0)
18180+
#define __tryknife knife_spawn(NULL, -1, self->position.x + position_x, self->position.z + anim->projectile.position.z, self->position.y + anim->projectile.position.y, self->direction, 0, 0)
1816118181

1816218182
if(anim->projectile.knife >= 0 || anim->projectile.flash >= 0)
1816318183
{
@@ -18183,13 +18203,13 @@ void update_frame(entity *ent, unsigned int f)
1818318203

1818418204
if(anim->projectile.shootframe == f)
1818518205
{
18186-
knife_spawn(NULL, -1, self->position.x, self->position.z, self->position.y, self->direction, 1, 0);
18206+
knife_spawn(NULL, -1, self->position.x + position_x, self->position.z + anim->projectile.position.z, self->position.y + anim->projectile.position.y, self->direction, 1, 0);
1818718207
self->deduct_ammo = 1;
1818818208
}
1818918209

1819018210
if(anim->projectile.tossframe == f)
1819118211
{
18192-
bomb_spawn(NULL, -1, self->position.x, self->position.z, self->position.y + anim->projectile.position.y, self->direction, 0);
18212+
bomb_spawn(NULL, -1, self->position.x + position_x, self->position.z + anim->projectile.position.z, self->position.y + anim->projectile.position.y, self->direction, 0);
1819318213
self->deduct_ammo = 1;
1819418214
}
1819518215

engine/source/openborscript/commands.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ List *createModelCommandList(void)
402402
LIST_ADD(CMD_MODEL_PLAYSHOTW, "playshotw");
403403
LIST_ADD(CMD_MODEL_PRIORITY, "priority");
404404
LIST_ADD(CMD_MODEL_PROJECT, "project");
405+
LIST_ADD(CMD_MODEL_PROJECTILE_POSITION_X, "projectile_position_x");
406+
LIST_ADD(CMD_MODEL_PROJECTILE_POSITION_Y, "projectile_position_y");
407+
LIST_ADD(CMD_MODEL_PROJECTILE_POSITION_Z, "projectile_position_z");
405408
LIST_ADD(CMD_MODEL_PROJECTILEHIT, "projectilehit");
406409
LIST_ADD(CMD_MODEL_PSHOTFRAME, "pshotframe");
407410
LIST_ADD(CMD_MODEL_PSHOTFRAMENO, "pshotframeno");

engine/source/openborscript/commands.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,10 @@ typedef enum modelCommand
522522
CMD_MODEL_PLAYSHOTW,
523523
CMD_MODEL_PRIORITY,
524524
CMD_MODEL_PROJECT,
525-
CMD_MODEL_PROJECTILEHIT,
525+
CMD_MODEL_PROJECTILE_POSITION_X,
526+
CMD_MODEL_PROJECTILE_POSITION_Y,
527+
CMD_MODEL_PROJECTILE_POSITION_Z,
528+
CMD_MODEL_PROJECTILEHIT,
526529
CMD_MODEL_PSHOTFRAME,
527530
CMD_MODEL_PSHOTFRAMENO,
528531
CMD_MODEL_PSHOTFRAMEW,

0 commit comments

Comments
 (0)