… | |
… | |
33 | typedef signed char int8_t; |
33 | typedef signed char int8_t; |
34 | typedef signed short int16_t; |
34 | typedef signed short int16_t; |
35 | typedef signed int int32_t; |
35 | typedef signed int int32_t; |
36 | #endif |
36 | #endif |
37 | |
37 | |
|
|
38 | #include "glext.h" |
|
|
39 | |
38 | #define FOW_DARKNESS 32 |
40 | #define FOW_DARKNESS 32 |
39 | |
41 | |
40 | #define MAP_EXTEND_X 32 |
42 | #define MAP_EXTEND_X 32 |
41 | #define MAP_EXTEND_Y 512 |
43 | #define MAP_EXTEND_Y 512 |
42 | |
44 | |
… | |
… | |
237 | break; |
239 | break; |
238 | |
240 | |
239 | row->col[x - row->c0].darkness = -1; |
241 | row->col[x - row->c0].darkness = -1; |
240 | } |
242 | } |
241 | } |
243 | } |
|
|
244 | } |
|
|
245 | |
|
|
246 | static void |
|
|
247 | music_finished () |
|
|
248 | { |
|
|
249 | SDL_UserEvent ev; |
|
|
250 | |
|
|
251 | ev.type = SDL_USEREVENT; |
|
|
252 | ev.code = 0; |
|
|
253 | ev.data1 = 0; |
|
|
254 | ev.data2 = 0; |
|
|
255 | |
|
|
256 | SDL_PushEvent ((SDL_Event *)&ev); |
242 | } |
257 | } |
243 | |
258 | |
244 | MODULE = CFClient PACKAGE = CFClient |
259 | MODULE = CFClient PACKAGE = CFClient |
245 | |
260 | |
246 | PROTOTYPES: ENABLE |
261 | PROTOTYPES: ENABLE |
… | |
… | |
463 | } |
478 | } |
464 | } |
479 | } |
465 | |
480 | |
466 | int |
481 | int |
467 | Mix_OpenAudio (int frequency = 22050, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 512) |
482 | Mix_OpenAudio (int frequency = 22050, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 512) |
|
|
483 | POSTCALL: |
|
|
484 | Mix_HookMusicFinished (music_finished); |
468 | |
485 | |
469 | void |
486 | void |
470 | Mix_CloseAudio () |
487 | Mix_CloseAudio () |
471 | |
488 | |
472 | int |
489 | int |
… | |
… | |
933 | cell->darkness = -1; |
950 | cell->darkness = -1; |
934 | } |
951 | } |
935 | } |
952 | } |
936 | |
953 | |
937 | SV * |
954 | SV * |
938 | mapmap (CFClient::Map self, int w, int h) |
955 | mapmap (CFClient::Map self, int x0, int y0, int w, int h) |
939 | CODE: |
956 | CODE: |
940 | { |
957 | { |
941 | int x0, x1, x; |
958 | int x1, x; |
942 | int y0, y1, y; |
959 | int y1, y; |
943 | int z; |
960 | int z; |
944 | SV *map_sv = newSV (w * h * sizeof (uint32_t)); |
961 | SV *map_sv = newSV (w * h * sizeof (uint32_t)); |
945 | uint32_t *map = (uint32_t *)SvPVX (map_sv); |
962 | uint32_t *map = (uint32_t *)SvPVX (map_sv); |
946 | |
963 | |
947 | SvPOK_only (map_sv); |
964 | SvPOK_only (map_sv); |
948 | SvCUR_set (map_sv, w * h * sizeof (uint32_t)); |
965 | SvCUR_set (map_sv, w * h * sizeof (uint32_t)); |
949 | |
966 | |
950 | x0 = self->x - w / 2; x1 = x0 + w; |
967 | x0 += self->x; x1 = x0 + w; |
951 | y0 = self->y - h / 2; y1 = y0 + h; |
968 | y0 += self->y; y1 = y0 + h; |
952 | |
969 | |
953 | for (y = y0; y < y1; y++) |
970 | for (y = y0; y < y1; y++) |
954 | { |
971 | { |
955 | maprow *row = 0 <= y && y < self->rows |
972 | maprow *row = 0 <= y && y < self->rows |
956 | ? self->row + y |
973 | ? self->row + y |
… | |
… | |
1096 | *data++ = 0; /* version 0 format */ |
1113 | *data++ = 0; /* version 0 format */ |
1097 | *data++ = w >> 8; *data++ = w; |
1114 | *data++ = w >> 8; *data++ = w; |
1098 | *data++ = h >> 8; *data++ = h; |
1115 | *data++ = h >> 8; *data++ = h; |
1099 | |
1116 | |
1100 | // we need to do this 'cause we don't keep an absolute coord system for rows |
1117 | // we need to do this 'cause we don't keep an absolute coord system for rows |
1101 | // TODO: treat rows as we treat |
1118 | // TODO: treat rows as we treat columns |
1102 | map_get_row (self, y0 + self->y - self->oy);//D |
1119 | map_get_row (self, y0 + self->y - self->oy);//D |
1103 | map_get_row (self, y0 + self->y - self->oy + h - 1);//D |
1120 | map_get_row (self, y0 + self->y - self->oy + h - 1);//D |
1104 | |
1121 | |
1105 | x0 += self->x - self->ox; |
1122 | x0 += self->x - self->ox; |
1106 | y0 += self->y - self->oy; |
1123 | y0 += self->y - self->oy; |
… | |
… | |
1170 | |
1187 | |
1171 | w = *data++ << 8; w |= *data++; |
1188 | w = *data++ << 8; w |= *data++; |
1172 | h = *data++ << 8; h |= *data++; |
1189 | h = *data++ << 8; h |= *data++; |
1173 | |
1190 | |
1174 | // we need to do this 'cause we don't keep an absolute coord system for rows |
1191 | // we need to do this 'cause we don't keep an absolute coord system for rows |
1175 | // TODO: treat rows as we treat |
1192 | // TODO: treat rows as we treat columns |
1176 | map_get_row (self, y0 + self->y - self->oy);//D |
1193 | map_get_row (self, y0 + self->y - self->oy);//D |
1177 | map_get_row (self, y0 + self->y - self->oy + h - 1);//D |
1194 | map_get_row (self, y0 + self->y - self->oy + h - 1);//D |
1178 | |
1195 | |
1179 | x0 += self->x - self->ox; |
1196 | x0 += self->x - self->ox; |
1180 | y0 += self->y - self->oy; |
1197 | y0 += self->y - self->oy; |
… | |
… | |
1308 | const_iv (GL_TEXTURE_WRAP_T), |
1325 | const_iv (GL_TEXTURE_WRAP_T), |
1309 | const_iv (GL_CLAMP), |
1326 | const_iv (GL_CLAMP), |
1310 | const_iv (GL_REPEAT), |
1327 | const_iv (GL_REPEAT), |
1311 | const_iv (GL_NEAREST), |
1328 | const_iv (GL_NEAREST), |
1312 | const_iv (GL_LINEAR), |
1329 | const_iv (GL_LINEAR), |
|
|
1330 | const_iv (GL_NEAREST_MIPMAP_NEAREST), |
|
|
1331 | const_iv (GL_LINEAR_MIPMAP_NEAREST), |
|
|
1332 | const_iv (GL_NEAREST_MIPMAP_LINEAR), |
|
|
1333 | const_iv (GL_LINEAR_MIPMAP_LINEAR), |
|
|
1334 | const_iv (GL_GENERATE_MIPMAP), |
|
|
1335 | const_iv (GL_LINEAR), |
1313 | const_iv (GL_MODULATE), |
1336 | const_iv (GL_MODULATE), |
1314 | const_iv (GL_REPLACE), |
1337 | const_iv (GL_REPLACE), |
1315 | const_iv (GL_COLOR_BUFFER_BIT), |
1338 | const_iv (GL_COLOR_BUFFER_BIT), |
1316 | const_iv (GL_PROJECTION), |
1339 | const_iv (GL_PROJECTION), |
1317 | const_iv (GL_MODELVIEW), |
1340 | const_iv (GL_MODELVIEW), |
… | |
… | |
1319 | const_iv (GL_CONVOLUTION_2D), |
1342 | const_iv (GL_CONVOLUTION_2D), |
1320 | const_iv (GL_CONVOLUTION_BORDER_MODE), |
1343 | const_iv (GL_CONVOLUTION_BORDER_MODE), |
1321 | const_iv (GL_CONSTANT_BORDER), |
1344 | const_iv (GL_CONSTANT_BORDER), |
1322 | const_iv (GL_LINES), |
1345 | const_iv (GL_LINES), |
1323 | const_iv (GL_QUADS), |
1346 | const_iv (GL_QUADS), |
|
|
1347 | const_iv (GL_LINE_LOOP), |
1324 | const_iv (GL_PERSPECTIVE_CORRECTION_HINT), |
1348 | const_iv (GL_PERSPECTIVE_CORRECTION_HINT), |
1325 | const_iv (GL_FASTEST), |
1349 | const_iv (GL_FASTEST), |
1326 | # undef const_iv |
1350 | # undef const_iv |
1327 | }; |
1351 | }; |
1328 | |
1352 | |