Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
#include <drivers/glib.h>
#include "include/draw.h"
#include "include/simcity.h"
#include "include/states.h"
#include "include/misc.h"
#define rgb rgb16
void draw_tl
(int x
,int y
,DWORD img
[SH
][SW
]) {
int i
,j
;
for(i
=0;i
<SH
;i
++) {
for(j
=0;j
<SW
;j
++) {
//if(img[i][j]==tl_bg) continue;
grx_plot
(x
+j
,y
+i
,img
[i
][j
]);
}
}
}
void draw_scenario
() {
char msg1
[35];
int color
,fbg
;
color
=rgb
(235,235,235);
fbg
=rgb
(198,198,206);
grx_putimage
(0,0,799,599,clrscr
);
bold_rect
(0,0,300,100,0,0,(255-120));
bold_rect
(656,102,799,599,(254-120),(255-120),0);
grx_putimage
(MAPX
,MAPY
,MAPX
+W
-1,MAPY
+H
-1,street
);
bold_rect
(0,102,655,599,0,0,(255-120));
bold_rect
(301,0,799,100,(255-120),0,0);
grx_box
(308,8,791,92,fbg
);
grx_text
("Alt + x , Enter -> Stop SIMCITY",10,10,color
,black
);
sprintf(msg1
,"c -> Create a new hard car (max %d)",MAX_CAR
);
grx_text
(msg1
,10,20,color
,black
);
sprintf(msg1
,"s -> Create a new soft car (max %d)",MAX_CAR
);
grx_text
(msg1
,10,30,color
,black
);
grx_text
("k -> Kill oldest car",10,40,color
,black
);
grx_text
("r -> Refresh screen",10,50,color
,black
);
grx_text
("d -> Toggle sensor",10,60,color
,black
);
grx_text
("road spd",CAMX
,CAMY
-10,gray
,black
);
grx_text
("Simcity is presented by",450,20,black
,fbg
);
grx_text
(" Aguzzi Marco",450,50,rgb
(200,140,5),fbg
);
grx_text
(" &",450,60,black
,fbg
);
grx_text
(" Ferrari Fabio",450,70,rgb
(120,40,226),fbg
);
drawFaces
(390,15,0);
drawFaces
(640,15,1);
}
void bold_rect
(WORD x1
,WORD y1
,WORD x2
,WORD y2
,BYTE r
,BYTE g
,BYTE b
) {
int c1
,c2
,c3
,c4
;
if(r
>=255) r
=255;
if(g
>=255) g
=255;
if(b
>=255) b
=255;
c1
=rgb
(r
,g
,b
);
c2
=rgb
((r
+40),(g
+40),(b
+40));
c3
=rgb
((r
+80),(g
+80),(b
+80));
c4
=rgb
((r
+120),(g
+120),(b
+120));
grx_rect
(x1
,y1
,x2
,y2
,c1
);
grx_rect
((x1
+1),(y1
+1),(x2
-1),(y2
-1),c2
);
grx_rect
((x1
+2),(y1
+2),(x2
-2),(y2
-2),c3
);
grx_rect
((x1
+3),(y1
+3),(x2
-3),(y2
-3),c4
);
grx_rect
((x1
+4),(y1
+4),(x2
-4),(y2
-4),c4
);
grx_rect
((x1
+5),(y1
+5),(x2
-5),(y2
-5),c3
);
grx_rect
((x1
+6),(y1
+6),(x2
-6),(y2
-6),c2
);
grx_rect
((x1
+7),(y1
+7),(x2
-7),(y2
-7),c1
);
}
void drawCar
(int x
,int y
,int angle
,char mode
) {
int i
,j
;
for (i
=0;i
<ROW
;i
++) {
for (j
=0;j
<COL
;j
++) {
if (macchine
[i
][j
][returnCarIndex
(angle
)]!=0) {
grx_plot
(x
+j
-15,y
+i
-15,macchine
[i
][j
][returnCarIndex
(angle
)]*mode
);
}
}
}
}
void get_images
() {
grx_getimage
(0,0,799,599,clrscr
);
drawStreet
(0,0);
grx_getimage
(0,0,639,479,street
);
grx_putimage
(0,0,799,599,clrscr
);
grx_getimage
(0,0,31,31,clrcam
);
drawSprites
(15,15,GAUGE
,DRAW
);
grx_getimage
(0,0,29,29,gauge_img
);
grx_putimage
(0,0,30,30,clrcam
);
drawSprites
(15,15,ARR_OFF
,DRAW
);
grx_getimage
(0,0,29,29,arrow
[1]);
grx_putimage
(0,0,30,30,clrcam
);
drawSprites
(15,15,ARR_SX
,DRAW
);
grx_getimage
(0,0,29,29,arrow
[2]);
grx_putimage
(0,0,30,30,clrcam
);
drawSprites
(15,15,ARR_DX
,DRAW
);
grx_getimage
(0,0,29,29,arrow
[0]);
grx_putimage
(0,0,30,30,clrcam
);
drawSprites
(15,15,GAUGE_ROTTO
,DRAW
);
grx_getimage
(0,0,29,29,brk_gauge
);
grx_putimage
(0,0,30,30,clrcam
);
}
void drawStreet
(int x
,int y
) {
int i
,j
;
for (i
=0;i
<H
;i
++) {
for (j
=0;j
<W
;j
++) {
grx_plot
(x
+j
,y
+i
,strada
[i
][j
]);
}
}
}
void drawSprites
(int x
,int y
,char number
,char mode
) {
int i
,j
;
for (i
=0;i
<ROW
;i
++) {
for (j
=0;j
<COL
;j
++) {
if (sprites
[i
][j
][(int)number
]!=0) {
grx_plot
(x
+j
-15,y
+i
-15,sprites
[i
][j
][(int)number
]*mode
);
}
}
}
}
void drawFaces
(int x
,int y
,short face
) {
int i
,j
;
for (i
=0;i
<74;i
++) {
for (j
=0;j
<47;j
++) {
grx_plot
(x
+j
,y
+i
,faces
[face
][i
][j
]);
}
}
}