From: Holger Schemel Date: Sat, 30 Jan 1999 01:42:55 +0000 (+0100) Subject: rnd-19990130-1 X-Git-Tag: 1.3.0^2~7 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=6b83db8bee17d70c4e89dc3e3b703b7032aa5f27;p=rocksndiamonds.git rnd-19990130-1 --- diff --git a/src/editor.c b/src/editor.c index d4f68daa..82e04959 100644 --- a/src/editor.c +++ b/src/editor.c @@ -104,7 +104,7 @@ #define ED_COUNT_ELEM_SCORE_XPOS ED_SETTINGS_XPOS #define ED_COUNT_ELEM_SCORE_YPOS (14 * MINI_TILEY) #define ED_COUNT_ELEM_CONTENT_XPOS ED_SETTINGS_XPOS -#define ED_COUNT_ELEM_CONTENT_YPOS (17 * MINI_TILEY) +#define ED_COUNT_ELEM_CONTENT_YPOS (19 * MINI_TILEY) #define ED_COUNTER_YSTART (ED_SETTINGS_YPOS + 2 * TILEY) #define ED_COUNTER_YDISTANCE (3 * MINI_TILEY) @@ -118,7 +118,7 @@ /* values for element content drawing areas */ #define ED_AREA_ELEM_CONTENT_XPOS ( 2 * MINI_TILEX) -#define ED_AREA_ELEM_CONTENT_YPOS (20 * MINI_TILEY) +#define ED_AREA_ELEM_CONTENT_YPOS (22 * MINI_TILEY) /* values for random placement background drawing area */ #define ED_AREA_RANDOM_BACKGROUND_XPOS (29 * MINI_TILEX) @@ -154,9 +154,9 @@ #define ED_CHECKBUTTON_XSIZE ED_BUTTON_COUNT_XSIZE #define ED_CHECKBUTTON_YSIZE ED_BUTTON_COUNT_YSIZE #define ED_CHECKBUTTON_UNCHECKED_XPOS ED_BUTTON_MINUS_XPOS -#define ED_CHECKBUTTON_UNCHECKED_YPOS (ED_BUTTON_MINUS_YPOS + 22) #define ED_CHECKBUTTON_CHECKED_XPOS ED_BUTTON_PLUS_XPOS -#define ED_CHECKBUTTON_CHECKED_YPOS (ED_BUTTON_PLUS_YPOS + 22) +#define ED_CHECKBUTTON_YPOS (ED_BUTTON_MINUS_YPOS + 22) +#define ED_STICKYBUTTON_YPOS (ED_BUTTON_MINUS_YPOS + 88) #define GADGET_ID_NONE -1 @@ -247,11 +247,12 @@ #define GADGET_ID_RANDOM_QUANTITY 107 #define GADGET_ID_RANDOM_RESTRICTED 108 #define GADGET_ID_DOUBLE_SPEED 109 +#define GADGET_ID_STICK_ELEMENT 110 /* another drawing area for random placement */ -#define GADGET_ID_RANDOM_BACKGROUND 110 +#define GADGET_ID_RANDOM_BACKGROUND 111 -#define NUM_EDITOR_GADGETS 111 +#define NUM_EDITOR_GADGETS 112 /* radio button numbers */ #define RADIO_NR_NONE 0 @@ -268,24 +269,24 @@ #define ED_COUNTER_ID_LEVEL_TIMESCORE 6 #define ED_COUNTER_ID_LEVEL_RANDOM 7 +#define ED_NUM_COUNTERBUTTONS 8 + #define ED_COUNTER_ID_LEVEL_FIRST ED_COUNTER_ID_LEVEL_XSIZE #define ED_COUNTER_ID_LEVEL_LAST ED_COUNTER_ID_LEVEL_RANDOM -#define ED_NUM_COUNTERBUTTONS 8 - /* values for scrollbutton gadgets */ -#define ED_SCROLLBUTTON_AREA_UP 0 -#define ED_SCROLLBUTTON_AREA_DOWN 1 -#define ED_SCROLLBUTTON_AREA_LEFT 2 -#define ED_SCROLLBUTTON_AREA_RIGHT 3 -#define ED_SCROLLBUTTON_LIST_UP 4 -#define ED_SCROLLBUTTON_LIST_DOWN 5 +#define ED_SCROLLBUTTON_ID_AREA_UP 0 +#define ED_SCROLLBUTTON_ID_AREA_DOWN 1 +#define ED_SCROLLBUTTON_ID_AREA_LEFT 2 +#define ED_SCROLLBUTTON_ID_AREA_RIGHT 3 +#define ED_SCROLLBUTTON_ID_LIST_UP 4 +#define ED_SCROLLBUTTON_ID_LIST_DOWN 5 #define ED_NUM_SCROLLBUTTONS 6 /* values for scrollbar gadgets */ -#define ED_SCROLLBAR_HORIZONTAL 0 -#define ED_SCROLLBAR_VERTICAL 1 +#define ED_SCROLLBAR_ID_HORIZONTAL 0 +#define ED_SCROLLBAR_ID_VERTICAL 1 #define ED_NUM_SCROLLBARS 2 @@ -293,23 +294,30 @@ #define ED_TEXTINPUT_ID_LEVEL_NAME 0 #define ED_TEXTINPUT_ID_LEVEL_AUTHOR 1 +#define ED_NUM_TEXTINPUT 2 + #define ED_TEXTINPUT_ID_LEVEL_FIRST ED_TEXTINPUT_ID_LEVEL_NAME #define ED_TEXTINPUT_ID_LEVEL_LAST ED_TEXTINPUT_ID_LEVEL_AUTHOR -#define ED_NUM_TEXTINPUT 2 - /* values for checkbutton gadgets */ -#define ED_CHECKBUTTON_DOUBLE_SPEED 0 -#define ED_CHECKBUTTON_RANDOM_RESTRICTED 1 +#define ED_CHECKBUTTON_ID_DOUBLE_SPEED 0 +#define ED_CHECKBUTTON_ID_RANDOM_RESTRICTED 1 +#define ED_CHECKBUTTON_ID_STICK_ELEMENT 2 + +#define ED_NUM_CHECKBUTTONS 3 -#define ED_NUM_CHECKBUTTONS 2 +#define ED_CHECKBUTTON_ID_LEVEL_FIRST ED_CHECKBUTTON_ID_DOUBLE_SPEED +#define ED_CHECKBUTTON_ID_LEVEL_LAST ED_CHECKBUTTON_ID_RANDOM_RESTRICTED /* values for radiobutton gadgets */ -#define ED_RADIOBUTTON_PERCENTAGE 0 -#define ED_RADIOBUTTON_QUANTITY 1 +#define ED_RADIOBUTTON_ID_PERCENTAGE 0 +#define ED_RADIOBUTTON_ID_QUANTITY 1 #define ED_NUM_RADIOBUTTONS 2 +#define ED_RADIOBUTTON_ID_LEVEL_FIRST ED_RADIOBUTTON_ID_PERCENTAGE +#define ED_RADIOBUTTON_ID_LEVEL_LAST ED_RADIOBUTTON_ID_QUANTITY + /* values for CopyLevelToUndoBuffer() */ #define UNDO_IMMEDIATE 0 #define UNDO_ACCUMULATE 1 @@ -544,6 +552,7 @@ static int random_placement_value = 10; static int random_placement_method = RANDOM_USE_QUANTITY; static int random_placement_background_element = EL_ERDREICH; static boolean random_placement_background_restricted = FALSE; +static boolean stick_element_properties_window = FALSE; static struct { @@ -590,6 +599,12 @@ static struct GADGET_ID_RANDOM_RESTRICTED, &random_placement_background_restricted, "restrict random placement to", "set random placement restriction" + }, + { + ED_SETTINGS_XPOS, ED_COUNTER_YPOS(4), + GADGET_ID_STICK_ELEMENT, + &stick_element_properties_window, + "stick window to edit content", "stick window to edit content" } }; @@ -1530,7 +1545,7 @@ static void CreateCheckbuttonGadgets() Pixmap gd_pixmap = pix[PIX_DOOR]; struct GadgetInfo *gi; unsigned long event_mask; - int gd_x1, gd_x2, gd_x3, gd_x4, gd_y1, gd_y2; + int gd_x1, gd_x2, gd_x3, gd_x4, gd_y; boolean checked; int i; @@ -1540,8 +1555,7 @@ static void CreateCheckbuttonGadgets() gd_x2 = DOOR_GFX_PAGEX3 + ED_CHECKBUTTON_UNCHECKED_XPOS; gd_x3 = DOOR_GFX_PAGEX4 + ED_CHECKBUTTON_CHECKED_XPOS; gd_x4 = DOOR_GFX_PAGEX3 + ED_CHECKBUTTON_CHECKED_XPOS; - gd_y1 = DOOR_GFX_PAGEY1 + ED_CHECKBUTTON_UNCHECKED_YPOS; - gd_y2 = DOOR_GFX_PAGEY1 + ED_CHECKBUTTON_CHECKED_YPOS; + gd_y = DOOR_GFX_PAGEY1 + ED_CHECKBUTTON_YPOS; for (i=0; ievent.y; int lx = sx + level_xpos; int ly = sy + level_ypos; + int min_sx = 0, min_sy = 0; + int max_sx = gi->drawing.area_xsize - 1; + int max_sy = gi->drawing.area_ysize - 1; ClearEditorGadgetInfoText(); + /* make sure to stay inside drawing area boundaries */ + sx = (sx < min_sx ? min_sx : sx > max_sx ? max_sx : sx); + sy = (sy < min_sy ? min_sy : sy > max_sy ? max_sy : sy); + if (id == GADGET_ID_DRAWING_LEVEL) { if (button_status) { - int min_sx = 0, min_sy = 0; - int max_sx = gi->drawing.area_xsize - 1; - int max_sy = gi->drawing.area_ysize - 1; int min_lx = 0, min_ly = 0; int max_lx = lev_fieldx - 1, max_ly = lev_fieldy - 1; - /* make sure to stay inside drawing area boundaries */ - sx = (sx < min_sx ? min_sx : sx > max_sx ? max_sx : sx); - sy = (sy < min_sy ? min_sy : sy > max_sy ? max_sy : sy); - /* get positions inside level field */ lx = sx + level_xpos; ly = sy + level_ypos; @@ -3986,6 +4028,6 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi) "Random placement background"); else DrawTextF(INFOTEXT_XPOS - SX, INFOTEXT_YPOS - SY, FC_YELLOW, - "Cruncher %d content: %d, %d", + "Content area %d position: %d, %d", id - GADGET_ID_ELEM_CONTENT_0 + 1, sx, sy); } diff --git a/src/init.c b/src/init.c index dfbdd059..684cdb4d 100644 --- a/src/init.c +++ b/src/init.c @@ -528,6 +528,15 @@ void InitGfx() { GFX_SPIELER4_RIGHT, 4 }, { GFX_SPIELER4_PUSH_LEFT, 4 }, { GFX_SPIELER4_PUSH_RIGHT, 4 }, + { GFX_SP_MURPHY, 1 }, + { GFX_MURPHY_GO_LEFT, 3 }, + { GFX_MURPHY_GO_RIGHT, 3 }, + { GFX_MURPHY_SNAP_UP, 1 }, + { GFX_MURPHY_SNAP_DOWN, 1 }, + { GFX_MURPHY_SNAP_RIGHT, 1 }, + { GFX_MURPHY_SNAP_LEFT, 1 }, + { GFX_MURPHY_PUSH_RIGHT, 1 }, + { GFX_MURPHY_PUSH_LEFT, 1 }, { GFX_GEBLUBBER, 4 }, { GFX_DYNAMIT, 7 }, { GFX_DYNABOMB, 4 }, @@ -593,6 +602,7 @@ void InitGfx() int src_x, src_y; Pixmap src_pixmap; +#if 0 if (graphic >= GFX_START_ROCKSSCREEN && graphic <= GFX_END_ROCKSSCREEN) { @@ -620,6 +630,14 @@ void InitGfx() } else break; +#else + + int pixmap_nr; + + getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y); + src_pixmap = clipmask[pixmap_nr]; + +#endif tile_clipmask[tile] = XCreatePixmap(display, window, TILEX,TILEY, 1); diff --git a/src/main.h b/src/main.h index 900c5ed4..8f979b49 100644 --- a/src/main.h +++ b/src/main.h @@ -1047,62 +1047,73 @@ extern char *element_info[]; #define GFX_FLAMMEN_DOWN (GFX_START_ROCKSHEROES +15*HEROES_PER_LINE + 8) /* graphics from "RocksMore" */ -#define GFX_SP_EMPTY (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 0) -#define GFX_SP_ZONK (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 1) -#define GFX_SP_BASE (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 2) -#define GFX_SP_MURPHY (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 3) -#define GFX_SP_INFOTRON (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 4) -#define GFX_SP_CHIP_SINGLE (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 5) -#define GFX_SP_HARD_GRAY (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 6) -#define GFX_SP_EXIT (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 7) -#define GFX_SP_DISK_ORANGE (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 0) -#define GFX_SP_PORT1_RIGHT (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 1) -#define GFX_SP_PORT1_DOWN (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 2) -#define GFX_SP_PORT1_LEFT (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 3) -#define GFX_SP_PORT1_UP (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 4) -#define GFX_SP_PORT2_RIGHT (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 5) -#define GFX_SP_PORT2_DOWN (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 6) -#define GFX_SP_PORT2_LEFT (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 7) -#define GFX_SP_PORT2_UP (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 0) -#define GFX_SP_SNIKSNAK (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 1) -#define GFX_SP_DISK_YELLOW (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 2) -#define GFX_SP_TERMINAL (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 3) -#define GFX_SP_DISK_RED (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 4) -#define GFX_SP_PORT_Y (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 5) -#define GFX_SP_PORT_X (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 6) -#define GFX_SP_PORT_XY (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 7) -#define GFX_SP_ELECTRON (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 0) -#define GFX_SP_BUG (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 1) -#define GFX_SP_CHIP_LEFT (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 2) -#define GFX_SP_CHIP_RIGHT (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 3) -#define GFX_SP_HARD_BASE1 (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 4) -#define GFX_SP_HARD_GREEN (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 5) -#define GFX_SP_HARD_BLUE (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 6) -#define GFX_SP_HARD_RED (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 7) -#define GFX_SP_HARD_YELLOW (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 0) -#define GFX_SP_HARD_BASE2 (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 1) -#define GFX_SP_HARD_BASE3 (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 2) -#define GFX_SP_HARD_BASE4 (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 3) -#define GFX_SP_HARD_BASE5 (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 4) -#define GFX_SP_HARD_BASE6 (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 5) -#define GFX_SP_CHIP_UPPER (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 6) -#define GFX_SP_CHIP_LOWER (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 7) - -#define GFX_INVISIBLE_STEEL (GFX_START_ROCKSMORE + 5 * MORE_PER_LINE + 3) -#define GFX_UNSICHTBAR (GFX_START_ROCKSMORE + 5 * MORE_PER_LINE + 7) - -#define GFX_SP_BUG_WARNING (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE +15) -#define GFX_SP_EXPLODE_EMPTY (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 8) -#define GFX_SP_EXPLODE_INFOTRON (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 8) -#define GFX_SP_BUG_ACTIVE (GFX_START_ROCKSMORE + 6 * MORE_PER_LINE + 8) -#define GFX_SP_SNIKSNAK_LEFT (GFX_START_ROCKSMORE + 8 * MORE_PER_LINE + 8) -#define GFX_SP_SNIKSNAK_RIGHT (GFX_START_ROCKSMORE + 8 * MORE_PER_LINE +12) -#define GFX_SP_SNIKSNAK_UP (GFX_START_ROCKSMORE + 9 * MORE_PER_LINE + 8) -#define GFX_SP_SNIKSNAK_DOWN (GFX_START_ROCKSMORE + 9 * MORE_PER_LINE +12) - -#define GFX2_SP_ELECTRON (GFX_START_ROCKSMORE + 10 * MORE_PER_LINE + 8) -#define GFX2_SP_TERMINAL (GFX_START_ROCKSMORE + 11 * MORE_PER_LINE + 8) -#define GFX2_SP_TERMINAL_ACTIVE (GFX_START_ROCKSMORE + 12 * MORE_PER_LINE + 8) +#define GFX_SP_EMPTY (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 0) +#define GFX_SP_ZONK (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 1) +#define GFX_SP_BASE (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 2) +#define GFX_SP_MURPHY (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 3) +#define GFX_SP_INFOTRON (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 4) +#define GFX_SP_CHIP_SINGLE (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 5) +#define GFX_SP_HARD_GRAY (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 6) +#define GFX_SP_EXIT (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 7) +#define GFX_SP_DISK_ORANGE (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 0) +#define GFX_SP_PORT1_RIGHT (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 1) +#define GFX_SP_PORT1_DOWN (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 2) +#define GFX_SP_PORT1_LEFT (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 3) +#define GFX_SP_PORT1_UP (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 4) +#define GFX_SP_PORT2_RIGHT (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 5) +#define GFX_SP_PORT2_DOWN (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 6) +#define GFX_SP_PORT2_LEFT (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 7) +#define GFX_SP_PORT2_UP (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 0) +#define GFX_SP_SNIKSNAK (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 1) +#define GFX_SP_DISK_YELLOW (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 2) +#define GFX_SP_TERMINAL (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 3) +#define GFX_SP_DISK_RED (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 4) +#define GFX_SP_PORT_Y (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 5) +#define GFX_SP_PORT_X (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 6) +#define GFX_SP_PORT_XY (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 7) +#define GFX_SP_ELECTRON (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 0) +#define GFX_SP_BUG (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 1) +#define GFX_SP_CHIP_LEFT (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 2) +#define GFX_SP_CHIP_RIGHT (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 3) +#define GFX_SP_HARD_BASE1 (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 4) +#define GFX_SP_HARD_GREEN (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 5) +#define GFX_SP_HARD_BLUE (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 6) +#define GFX_SP_HARD_RED (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 7) +#define GFX_SP_HARD_YELLOW (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 0) +#define GFX_SP_HARD_BASE2 (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 1) +#define GFX_SP_HARD_BASE3 (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 2) +#define GFX_SP_HARD_BASE4 (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 3) +#define GFX_SP_HARD_BASE5 (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 4) +#define GFX_SP_HARD_BASE6 (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 5) +#define GFX_SP_CHIP_UPPER (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 6) +#define GFX_SP_CHIP_LOWER (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 7) + +#define GFX_INVISIBLE_STEEL (GFX_START_ROCKSMORE + 5 * MORE_PER_LINE + 3) +#define GFX_UNSICHTBAR (GFX_START_ROCKSMORE + 5 * MORE_PER_LINE + 7) + +#define GFX_MURPHY_GO_LEFT (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 8) +#define GFX_MURPHY_ANY_LEFT (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 9) +#define GFX_MURPHY_GO_RIGHT (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 11) +#define GFX_MURPHY_ANY_RIGHT (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 12) +#define GFX_MURPHY_SNAP_UP (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 14) +#define GFX_MURPHY_SNAP_DOWN (GFX_START_ROCKSMORE + 0 * MORE_PER_LINE + 15) +#define GFX_MURPHY_SNAP_RIGHT (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 8) +#define GFX_MURPHY_SNAP_LEFT (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 9) +#define GFX_MURPHY_PUSH_RIGHT (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 10) +#define GFX_MURPHY_PUSH_LEFT (GFX_START_ROCKSMORE + 1 * MORE_PER_LINE + 11) + +#define GFX_SP_BUG_WARNING (GFX_START_ROCKSMORE + 2 * MORE_PER_LINE + 15) +#define GFX_SP_EXPLODE_EMPTY (GFX_START_ROCKSMORE + 3 * MORE_PER_LINE + 8) +#define GFX_SP_EXPLODE_INFOTRON (GFX_START_ROCKSMORE + 4 * MORE_PER_LINE + 8) +#define GFX_SP_BUG_ACTIVE (GFX_START_ROCKSMORE + 6 * MORE_PER_LINE + 8) +#define GFX_SP_SNIKSNAK_LEFT (GFX_START_ROCKSMORE + 8 * MORE_PER_LINE + 8) +#define GFX_SP_SNIKSNAK_RIGHT (GFX_START_ROCKSMORE + 8 * MORE_PER_LINE + 12) +#define GFX_SP_SNIKSNAK_UP (GFX_START_ROCKSMORE + 9 * MORE_PER_LINE + 8) +#define GFX_SP_SNIKSNAK_DOWN (GFX_START_ROCKSMORE + 9 * MORE_PER_LINE + 12) + +#define GFX2_SP_ELECTRON (GFX_START_ROCKSMORE + 10 * MORE_PER_LINE + 8) +#define GFX2_SP_TERMINAL (GFX_START_ROCKSMORE + 11 * MORE_PER_LINE + 8) +#define GFX2_SP_TERMINAL_ACTIVE (GFX_START_ROCKSMORE + 12 * MORE_PER_LINE + 8) /* graphics from "RocksFont" */ #define GFX_CHAR_START (GFX_START_ROCKSFONT) diff --git a/src/tools.c b/src/tools.c index 797befef..2a8b6f17 100644 --- a/src/tools.c +++ b/src/tools.c @@ -117,9 +117,9 @@ void BackToFront() if (redraw_mask & REDRAW_ALL) { - XCopyArea(display,backbuffer,window,gc, - 0,0, WIN_XSIZE,WIN_YSIZE, - 0,0); + XCopyArea(display, backbuffer, window, gc, + 0, 0, WIN_XSIZE, WIN_YSIZE, + 0, 0); redraw_mask = 0; } @@ -127,9 +127,9 @@ void BackToFront() { if (game_status != PLAYING || redraw_mask & REDRAW_FROM_BACKBUFFER) { - XCopyArea(display,backbuffer,window,gc, - REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE, - REAL_SX,REAL_SY); + XCopyArea(display, backbuffer, window, gc, + REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, + REAL_SX, REAL_SY); } else { @@ -169,9 +169,9 @@ void BackToFront() if (redraw_mask & REDRAW_DOORS) { if (redraw_mask & REDRAW_DOOR_1) - XCopyArea(display,backbuffer,window,gc, - DX,DY, DXSIZE,DYSIZE, - DX,DY); + XCopyArea(display, backbuffer, window, gc, + DX, DY, DXSIZE, DYSIZE, + DX, DY); if (redraw_mask & REDRAW_DOOR_2) { if ((redraw_mask & REDRAW_DOOR_2) == REDRAW_DOOR_2) @@ -419,7 +419,7 @@ void DrawTextExt(Drawable d, GC gc, int x, int y, XSetClipOrigin(display, clip_gc[font_pixmap], dest_x - src_x, dest_y - src_y); - XCopyArea(display, pix[font_pixmap], drawto, clip_gc[font_pixmap], + XCopyArea(display, pix[font_pixmap], d, clip_gc[font_pixmap], 0, 0, font_width, font_height, dest_x, dest_y); } else @@ -518,17 +518,95 @@ void DrawPlayer(struct PlayerInfo *player) /* draw player himself */ - if (player->MovDir == MV_LEFT) - graphic = (player->Pushing ? GFX_SPIELER1_PUSH_LEFT : GFX_SPIELER1_LEFT); - else if (player->MovDir == MV_RIGHT) - graphic = (player->Pushing ? GFX_SPIELER1_PUSH_RIGHT : GFX_SPIELER1_RIGHT); - else if (player->MovDir == MV_UP) - graphic = GFX_SPIELER1_UP; - else /* MV_DOWN || MV_NO_MOVING */ - graphic = GFX_SPIELER1_DOWN; + if (game_emulation == EMU_SUPAPLEX) + { +#if 0 + if (player->MovDir == MV_LEFT) + graphic = + (player->Pushing ? GFX_MURPHY_PUSH_LEFT : GFX_MURPHY_LEFT); + else if (player->MovDir == MV_RIGHT) + graphic = + (player->Pushing ? GFX_MURPHY_PUSH_RIGHT : GFX_MURPHY_RIGHT); + else if (player->MovDir == MV_UP) + graphic = GFX_MURPHY_UP; + else if (player->MovDir == MV_DOWN) + graphic = GFX_MURPHY_DOWN; + else /* MV_NO_MOVING */ + graphic = GFX_SP_MURPHY; + + + /* + if (player->snapped) + graphic = GFX_SPIELER1_PUSH_LEFT; + else + graphic = GFX_SPIELER1_PUSH_RIGHT; + */ +#endif + + static last_dir = MV_LEFT; + + if (player->Pushing) + { + if (player->MovDir == MV_LEFT) + graphic = GFX_MURPHY_PUSH_LEFT; + else if (player->MovDir == MV_RIGHT) + graphic = GFX_MURPHY_PUSH_RIGHT; + else if (last_dir == MV_LEFT) + graphic = GFX_MURPHY_ANY_LEFT; + else if (last_dir == MV_RIGHT) + graphic = GFX_MURPHY_ANY_RIGHT; + else + graphic = GFX_SP_MURPHY; + } + else if (player->snapped) + { + if (player->MovDir == MV_LEFT) + graphic = GFX_MURPHY_SNAP_LEFT; + else if (player->MovDir == MV_RIGHT) + graphic = GFX_MURPHY_SNAP_RIGHT; + else if (player->MovDir == MV_UP) + graphic = GFX_MURPHY_SNAP_UP; + else if (player->MovDir == MV_DOWN) + graphic = GFX_MURPHY_SNAP_DOWN; + else + graphic = GFX_SP_MURPHY; + } + else + { + if (player->MovDir == MV_LEFT) + graphic = GFX_MURPHY_ANY_LEFT; + else if (player->MovDir == MV_RIGHT) + graphic = GFX_MURPHY_ANY_RIGHT; + else if (last_dir == MV_LEFT) + graphic = GFX_MURPHY_ANY_LEFT; + else if (last_dir == MV_RIGHT) + graphic = GFX_MURPHY_ANY_RIGHT; + else + graphic = GFX_SP_MURPHY; + } - graphic += player->index_nr * 3*HEROES_PER_LINE; - graphic += player->Frame; + if (player->MovDir == MV_LEFT || player->MovDir == MV_RIGHT) + last_dir = player->MovDir; + + if (!player->Pushing && !player->snapped && player->MovDir != MV_NO_MOVING) + graphic -= player->Frame % 2; + } + else + { + if (player->MovDir == MV_LEFT) + graphic = + (player->Pushing ? GFX_SPIELER1_PUSH_LEFT : GFX_SPIELER1_LEFT); + else if (player->MovDir == MV_RIGHT) + graphic = + (player->Pushing ? GFX_SPIELER1_PUSH_RIGHT : GFX_SPIELER1_RIGHT); + else if (player->MovDir == MV_UP) + graphic = GFX_SPIELER1_UP; + else /* MV_DOWN || MV_NO_MOVING */ + graphic = GFX_SPIELER1_DOWN; + + graphic += player->index_nr * 3 * HEROES_PER_LINE; + graphic += player->Frame; + } if (player->GfxPos) { @@ -664,6 +742,45 @@ void DrawGraphicAnimationThruMask(int x, int y, int graphic, DrawGraphicAnimationExt(x, y, graphic, frames, delay, mode, USE_MASKING); } +void getGraphicSource(int graphic, int *pixmap_nr, int *x, int *y) +{ + if (graphic >= GFX_START_ROCKSSCREEN && graphic <= GFX_END_ROCKSSCREEN) + { + graphic -= GFX_START_ROCKSSCREEN; + *pixmap_nr = PIX_BACK; + *x = SX + (graphic % GFX_PER_LINE) * TILEX; + *y = SY + (graphic / GFX_PER_LINE) * TILEY; + } + else if (graphic >= GFX_START_ROCKSMORE && graphic <= GFX_END_ROCKSMORE) + { + graphic -= GFX_START_ROCKSMORE; + *pixmap_nr = PIX_MORE; + *x = (graphic % MORE_PER_LINE) * TILEX; + *y = (graphic / MORE_PER_LINE) * TILEY; + } + else if (graphic >= GFX_START_ROCKSHEROES && graphic <= GFX_END_ROCKSHEROES) + { + graphic -= GFX_START_ROCKSHEROES; + *pixmap_nr = PIX_HEROES; + *x = (graphic % HEROES_PER_LINE) * TILEX; + *y = (graphic / HEROES_PER_LINE) * TILEY; + } + else if (graphic >= GFX_START_ROCKSFONT && graphic <= GFX_END_ROCKSFONT) + { + graphic -= GFX_START_ROCKSFONT; + *pixmap_nr = PIX_BIGFONT; + *x = (graphic % FONT_CHARS_PER_LINE) * TILEX; + *y = ((graphic / FONT_CHARS_PER_LINE) * TILEY + + FC_SPECIAL1 * FONT_LINES_PER_FONT * TILEY); + } + else + { + *pixmap_nr = PIX_MORE; + *x = 0; + *y = 0; + } +} + void DrawGraphic(int x, int y, int graphic) { #if DEBUG @@ -681,6 +798,18 @@ void DrawGraphic(int x, int y, int graphic) void DrawGraphicExt(Drawable d, GC gc, int x, int y, int graphic) { + +#if 1 + + int pixmap_nr; + int src_x, src_y; + + getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y); + XCopyArea(display, pix[pixmap_nr], d, gc, + src_x, src_y, TILEX, TILEY, x, y); + +#else + if (graphic >= GFX_START_ROCKSSCREEN && graphic <= GFX_END_ROCKSSCREEN) { graphic -= GFX_START_ROCKSSCREEN; @@ -716,6 +845,9 @@ void DrawGraphicExt(Drawable d, GC gc, int x, int y, int graphic) } else XFillRectangle(display, d, gc, x, y, TILEX, TILEY); + +#endif + } void DrawGraphicThruMask(int x, int y, int graphic) @@ -735,6 +867,21 @@ void DrawGraphicThruMask(int x, int y, int graphic) void DrawGraphicThruMaskExt(Drawable d, int dest_x, int dest_y, int graphic) { + +#if 1 + + int tile = graphic; + int pixmap_nr; + int src_x, src_y; + Pixmap src_pixmap; + GC drawing_gc; + + getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y); + src_pixmap = pix[pixmap_nr]; + drawing_gc = clip_gc[pixmap_nr]; + +#else + int src_x, src_y; int tile = graphic; Pixmap src_pixmap; @@ -770,11 +917,14 @@ void DrawGraphicThruMaskExt(Drawable d, int dest_x, int dest_y, int graphic) return; } +#endif + + if (tile_clipmask[tile] != None) { XSetClipMask(display, tile_clip_gc, tile_clipmask[tile]); XSetClipOrigin(display, tile_clip_gc, dest_x, dest_y); - XCopyArea(display, src_pixmap, drawto_field, tile_clip_gc, + XCopyArea(display, src_pixmap, d, tile_clip_gc, src_x, src_y, TILEX, TILEY, dest_x, dest_y); } else @@ -784,7 +934,7 @@ void DrawGraphicThruMaskExt(Drawable d, int dest_x, int dest_y, int graphic) #endif XSetClipOrigin(display, drawing_gc, dest_x-src_x, dest_y-src_y); - XCopyArea(display, src_pixmap, drawto_field, drawing_gc, + XCopyArea(display, src_pixmap, d, drawing_gc, src_x, src_y, TILEX, TILEY, dest_x, dest_y); } } @@ -817,7 +967,7 @@ void getMiniGraphicSource(int graphic, Pixmap *pixmap, int *x, int *y) *pixmap = pix[PIX_SMALLFONT]; *x = (graphic % FONT_CHARS_PER_LINE) * FONT4_XSIZE; *y = ((graphic / FONT_CHARS_PER_LINE) * FONT4_YSIZE + - FC_SPECIAL2 * FONT2_YSIZE * FONT_LINES_PER_FONT); + FC_SPECIAL2 * FONT2_YSIZE * FONT_LINES_PER_FONT); } else { @@ -829,6 +979,18 @@ void getMiniGraphicSource(int graphic, Pixmap *pixmap, int *x, int *y) void DrawMiniGraphicExt(Drawable d, GC gc, int x, int y, int graphic) { + +#if 1 + + Pixmap pixmap; + int src_x, src_y; + + getMiniGraphicSource(graphic, &pixmap, &src_x, &src_y); + XCopyArea(display, pixmap, d, gc, + src_x, src_y, MINI_TILEX, MINI_TILEY, x, y); + +#else + if (graphic >= GFX_START_ROCKSSCREEN && graphic <= GFX_END_ROCKSSCREEN) { graphic -= GFX_START_ROCKSSCREEN; @@ -856,6 +1018,9 @@ void DrawMiniGraphicExt(Drawable d, GC gc, int x, int y, int graphic) } else XFillRectangle(display, d, gc, x, y, MINI_TILEX, MINI_TILEY); + +#endif + } void DrawGraphicShifted(int x,int y, int dx,int dy, int graphic, diff --git a/src/tools.h b/src/tools.h index 5b694d48..7878a283 100644 --- a/src/tools.h +++ b/src/tools.h @@ -72,6 +72,7 @@ void DrawPlayer(struct PlayerInfo *); void DrawGraphicAnimationExt(int, int, int, int, int, int, int); void DrawGraphicAnimation(int, int, int, int, int, int); void DrawGraphicAnimationThruMask(int, int, int, int, int, int); +void getGraphicSource(int, int *, int *, int *); void DrawGraphic(int, int, int); void DrawGraphicExt(Drawable, GC, int, int, int); void DrawGraphicThruMask(int, int, int);