+2003-12-02
+ * fixed bug with wrong default impact sound for colored emeralds
+
+2003-11-30
+ * added several sub-screens for the info screen
2003-11-25
* added configurable "bored" and "sleeping" animations for the player
{ "player_1.pushing.right", "16" },
{ "end", "" },
- { "sand", "-1" },
+ { "sand", "50" },
+ { "sand.digging.left", "8" },
+ { "empty_space", "10" },
+ { "sand", "50" },
+ { "sand.digging.right", "8" },
+ { "empty_space", "10" },
+ { "sand", "50" },
+ { "sand.digging.up", "8" },
+ { "empty_space", "10" },
+ { "sand", "50" },
+ { "sand.digging.down", "8" },
+ { "empty_space", "10" },
{ "end", "" },
{ "empty_space", "-1" },
{ "char_cursor", "10" },
{ "end", "" },
- { "emerald", "-1" },
+ { "emerald", "50" },
+ { "emerald.collecting", "8" },
+ { "empty_space", "10" },
{ "end", "" },
- { "diamond", "-1" },
+ { "diamond", "50" },
+ { "diamond.collecting", "8" },
+ { "empty_space", "10" },
{ "end", "" },
- { "bd_diamond", "-1" },
+ { "bd_diamond", "50" },
+ { "bd_diamond.collecting", "8" },
+ { "empty_space", "10" },
{ "end", "" },
{ "emerald_yellow", "50" },
+ { "emerald_yellow.collecting", "8" },
+ { "empty_space", "10" },
{ "emerald_red", "50" },
+ { "emerald_red.collecting", "8" },
+ { "empty_space", "10" },
{ "emerald_purple", "50" },
+ { "emerald_purple.collecting", "8" },
+ { "empty_space", "10" },
{ "end", "" },
{ "bd_rock", "-1" },
SND_SAND_DIGGING
},
{
- EL_EMERALD, FALSE, ACTION_COLLECTING,
- SND_EMERALD_COLLECTING
+ EL_EMERALD, TRUE, ACTION_COLLECTING,
+ SND_CLASS_EMERALD_COLLECTING
},
{
- EL_EMERALD, FALSE, ACTION_IMPACT,
- SND_EMERALD_IMPACT
+ EL_EMERALD, TRUE, ACTION_IMPACT,
+ SND_CLASS_EMERALD_IMPACT
},
{
EL_DIAMOND, FALSE, ACTION_COLLECTING,
{ "[player].moving", "empty.wav" },
{ "[player].moving.mode_loop", "false" },
{ "sand.digging", "schlurf.wav" },
- { "emerald.collecting", "pong.wav" },
- { "emerald.impact", "pling.wav" },
+ { "[emerald].collecting", "pong.wav" },
+ { "[emerald].impact", "pling.wav" },
{ "diamond.collecting", "pong.wav" },
{ "diamond.impact", "pling.wav" },
{ "diamond.breaking", "quirk.wav" },
#define SND_CLASS_SOKOBAN_EMPTYING 47
#define SND_CLASS_PLAYER_MOVING 48
#define SND_SAND_DIGGING 49
-#define SND_EMERALD_COLLECTING 50
-#define SND_EMERALD_IMPACT 51
+#define SND_CLASS_EMERALD_COLLECTING 50
+#define SND_CLASS_EMERALD_IMPACT 51
#define SND_DIAMOND_COLLECTING 52
#define SND_DIAMOND_IMPACT 53
#define SND_DIAMOND_BREAKING 54
-#define COMPILE_DATE_STRING "[2003-11-30 15:29]"
+#define COMPILE_DATE_STRING "[2003-12-02 02:40]"
return TRUE;
}
+#if 1
+
+static int PrintElementDescriptionFromFile(char *filename, int start_line)
+{
+ int font_nr = FONT_TEXT_2;
+ int font_width = getFontWidth(font_nr);
+ int font_height = getFontHeight(font_nr);
+ int pad_x = ED_SETTINGS_XPOS(0);
+ int pad_y = ED_SETTINGS_YPOS(0) + ED_BORDER_SIZE;
+ int sx = SX + pad_x;
+ int sy = SY + pad_y + start_line * font_height;
+ int max_chars_per_line = (SXSIZE - 2 * pad_x) / font_width;
+ int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1;
+
+ return DrawTextFromFile(sx, sy, filename, font_nr, max_chars_per_line,
+ max_lines_per_screen);
+}
+
+#else
+
static int PrintElementDescriptionFromFile(char *filename, int start_line)
{
int font_nr = FONT_TEXT_2;
return (current_line - start_line);
}
+#endif
+
static void DrawPropertiesTabulatorGadgets()
{
struct GadgetInfo *gd_gi = level_editor_gadget[GADGET_ID_PROPERTIES_INFO];
if (HandleGadgets(mx, my, button))
{
/* do not handle this button event anymore */
- mx = my = 0;
+ mx = my = -32; /* force mouse event to be outside screen tiles */
}
switch(game_status)
return filename;
}
+char *getLevelSetInfoFilename()
+{
+ static char *filename = NULL;
+ char *basenames[] =
+ {
+ "readme",
+ "readme.txt",
+ "README",
+ "README.txt",
+ "README.TXT",
+
+ NULL
+ };
+ int i;
+
+ for (i = 0; basenames[i] != NULL; i++)
+ {
+ if (filename != NULL)
+ free(filename);
+
+ filename = getPath2(getCurrentLevelDir(), basenames[i]);
+ if (fileExists(filename))
+ return filename;
+ }
+
+ return NULL;
+}
+
static char *getCorrectedArtworkBasename(char *basename)
{
char *basename_corrected = basename;
char *getEditorSetupFilename(void);
char *getHelpAnimFilename(void);
char *getHelpTextFilename(void);
+char *getLevelSetInfoFilename(void);
char *getImageFilename(char *);
char *getCustomImageFilename(char *);
char *getCustomSoundFilename(char *);
boolean RenderLineToBuffer(char **src_buffer_ptr, char *dst_buffer,
int *dst_buffer_len, boolean last_line_was_empty,
- int max_chars_per_line)
+ int line_length)
{
char *text_ptr = *src_buffer_ptr;
char *buffer = dst_buffer;
if (buffer_len > 0 || !last_line_was_empty)
buffer_filled = TRUE;
}
- else if (word_len < max_chars_per_line - buffer_len)
+ else if (word_len < line_length - buffer_len)
{
/* word fits into text buffer -- add word */
{
/* word does not fit at all into empty text buffer -- cut word */
- strncpy(buffer, text_ptr, max_chars_per_line);
- buffer[max_chars_per_line] = '\0';
- text_ptr += max_chars_per_line;
+ strncpy(buffer, text_ptr, line_length);
+ buffer[line_length] = '\0';
+ text_ptr += line_length;
buffer_filled = TRUE;
}
current_line++;
}
}
+
+int DrawTextFromFile(int x, int y, char *filename, int font_nr,
+ int line_length, int max_lines)
+{
+ int font_height = getFontHeight(font_nr);
+ char line[MAX_LINE_LEN];
+ char buffer[line_length + 1];
+ int buffer_len;
+ int current_line = 0;
+ FILE *file;
+
+ if (current_line >= max_lines)
+ return 0;
+
+ if (filename == NULL)
+ return 0;
+
+ if (!(file = fopen(filename, MODE_READ)))
+ return 0;
+
+ buffer[0] = '\0';
+ buffer_len = 0;
+
+ while (!feof(file) && current_line < max_lines)
+ {
+ char *line_ptr;
+ boolean last_line_was_empty = TRUE;
+
+ /* read next line of input file */
+ if (!fgets(line, MAX_LINE_LEN, file))
+ break;
+
+ /* skip comments (lines directly beginning with '#') */
+ if (line[0] == '#')
+ continue;
+
+ /* cut trailing newline from input line */
+ for (line_ptr = line; *line_ptr; line_ptr++)
+ {
+ if (*line_ptr == '\n' || *line_ptr == '\r')
+ {
+ *line_ptr = '\0';
+ break;
+ }
+ }
+
+ if (strlen(line) == 0) /* special case: force empty line */
+ strcpy(line, "\n");
+
+ line_ptr = line;
+
+ while (*line_ptr && current_line < max_lines)
+ {
+ boolean buffer_filled = RenderLineToBuffer(&line_ptr,
+ buffer, &buffer_len,
+ last_line_was_empty,
+ line_length);
+ if (buffer_filled)
+ {
+ DrawText(x, y + current_line * font_height, buffer, font_nr);
+ current_line++;
+
+ last_line_was_empty = (buffer_len == 0);
+
+ buffer[0] = '\0';
+ buffer_len = 0;
+ }
+ }
+ }
+
+ fclose(file);
+
+ if (buffer_len > 0 && current_line < max_lines)
+ {
+ DrawText(x, y + current_line * font_height, buffer, font_nr);
+ current_line++;
+ }
+
+ return current_line;
+}
void DrawTextToTextArea(int, int, char *, int, int, int, int, int);
boolean RenderLineToBuffer(char **, char *, int *, boolean, int);
void DrawTextWrapped(int, int, char *, int, int, int);
+int DrawTextFromFile(int, int, char *, int, int, int);
#endif /* TEXT_H */
#define INFO_MODE_MUSIC 2
#define INFO_MODE_CREDITS 3
#define INFO_MODE_PROGRAM 4
+#define INFO_MODE_LEVELSET 5
-#define MAX_INFO_MODES 5
+#define MAX_INFO_MODES 6
/* for various menu stuff */
#define MAX_INFO_ELEMENTS_ON_SCREEN 10
}
for (i = 0; i < 8; i++)
- initCursor(i, (i == 1 || i == 6 ? IMG_MENU_BUTTON_RIGHT :IMG_MENU_BUTTON));
+ initCursor(i, (i == 1 || i == 4 || i == 6 ? IMG_MENU_BUTTON_RIGHT :
+ IMG_MENU_BUTTON));
drawCursorXY(level_width/32 + 4, 1, IMG_MENU_BUTTON_LEFT);
drawCursorXY(level_width/32 + 8, 1, IMG_MENU_BUTTON_RIGHT);
DelayReached(&level_delay, 0); /* reset delay counter */
}
}
- else if (IN_GFX_SCREEN(mx, my) &&
+ else if (IN_VIS_FIELD(x, y) &&
y >= 0 && y <= 7 && (y != 1 || x < 10))
{
if (button)
DrawInfoScreen();
}
+static void execInfoLevelSet()
+{
+ info_mode = INFO_MODE_LEVELSET;
+ DrawInfoScreen();
+}
+
static void execExitInfo()
{
game_status = GAME_MODE_MAIN;
{ TYPE_ENTER_SCREEN, execInfoMusic, "Music Info" },
{ TYPE_ENTER_SCREEN, execInfoCredits, "Credits" },
{ TYPE_ENTER_SCREEN, execInfoProgram, "Program Info" },
+ { TYPE_ENTER_SCREEN, execInfoLevelSet, "Level Set Info" },
{ TYPE_EMPTY, NULL, "" },
{ TYPE_LEAVE_MENU, execExitInfo, "Exit" },
y += dy;
}
- if (IN_GFX_SCREEN(mx, my) &&
+ if (IN_VIS_FIELD(x, y) &&
y >= 0 && y < num_info_info && info_info[y].type & ~TYPE_SKIP_ENTRY)
{
if (button)
ClearWindow();
DrawHeadline();
- DrawTextSCentered(100, FONT_TEXT_1, "The game elements:");
+ DrawTextSCentered(100, FONT_TEXT_1, "The Game Elements:");
DrawTextSCentered(SYSIZE - 20, FONT_TEXT_4,
"Press any key or button for next page");
FrameCounter++;
}
-#if 1
-
static char *getHelpText(int element, int action, int direction)
{
char token[MAX_LINE_LEN];
void DrawInfoScreen_HelpText(int element, int action, int direction, int ypos)
{
+#if 0
int font_nr = FONT_TEXT_2;
- int max_chars_per_line = 34;
- int max_lines_per_text = 2;
- int sx = mSX + 56;
+#else
+ int font_nr = FONT_LEVEL_NUMBER;
+#endif
+ int font_width = getFontWidth(font_nr);
+ int sx = mSX + MINI_TILEX + TILEX + MINI_TILEX;
int sy = mSY + 65 + 2 * 32 + 1;
int ystep = TILEY + 4;
+ int pad_x = sx - SX;
+ int max_chars_per_line = (SXSIZE - pad_x - MINI_TILEX) / font_width;
+ int max_lines_per_text = 2;
char *text = NULL;
if (action != -1 && direction != -1) /* element.action.direction */
max_chars_per_line, max_lines_per_text);
}
-#else
-
-void DrawInfoScreen_HelpText(int element, int action, int direction, int ypos)
-{
- int font_nr = FONT_TEXT_2;
- int max_chars_per_line = 34;
- int max_lines_per_text = 2;
- int sx = mSX + 56;
- int sy = mSY + 65 + 2 * 32 + 1;
- int ystep = TILEY + 4;
- char *text;
-
- /* 1st try: get text for base element */
- text = getHashEntry(helptext_info, element_info[element].token_name);
-
- if (text == NULL)
- {
- /* 2nd try: get text for element/action/direction */
- char token[MAX_LINE_LEN];
-
- strcpy(token, element_info[element].token_name);
-
- if (action != -1)
- strcat(token, element_action_info[action].suffix);
-
- if (direction != -1)
- strcat(token, element_direction_info[MV_DIR_BIT(direction)].suffix);
-
- text = getHashEntry(helptext_info, token);
-
- if (text == NULL)
- text = "No description available";
- }
-
- if (strlen(text) <= max_chars_per_line) /* only one line of text */
- sy += getFontHeight(font_nr) / 2;
-
- DrawTextWrapped(sx, sy + ypos * ystep, text, font_nr,
- max_chars_per_line, max_lines_per_text);
-}
-#endif
-
void DrawInfoScreen_Elements()
{
LoadHelpAnimInfo();
ClearWindow();
DrawHeadline();
- DrawTextSCentered(100, FONT_TEXT_1, "The game background music:");
+ DrawTextSCentered(100, FONT_TEXT_1, "The Game Background Music:");
DrawTextSCentered(ystart + 0 * ystep, FONT_TEXT_2, "Excerpt from");
DrawTextFCentered(ystart + 1 * ystep, FONT_TEXT_3, "\"%s\"", list->title);
ClearWindow();
DrawHeadline();
- DrawTextSCentered(100, FONT_TEXT_1, "Program information:");
+ DrawTextSCentered(100, FONT_TEXT_1, "Program Information:");
DrawTextSCentered(ystart + 0 * ystep, FONT_TEXT_2,
"This game is Freeware!");
}
}
+void DrawInfoScreen_LevelSet()
+{
+ int ystart = 150;
+ int ybottom = SYSIZE - 20;
+ char *filename = getLevelSetInfoFilename();
+#if 0
+ int font_nr = FONT_TEXT_2;
+#else
+ int font_nr = FONT_LEVEL_NUMBER;
+#endif
+ int font_width = getFontWidth(font_nr);
+ int font_height = getFontHeight(font_nr);
+ int pad_x = 32;
+ int pad_y = ystart;
+ int sx = SX + pad_x;
+ int sy = SY + pad_y;
+ int max_chars_per_line = (SXSIZE - 2 * pad_x) / font_width;
+ int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1;
+
+ ClearWindow();
+ DrawHeadline();
+
+ DrawTextSCentered(100, FONT_TEXT_1, "Level Set Information:");
+
+ DrawTextSCentered(ybottom, FONT_TEXT_4,
+ "Press any key or button for info menu");
+
+ if (filename != NULL)
+ DrawTextFromFile(sx, sy, filename, font_nr, max_chars_per_line,
+ max_lines_per_screen);
+ else
+ DrawTextSCentered(ystart, FONT_TEXT_2,
+ "No information for this level set.");
+}
+
+void HandleInfoScreen_LevelSet(int button)
+{
+ int button_released = !button;
+
+ if (button == MB_MENU_LEAVE)
+ {
+ info_mode = INFO_MODE_MAIN;
+ DrawInfoScreen();
+
+ return;
+ }
+
+ if (button_released)
+ {
+ FadeSoundsAndMusic();
+
+ info_mode = INFO_MODE_MAIN;
+ DrawInfoScreen();
+ }
+ else
+ {
+ PlayMenuSoundIfLoop();
+ }
+}
+
void DrawInfoScreen()
{
SetMainBackgroundImage(IMG_BACKGROUND_INFO);
DrawInfoScreen_Credits();
else if (info_mode == INFO_MODE_PROGRAM)
DrawInfoScreen_Program();
+ else if (info_mode == INFO_MODE_LEVELSET)
+ DrawInfoScreen_LevelSet();
else
DrawInfoScreen_Main();
HandleInfoScreen_Credits(button);
else if (info_mode == INFO_MODE_PROGRAM)
HandleInfoScreen_Program(button);
+ else if (info_mode == INFO_MODE_LEVELSET)
+ HandleInfoScreen_LevelSet(button);
else
HandleInfoScreen_Main(mx, my, dx, dy, button);
return;
}
- if (IN_GFX_SCREEN(mx, my) &&
+ if (IN_VIS_FIELD(x, y) &&
mx < screen_gadget[SCREEN_CTRL_ID_SCROLL_VERTICAL]->x &&
y >= 0 && y < num_page_entries)
{
y += dy;
}
- if (IN_GFX_SCREEN(mx, my) &&
+ if (IN_VIS_FIELD(x, y) &&
y >= 0 && y < num_setup_info && setup_info[y].type & ~TYPE_SKIP_ENTRY)
{
if (button)
y = (dy > 0 ? pos_empty2 + 1 : pos_empty1 - 1);
}
- if (IN_GFX_SCREEN(mx, my) &&
+ if (IN_VIS_FIELD(x, y) &&
y == 0 && ((x < 10 && !button) || ((x == 10 || x == 12) && button)))
{
static unsigned long delay = 0;
drawPlayerSetupInputInfo(player_nr);
}
- else if (IN_GFX_SCREEN(mx, my) &&
+ else if (IN_VIS_FIELD(x, y) &&
y >= pos_start && y <= pos_end &&
!(y >= pos_empty1 && y <= pos_empty2))
{