Speicherschwein, Speicherschwein... wer kann das was ein Speicherschwein kann?
This commit is contained in:
parent
0c65727a52
commit
108cf1321d
|
@ -39,6 +39,13 @@ void borg_breakout_game()
|
||||||
|
|
||||||
void borg_breakout(uint8_t demomode)
|
void borg_breakout(uint8_t demomode)
|
||||||
{
|
{
|
||||||
|
// save pointer address just in case that the breakout demo was previously
|
||||||
|
// running so it can reentered
|
||||||
|
char (*old_playfield)[NUM_COLS][NUM_ROWS] = playfield;
|
||||||
|
// new playing field
|
||||||
|
char my_playfield[NUM_COLS][NUM_ROWS];
|
||||||
|
playfield = &my_playfield;
|
||||||
|
|
||||||
uint8_t ignorescore_buffer = ignorescore;
|
uint8_t ignorescore_buffer = ignorescore;
|
||||||
uint16_t cycles = DEMO_CYCLES;
|
uint16_t cycles = DEMO_CYCLES;
|
||||||
uint8_t level;
|
uint8_t level;
|
||||||
|
@ -99,4 +106,6 @@ void borg_breakout(uint8_t demomode)
|
||||||
}
|
}
|
||||||
|
|
||||||
ignorescore = ignorescore_buffer;
|
ignorescore = ignorescore_buffer;
|
||||||
|
// restore saved pointer
|
||||||
|
playfield = old_playfield;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "playfield.h"
|
#include "playfield.h"
|
||||||
static enum game_field_t playfield[NUM_COLS][NUM_ROWS];
|
char (*playfield)[NUM_COLS][NUM_ROWS];
|
||||||
|
|
||||||
void playfield_set (uint8_t in_x, uint8_t in_y, enum game_field_t in_field)
|
void playfield_set (uint8_t in_x, uint8_t in_y, enum game_field_t in_field)
|
||||||
{
|
{
|
||||||
|
@ -25,15 +25,15 @@ void playfield_set (uint8_t in_x, uint8_t in_y, enum game_field_t in_field)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
playfield[in_x][in_y] = in_field;
|
(*playfield)[in_x][in_y] = in_field;
|
||||||
}
|
}
|
||||||
|
|
||||||
void brick_damage (uint8_t in_x, uint8_t in_y)
|
void brick_damage (uint8_t in_x, uint8_t in_y)
|
||||||
{
|
{
|
||||||
if (playfield[in_x][in_y] >= bs || playfield[in_x][in_y] == 0)
|
if ((*playfield)[in_x][in_y] >= bs || (*playfield)[in_x][in_y] == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
playfield[in_x][in_y] -= 1;
|
(*playfield)[in_x][in_y] -= 1;
|
||||||
score_add (1);
|
score_add (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ uint8_t check_bounce (int8_t in_x, int8_t in_y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* collisions with real objects */
|
/* collisions with real objects */
|
||||||
switch (playfield[abs(in_x)][abs(in_y)])
|
switch ((*playfield)[abs(in_x)][abs(in_y)])
|
||||||
{
|
{
|
||||||
case b2:
|
case b2:
|
||||||
case b3:
|
case b3:
|
||||||
|
@ -119,7 +119,7 @@ void playfield_draw ()
|
||||||
{
|
{
|
||||||
for (y=0;y<NUM_COLS;y++)
|
for (y=0;y<NUM_COLS;y++)
|
||||||
{
|
{
|
||||||
draw_single_field (x,y, playfield[x][y]);
|
draw_single_field (x,y, (*playfield)[x][y]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ enum game_field_t
|
||||||
rb /* rebound */
|
rb /* rebound */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern char (*playfield)[NUM_COLS][NUM_ROWS];
|
||||||
|
|
||||||
/* @description draw the current field
|
/* @description draw the current field
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue