redraw_mask |= REDRAW_ALL;
}
+void ClickOnGadget(struct GadgetInfo *gi)
+{
+ /* simulate releasing mouse button over last gadget, if still pressed */
+ if (button_status)
+ HandleGadgets(-1, -1, 0);
+
+ /* simulate pressing mouse button over specified gadget */
+ HandleGadgets(gi->x, gi->y, 1);
+
+ /* simulate releasing mouse button over specified gadget */
+ HandleGadgets(gi->x, gi->y, 0);
+}
+
void MapGadget(struct GadgetInfo *gi)
{
if (gi == NULL)
void HandleGadgets(int mx, int my, int button)
{
- static struct GadgetInfo *gi = NULL;
+ static struct GadgetInfo *last_gi = NULL;
static unsigned long pressed_delay = 0;
- struct GadgetInfo *new_gi;
+ struct GadgetInfo *new_gi, *gi;
boolean gadget_pressed;
boolean gadget_pressed_repeated;
boolean gadget_moving;
if (gadget_list_first_entry == NULL)
return;
- new_gi = getGadgetInfoFromMousePosition(mx,my);
+ new_gi = getGadgetInfoFromMousePosition(mx, my);
gadget_pressed =
- (button != 0 && gi == NULL && new_gi != NULL && !motion_status);
+ (button != 0 && last_gi == NULL && new_gi != NULL && !motion_status);
gadget_pressed_repeated =
- (button != 0 && gi != NULL && new_gi == gi);
+ (button != 0 && last_gi != NULL && new_gi == last_gi);
gadget_moving =
- (button != 0 && gi != NULL && new_gi == gi && motion_status);
+ (button != 0 && last_gi != NULL && new_gi == last_gi && motion_status);
gadget_moving_off_borders =
- (button != 0 && gi != NULL && new_gi != gi && motion_status);
+ (button != 0 && last_gi != NULL && new_gi != last_gi && motion_status);
gadget_released =
- (button == 0 && gi != NULL && new_gi == gi);
+ (button == 0 && last_gi != NULL && new_gi == last_gi);
gadget_released_off_borders =
- (button == 0 && gi != NULL && new_gi != gi);
+ (button == 0 && last_gi != NULL && new_gi != last_gi);
if (gadget_pressed)
- gi = new_gi;
+ last_gi = new_gi;
+
+ gi = last_gi;
+
+ if (button == 0)
+ last_gi = NULL;
if (gi)
{
gi->event_mask & GD_EVENT_OFF_BORDERS)
gi->callback(gi);
}
-
- if (button == 0)
- gi = NULL;
}
struct GadgetInfo *CreateGadget(int, ...);
void FreeGadget(struct GadgetInfo *);
+void ClickOnGadget(struct GadgetInfo *);
+
void MapGadget(struct GadgetInfo *);
void UnmapGadget(struct GadgetInfo *);
#define ED_CTRL_ID_RANDOM_PLACEMENT 12
#define ED_CTRL_ID_BRUSH 13
#define ED_CTRL_ID_WRAP_DOWN 14
-#define ED_CTRL_ID_UNUSED2 15
+#define ED_CTRL_ID_PICK_ELEMENT 15
#define ED_CTRL_ID_UNDO 16
#define ED_CTRL_ID_INFO 17
#define ED_CTRL_ID_SAVE 18
static boolean level_editor_gadgets_created = FALSE;
static int drawing_function = ED_CTRL_ID_SINGLE_ITEMS;
+static int last_drawing_function = ED_CTRL_ID_SINGLE_ITEMS;
static int properties_element = 0;
static short ElementContent[MAX_ELEMCONT][3][3];
id == ED_CTRL_ID_RECTANGLE ||
id == ED_CTRL_ID_FILLED_BOX ||
id == ED_CTRL_ID_FLOOD_FILL ||
- id == ED_CTRL_ID_BRUSH)
+ id == ED_CTRL_ID_BRUSH ||
+ id == ED_CTRL_ID_PICK_ELEMENT)
{
button_type = GD_TYPE_RADIO_BUTTON;
radio_button_nr = 1;
level_ypos = -1;
}
+static void PickDrawingElement(int button, int element)
+{
+ if (button < 1 || button > 3)
+ return;
+
+ if (button == 1)
+ {
+ new_element1 = element;
+ DrawMiniGraphicExt(drawto, gc,
+ DX + ED_WIN_MB_LEFT_XPOS,
+ DY + ED_WIN_MB_LEFT_YPOS,
+ el2gfx(new_element1));
+ }
+ else if (button == 2)
+ {
+ new_element2 = element;
+ DrawMiniGraphicExt(drawto, gc,
+ DX + ED_WIN_MB_MIDDLE_XPOS,
+ DY + ED_WIN_MB_MIDDLE_YPOS,
+ el2gfx(new_element2));
+ }
+ else
+ {
+ new_element3 = element;
+ DrawMiniGraphicExt(drawto, gc,
+ DX + ED_WIN_MB_RIGHT_XPOS,
+ DY + ED_WIN_MB_RIGHT_YPOS,
+ el2gfx(new_element3));
+ }
+
+ redraw_mask |= REDRAW_DOOR_1;
+}
+
void LevelEd(int mx, int my, int button)
{
static int last_button = 0;
else
new_element = EL_LEERRAUM;
- if (last_button==1)
- new_element1 = new_element;
- else if (last_button==2)
- new_element2 = new_element;
- else if (last_button==3)
- new_element3 = new_element;
-
- DrawMiniGraphicExt(drawto,gc,
- DX+ED_WIN_MB_LEFT_XPOS,
- DY+ED_WIN_MB_LEFT_YPOS,
- el2gfx(new_element1));
- DrawMiniGraphicExt(drawto,gc,
- DX+ED_WIN_MB_MIDDLE_XPOS,
- DY+ED_WIN_MB_MIDDLE_YPOS,
- el2gfx(new_element2));
- DrawMiniGraphicExt(drawto,gc,
- DX+ED_WIN_MB_RIGHT_XPOS,
- DY+ED_WIN_MB_RIGHT_YPOS,
- el2gfx(new_element3));
- redraw_mask |= REDRAW_DOOR_1;
+ PickDrawingElement(last_button, new_element);
if (!HAS_CONTENT(properties_element))
{
}
break;
+ case ED_CTRL_ID_PICK_ELEMENT:
+ if (button_press_event)
+ PickDrawingElement(button, Feld[lx][ly]);
+ if (button_release_event)
+ ClickOnGadget(level_editor_gadget[last_drawing_function]);
+ break;
+
default:
break;
}
case ED_CTRL_ID_FILLED_BOX:
case ED_CTRL_ID_FLOOD_FILL:
case ED_CTRL_ID_BRUSH:
+ case ED_CTRL_ID_PICK_ELEMENT:
+ last_drawing_function = drawing_function;
drawing_function = id;
break;
#define TAPE_PERMS LEVEL_PERMS
#define SETUP_PERMS LEVEL_PERMS
+/* sort priorities of level series (also used as level series classes) */
+#define LEVELCLASS_TUTORIAL_START 10
+#define LEVELCLASS_TUTORIAL_END 99
+#define LEVELCLASS_CLASSICS_START 100
+#define LEVELCLASS_CLASSICS_END 199
+#define LEVELCLASS_CONTRIBUTION_START 200
+#define LEVELCLASS_CONTRIBUTION_END 299
+#define LEVELCLASS_USER_START 300
+#define LEVELCLASS_USER_END 399
+#define LEVELCLASS_UNDEFINED 999
+
static void SaveUserLevelInfo(); /* for 'InitUserLevelDir()' */
static char *getSetupLine(char *, int); /* for 'SaveUserLevelInfo()' */
level.time = 10;
#endif
- if (file_version == FILE_VERSION_1_0)
+ if (file_version == FILE_VERSION_1_0 &&
+ leveldir[leveldir_nr].sort_priority >= LEVELCLASS_CONTRIBUTION_START &&
+ leveldir[leveldir_nr].sort_priority <= LEVELCLASS_CONTRIBUTION_END)
{
Error(ERR_WARN, "level file '%s' has version number 1.0", filename);
Error(ERR_WARN, "using high speed movement for player");
/* level directory info */
#define LEVELINFO_TOKEN_NAME 29
#define LEVELINFO_TOKEN_LEVELS 30
-#define LEVELINFO_TOKEN_SORT_PRIORITY 31
-#define LEVELINFO_TOKEN_READONLY 32
+#define LEVELINFO_TOKEN_FIRST_LEVEL 31
+#define LEVELINFO_TOKEN_SORT_PRIORITY 32
+#define LEVELINFO_TOKEN_READONLY 33
#define FIRST_GLOBAL_SETUP_TOKEN SETUP_TOKEN_PLAYER_NAME
#define LAST_GLOBAL_SETUP_TOKEN SETUP_TOKEN_TEAM_MODE
/* level directory info */
{ TYPE_STRING, &ldi.name, "name" },
{ TYPE_INTEGER, &ldi.levels, "levels" },
+ { TYPE_INTEGER, &ldi.first_level, "first_level" },
{ TYPE_INTEGER, &ldi.sort_priority, "sort_priority" },
{ TYPE_BOOLEAN, &ldi.readonly, "readonly" }
};
{
ldi->name = getStringCopy("non-existing");
ldi->levels = 0;
- ldi->sort_priority = 999; /* default: least priority */
+ ldi->first_level = 0;
+ ldi->sort_priority = LEVELCLASS_UNDEFINED; /* default: least priority */
ldi->readonly = TRUE;
}
if (token_value)
{
- int highest_level_nr = leveldir[level_series_nr].levels - 1;
-
last_level_nr = atoi(token_value);
- if (last_level_nr < 0)
- last_level_nr = 0;
- if (last_level_nr > highest_level_nr)
- last_level_nr = highest_level_nr;
+ if (last_level_nr < leveldir[level_series_nr].first_level)
+ last_level_nr = leveldir[level_series_nr].first_level;
+ if (last_level_nr > leveldir[level_series_nr].last_level)
+ last_level_nr = leveldir[level_series_nr].last_level;
}
return last_level_nr;
leveldir[current_entry] = ldi;
leveldir[current_entry].filename = getStringCopy(dir_entry->d_name);
+ leveldir[current_entry].last_level =
+ leveldir[current_entry].first_level +
+ leveldir[current_entry].levels - 1;
leveldir[current_entry].user_defined =
(level_directory == options.level_directory ? FALSE : TRUE);
ldi.name = getLoginName();
ldi.levels = 100;
- ldi.sort_priority = 300;
+ ldi.first_level = 0;
+ ldi.sort_priority = LEVELCLASS_USER_START;
ldi.readonly = FALSE;
fprintf(file, "%s\n\n",
else if (element == EL_BURNING)
CheckForDragon(x, y);
else if (element == EL_SP_TERMINAL)
- DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL, 7, 10, ANIM_NORMAL);
+ DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL, 7, 12, ANIM_NORMAL);
else if (element == EL_SP_TERMINAL_ACTIVE)
- DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 2, ANIM_NORMAL);
+ DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 4, ANIM_NORMAL);
if (SiebAktiv)
{
char *filename;
char *name;
int levels;
+ int first_level;
+ int last_level;
int sort_priority;
boolean user_defined;
boolean readonly;
/* game graphics:
** 0 - 255: graphics from "RocksScreen"
-** 256 - 511: graphics from "RocksMore"
-** 512 - 767: graphics from "RocksFont"
+** 256 - 511: graphics from "RocksFont"
+** 512 - 767: graphics from "RocksMore"
** 768 - 1023: graphics from "RocksHeroes"
*/
#define GFX_START_ROCKSSCREEN 0
#define GFX_END_ROCKSSCREEN 255
-#define GFX_START_ROCKSMORE 256
-#define GFX_END_ROCKSMORE 511
-#define GFX_START_ROCKSFONT 512
-#define GFX_END_ROCKSFONT 767
+#define GFX_START_ROCKSFONT 256
+#define GFX_END_ROCKSFONT 511
+#define GFX_START_ROCKSMORE 512
+#define GFX_END_ROCKSMORE 767
#define GFX_START_ROCKSHEROES 768
#define GFX_END_ROCKSHEROES 1023
#define TAPES_DIRECTORY "tapes"
#define SCORES_DIRECTORY "scores"
-#define VERSION_STRING "1.2.0"
+#define VERSION_STRING "1.2.1"
#define GAMETITLE_STRING "Rocks'n'Diamonds"
#define WINDOWTITLE_STRING GAMETITLE_STRING " " VERSION_STRING
-#define COPYRIGHT_STRING "Copyright ^1995-98 by Holger Schemel"
+#define COPYRIGHT_STRING "Copyright ^1995-99 by Holger Schemel"
/* default name for empty highscore entry */
#define EMPTY_PLAYER_NAME "no name"
DrawMicroLevel(MICROLEV_XPOS,MICROLEV_YPOS);
+ DrawTextF(7*32 + 6, 3*32 + 9, FC_RED, "%d-%d",
+ leveldir[leveldir_nr].first_level,
+ leveldir[leveldir_nr].last_level);
+
+ if (leveldir[leveldir_nr].readonly)
+ {
+ DrawTextF(15*32 + 6, 3*32 + 9 - 7, FC_RED, "READ");
+ DrawTextF(15*32 + 6, 3*32 + 9 + 7, FC_RED, "ONLY");
+ }
+
for(i=2; i<10; i++)
DrawGraphic(0, i, GFX_KUGEL_BLAU);
DrawGraphic(10, 3, GFX_PFEIL_L);
DrawGraphic(14, 3, GFX_PFEIL_R);
- DrawTextF(15*32 + 6, 3*32 + 9, FC_RED, "%d", leveldir[leveldir_nr].levels);
-
DrawText(SX + 56, SY + 326, "A Game by Artsoft Entertainment",
FS_SMALL, FC_RED);
y = choice;
}
- if (y == 4 && ((x == 11 && level_nr > 0) ||
- (x == 15 && level_nr < leveldir[leveldir_nr].levels - 1)) &&
+ if (y == 4 && ((x == 11 && level_nr > leveldir[leveldir_nr].first_level) ||
+ (x == 15 && level_nr < leveldir[leveldir_nr].last_level)) &&
button)
{
static unsigned long level_delay = 0;
int font_color = (leveldir[leveldir_nr].readonly ? FC_RED : FC_YELLOW);
new_level_nr = level_nr + (x == 11 ? -step : +step);
- if (new_level_nr < 0)
- new_level_nr = 0;
- if (new_level_nr > leveldir[leveldir_nr].levels - 1)
- new_level_nr = leveldir[leveldir_nr].levels - 1;
+ if (new_level_nr < leveldir[leveldir_nr].first_level)
+ new_level_nr = leveldir[leveldir_nr].first_level;
+ if (new_level_nr > leveldir[leveldir_nr].last_level)
+ new_level_nr = leveldir[leveldir_nr].last_level;
if (old_level_nr == new_level_nr ||
!DelayReached(&level_delay, GADGET_FRAME_DELAY))