Removed BBox, renamed position to origin
I've replaced the BBox class with a pair of inline functions in check_bounds.hpp. I've also renamed the 'position' variable to 'origin' in several locations. These changes are mostly to alleviate ambiguity.
This commit is contained in:
@@ -23,10 +23,10 @@
|
||||
|
||||
void CharacterData::Update(double delta) {
|
||||
if (motion.x && motion.y) {
|
||||
position += motion * delta * CHARACTER_WALKING_MOD;
|
||||
origin += motion * delta * CHARACTER_WALKING_MOD;
|
||||
}
|
||||
else if (motion != 0) {
|
||||
position += motion * delta;
|
||||
origin += motion * delta;
|
||||
}
|
||||
#ifdef GRAPHICS
|
||||
sprite.Update(delta);
|
||||
@@ -36,7 +36,7 @@ void CharacterData::Update(double delta) {
|
||||
#ifdef GRAPHICS
|
||||
|
||||
void CharacterData::DrawTo(SDL_Surface* const dest, int camX, int camY) {
|
||||
sprite.DrawTo(dest, position.x - camX, position.y - camY);
|
||||
sprite.DrawTo(dest, origin.x - camX, origin.y - camY);
|
||||
}
|
||||
|
||||
void CharacterData::CorrectSprite() {
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
#ifndef CHARACTERDATA_HPP_
|
||||
#define CHARACTERDATA_HPP_
|
||||
|
||||
//POD members
|
||||
#include "bbox.hpp"
|
||||
#include "vector2.hpp"
|
||||
#include "statistics.hpp"
|
||||
|
||||
@@ -48,7 +46,7 @@ struct CharacterData {
|
||||
|
||||
//world position
|
||||
int mapIndex = 0;
|
||||
Vector2 position = {0.0,0.0};
|
||||
Vector2 origin = {0.0,0.0};
|
||||
Vector2 motion = {0.0,0.0};
|
||||
|
||||
//base statistics
|
||||
@@ -71,7 +69,7 @@ struct CharacterData {
|
||||
#ifdef GRAPHICS
|
||||
SpriteSheet sprite;
|
||||
#endif
|
||||
BBox bbox = {0,0,0,0};
|
||||
Vector2 bounds = {0.0,0.0};
|
||||
bool inCombat = false;
|
||||
int atbGauge = 0;
|
||||
//TODO: stored command
|
||||
|
||||
@@ -22,9 +22,7 @@
|
||||
#ifndef COMBATDATA_HPP_
|
||||
#define COMBATDATA_HPP_
|
||||
|
||||
//POD members
|
||||
#include "vector2.hpp"
|
||||
#include "bbox.hpp"
|
||||
|
||||
//gameplay members
|
||||
#include "character_data.hpp"
|
||||
@@ -58,8 +56,8 @@ struct CombatData {
|
||||
|
||||
//world interaction
|
||||
int mapIndex = 0;
|
||||
Vector2 position = {0.0,0.0};
|
||||
BBox bbox = {0,0,0,0};
|
||||
Vector2 origin = {0.0,0.0};
|
||||
Vector2 bounds = {0.0,0.0};
|
||||
|
||||
//time interval
|
||||
Clock::time_point lastTick = Clock::now();
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#ifndef ENEMYDATA_HPP_
|
||||
#define ENEMYDATA_HPP_
|
||||
|
||||
//gameplay
|
||||
#include "vector2.hpp"
|
||||
#include "statistics.hpp"
|
||||
|
||||
//graphics
|
||||
@@ -50,6 +50,8 @@ struct EnemyData {
|
||||
//NOTE: these are lost when unloaded
|
||||
#ifdef GRAPHICS
|
||||
SpriteSheet sprite;
|
||||
Vector2 origin = {0.0,0.0};
|
||||
Vector2 bounds = {0.0,0.0};
|
||||
#endif
|
||||
int tableIndex;
|
||||
int atbGauge = 0;
|
||||
|
||||
Reference in New Issue
Block a user