dos-vga-arena-shooter-game/movement.h

74 lines
1.4 KiB
C
Raw Normal View History

2024-02-26 23:12:39 +00:00
#ifndef __MOVEMENT_H__
#define __MOVEMENT_H__
2024-02-21 13:25:55 +00:00
#include "system/keyboard.h"
2024-02-21 21:25:00 +00:00
2024-02-21 13:25:55 +00:00
struct RabbitPosition {
int rabbitPosition[2];
int oldRabbitPosition[2];
int rabbitLimits[2][2];
signed char rabbitVelocity[2];
2024-02-20 17:51:59 +00:00
2024-02-21 13:25:55 +00:00
int mousePosition[2];
int oldMousePosition[2];
int mouseDotPosition[2];
int oldMouseDotPosition[2];
int mouseAngle;
};
struct RabbitWeaponry {
char cooldown;
2024-02-26 23:12:39 +00:00
char currentWeapon;
2024-02-27 01:40:05 +00:00
int currentWeaponRemainingRounds;
2024-03-04 22:38:03 +00:00
char damage;
2024-02-27 01:40:05 +00:00
};
struct PlayerPowerup {
int x, y;
int cooldown;
char isActive;
2024-02-27 13:16:16 +00:00
char willBeInactive;
2024-02-27 01:40:05 +00:00
char type;
2024-02-20 17:51:59 +00:00
};
2024-02-21 13:25:55 +00:00
struct BulletPosition {
// 1 if the bullet should be rendered
char isActive;
// sweep up the bullet from the display
char willBeInactive;
int x, y;
int oldX, oldY;
2024-02-26 23:12:39 +00:00
int wallCooldown;
2024-02-25 21:59:04 +00:00
signed int velocityXSteps[2], velocityYSteps[2];
int velocityStep;
2024-02-27 13:16:16 +00:00
int angle;
2024-02-21 13:25:55 +00:00
};
2024-02-21 21:25:00 +00:00
struct EnemyPosition {
2024-03-04 22:38:03 +00:00
int hitPoints;
int enemyPosition[2];
int oldEnemyPosition[2];
int enemyMoveDelayStep;
int enemyFireDelayStep;
2024-02-21 21:25:00 +00:00
char isActive;
char willBeInactive;
2024-02-25 21:59:04 +00:00
char wasKilled;
2024-02-21 21:25:00 +00:00
2024-02-26 23:12:39 +00:00
char hasLeftGate;
char gateExitedFrom;
2024-02-21 21:25:00 +00:00
};
void calculateTargetAngle(struct RabbitPosition*);
2024-02-21 13:25:55 +00:00
void captureAndLimitMousePosition(struct RabbitPosition*, struct MouseStatus*);
void handleRabbitMovement(struct RabbitPosition*, struct KeyboardKeydownState*);
2024-02-25 21:59:04 +00:00
void handleEnemyMovement(struct EnemyPosition[], struct RabbitPosition*);
2024-02-26 23:12:39 +00:00
#endif