it works!
This commit is contained in:
parent
eee99e8d7e
commit
f86ecfb349
4
bun.c
4
bun.c
@ -64,7 +64,7 @@ void bun_offRightSide(
|
|||||||
|
|
||||||
custom.bltafwm = 0xffff;
|
custom.bltafwm = 0xffff;
|
||||||
bltalwm = 0x0000;
|
bltalwm = 0x0000;
|
||||||
for (i = 0; i < 15 - shift; ++i) {
|
for (i = 0; i <= 15 - shift; ++i) {
|
||||||
bltalwm += (1 << (15 - i));
|
bltalwm += (1 << (15 - i));
|
||||||
}
|
}
|
||||||
custom.bltalwm = bltalwm;
|
custom.bltalwm = bltalwm;
|
||||||
@ -114,7 +114,7 @@ void bun_offLeftSide(
|
|||||||
|
|
||||||
custom.bltafwm = 0xffff;
|
custom.bltafwm = 0xffff;
|
||||||
bltalwm = 0x0000;
|
bltalwm = 0x0000;
|
||||||
for (i = 0; i < 15 - shift; ++i) {
|
for (i = 0; i <= 15 - shift; ++i) {
|
||||||
bltalwm += (1 << i);
|
bltalwm += (1 << i);
|
||||||
}
|
}
|
||||||
custom.bltalwm = bltalwm;
|
custom.bltalwm = bltalwm;
|
||||||
|
75
main.c
75
main.c
@ -37,9 +37,49 @@ void *copperlistSpritePointers[8];
|
|||||||
uint16_t custom_color = (uint16_t)offsetof(Custom, color);
|
uint16_t custom_color = (uint16_t)offsetof(Custom, color);
|
||||||
uint16_t custom_sprite = (uint16_t)offsetof(Custom, sprpt);
|
uint16_t custom_sprite = (uint16_t)offsetof(Custom, sprpt);
|
||||||
|
|
||||||
|
#define BUN_COUNT (12)
|
||||||
|
#define BUN_SPEED (2)
|
||||||
|
|
||||||
|
short int bunPositions[BUN_COUNT][2];
|
||||||
|
|
||||||
|
#define BUN_MAX_RANGE (31 + 320 - 1)
|
||||||
|
|
||||||
|
#define BUN_HORIZ_DISTANCE_BETWEEN_BUNS ((BUN_MAX_RANGE / 4) - COOL_BUN_WIDTH)
|
||||||
|
#define BUN_TOTAL_HORIZ_DISTANCE (BUN_HORIZ_DISTANCE_BETWEEN_BUNS + COOL_BUN_WIDTH)
|
||||||
|
#define BUN_ROW_START (10)
|
||||||
|
#define BUN_VERT_DISTANCE_BETWEEN_BUNS (20)
|
||||||
|
#define BUN_TOTAL_VERT_DISTANCE (COOL_BUN_HEIGHT + BUN_VERT_DISTANCE_BETWEEN_BUNS)
|
||||||
|
#define FRAME_MAX (BUN_TOTAL_HORIZ_DISTANCE / BUN_SPEED)
|
||||||
|
|
||||||
|
void calculateBunPositions(
|
||||||
|
uint16_t frame,
|
||||||
|
short int bunPositions[BUN_COUNT][2],
|
||||||
|
struct ScreenSetup *screenSetup
|
||||||
|
) {
|
||||||
|
int x, y, row, column, current;
|
||||||
|
|
||||||
|
frame %= FRAME_MAX;
|
||||||
|
|
||||||
|
for (current = 0; current < BUN_COUNT; ++current) {
|
||||||
|
row = current / 4;
|
||||||
|
column = current % 4;
|
||||||
|
|
||||||
|
x = column * BUN_TOTAL_HORIZ_DISTANCE + frame * BUN_SPEED;
|
||||||
|
if (row == 1) {
|
||||||
|
//x += BUN_TOTAL_HORIZ_DISTANCE / 2;
|
||||||
|
}
|
||||||
|
x %= BUN_MAX_RANGE;
|
||||||
|
x -= 31;
|
||||||
|
y = BUN_ROW_START + row * BUN_TOTAL_VERT_DISTANCE;
|
||||||
|
|
||||||
|
bunPositions[current][0] = x;
|
||||||
|
bunPositions[current][1] = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
uint16_t *copperlist, *currentCopperlist, result;
|
uint16_t *copperlist, *currentCopperlist, result;
|
||||||
int i, x, y, plane;
|
int i, j, x, y, plane;
|
||||||
int blitShiftRight, memoryXOffset, blitWidth;
|
int blitShiftRight, memoryXOffset, blitWidth;
|
||||||
uint32_t wow, wow2;
|
uint32_t wow, wow2;
|
||||||
|
|
||||||
@ -98,7 +138,9 @@ int main(void) {
|
|||||||
|
|
||||||
endCopperlist(currentCopperlist);
|
endCopperlist(currentCopperlist);
|
||||||
|
|
||||||
for (i = -31; i < screenSetup.width - 1; i += 3) {
|
for (i = 0; i < FRAME_MAX * 6; ++i) {
|
||||||
|
calculateBunPositions(i, bunPositions, &screenSetup);
|
||||||
|
|
||||||
swapCurrentScreenBuffer(&screenSetup, ¤tScreen);
|
swapCurrentScreenBuffer(&screenSetup, ¤tScreen);
|
||||||
|
|
||||||
for (plane = 0; plane < 2; ++plane) {
|
for (plane = 0; plane < 2; ++plane) {
|
||||||
@ -107,19 +149,20 @@ int main(void) {
|
|||||||
custom.bltadat = 0x0000;
|
custom.bltadat = 0x0000;
|
||||||
custom.bltafwm = 0xffff;
|
custom.bltafwm = 0xffff;
|
||||||
custom.bltalwm = 0xffff;
|
custom.bltalwm = 0xffff;
|
||||||
custom.bltdpt = currentScreen.planes[plane] +
|
custom.bltdpt = currentScreen.planes[plane];
|
||||||
(45 * screenSetup.byteWidth);
|
|
||||||
custom.bltdmod = 0;
|
custom.bltdmod = 0;
|
||||||
custom.bltsize = screenSetup.byteWidth / 2 + (COOL_BUN_HEIGHT << 6);
|
custom.bltsize = screenSetup.byteWidth / 2 + (screenSetup.height << 6);
|
||||||
WaitBlit();
|
WaitBlit();
|
||||||
}
|
}
|
||||||
|
|
||||||
renderBun(
|
for (j = 0; j < BUN_COUNT; ++j) {
|
||||||
i,
|
renderBun(
|
||||||
45,
|
bunPositions[j][0],
|
||||||
&screenSetup,
|
bunPositions[j][1],
|
||||||
¤tScreen
|
&screenSetup,
|
||||||
);
|
¤tScreen
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
updateDisplayInCopperList(
|
updateDisplayInCopperList(
|
||||||
&screenSetup,
|
&screenSetup,
|
||||||
@ -130,9 +173,11 @@ int main(void) {
|
|||||||
WaitTOF();
|
WaitTOF();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 100; ++i) {
|
/*
|
||||||
WaitBOF(200);
|
for (i = 0; i < 200; ++i) {
|
||||||
|
WaitTOF();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
giveBackSystem();
|
giveBackSystem();
|
||||||
|
|
||||||
@ -142,5 +187,9 @@ int main(void) {
|
|||||||
|
|
||||||
teardownBun();
|
teardownBun();
|
||||||
|
|
||||||
|
for (i = 0; i < BUN_COUNT; ++i) {
|
||||||
|
printf("%d %d\n", bunPositions[i][0], bunPositions[i][1]);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user