Compare commits
5 Commits
a2b1ae1670
...
1f2cfb7234
Author | SHA1 | Date |
---|---|---|
wgroeneveld | 1f2cfb7234 | |
Wouter Groeneveld | 941aea1241 | |
Wouter Groeneveld | aef56ed72c | |
Rodrigo Alfonso | 0004269c21 | |
Rodrigo Alfonso | 337631b839 |
|
@ -61,6 +61,7 @@ protected:
|
||||||
u8 animationDelay, numberOfFrames, beginFrame, currentFrame, previousFrame, animationCounter;
|
u8 animationDelay, numberOfFrames, beginFrame, currentFrame, previousFrame, animationCounter;
|
||||||
bool animating;
|
bool animating;
|
||||||
OBJ_ATTR oam;
|
OBJ_ATTR oam;
|
||||||
|
bool isAffine;
|
||||||
|
|
||||||
void syncAnimation();
|
void syncAnimation();
|
||||||
virtual void syncOam();
|
virtual void syncOam();
|
||||||
|
@ -96,8 +97,8 @@ public:
|
||||||
GBAVector getPosAsVector() { return GBAVector(getPos()); }
|
GBAVector getPosAsVector() { return GBAVector(getPos()); }
|
||||||
VECTOR getCenter() { return { x + w / 2, y + h / 2 }; }
|
VECTOR getCenter() { return { x + w / 2, y + h / 2 }; }
|
||||||
VECTOR getVelocity() { return { dx, dy}; }
|
VECTOR getVelocity() { return { dx, dy}; }
|
||||||
u32 getX() { return x; }
|
int getX() { return x; }
|
||||||
u32 getY() { return y; }
|
int getY() { return y; }
|
||||||
u32 getDx() { return dx; }
|
u32 getDx() { return dx; }
|
||||||
u32 getDy() { return dy; }
|
u32 getDy() { return dy; }
|
||||||
u32 getWidth() { return w; }
|
u32 getWidth() { return w; }
|
||||||
|
|
|
@ -13,11 +13,11 @@ void AffineSprite::identity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
AffineSprite::AffineSprite(const AffineSprite &other) : Sprite(other), affIndex(other.affIndex) {
|
AffineSprite::AffineSprite(const AffineSprite &other) : Sprite(other), affIndex(other.affIndex) {
|
||||||
|
isAffine = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AffineSprite::AffineSprite(const void *imgData, int imgSize, int xC, int yC, SpriteSize spriteSize) : Sprite(imgData, imgSize, xC, yC, spriteSize), affIndex(0) {
|
AffineSprite::AffineSprite(const void *imgData, int imgSize, int xC, int yC, SpriteSize spriteSize) : Sprite(imgData, imgSize, xC, yC, spriteSize), affIndex(0) {
|
||||||
|
isAffine = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AffineSprite::rotate(u16 alpha) {
|
void AffineSprite::rotate(u16 alpha) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ Sprite::Sprite(const Sprite &other) : Sprite(nullptr, 0, other.x, other.y, other
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite::Sprite(const void *imageData, int imageSize, int x, int y, SpriteSize size)
|
Sprite::Sprite(const void *imageData, int imageSize, int x, int y, SpriteSize size)
|
||||||
: x(x), y(y), data(imageData), imageSize(imageSize), spriteSize(size), priority(0),
|
: x(x), y(y), data(imageData), imageSize(imageSize), spriteSize(size), priority(0), isAffine(false),
|
||||||
animationDelay(0), numberOfFrames(0), beginFrame(0), currentFrame(0), animationCounter(0) {
|
animationDelay(0), numberOfFrames(0), beginFrame(0), currentFrame(0), animationCounter(0) {
|
||||||
setAttributesBasedOnSize(size);
|
setAttributesBasedOnSize(size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,11 +47,10 @@ void SpriteManager::copyOverSpriteOAMToVRAM() {
|
||||||
|
|
||||||
oam_mem[i] = sprite->oam;
|
oam_mem[i] = sprite->oam;
|
||||||
|
|
||||||
auto affine = dynamic_cast<AffineSprite*>(sprite);
|
if(sprite->isAffine) {
|
||||||
if(affine) {
|
|
||||||
// WHY warning: can't do this: obj_aff_mem[affineIndex] = *affineShadow;
|
// WHY warning: can't do this: obj_aff_mem[affineIndex] = *affineShadow;
|
||||||
// because that would override OAM also! only want to set non-overlapping affine attribs
|
// because that would override OAM also! only want to set non-overlapping affine attribs
|
||||||
|
auto affine = static_cast<AffineSprite*>(sprite);
|
||||||
affine->setTransformationMatrix(&obj_aff_mem[affineIndex]);
|
affine->setTransformationMatrix(&obj_aff_mem[affineIndex]);
|
||||||
affine->setAffineIndex(affineIndex);
|
affine->setAffineIndex(affineIndex);
|
||||||
affineIndex++;
|
affineIndex++;
|
||||||
|
|
|
@ -14,6 +14,9 @@ SET(CMAKE_EXE_LINKER_FLAGS "${BASE_CMAKE_LINK_FLAGS}")
|
||||||
SET(CMAKE_C_COMPILER gcc)
|
SET(CMAKE_C_COMPILER gcc)
|
||||||
SET(CMAKE_CXX_COMPILER g++)
|
SET(CMAKE_CXX_COMPILER g++)
|
||||||
|
|
||||||
|
# remove -03 optimization flag otherwise debugging will be annoying as hell
|
||||||
|
SET(CMAKE_CXX_FLAGS "-Wno-narrowing")
|
||||||
|
|
||||||
add_definitions(-DCODE_COMPILED_AS_PART_OF_TEST)
|
add_definitions(-DCODE_COMPILED_AS_PART_OF_TEST)
|
||||||
|
|
||||||
include_directories(${GTEST_LIBRARY}/include)
|
include_directories(${GTEST_LIBRARY}/include)
|
||||||
|
|
Loading…
Reference in New Issue