Skip to content

Commit

Permalink
Move and shoot #71
Browse files Browse the repository at this point in the history
  • Loading branch information
cxong committed Nov 28, 2023
1 parent adebcef commit 5df151b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
12 changes: 6 additions & 6 deletions missions/custom/techdemo/cyberdogs.cdogscpn/characters.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"speed": 192,
"Gun": "DumbGun",
"maxHealth": 15,
"flags": 1024,
"flags": 167773184,
"probabilityToMove": 25,
"probabilityToTrack": 50,
"probabilityToShoot": 10,
Expand All @@ -102,7 +102,7 @@
"speed": 384,
"Gun": "Lazer",
"maxHealth": 12,
"flags": 1024,
"flags": 167773184,
"probabilityToMove": 50,
"probabilityToTrack": 50,
"probabilityToShoot": 10,
Expand All @@ -123,7 +123,7 @@
"speed": 128,
"Gun": "Gun",
"maxHealth": 60,
"flags": 1024,
"flags": 167773184,
"probabilityToMove": 25,
"probabilityToTrack": 50,
"probabilityToShoot": 10,
Expand All @@ -144,7 +144,7 @@
"speed": 512,
"Gun": "Lazer",
"maxHealth": 12,
"flags": 1024,
"flags": 167773184,
"probabilityToMove": 25,
"probabilityToTrack": 50,
"probabilityToShoot": 10,
Expand All @@ -166,7 +166,7 @@
"speed": 256,
"Gun": "DumbGun",
"maxHealth": 15,
"flags": 1024,
"flags": 167773184,
"probabilityToMove": 25,
"probabilityToTrack": 50,
"probabilityToShoot": 10,
Expand All @@ -188,7 +188,7 @@
"speed": 256,
"Gun": "TurboLazer",
"maxHealth": 60,
"flags": 1024,
"flags": 167773184,
"probabilityToMove": 50,
"probabilityToTrack": 50,
"probabilityToShoot": 10,
Expand Down
14 changes: 7 additions & 7 deletions missions/custom/techdemo/cyberdogs.cdogscpn/missions.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
8],
"SpecialChars": [],
"MapObjectDensities": [],
"EnemyDensity": 10,
"EnemyDensity": 20,
"Weapons": ["Knife",
"Machine gun",
"Grenades",
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 5 additions & 2 deletions src/cdogs/actors.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/cdogs/actors.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
3 changes: 3 additions & 0 deletions src/cdogsed/char_editor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 5df151b

Please sign in to comment.