Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added new floor graphics

  • Loading branch information...
commit be7945881056eda035322e069cd6724970eeb07f 1 parent 0f78c93
@stransky authored
View
3  TODO
@@ -10,7 +10,6 @@
- fix console position
- windows - add MSVC dll
-- generate shadows to floor automatically when level is loaded
- New backgrounds (from B2)
- better animations - explosions and so
@@ -41,7 +40,7 @@ Game:
- uvolnovani surfacu z pameti!!
- flag SPRITE_NO_BACK - pod tim to spritem se nic nekresli
- - skontrolovat to pretaceni animaci - jestli se to dobre uvolnuje a tak...
+ - zkontrolovat to pretaceni animaci - jestli se to dobre uvolnuje a tak...
- problem -> pokud smazu tu animaci v enginu a ma zaznam v levelu -> jak se to ten level dozvi?
-> pridat udalost -> smaz animaci!!! -> pro level
View
92 data/GameData/items.dat
@@ -99,7 +99,7 @@ PP_BOTTOM_JAMB_Z P_WALL SPRITE_STATIC 0 0 0 1 FIRST_CLASSIC_LEVEL + 80 0 0
#
# position function flag minus_x plus_x x_cor y_cor sprite animation when_run_anim so_1 so_2
-P_GROUND P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_CLASSIC_LEVEL + 81 0 0 0 0
+P_GROUND P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_CLASSIC_LEVEL + 81 0 0 0 0
P_GROUND+1 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_CLASSIC_LEVEL + 92 0 0 0 0
P_GROUND+2 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_CLASSIC_LEVEL + 83 0 0 0 0
P_GROUND+3 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_CLASSIC_LEVEL + 82 0 0 0 0
@@ -111,6 +111,96 @@ P_GROUND+7 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_CYBER_LEVE
P_GROUND+8 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_CYBER_LEVEL + 25 0 0 0 0
P_GROUND+9 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_CYBER_LEVEL + 28 0 0 0 0
+P_GROUND+10 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 0 0 0 0 0
+P_GROUND+11 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 1 0 0 0 0
+P_GROUND+12 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 2 0 0 0 0
+P_GROUND+13 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 3 0 0 0 0
+P_GROUND+14 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 4 0 0 0 0
+
+P_GROUND+15 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 5 0 0 0 0
+P_GROUND+16 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 6 0 0 0 0
+P_GROUND+17 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 7 0 0 0 0
+P_GROUND+18 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 8 0 0 0 0
+P_GROUND+19 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 9 0 0 0 0
+
+P_GROUND+20 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 10 0 0 0 0
+P_GROUND+21 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 11 0 0 0 0
+P_GROUND+22 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 12 0 0 0 0
+P_GROUND+23 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 13 0 0 0 0
+P_GROUND+24 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 14 0 0 0 0
+
+P_GROUND+25 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 15 0 0 0 0
+P_GROUND+26 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 16 0 0 0 0
+P_GROUND+27 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 17 0 0 0 0
+P_GROUND+28 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 18 0 0 0 0
+P_GROUND+29 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 19 0 0 0 0
+
+P_GROUND+30 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 20 0 0 0 0
+P_GROUND+31 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 21 0 0 0 0
+P_GROUND+32 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 22 0 0 0 0
+P_GROUND+33 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 23 0 0 0 0
+P_GROUND+34 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_IRON + 24 0 0 0 0
+
+P_GROUND+35 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_SNOW + 0 0 0 0 0
+P_GROUND+36 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_SNOW + 1 0 0 0 0
+P_GROUND+37 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_SNOW + 2 0 0 0 0
+P_GROUND+38 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_SNOW + 3 0 0 0 0
+P_GROUND+39 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_SNOW + 4 0 0 0 0
+
+P_GROUND+40 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 0 0 0 0 0
+P_GROUND+41 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 1 0 0 0 0
+P_GROUND+42 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 2 0 0 0 0
+P_GROUND+43 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 3 0 0 0 0
+P_GROUND+44 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 4 0 0 0 0
+
+P_GROUND+45 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 5 0 0 0 0
+P_GROUND+46 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 6 0 0 0 0
+P_GROUND+47 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 7 0 0 0 0
+P_GROUND+48 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 8 0 0 0 0
+P_GROUND+49 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 9 0 0 0 0
+
+P_GROUND+50 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 10 0 0 0 0
+P_GROUND+51 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 11 0 0 0 0
+P_GROUND+52 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 12 0 0 0 0
+P_GROUND+53 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 13 0 0 0 0
+P_GROUND+54 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 14 0 0 0 0
+
+P_GROUND+55 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 15 0 0 0 0
+P_GROUND+56 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 16 0 0 0 0
+P_GROUND+57 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 17 0 0 0 0
+P_GROUND+58 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 18 0 0 0 0
+P_GROUND+59 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_DANGER + 19 0 0 0 0
+
+P_GROUND+60 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 0 0 0 0 0
+P_GROUND+61 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 1 0 0 0 0
+P_GROUND+62 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 2 0 0 0 0
+P_GROUND+63 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 3 0 0 0 0
+P_GROUND+64 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 4 0 0 0 0
+
+P_GROUND+65 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 5 0 0 0 0
+P_GROUND+66 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 6 0 0 0 0
+P_GROUND+67 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 7 0 0 0 0
+P_GROUND+68 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 8 0 0 0 0
+P_GROUND+69 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 9 0 0 0 0
+
+P_GROUND+70 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 10 0 0 0 0
+P_GROUND+71 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 11 0 0 0 0
+P_GROUND+72 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 12 0 0 0 0
+P_GROUND+73 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 13 0 0 0 0
+P_GROUND+74 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_ELEVATORS + 14 0 0 0 0
+
+P_GROUND+75 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_GRAY + 0 0 0 0 0
+P_GROUND+76 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_GRAY + 1 0 0 0 0
+P_GROUND+77 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_GRAY + 2 0 0 0 0
+P_GROUND+78 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_GRAY + 3 0 0 0 0
+P_GROUND+79 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_GRAY + 4 0 0 0 0
+
+P_GROUND+80 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_GRAY + 5 0 0 0 0
+P_GROUND+81 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_GRAY + 6 0 0 0 0
+P_GROUND+82 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_GRAY + 7 0 0 0 0
+P_GROUND+83 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_GRAY + 8 0 0 0 0
+P_GROUND+84 P_GROUND SPRITE_STATIC|SPRITE_NO_ROTATE 0 0 0 0 FIRST_FLOOR_GRAY + 9 0 0 0 0
+
#
# Players
#
View
BIN  data/Graphics/floor_iron_1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1  data/Graphics/floor_iron_1.spr
@@ -0,0 +1 @@
+s 0 0 40 40 0
View
BIN  data/Graphics/floor_iron_2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1  data/Graphics/floor_iron_2.spr
@@ -0,0 +1 @@
+s 0 0 40 40 0
View
BIN  data/Graphics/floor_iron_3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1  data/Graphics/floor_iron_3.spr
@@ -0,0 +1 @@
+s 0 0 40 40 0
View
BIN  data/Graphics/floor_iron_4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1  data/Graphics/floor_iron_4.spr
@@ -0,0 +1 @@
+s 0 0 40 40 0
View
BIN  data/Graphics/floor_iron_5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1  data/Graphics/floor_iron_5.spr
@@ -0,0 +1 @@
+s 0 0 40 40 0
View
BIN  data/Graphics/floor_snow.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1  data/Graphics/floor_snow.spr
@@ -0,0 +1 @@
+s 0 0 40 40 0
View
62 src/2d_graph.cpp
@@ -31,6 +31,8 @@
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
+#include <math.h>
+
#include "berusky.h"
@@ -344,6 +346,66 @@ void surface::blit(tpos sx, tpos sy, tpos dx, tpos dy, class surface *p_dst, tpo
SDL_BlitSurface(p_surf, &src_rec, p_dst->p_surf, &dst_rec);
}
+void surface::blend(tpos sx, tpos sy, tpos dx, tpos dy, tcolor color, BLEND_OP operation)
+{
+ // Lock the surface
+ if(SDL_MUSTLOCK(p_surf) ) {
+ if(SDL_LockSurface(p_surf) < 0 ) {
+ berror("Can't lock surface: %s\n", SDL_GetError());
+ }
+ }
+
+ assert(sx+dx <= width_get());
+ assert(sy+dy <= height_get());
+
+ int x,y;
+ int width = sx+dx;
+ int height = sy+dy;
+ RGB color_rgb;
+ RGB pixel;
+
+ byte r,g,b;
+ color_unmap(color, &r, &g, &b);
+ color_rgb.r = r;
+ color_rgb.g = g;
+ color_rgb.b = b;
+
+ // Adjust original pixels
+ for(y = sy; y < height; y++) {
+ for(x = sx; x < width; x++) {
+ if(getpixel(p_surf, x, y, &pixel)) {
+ switch(operation) {
+ case BLEND_SET:
+ pixel = color_rgb;
+ break;
+ case BLEND_ADD:
+ pixel.r += color_rgb.r;
+ pixel.g += color_rgb.g;
+ pixel.b += color_rgb.b;
+ pixel.norm();
+ break;
+ case BLEND_SUB:
+ pixel.r -= color_rgb.r;
+ pixel.g -= color_rgb.g;
+ pixel.b -= color_rgb.b;
+
+ int rn = floor(((float)rand()/RAND_MAX)*10);
+ pixel.r -= rn;
+ pixel.g -= rn;
+ pixel.b -= rn;
+ pixel.norm();
+ break;
+ }
+ putpixel(p_surf, x, y, pixel);
+ }
+ }
+ }
+
+ if(SDL_MUSTLOCK(p_surf)) {
+ SDL_UnlockSurface(p_surf);
+ }
+}
+
// Double scale from the source surface
// (src_x, src_y) are coordinates in source surface
// (width, height) is a size of scaled rectangle in source surface
View
24 src/2d_graph.h
@@ -106,6 +106,17 @@ typedef class rgb {
public:
+ void norm(void)
+ {
+ if(r < 0) r = 0;
+ if(g < 0) g = 0;
+ if(b < 0) b = 0;
+
+ if(r > 255) r = 255;
+ if(g > 255) g = 255;
+ if(b > 255) b = 255;
+ }
+
rgb(void) {};
rgb(int r_, int g_, int b_)
@@ -123,6 +134,13 @@ void rect_adjust(RECT *p_r, RECT *p_s);
// -------------------------------------------------------
// the surface class
// -------------------------------------------------------
+typedef enum {
+
+ BLEND_SET = 0,
+ BLEND_ADD,
+ BLEND_SUB,
+
+} BLEND_OP;
typedef class surface
{
@@ -168,11 +186,17 @@ typedef class surface
void fill(tpos x, tpos y, tpos dx, tpos dy, tcolor color);
void blit(class surface *p_dst, tpos tx, tpos ty);
void blit(tpos sx, tpos sy, tpos dx, tpos dy, class surface *p_dst, tpos tx, tpos ty);
+ void blend(tpos sx, tpos sy, tpos dx, tpos dy, tcolor color, BLEND_OP operation);
tcolor color_map(Uint8 r, Uint8 g, Uint8 b)
{
return(SDL_MapRGB(p_surf->format, r, g, b));
}
+
+ void color_unmap(tcolor color, Uint8 *r, Uint8 *g, Uint8 *b)
+ {
+ SDL_GetRGB(color, p_surf->format, r, g, b);
+ }
bool is_loaded(void)
{
View
2  src/berusky_gui.cpp
@@ -540,7 +540,7 @@ void game_gui::menu_settings(MENU_STATE state, size_ptr data, size_ptr data1)
if(DOUBLE_SIZE) {
p_grf->draw(menu_background_get(),0,0);
}
-
+
p_grf->draw(MENU_SPRIT_LOGO,(GAME_RESOLUTION_X-width)/2,LOGO_START);
#define MENU_X_START (GAME_RESOLUTION_X/2 - 220)
View
2  src/data_parser_tables.cpp
@@ -146,6 +146,8 @@ POSITION_TABLE_ITEM parser_table[] =
{"FIRST_WALL_SNOW", FIRST_WALL_SNOW},
{"FIRST_WALL_SWAMP", FIRST_WALL_SWAMP},
{"FIRST_WALL_WOOD", FIRST_WALL_WOOD},
+ {"FIRST_FLOOR_IRON", FIRST_FLOOR_IRON},
+ {"FIRST_FLOOR_SNOW", FIRST_FLOOR_SNOW},
{"FIRST_OTHER", FIRST_OTHER},
{"FIRST_PLAYER", FIRST_PLAYER},
View
11 src/defines.h
@@ -152,9 +152,6 @@
#define FIRST_BOX_DARK 2150
#define FIRST_BOX_PAPER 2200
#define FIRST_BOX_SNOW 2250
-#define FIRST_FLOOR_DANGER 2300
-#define FIRST_FLOOR_ELEVATORS 2350
-#define FIRST_FLOOR_GRAY 2400
#define FIRST_LIGHT_BOX 2450
#define FIRST_TNT_BRIGHT 2500
#define FIRST_TNT_DARK 2550
@@ -171,6 +168,14 @@
#define FIRST_WALL_SWAMP 3100
#define FIRST_WALL_WOOD 3150
#define SPRITE_BLACK 3200
+#define FIRST_FLOOR_DANGER_SRC 3250
+#define FIRST_FLOOR_DANGER 3260
+#define FIRST_FLOOR_ELEVATORS_SRC 3300
+#define FIRST_FLOOR_ELEVATORS 3310
+#define FIRST_FLOOR_GRAY_SRC 3350
+#define FIRST_FLOOR_GRAY 3360
+#define FIRST_FLOOR_IRON 3400
+#define FIRST_FLOOR_SNOW 3500
#define ROT_SHIFT 10000
View
2  src/editor.cpp
@@ -1386,7 +1386,7 @@ void editor_gui::editor_shader(tpos sx, tpos sy, tpos dx, tpos dy)
for(x = sx; x < sx+dx; x++) {
for(y = sy; y < sy+dy; y++) {
- if(IN_LEVEL(x-1,y) && IS_WALL(x-1,y) &&
+ if(IN_LEVEL(x-1,y) && IS_WALL(x-1,y) &&
IN_LEVEL(x, y-1) && IS_WALL(x, y-1)) {
// ####
// ##@@
View
151 src/main.cpp
@@ -40,6 +40,8 @@
#include "main.h"
#include "editor.h"
+void graphics_generate(void);
+
/* Time loop - grabbed from SDL documentation */
#define TICK_INTERVAL (1000 / GAME_FPS)
@@ -465,9 +467,6 @@ bool graphics_game_load(DIR_LIST *p_dir)
i += p_grf->sprite_insert("box_dark1.spr", FIRST_BOX_DARK);
i += p_grf->sprite_insert("box_paper1.spr", FIRST_BOX_PAPER);
i += p_grf->sprite_insert("box_snow1.spr", FIRST_BOX_SNOW);
- i += p_grf->sprite_insert("floor_danger1.spr", FIRST_FLOOR_DANGER);
- i += p_grf->sprite_insert("floor_elevators1.spr", FIRST_FLOOR_ELEVATORS);
- i += p_grf->sprite_insert("floor_gray1.spr", FIRST_FLOOR_GRAY);
i += p_grf->sprite_insert("light_box1.spr", FIRST_LIGHT_BOX);
i += p_grf->sprite_insert("tnt_bright1.spr", FIRST_TNT_BRIGHT);
i += p_grf->sprite_insert("tnt_dark1.spr", FIRST_TNT_DARK);
@@ -483,6 +482,17 @@ bool graphics_game_load(DIR_LIST *p_dir)
i += p_grf->sprite_insert("wall_snow1.spr", FIRST_WALL_SNOW);
i += p_grf->sprite_insert("wall_swamp1.spr", FIRST_WALL_SWAMP);
i += p_grf->sprite_insert("wall_wood1.spr", FIRST_WALL_WOOD);
+
+ i += p_grf->sprite_insert("floor_danger1.spr", FIRST_FLOOR_DANGER_SRC);
+ i += p_grf->sprite_insert("floor_elevators1.spr", FIRST_FLOOR_ELEVATORS_SRC);
+ i += p_grf->sprite_insert("floor_gray1.spr", FIRST_FLOOR_GRAY_SRC);
+
+ i += p_grf->sprite_insert("floor_iron_1.spr", FIRST_FLOOR_IRON);
+ i += p_grf->sprite_insert("floor_iron_2.spr", FIRST_FLOOR_IRON+5);
+ i += p_grf->sprite_insert("floor_iron_3.spr", FIRST_FLOOR_IRON+10);
+ i += p_grf->sprite_insert("floor_iron_4.spr", FIRST_FLOOR_IRON+15);
+ i += p_grf->sprite_insert("floor_iron_5.spr", FIRST_FLOOR_IRON+20);
+ i += p_grf->sprite_insert("floor_snow.spr", FIRST_FLOOR_SNOW);
}
if(!i) {
@@ -490,10 +500,6 @@ bool graphics_game_load(DIR_LIST *p_dir)
}
bprintf(_("%d sprites loaded..."), i);
- // Create black sprite for blending
- p_grf->sprite_copy(SPRITE_BLACK, FIRST_CLASSIC_LEVEL+57, TRUE);
- SDL_Surface *p_surf = ((p_grf->sprite_get(SPRITE_BLACK))->surf_get())->surf_get();
- SDL_SetAlpha(p_surf, SDL_SRCALPHA, 150);
return(i > 0);
}
@@ -580,6 +586,8 @@ bool graphics_menu_load(DIR_LIST *p_dir)
}
bprintf(_("%d sprites loaded..."), i);
+ graphics_generate();
+
return((bool)i);
}
@@ -626,3 +634,132 @@ int background_num(DIR_LIST *p_dir)
return(j);
}
+
+/*
+ // ####
+ // ##@@
+ CHANGE_FLOOR(x,y,0);
+ // ##
+ // @@
+ CHANGE_FLOOR(x,y,3);
+ //
+ // ##@@
+ CHANGE_FLOOR(x,y,2);
+ // ##
+ // @@
+ CHANGE_FLOOR(x,y,1);
+ //
+ // @@
+ CHANGE_FLOOR(x,y,4);
+*/
+// TODO -> randomize the shadow
+void graphics_generate_floor(spr_handle spr, int type)
+{
+ SURFACE *p_surf = (p_grf->sprite_get(spr))->surf_get();
+ tcolor color = p_surf->color_map(30, 30, 30);
+
+ switch(type) {
+ case 0:
+ {
+ p_surf->blend(0, 0, 12, p_surf->height_get(), color, BLEND_SUB);
+ p_surf->blend(12, 0, p_surf->width_get()-12, 14, color, BLEND_SUB);
+ }
+ break;
+ case 1:
+ {
+ SURFACE *p_surf = (p_grf->sprite_get(spr))->surf_get();
+ p_surf->blend(0, 0, 12, 14, color, BLEND_SUB);
+ }
+ break;
+ case 2:
+ {
+ SURFACE *p_surf = (p_grf->sprite_get(spr))->surf_get();
+ p_surf->blend(0, 0, 12, p_surf->height_get(), color, BLEND_SUB);
+ }
+ break;
+ case 3:
+ {
+ SURFACE *p_surf = (p_grf->sprite_get(spr))->surf_get();
+ p_surf->blend(0, 0, p_surf->width_get(), 14, color, BLEND_SUB);
+ }
+ break;
+ case 4: // no action
+ break;
+ default:
+ break;
+ }
+}
+
+// Regenerate rest of graphics
+void graphics_generate(void)
+{
+ // Create black sprite for blending
+ p_grf->sprite_copy(SPRITE_BLACK, FIRST_CLASSIC_LEVEL+57, TRUE);
+ SDL_Surface *p_surf = ((p_grf->sprite_get(SPRITE_BLACK))->surf_get())->surf_get();
+ SDL_SetAlpha(p_surf, SDL_SRCALPHA, 150);
+
+ int i;
+
+ // Generate floor graphics
+ for(i = 1; i < 5; i++) {
+ p_grf->sprite_copy(FIRST_FLOOR_IRON+i, FIRST_FLOOR_IRON, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_IRON+i, i);
+ }
+ graphics_generate_floor(FIRST_FLOOR_IRON, 0);
+
+ for(i = 1; i < 5; i++) {
+ p_grf->sprite_copy(FIRST_FLOOR_IRON+5+i, FIRST_FLOOR_IRON+5, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_IRON+5+i, i);
+ }
+ graphics_generate_floor(FIRST_FLOOR_IRON+5, 0);
+
+ for(i = 1; i < 5; i++) {
+ p_grf->sprite_copy(FIRST_FLOOR_IRON+10+i, FIRST_FLOOR_IRON+10, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_IRON+10+i, i);
+ }
+ graphics_generate_floor(FIRST_FLOOR_IRON+10, 0);
+
+ for(i = 1; i < 5; i++) {
+ p_grf->sprite_copy(FIRST_FLOOR_IRON+15+i, FIRST_FLOOR_IRON+15, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_IRON+15+i, i);
+ }
+ graphics_generate_floor(FIRST_FLOOR_IRON+15, 0);
+
+ for(i = 1; i < 5; i++) {
+ p_grf->sprite_copy(FIRST_FLOOR_IRON+20+i, FIRST_FLOOR_IRON+20, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_IRON+20+i, i);
+ }
+ graphics_generate_floor(FIRST_FLOOR_IRON+20, 0);
+
+ for(i = 1; i < 5; i++) {
+ p_grf->sprite_copy(FIRST_FLOOR_SNOW+i, FIRST_FLOOR_SNOW, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_SNOW+i, i);
+ }
+ graphics_generate_floor(FIRST_FLOOR_SNOW, 0);
+
+ for(i = 0; i < 5; i++) {
+ // 4 sprites
+ p_grf->sprite_copy(FIRST_FLOOR_DANGER+i, FIRST_FLOOR_DANGER_SRC, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_DANGER+i, i);
+ p_grf->sprite_copy(FIRST_FLOOR_DANGER+5+i, FIRST_FLOOR_DANGER_SRC+1, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_DANGER+5+i, i);
+ p_grf->sprite_copy(FIRST_FLOOR_DANGER+10+i, FIRST_FLOOR_DANGER_SRC+2, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_DANGER+10+i, i);
+ p_grf->sprite_copy(FIRST_FLOOR_DANGER+15+i, FIRST_FLOOR_DANGER_SRC+3, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_DANGER+15+i, i);
+
+ // 3 sprites
+ p_grf->sprite_copy(FIRST_FLOOR_ELEVATORS+i, FIRST_FLOOR_ELEVATORS_SRC, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_ELEVATORS+i, i);
+ p_grf->sprite_copy(FIRST_FLOOR_ELEVATORS+5+i, FIRST_FLOOR_ELEVATORS_SRC+1, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_ELEVATORS+5+i, i);
+ p_grf->sprite_copy(FIRST_FLOOR_ELEVATORS+10+i, FIRST_FLOOR_ELEVATORS_SRC+2, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_ELEVATORS+10+i, i);
+
+ // 2 sprites
+ p_grf->sprite_copy(FIRST_FLOOR_GRAY+i, FIRST_FLOOR_GRAY_SRC, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_GRAY+i, i);
+ p_grf->sprite_copy(FIRST_FLOOR_GRAY+5+i, FIRST_FLOOR_GRAY_SRC+1, TRUE);
+ graphics_generate_floor(FIRST_FLOOR_GRAY+5+i, i);
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.