From 5df151b4c265fc8dfc0070d974cabd53f5c86630 Mon Sep 17 00:00:00 2001 From: Cong Date: Tue, 28 Nov 2023 19:38:36 +1100 Subject: [PATCH] Move and shoot #71 --- .../techdemo/cyberdogs.cdogscpn/characters.json | 12 ++++++------ .../techdemo/cyberdogs.cdogscpn/missions.json | 14 +++++++------- src/cdogs/actors.c | 7 +++++-- src/cdogs/actors.h | 1 + src/cdogsed/char_editor.c | 3 +++ 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/missions/custom/techdemo/cyberdogs.cdogscpn/characters.json b/missions/custom/techdemo/cyberdogs.cdogscpn/characters.json index f50118495..1174ac25a 100644 --- a/missions/custom/techdemo/cyberdogs.cdogscpn/characters.json +++ b/missions/custom/techdemo/cyberdogs.cdogscpn/characters.json @@ -81,7 +81,7 @@ "speed": 192, "Gun": "DumbGun", "maxHealth": 15, - "flags": 1024, + "flags": 167773184, "probabilityToMove": 25, "probabilityToTrack": 50, "probabilityToShoot": 10, @@ -102,7 +102,7 @@ "speed": 384, "Gun": "Lazer", "maxHealth": 12, - "flags": 1024, + "flags": 167773184, "probabilityToMove": 50, "probabilityToTrack": 50, "probabilityToShoot": 10, @@ -123,7 +123,7 @@ "speed": 128, "Gun": "Gun", "maxHealth": 60, - "flags": 1024, + "flags": 167773184, "probabilityToMove": 25, "probabilityToTrack": 50, "probabilityToShoot": 10, @@ -144,7 +144,7 @@ "speed": 512, "Gun": "Lazer", "maxHealth": 12, - "flags": 1024, + "flags": 167773184, "probabilityToMove": 25, "probabilityToTrack": 50, "probabilityToShoot": 10, @@ -166,7 +166,7 @@ "speed": 256, "Gun": "DumbGun", "maxHealth": 15, - "flags": 1024, + "flags": 167773184, "probabilityToMove": 25, "probabilityToTrack": 50, "probabilityToShoot": 10, @@ -188,7 +188,7 @@ "speed": 256, "Gun": "TurboLazer", "maxHealth": 60, - "flags": 1024, + "flags": 167773184, "probabilityToMove": 50, "probabilityToTrack": 50, "probabilityToShoot": 10, diff --git a/missions/custom/techdemo/cyberdogs.cdogscpn/missions.json b/missions/custom/techdemo/cyberdogs.cdogscpn/missions.json index 35e8fa606..ce3b21d54 100644 --- a/missions/custom/techdemo/cyberdogs.cdogscpn/missions.json +++ b/missions/custom/techdemo/cyberdogs.cdogscpn/missions.json @@ -16,7 +16,7 @@ 8], "SpecialChars": [], "MapObjectDensities": [], - "EnemyDensity": 10, + "EnemyDensity": 20, "Weapons": ["Knife", "Machine gun", "Grenades", @@ -108,13 +108,13 @@ "DamageBullet": "" } }, - "Walls": 0, - "WallLength": 0, - "CorridorWidth": 1, + "Walls": 11, + "WallLength": 14, + "CorridorWidth": 2, "Rooms": { - "Count": 0, - "Min": 5, - "Max": 5, + "Count": 3, + "Min": 7, + "Max": 10, "Edge": false, "Overlap": false, "Walls": 0, diff --git a/src/cdogs/actors.c b/src/cdogs/actors.c index cb4872bae..e8ad29b8b 100644 --- a/src/cdogs/actors.c +++ b/src/cdogs/actors.c @@ -1121,11 +1121,14 @@ void CommandActor(TActor *actor, int cmd, int ticks) static bool ActorTryMove(TActor *actor, int cmd, int ticks) { const bool canMoveWhenShooting = - ConfigGetEnum(&gConfig, "Game.FireMoveStyle") != FIREMOVE_STOP || + actor->PlayerUID < 0 ? (actor->flags & FLAGS_MOVE_AND_SHOOT) : + ( + ConfigGetEnum(&gConfig, "Game.FireMoveStyle") != FIREMOVE_STOP || !actor->hasShot || (ConfigGetEnum(&gConfig, "Game.SwitchMoveStyle") == SWITCHMOVE_STRAFE && - Button2(cmd)); + Button2(cmd)) + ); const bool willMove = !actor->petrified && CMD_HAS_DIRECTION(cmd) && canMoveWhenShooting; actor->MoveVel = svec2_zero(); diff --git a/src/cdogs/actors.h b/src/cdogs/actors.h index b66071654..c0722e03f 100644 --- a/src/cdogs/actors.h +++ b/src/cdogs/actors.h @@ -88,6 +88,7 @@ #define FLAGS_SLEEPALWAYS (1 << 24) #define FLAGS_AWAKEALWAYS (1 << 25) #define FLAGS_RESCUED (1 << 26) // Run towards exit +#define FLAGS_MOVE_AND_SHOOT (1 << 27) // Can move and shoot at the same time typedef enum { diff --git a/src/cdogsed/char_editor.c b/src/cdogsed/char_editor.c index b7298bb81..819212f5a 100644 --- a/src/cdogsed/char_editor.c +++ b/src/cdogsed/char_editor.c @@ -711,6 +711,9 @@ static bool Draw(SDL_Window *win, struct nk_context *ctx, void *data) DrawFlag( ctx, ec, "Unlock Doors", FLAGS_UNLOCK_DOORS, "Can open any locked door"); + DrawFlag( + ctx, ec, "Move and shoot", FLAGS_MOVE_AND_SHOOT, + "Can move while shooting"); nk_end(ctx); } }