-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathballblob.c
More file actions
73 lines (61 loc) · 2.4 KB
/
ballblob.c
File metadata and controls
73 lines (61 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <stdio.h>
#include <stdlib.h>
#include <exec/types.h>
#include <proto/graphics.h>
#include <proto/exec.h>
#include <graphics/displayinfo.h>
#include <graphics/gfxbase.h>
#include <graphics/videocontrol.h>
#include <dos/dos.h>
#include "starlight/starlight.h"
#include "ballblob.h"
#include "main.h"
struct BitMap* ballBlob = NULL;
struct BitMap* ballBlobScreen = NULL;
void initBallBlob(void){
UWORD colortable0[] = { BLACK, RED, GREEN, BLUE, BLACK, RED, GREEN, BLUE };
BYTE i = 0;
writeLog("\n== Initialize View: BallBlob ==\n");
//Load Boingball Blob Sprite and its Colors
ballBlob = loadBlob("img/ball_207_207_3.RAW", VIEW_BALLBLOB_DEPTH,
VIEW_BALLBLOB_BALL_WIDTH, VIEW_BALLBLOB_BALL_HEIGHT);
if(ballBlob == NULL){
writeLog("Error: Payload BallBlob, could not load ball blob\n");
exitStarlight();
exitBallBlob();
exit(RETURN_ERROR);
}
writeLogFS("Ballblob BitMap: BytesPerRow: %d, Rows: %d, Flags: %d, pad: %d\n",
ballBlob->BytesPerRow, ballBlob->Rows, ballBlob->Flags,
ballBlob->pad);
loadColorMap("img/ball_207_207_3.CMAP", colortable0, VIEW_BALLBLOB_COLORS);
//Create View and ViewExtra memory structures
createNewView();
//Create Bitmap for ViewPort
ballBlobScreen = createBitMap(VIEW_BALLBLOB_DEPTH, VIEW_BALLBLOB_WIDTH,
VIEW_BALLBLOB_HEIGHT);
for(i=0; i<VIEW_BALLBLOB_DEPTH; i++){
BltClear(ballBlobScreen->Planes[i],
(ballBlobScreen->BytesPerRow) * (ballBlobScreen->Rows), 1);
}
writeLogFS("Screen BitMap: BytesPerRow: %d, Rows: %d, Flags: %d, pad: %d\n",
ballBlobScreen->BytesPerRow, ballBlobScreen->Rows,
ballBlobScreen->Flags, ballBlobScreen->pad);
//Add previously created BitMap to ViewPort so its shown on Screen
addViewPort(ballBlobScreen, NULL, colortable0, VIEW_BALLBLOB_COLORS, FALSE,
0, 0, VIEW_BALLBLOB_WIDTH, VIEW_BALLBLOB_HEIGHT, 0, 0);
//Copy Ball into ViewPort
BltBitMap(ballBlob, 0, 0, ballBlobScreen, 60, 20, VIEW_BALLBLOB_BALL_WIDTH,
VIEW_BALLBLOB_BALL_HEIGHT, 0xC0, 0xff, 0);
//Make View visible
startView();
}
// just a wrapper because we do not have business logic here
// just quit on mouse click
BOOL executeBallBlob(void){
return ((BOOL) !mouseClick());
}
void exitBallBlob(void){
cleanBitMap(ballBlobScreen);
cleanBitMap(ballBlob);
}