Minor fixes

This commit is contained in:
schmelczerandras 2020-04-20 17:33:58 +02:00
parent 756f5b5eb8
commit 3da2a7a7c2
5 changed files with 16 additions and 6 deletions

View file

@ -42,6 +42,9 @@ void setDisplayContrast(uint8_t value);
// Clear buffer and wasIntersection bit
void startIntersectionTest();
// Make the display go to / return from sleep
void turnDisplayOnOff(bool shouldBeOn);
// Return wasIntersection bit
bool endIntersectionTest();

View file

@ -14,10 +14,11 @@
#define REPEAT_CODE 1
typedef void (*OnCommandReceived)(uint8_t);
typedef void (*OnReceiveStarted)();
// Initialize infra and call onCommandReceived with every received byte
// Call onCommandReceived with the argument REPEAT_CODE if a repeat code
// has been received.
void initializeInfra(OnCommandReceived onCommandReceived);
void initializeInfra(OnCommandReceived onCommandReceived, OnReceiveStarted onReceiveStarted);
#endif

View file

@ -7,6 +7,9 @@
// FrameFunction gets previousFrameTime (in milliseconds) as argument
typedef bool (*FrameFunction)(uint8_t);
// Shut down the machine
void powerOff();
// Call function every frameLengthInMilliseconds while it returns true
void startFrameLoop(FrameFunction function, uint8_t frameLengthInMilliseconds);

View file

@ -62,9 +62,9 @@ void handleOn() {
static bool frameFunction(uint8_t previousFrameTime) {
if (state.isSleeping) {
/*if (state.isSleeping) {
powerOff();
} else {
} else {*/
disableWritingEEPROM();
tickObjects(previousFrameTime);
handleCommands();
@ -74,7 +74,7 @@ static bool frameFunction(uint8_t previousFrameTime) {
enableWritingEEPROM();
saveGame();
return handleDeathAnimation();
}
//}
return true;
}

View file

@ -134,7 +134,7 @@ Action getPossibleActionFromSpaceship(Object* astronaut) {
return noAction;
}
void tick(Object* spaceship, uint8_t previousFrameTime) {
void tick(Object* spaceship, __attribute__((unused)) uint8_t previousFrameTime) {
flickerState = !flickerState;
if (spaceship->as.spaceship.healthLoss >= MAX_HEALTH) {
spaceship->as.spaceship.healthLoss++;
@ -191,7 +191,10 @@ static inline void drawExhaust(Rectangle compositingWindow) {
static inline void drawGlitches() {
for (uint8_t i = 0; i < spaceshipObject->as.spaceship.healthLoss - MAX_HEALTH; i++) {
Rectangle r = translateRectangle((Rectangle){(Vec2){getRandomNumber() % SPACESHIP_SIZE.x, getRandomNumber() % SPACESHIP_SIZE.y}, (Vec2){8, 8}}, spaceshipObject->position);
Rectangle r = translateRectangle(
(Rectangle){(Vec2){getRandomNumber() % SPACESHIP_SIZE.x, getRandomNumber() % SPACESHIP_SIZE.y}, (Vec2){8, 8}},
spaceshipObject->position
);
if (areIntersecting(r, WINDOW)) {
drawFilledRectangle(r, 0xFF, 0x00);
}