#include "screens.h"
-/* values for global toon animation definition */
+// values for global toon animation definition
#define NUM_GLOBAL_TOON_ANIMS 1
#define NUM_GLOBAL_TOON_PARTS MAX_NUM_TOONS
-/* values for global animation definition (including toons) */
+// values for global animation definition (including toons)
#define NUM_GLOBAL_ANIMS_AND_TOONS (NUM_GLOBAL_ANIMS + \
NUM_GLOBAL_TOON_ANIMS)
#define NUM_GLOBAL_ANIM_PARTS_AND_TOONS MAX(NUM_GLOBAL_ANIM_PARTS_ALL, \
ANIM_CLASS_MENU | \
ANIM_CLASS_SUBMENU)
-/* values for global animation states */
+// values for global animation states
#define ANIM_STATE_INACTIVE 0
#define ANIM_STATE_RESTART (1 << 0)
#define ANIM_STATE_WAITING (1 << 1)
#define ANIM_STATE_RUNNING (1 << 2)
-/* values for global animation control */
+// values for global animation control
#define ANIM_NO_ACTION 0
#define ANIM_START 1
#define ANIM_CONTINUE 2
{ -1, -1 }
};
-/* forward declaration for internal use */
+// forward declaration for internal use
static void HandleGlobalAnim(int, int);
static void DoAnimationExt(void);
static void ResetGlobalAnim_Clickable(void);
static boolean drawing_to_fading_buffer = FALSE;
-/* ========================================================================= */
-/* generic animation frame calculation */
-/* ========================================================================= */
+// ============================================================================
+// generic animation frame calculation
+// ============================================================================
int getAnimationFrame(int num_frames, int delay, int mode, int start_frame,
int sync_frame)
sync_frame += start_frame * delay;
- if (mode & ANIM_LOOP) /* looping animation */
+ if (mode & ANIM_LOOP) // looping animation
{
frame = (sync_frame % (delay * num_frames)) / delay;
}
- else if (mode & ANIM_LINEAR) /* linear (non-looping) animation */
+ else if (mode & ANIM_LINEAR) // linear (non-looping) animation
{
frame = sync_frame / delay;
if (frame > num_frames - 1)
frame = num_frames - 1;
}
- else if (mode & ANIM_PINGPONG) /* oscillate (border frames once) */
+ else if (mode & ANIM_PINGPONG) // oscillate (border frames once)
{
int max_anim_frames = (num_frames > 1 ? 2 * num_frames - 2 : 1);
frame = (sync_frame % (delay * max_anim_frames)) / delay;
frame = (frame < num_frames ? frame : max_anim_frames - frame);
}
- else if (mode & ANIM_PINGPONG2) /* oscillate (border frames twice) */
+ else if (mode & ANIM_PINGPONG2) // oscillate (border frames twice)
{
int max_anim_frames = 2 * num_frames;
frame = (sync_frame % (delay * max_anim_frames)) / delay;
frame = (frame < num_frames ? frame : max_anim_frames - frame - 1);
}
- else if (mode & ANIM_RANDOM) /* play frames in random order */
+ else if (mode & ANIM_RANDOM) // play frames in random order
{
- /* note: expect different frames for the same delay cycle! */
+ // note: expect different frames for the same delay cycle!
if (gfx.anim_random_frame < 0)
frame = GetSimpleRandom(num_frames);
frame = sync_frame % num_frames;
}
- if (mode & ANIM_REVERSE) /* use reverse animation direction */
+ if (mode & ANIM_REVERSE) // use reverse animation direction
frame = num_frames - frame - 1;
return frame;
}
-/* ========================================================================= */
-/* global animation functions */
-/* ========================================================================= */
+// ============================================================================
+// global animation functions
+// ============================================================================
static int getGlobalAnimationPart(struct GlobalAnimMainControlInfo *anim)
{
InitToonControls();
- /* sort all animations according to draw_order and animation number */
+ // sort all animations according to draw_order and animation number
for (m = 0; m < NUM_GAME_MODES; m++)
{
struct GlobalAnimControlInfo *ctrl = &global_anim_ctrl[m];
- /* sort all main animations for this game mode */
+ // sort all main animations for this game mode
qsort(ctrl->anim, ctrl->num_anims,
sizeof(struct GlobalAnimMainControlInfo),
compareGlobalAnimMainControlInfo);
{
struct GlobalAnimMainControlInfo *anim = &ctrl->anim[a];
- /* sort all animation parts for this main animation */
+ // sort all animation parts for this main animation
qsort(anim->part, anim->num_parts,
sizeof(struct GlobalAnimPartControlInfo),
compareGlobalAnimPartControlInfo);
boolean release_event;
boolean click_consumed_current = click_consumed;
- /* check if button state has changed since last invocation */
+ // check if button state has changed since last invocation
press_event = (button != 0 && last_button == 0);
release_event = (button == 0 && last_button != 0);
last_button = button;
// image definitions for game elements (for in-game and editor graphics)
// ==========================================================================
- /* images for Boulder Dash style elements and actions */
+ // images for Boulder Dash style elements and actions
{ "bd_wall", "RocksDC.png" },
{ "bd_wall.xpos", "12" },
{ "bd_firefly.down.EDITOR.xpos", "15" },
{ "bd_firefly.down.EDITOR.ypos", "12" },
- /* images for Supaplex style elements and actions */
+ // images for Supaplex style elements and actions
{ "[sp_default].exploding", "RocksSP.png" },
{ "[sp_default].exploding.xpos", "8" },
{ "sp_hardware_base_6.ypos", "4" },
{ "sp_hardware_base_6.frames", "1" },
- /* images for Sokoban style elements and actions */
+ // images for Sokoban style elements and actions
{ "sokoban_object", "RocksElements.png" },
{ "sokoban_object.xpos", "9" },
{ "sokoban_field_player.EDITOR.xpos", "1" },
{ "sokoban_field_player.EDITOR.ypos", "15" },
- /* images for Emerald Mine style elements and actions */
+ // images for Emerald Mine style elements and actions
{ "empty_space", "RocksSP.png" },
{ "empty_space.xpos", "0" },
{ "em_steel_exit.closing.delay", "6" },
{ "em_steel_exit.closing.anim_mode", "linear" },
- /* images for Emerald Mine Club style elements and actions */
+ // images for Emerald Mine Club style elements and actions
{ "balloon", "RocksDC.png" },
{ "balloon.xpos", "12" },
{ "emc_wall_8.ypos", "7" },
{ "emc_wall_8.frames", "1" },
- /* images for Diamond Caves style elements and actions */
+ // images for Diamond Caves style elements and actions
{ "invisible_steelwall", "RocksSP.png" },
{ "invisible_steelwall.xpos", "3" },
{ "dc_steelwall_2_single.ypos", "0" },
{ "dc_steelwall_2_single.frames", "1" },
- /* images for DX Boulderdash style elements and actions */
+ // images for DX Boulderdash style elements and actions
{ "tube_right_down", "RocksDC.png" },
{ "tube_right_down.xpos", "9" },
{ "dx_supabomb.ypos", "9" },
{ "dx_supabomb.frames", "1" },
- /* images for Rocks'n'Diamonds style elements and actions */
+ // images for Rocks'n'Diamonds style elements and actions
{ "key_1", "RocksElements.png" },
{ "key_1.xpos", "4" },
{ "stoneblock.ypos", "1" },
{ "stoneblock.frames", "1" },
- /* images for other elements and actions */
+ // images for other elements and actions
{ "player_1", "RocksHeroes.png" },
{ "player_1.xpos", "0" },
{ "df_mine.ypos", "8" },
{ "df_mine.frames", "1" },
- /* (these are only defined as elements to support ".PANEL" definitions) */
+ // (these are only defined as elements to support ".PANEL" definitions)
{ "graphic_1", UNDEFINED_FILENAME },
{ "graphic_2", UNDEFINED_FILENAME },
{ "graphic_3", UNDEFINED_FILENAME },
{ "graphic_7", UNDEFINED_FILENAME },
{ "graphic_8", UNDEFINED_FILENAME },
-#include "conf_chr.c" /* include auto-generated data structure definitions */
-#include "conf_cus.c" /* include auto-generated data structure definitions */
-#include "conf_grp.c" /* include auto-generated data structure definitions */
+#include "conf_chr.c" // include auto-generated data structure definitions
+#include "conf_cus.c" // include auto-generated data structure definitions
+#include "conf_grp.c" // include auto-generated data structure definitions
// ==========================================================================
// image definitions not associated with game elements (menu screens etc.)
// ==========================================================================
- /* keyword to stop parser: "NO_MORE_ELEMENT_IMAGES" <-- do not change! */
+ // keyword to stop parser: "NO_MORE_ELEMENT_IMAGES" <-- do not change!
#if 1
- /* !!! TEMPORARILY STORED HERE -- PROBABLY TO BE CHANGED !!! */
+ // !!! TEMPORARILY STORED HERE -- PROBABLY TO BE CHANGED !!!
- /* (for testing, change filename back to "emc_objects dot png") */
+ // (for testing, change filename back to "emc_objects dot png")
{ "emc_object", "RocksEMC.png" },
#if 0
{ "emc_object.scale_up_factor", "2" },
#endif
- /* (for testing, change filename back to "emc_players dot png") */
+ // (for testing, change filename back to "emc_players dot png")
{ "emc_sprite", "RocksEMC.png" },
#if 0
{ "emc_sprite.scale_up_factor", "2" },
/* the following directives are not associated with an image, but
probably make sense to be defined in "graphicsinfo.conf", too */
- /* keyword to start parser: "CONFIG_VARS_START" <-- do not change! */
+ // keyword to start parser: "CONFIG_VARS_START" <-- do not change!
{ "[title_initial].fade_mode", "fade" },
{ "[title_initial].fade_delay", "500" },
struct ConfigInfo sound_config[] =
{
- /* some default sounds */
+ // some default sounds
{ "[default].digging", "schlurf.wav" },
{ "[default].collecting", "pong.wav" },
{ "[default].snapping", "pong.wav" },
{ "[sp_default].exploding", "booom.wav" },
{ "[mm_default].exploding", "kabumm.wav" },
- /* sounds for Boulder Dash style elements and actions */
+ // sounds for Boulder Dash style elements and actions
{ "bd_diamond.collecting", "pong.wav" },
{ "bd_diamond.impact", "pling.wav" },
{ "bd_rock.pushing", "pusch.wav" },
{ "bd_firefly.moving", "roehr.wav" },
{ "bd_firefly.waiting", "roehr.wav" },
- /* sounds for Supaplex style elements and actions */
+ // sounds for Supaplex style elements and actions
{ "sp_base.digging", "base.wav" },
{ "sp_buggy_base.digging", "base.wav" },
{ "sp_buggy_base.active", "bug.wav" },
{ "sp_terminal.activating", UNDEFINED_FILENAME },
{ "sp_terminal.active", UNDEFINED_FILENAME },
- /* sounds for Sokoban style elements and actions */
+ // sounds for Sokoban style elements and actions
{ "[sokoban].pushing", "pusch.wav" },
{ "[sokoban].filling", "deng.wav" },
{ "[sokoban].emptying", UNDEFINED_FILENAME },
- /* sounds for Emerald Mine style elements and actions */
+ // sounds for Emerald Mine style elements and actions
{ "[player].moving", "empty.wav" },
{ "[player].moving.mode_loop", "false" },
{ "sand.digging", "schlurf.wav" },
{ "[em_steel_exit].passing", "buing.wav" },
{ "penguin.passing", "buing.wav" },
- /* sounds for Emerald Mine Club style elements and actions */
+ // sounds for Emerald Mine Club style elements and actions
{ "balloon.moving", UNDEFINED_FILENAME },
{ "balloon.waiting", UNDEFINED_FILENAME },
{ "balloon.pushing", "schlurf.wav" },
{ "emc_android.dropping", "deng.wav" },
{ "emc_magic_ball.dropping", "deng.wav" },
- /* sounds for Diamond Caves style elements and actions */
+ // sounds for Diamond Caves style elements and actions
{ "pearl.collecting", "pong.wav" },
{ "pearl.breaking", "knack.wav" },
{ "pearl.impact", "pling.wav" },
{ "light_switch.activating", UNDEFINED_FILENAME },
{ "light_switch.deactivating", UNDEFINED_FILENAME },
- /* sounds for DX Boulderdash style elements and actions */
+ // sounds for DX Boulderdash style elements and actions
{ "dx_supabomb.pushing", "pusch.wav" },
{ "trap.digging", "schlurf.wav" },
{ "trap.activating", UNDEFINED_FILENAME },
{ "[tube].walking", UNDEFINED_FILENAME },
- /* sounds for Rocks'n'Diamonds style elements and actions */
+ // sounds for Rocks'n'Diamonds style elements and actions
{ "amoeba.turning_to_gem", "pling.wav" },
{ "amoeba.turning_to_rock", "klopf.wav" },
{ "speed_pill.collecting", "pong.wav" },
{ "dragon.waiting", UNDEFINED_FILENAME },
{ "dragon.attacking", UNDEFINED_FILENAME },
- /* sounds for Mirror Magic style elements and actions */
+ // sounds for Mirror Magic style elements and actions
{ "[mm_mcduffin].hitting", "autsch.wav" },
{ "[mm_mirror].hitting", "laser.wav" },
{ "[mm_mirror_fixed].hitting", "laser.wav" },
{ "[mm_steel_lock].exploding", "whoosh.wav" },
{ "[mm_wooden_lock].exploding", "whoosh.wav" },
- /* sounds not associated to game elements (used for menu screens etc.) */
- /* keyword to stop parser: "NO_MORE_ELEMENT_SOUNDS" <-- do not change! */
+ // sounds not associated to game elements (used for menu screens etc.)
+ // keyword to stop parser: "NO_MORE_ELEMENT_SOUNDS" <-- do not change!
- /* sounds for other game actions */
+ // sounds for other game actions
{ "game.starting", UNDEFINED_FILENAME },
{ "game.leveltime_charging", "fuel.wav" },
{ "game.health_charging", "warnton.wav" },
{ "game.winning", UNDEFINED_FILENAME },
{ "game.sokoban_solving", "buing.wav" },
- /* sounds for other non-game actions */
+ // sounds for other non-game actions
{ "door.opening", "door.wav" },
{ "door.closing", "door.wav" },
{ "door_1.opening", UNDEFINED_FILENAME },
{ "request.opening", UNDEFINED_FILENAME },
{ "request.closing", UNDEFINED_FILENAME },
- /* sounds for menu actions */
+ // sounds for menu actions
{ "menu.item.activating", "empty.wav" },
{ "menu.item.selecting", "base.wav" },
char *getConfigProgramCompanyString(void);
char *getWindowTitleString(void);
-#endif /* CONFIG_H */
+#endif // CONFIG_H
-----------------------------------------------------------------------------
*/
-/* values for the control window */
-#define ED_CTRL1_BUTTONS_HORIZ 4 /* toolbox */
+// values for the control window
+#define ED_CTRL1_BUTTONS_HORIZ 4 // toolbox
#define ED_CTRL1_BUTTONS_VERT 4
-#define ED_CTRL2_BUTTONS_HORIZ 3 /* level */
+#define ED_CTRL2_BUTTONS_HORIZ 3 // level
#define ED_CTRL2_BUTTONS_VERT 2
-#define ED_CTRL3_BUTTONS_HORIZ 3 /* CE and GE */
+#define ED_CTRL3_BUTTONS_HORIZ 3 // CE and GE
#define ED_CTRL3_BUTTONS_VERT 1
-#define ED_CTRL4_BUTTONS_HORIZ 2 /* CE and GE */
+#define ED_CTRL4_BUTTONS_HORIZ 2 // CE and GE
#define ED_CTRL4_BUTTONS_VERT 1
-#define ED_CTRL5_BUTTONS_HORIZ 1 /* properties */
+#define ED_CTRL5_BUTTONS_HORIZ 1 // properties
#define ED_CTRL5_BUTTONS_VERT 1
-#define ED_CTRL6_BUTTONS_HORIZ 3 /* properties */
+#define ED_CTRL6_BUTTONS_HORIZ 3 // properties
#define ED_CTRL6_BUTTONS_VERT 1
-#define ED_CTRL7_BUTTONS_HORIZ 1 /* palette */
+#define ED_CTRL7_BUTTONS_HORIZ 1 // palette
#define ED_CTRL7_BUTTONS_VERT 1
#define ED_NUM_CTRL1_BUTTONS (ED_CTRL1_BUTTONS_HORIZ * ED_CTRL1_BUTTONS_VERT)
#define ED_NUM_CTRL1_7_BUTTONS (ED_NUM_CTRL1_6_BUTTONS + ED_NUM_CTRL7_BUTTONS)
#define ED_NUM_CTRL_BUTTONS ED_NUM_CTRL1_7_BUTTONS
-/* values for the element list */
+// values for the element list
#define ED_ELEMENTLIST_XPOS (editor.palette.x)
#define ED_ELEMENTLIST_YPOS (editor.palette.y)
#define ED_ELEMENTLIST_XSIZE (graphic_info[IMG_EDITOR_PALETTE_BUTTON].width)
#define ED_NUM_ELEMENTLIST_BUTTONS (ED_ELEMENTLIST_BUTTONS_HORIZ * \
ED_ELEMENTLIST_BUTTONS_VERT)
-/* standard distances */
+// standard distances
#define ED_GADGET_NORMAL_DISTANCE (editor.gadget.normal_spacing)
#define ED_GADGET_SMALL_DISTANCE (editor.gadget.small_spacing)
#define ED_GADGET_TINY_DISTANCE (editor.gadget.tiny_spacing)
ED_DRAWINGAREA_BORDER_SIZE)
#define ED_GADGET_SPACE_DISTANCE (getFontWidth(FONT_TEXT_1))
-/* values for drawingarea gadgets */
+// values for drawingarea gadgets
#define IMG_BORDER_1 IMG_EDITOR_ELEMENT_BORDER
#define IMG_BORDER_2 IMG_EDITOR_ELEMENT_BORDER_INPUT
#define ED_ELEMENT_BORDER (graphic_info[IMG_BORDER_1].border_size)
#define ED_DRAWINGAREA_BORDER_SIZE (graphic_info[IMG_BORDER_2].border_size)
#define ED_DRAWINGAREA_TILE_SIZE (editor.drawingarea.tile_size)
-/* values for checkbutton gadgets */
+// values for checkbutton gadgets
#define ED_CHECKBUTTON_XSIZE (graphic_info[IMG_EDITOR_CHECKBOX].width)
#define ED_CHECKBUTTON_YSIZE (graphic_info[IMG_EDITOR_CHECKBOX].height)
ED_AREA_YOFFSET_1((i).y) - \
ED_AREA_YOFFSET_2((i).area_ysize))
-/* values for element content drawing areas */
+// values for element content drawing areas
#define ED_AREA_1X1_LSETTINGS_XPOS(n) ED_LEVEL_SETTINGS_XPOS(n)
#define ED_AREA_1X1_LSETTINGS_YPOS(n) ED_LEVEL_SETTINGS_YPOS(n)
#define ED_AREA_1X1_LSETTINGS_XOFF (0)
#define ED_AREA_3X3_SETTINGS_XOFF (0)
#define ED_AREA_3X3_SETTINGS_YOFF (0)
-/* element content */
+// element content
#define ED_AREA_ELEMENT_CONTENT_XOFF(n) (n)
#define ED_AREA_ELEMENT_CONTENT_YOFF(n) (n)
-/* yamyam content */
+// yamyam content
#define ED_XPOS_YAM 0
#define ED_YPOS_YAM 5
#define ED_AREA_YAMYAM_CONTENT_XPOS ED_ELEMENT_SETTINGS_XPOS(ED_XPOS_YAM)
ED_AREA_YOFFSET_1(ED_YPOS_YAM) - \
ED_AREA_YOFFSET_2(3))
-/* magic ball content */
+// magic ball content
#define ED_XPOS_BALL 0
#define ED_YPOS_BALL 6
#define ED_AREA_MAGIC_BALL_CONTENT_XPOS ED_ELEMENT_SETTINGS_XPOS(ED_XPOS_BALL)
ED_AREA_YOFFSET_1(ED_YPOS_BALL) - \
ED_AREA_YOFFSET_2(3))
-/* values for scrolling gadgets for drawing area */
+// values for scrolling gadgets for drawing area
#define ED_SCROLLBUTTON_XSIZE (graphic_info[IMG_EDITOR_PLAYFIELD_SCROLLBAR].width)
#define ED_SCROLLBUTTON_YSIZE (graphic_info[IMG_EDITOR_PLAYFIELD_SCROLLBAR].height)
#define ED_SCROLL_VERTICAL_XSIZE ED_SCROLLBUTTON_XSIZE
#define ED_SCROLL_VERTICAL_YSIZE (SYSIZE - 4 * ED_SCROLLBUTTON_YSIZE)
-/* values for scrolling gadgets for element list */
+// values for scrolling gadgets for element list
#define ED_SCROLLBUTTON2_XSIZE (graphic_info[IMG_EDITOR_PALETTE_SCROLL_UP].width)
#define ED_SCROLLBUTTON2_YSIZE (graphic_info[IMG_EDITOR_PALETTE_SCROLL_UP].height)
ED_ELEMENTLIST_YSIZE - \
2 * ED_SCROLLBUTTON2_YSIZE)
-/* values for ClearEditorGadgetInfoText() and HandleEditorGadgetInfoText() */
+// values for ClearEditorGadgetInfoText() and HandleEditorGadgetInfoText()
#define INFOTEXT_FONT FONT_TEXT_2
#define INFOTEXT_XSIZE SXSIZE
#define INFOTEXT_YSIZE getFontHeight(INFOTEXT_FONT)
{
GADGET_ID_NONE = -1,
- /* drawing toolbox buttons */
+ // drawing toolbox buttons
GADGET_ID_SINGLE_ITEMS,
GADGET_ID_CONNECTED_ITEMS,
GADGET_ID_ELEMENT_RIGHT,
GADGET_ID_PALETTE,
- /* counter gadget identifiers */
+ // counter gadget identifiers
GADGET_ID_SELECT_LEVEL_DOWN,
GADGET_ID_SELECT_LEVEL_TEXT,
GADGET_ID_GROUP_CONTENT_TEXT,
GADGET_ID_GROUP_CONTENT_UP,
- /* drawing area identifiers */
+ // drawing area identifiers
GADGET_ID_DRAWING_LEVEL,
GADGET_ID_YAMYAM_CONTENT_0,
GADGET_ID_GROUP_CONTENT,
GADGET_ID_RANDOM_BACKGROUND,
- /* text input identifiers */
+ // text input identifiers
GADGET_ID_LEVEL_NAME,
GADGET_ID_LEVEL_AUTHOR,
GADGET_ID_LEVELSET_AUTHOR,
GADGET_ID_ELEMENT_NAME,
- /* text area identifiers */
+ // text area identifiers
GADGET_ID_ENVELOPE_INFO,
- /* selectbox identifiers */
+ // selectbox identifiers
GADGET_ID_TIME_OR_STEPS,
GADGET_ID_GAME_ENGINE_TYPE,
GADGET_ID_SELECT_CHANGE_PAGE,
GADGET_ID_GROUP_CHOICE_MODE,
- /* textbutton identifiers */
+ // textbutton identifiers
GADGET_ID_LEVELINFO_LEVEL,
GADGET_ID_LEVELINFO_LEVELSET,
GADGET_ID_ADD_CHANGE_PAGE,
GADGET_ID_DEL_CHANGE_PAGE,
- /* graphicbutton identifiers */
+ // graphicbutton identifiers
GADGET_ID_PREV_CHANGE_PAGE,
GADGET_ID_NEXT_CHANGE_PAGE,
GADGET_ID_COPY_CHANGE_PAGE,
GADGET_ID_PASTE_CHANGE_PAGE,
- /* gadgets for scrolling of drawing area */
+ // gadgets for scrolling of drawing area
GADGET_ID_SCROLL_UP,
GADGET_ID_SCROLL_DOWN,
GADGET_ID_SCROLL_HORIZONTAL,
GADGET_ID_SCROLL_VERTICAL,
- /* gadgets for scrolling element list */
+ // gadgets for scrolling element list
GADGET_ID_SCROLL_LIST_UP,
GADGET_ID_SCROLL_LIST_DOWN,
GADGET_ID_SCROLL_LIST_VERTICAL,
- /* checkbuttons/radiobuttons for level/element properties */
+ // checkbuttons/radiobuttons for level/element properties
GADGET_ID_AUTO_COUNT_GEMS,
GADGET_ID_USE_LEVELSET_ARTWORK,
NUM_STATIC_GADGET_IDS
};
-/* gadgets for buttons in element list (dynamic) */
+// gadgets for buttons in element list (dynamic)
#define GADGET_ID_ELEMENTLIST_FIRST (NUM_STATIC_GADGET_IDS)
#define GADGET_ID_ELEMENTLIST_LAST (GADGET_ID_ELEMENTLIST_FIRST + \
ED_NUM_ELEMENTLIST_BUTTONS - 1)
#define NUM_EDITOR_GADGETS (GADGET_ID_ELEMENTLIST_LAST + 1)
-/* radio button numbers */
+// radio button numbers
enum
{
RADIO_NR_NONE,
RADIO_NR_RANDOM_ELEMENTS
};
-/* values for counter gadgets */
+// values for counter gadgets
enum
{
ED_COUNTER_ID_SELECT_LEVEL,
#define ED_COUNTER_ID_CHANGE_FIRST ED_COUNTER_ID_CHANGE_DELAY_FIX
#define ED_COUNTER_ID_CHANGE_LAST ED_COUNTER_ID_CHANGE_CONT_RND
-/* values for scrollbutton gadgets */
+// values for scrollbutton gadgets
enum
{
ED_SCROLLBUTTON_ID_AREA_UP,
#define ED_SCROLLBUTTON_ID_AREA_FIRST ED_SCROLLBUTTON_ID_AREA_UP
#define ED_SCROLLBUTTON_ID_AREA_LAST ED_SCROLLBUTTON_ID_AREA_RIGHT
-/* values for scrollbar gadgets */
+// values for scrollbar gadgets
enum
{
ED_SCROLLBAR_ID_AREA_HORIZONTAL,
#define ED_SCROLLBAR_ID_AREA_FIRST ED_SCROLLBAR_ID_AREA_HORIZONTAL
#define ED_SCROLLBAR_ID_AREA_LAST ED_SCROLLBAR_ID_AREA_VERTICAL
-/* values for text input gadgets */
+// values for text input gadgets
enum
{
ED_TEXTINPUT_ID_LEVEL_NAME,
#define ED_TEXTINPUT_ID_LEVELSET_FIRST ED_TEXTINPUT_ID_LEVELSET_NAME
#define ED_TEXTINPUT_ID_LEVELSET_LAST ED_TEXTINPUT_ID_LEVELSET_AUTHOR
-/* values for text area gadgets */
+// values for text area gadgets
enum
{
ED_TEXTAREA_ID_ENVELOPE_INFO,
#define ED_TEXTAREA_ID_LEVEL_FIRST ED_TEXTAREA_ID_ENVELOPE
#define ED_TEXTAREA_ID_LEVEL_LAST ED_TEXTAREA_ID_ENVELOPE
-/* values for selectbox gadgets */
+// values for selectbox gadgets
enum
{
ED_SELECTBOX_ID_TIME_OR_STEPS,
#define ED_SELECTBOX_ID_CHANGE_FIRST ED_SELECTBOX_ID_CHANGE_TIME_UNITS
#define ED_SELECTBOX_ID_CHANGE_LAST ED_SELECTBOX_ID_SELECT_CHANGE_PAGE
-/* values for textbutton gadgets */
+// values for textbutton gadgets
enum
{
ED_TEXTBUTTON_ID_LEVELINFO_LEVEL,
#define ED_TEXTBUTTON_ID_CHANGE_FIRST ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE
#define ED_TEXTBUTTON_ID_CHANGE_LAST ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE
-/* values for graphicbutton gadgets */
+// values for graphicbutton gadgets
enum
{
ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE,
#define ED_GRAPHICBUTTON_ID_CHANGE_FIRST ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE
#define ED_GRAPHICBUTTON_ID_CHANGE_LAST ED_GRAPHICBUTTON_ID_PASTE_CHANGE_PAGE
-/* values for checkbutton gadgets */
+// values for checkbutton gadgets
enum
{
ED_CHECKBUTTON_ID_AUTO_COUNT_GEMS,
#define ED_CHECKBUTTON_ID_CHANGE_FIRST ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE
#define ED_CHECKBUTTON_ID_CHANGE_LAST ED_CHECKBUTTON_ID_CHANGE_HAS_ACTION
-/* values for radiobutton gadgets */
+// values for radiobutton gadgets
enum
{
ED_RADIOBUTTON_ID_PERCENTAGE,
#define ED_RADIOBUTTON_ID_EDITOR_FIRST ED_RADIOBUTTON_ID_PERCENTAGE
#define ED_RADIOBUTTON_ID_EDITOR_LAST ED_RADIOBUTTON_ID_QUANTITY
-/* values for drawing area gadgets */
+// values for drawing area gadgets
enum
{
ED_DRAWING_ID_DRAWING_LEVEL,
-----------------------------------------------------------------------------
*/
-/* values for CopyLevelToUndoBuffer() */
+// values for CopyLevelToUndoBuffer()
#define UNDO_IMMEDIATE 0
#define UNDO_ACCUMULATE 1
-/* values for scrollbars */
+// values for scrollbars
#define ED_SCROLL_NO 0
#define ED_SCROLL_LEFT 1
#define ED_SCROLL_RIGHT 2
#define ED_SCROLL_UP 4
#define ED_SCROLL_DOWN 8
-/* screens in the level editor */
+// screens in the level editor
#define ED_MODE_DRAWING 0
#define ED_MODE_INFO 1
#define ED_MODE_PROPERTIES 2
#define ED_MODE_PALETTE 3
-/* sub-screens in the global settings section */
+// sub-screens in the global settings section
#define ED_MODE_LEVELINFO_LEVEL ED_TEXTBUTTON_ID_LEVELINFO_LEVEL
#define ED_MODE_LEVELINFO_LEVELSET ED_TEXTBUTTON_ID_LEVELINFO_LEVELSET
#define ED_MODE_LEVELINFO_EDITOR ED_TEXTBUTTON_ID_LEVELINFO_EDITOR
-/* sub-screens in the element properties section */
+// sub-screens in the element properties section
#define ED_MODE_PROPERTIES_INFO ED_TEXTBUTTON_ID_PROPERTIES_INFO
#define ED_MODE_PROPERTIES_CONFIG ED_TEXTBUTTON_ID_PROPERTIES_CONFIG
#define ED_MODE_PROPERTIES_CONFIG_1 ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_1
#define ED_MODE_PROPERTIES_CONFIG_2 ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_2
#define ED_MODE_PROPERTIES_CHANGE ED_TEXTBUTTON_ID_PROPERTIES_CHANGE
-/* how many steps can be cancelled */
+// how many steps can be cancelled
#define NUM_UNDO_STEPS (64 + 1)
-/* values for elements with score for certain actions */
+// values for elements with score for certain actions
#define MIN_SCORE 0
#define MAX_SCORE 999
-/* values for elements with count for collecting */
+// values for elements with count for collecting
#define MIN_COLLECT_COUNT 0
#define MAX_COLLECT_COUNT 999
-/* values for random placement */
+// values for random placement
#define RANDOM_USE_PERCENTAGE 0
#define RANDOM_USE_QUANTITY 1
-/* values for level set save mode */
+// values for level set save mode
#define LEVELSET_SAVE_MODE_UPDATE 0
#define LEVELSET_SAVE_MODE_CREATE 1
-/* default value for element tile size in drawing area */
+// default value for element tile size in drawing area
#define DEFAULT_EDITOR_TILESIZE MINI_TILESIZE
#define DEFAULT_EDITOR_TILESIZE_MM TILESIZE
/* note: some additional characters are already reserved for "cheat mode"
shortcuts (":XYZ" style) -- for details, see "events.c" */
- /* ---------- toolbox control buttons ------------------------------------ */
+ // ---------- toolbox control buttons ---------------------------------------
{
IMG_GFX_EDITOR_BUTTON_DRAW_SINGLE, GADGET_ID_SINGLE_ITEMS,
"pick drawing element", ','
},
- /* ---------- level control buttons -------------------------------------- */
+ // ---------- level control buttons -----------------------------------------
{
IMG_GFX_EDITOR_BUTTON_UNDO, GADGET_ID_UNDO,
"exit level editor", 'E'
},
- /* ---------- CE and GE control buttons ---------------------------------- */
+ // ---------- CE and GE control buttons -------------------------------------
{
IMG_GFX_EDITOR_BUTTON_CE_COPY_FROM, GADGET_ID_CUSTOM_COPY_FROM,
"paste settings to this element", 0
},
- /* ---------- palette control buttons ------------------------------------ */
+ // ---------- palette control buttons ---------------------------------------
{
IMG_GFX_EDITOR_BUTTON_PROPERTIES, GADGET_ID_PROPERTIES,
char *text_above, *text_left, *text_right;
} counterbutton_info[ED_NUM_COUNTERBUTTONS] =
{
- /* ---------- current level number --------------------------------------- */
+ // ---------- current level number ------------------------------------------
{
- -1, -1, /* these values are not constant, but can change at runtime */
+ -1, -1, // these values are not constant, but can change at runtime
1, 100,
GADGET_ID_SELECT_LEVEL_DOWN, GADGET_ID_SELECT_LEVEL_UP,
GADGET_ID_SELECT_LEVEL_TEXT, GADGET_ID_NONE,
NULL, NULL, NULL
},
- /* ---------- level and editor settings ---------------------------------- */
+ // ---------- level and editor settings -------------------------------------
{
ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(4),
"random element placement:", NULL, "in"
},
- /* ---------- element settings: configure (various elements) ------------- */
+ // ---------- element settings: configure (various elements) ----------------
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
MIN_SCORE, MAX_SCORE,
GADGET_ID_ELEMENT_VALUE1_DOWN, GADGET_ID_ELEMENT_VALUE1_UP,
GADGET_ID_ELEMENT_VALUE1_TEXT, GADGET_ID_NONE,
- NULL, /* will be set when used */
+ NULL, // will be set when used
NULL, NULL, NULL
},
{
MIN_SCORE, MAX_SCORE,
GADGET_ID_ELEMENT_VALUE2_DOWN, GADGET_ID_ELEMENT_VALUE2_UP,
GADGET_ID_ELEMENT_VALUE2_TEXT, GADGET_ID_NONE,
- NULL, /* will be set when used */
+ NULL, // will be set when used
NULL, NULL, NULL
},
{
MIN_SCORE, MAX_SCORE,
GADGET_ID_ELEMENT_VALUE3_DOWN, GADGET_ID_ELEMENT_VALUE3_UP,
GADGET_ID_ELEMENT_VALUE3_TEXT, GADGET_ID_NONE,
- NULL, /* will be set when used */
+ NULL, // will be set when used
NULL, NULL, NULL
},
{
MIN_SCORE, MAX_SCORE,
GADGET_ID_ELEMENT_VALUE4_DOWN, GADGET_ID_ELEMENT_VALUE4_UP,
GADGET_ID_ELEMENT_VALUE4_TEXT, GADGET_ID_NONE,
- NULL, /* will be set when used */
+ NULL, // will be set when used
NULL, NULL, NULL
},
{
MIN_ENVELOPE_XSIZE, MAX_ENVELOPE_XSIZE,
GADGET_ID_ENVELOPE_XSIZE_DOWN, GADGET_ID_ENVELOPE_XSIZE_UP,
GADGET_ID_ENVELOPE_XSIZE_TEXT, GADGET_ID_NONE,
- NULL, /* will be set when used */
+ NULL, // will be set when used
NULL, NULL, "width",
},
{
MIN_ENVELOPE_YSIZE, MAX_ENVELOPE_YSIZE,
GADGET_ID_ENVELOPE_YSIZE_DOWN, GADGET_ID_ENVELOPE_YSIZE_UP,
GADGET_ID_ENVELOPE_YSIZE_TEXT, GADGET_ID_ENVELOPE_XSIZE_UP,
- NULL, /* will be set when used */
+ NULL, // will be set when used
NULL, " ", "height",
},
{
NULL, NULL, "number of inventory elements"
},
- /* ---------- element settings: configure 1 (custom elements) ------------ */
+ // ---------- element settings: configure 1 (custom elements) ---------------
{
ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(5),
NULL, "+random", NULL
},
- /* ---------- element settings: configure 2 (custom elements) ------------ */
+ // ---------- element settings: configure 2 (custom elements) ---------------
{
ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(5),
NULL, "ignition delay", "(by fire)"
},
- /* ---------- element settings: configure (group elements) --------------- */
+ // ---------- element settings: configure (group elements) ------------------
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(3),
NULL, NULL, "number of elements in group"
},
- /* ---------- element settings: advanced (custom elements) --------------- */
+ // ---------- element settings: advanced (custom elements) ------------------
{
ED_ELEMENT_SETTINGS_XPOS(2), ED_ELEMENT_SETTINGS_YPOS(2),
"Author:", "Author for this or new level set"
},
{
- -1, -1, /* these values are not constant, but can change at runtime */
+ -1, -1, // these values are not constant, but can change at runtime
GADGET_ID_ELEMENT_NAME,
- MAX_ELEMENT_NAME_LEN - 2, /* currently 2 chars less editable */
+ MAX_ELEMENT_NAME_LEN - 2, // currently 2 chars less editable
custom_element.description,
NULL, "Element name"
}
int x, y;
int gadget_id;
int gadget_id_align;
- int size; /* char size of selectbox or '-1' (dynamically determined) */
+ int size; // char size of selectbox or '-1' (dynamically determined)
struct ValueTextInfo *options;
int *value;
char *text_above, *text_left, *text_right, *infotext;
} selectbox_info[ED_NUM_SELECTBOX] =
{
- /* ---------- level and editor settings ---------------------------------- */
+ // ---------- level and editor settings -------------------------------------
{
-1, ED_LEVEL_SETTINGS_YPOS(8),
"Action:", NULL, NULL, "action when saving level set"
},
- /* ---------- element settings: configure (several elements) ------------- */
+ // ---------- element settings: configure (several elements) ----------------
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
NULL, "initial player speed:", NULL, "initial player speed"
},
- /* ---------- element settings: configure 1 (custom elements) ------------ */
+ // ---------- element settings: configure 1 (custom elements) ---------------
{
ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(2),
NULL, NULL, NULL, "diggable/collectible/pushable"
},
- /* ---------- element settings: configure 2 (custom elements) ------------ */
+ // ---------- element settings: configure 2 (custom elements) ---------------
{
ED_ELEMENT_SETTINGS_XPOS(1), ED_ELEMENT_SETTINGS_YPOS(1),
NULL, "can explode", NULL, "explosion type"
},
- /* ---------- element settings: advanced (custom elements) --------------- */
+ // ---------- element settings: advanced (custom elements) ------------------
{
ED_ELEMENT_SETTINGS_XPOS(2), ED_ELEMENT_SETTINGS_YPOS(3),
NULL, NULL, NULL, "element change page"
},
- /* ---------- element settings: configure (group elements) --------------- */
+ // ---------- element settings: configure (group elements) ------------------
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(4),
char *text_above, *text_left, *text_right, *infotext;
} textbutton_info[ED_NUM_TEXTBUTTONS] =
{
- /* ---------- level and editor settings (tabs) --------------------------- */
+ // ---------- level and editor settings (tabs) ------------------------------
{
ED_LEVEL_TABS_XPOS(0), ED_LEVEL_TABS_YPOS(0),
NULL, NULL, NULL, "Configure editor properties"
},
- /* ---------- element settings (tabs) ------------------------------------ */
+ // ---------- element settings (tabs) ---------------------------------------
{
ED_ELEMENT_TABS_XPOS(0), ED_ELEMENT_TABS_YPOS(0),
NULL, NULL, NULL, "Configure custom element change pages"
},
- /* ---------- level and editor settings (buttons) ------------------------ */
+ // ---------- level and editor settings (buttons) ---------------------------
{
ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(10),
"Save current settings as new template"
},
- /* ---------- element settings (buttons) --------------------------------- */
+ // ---------- element settings (buttons) ------------------------------------
{
-1, -1,
char *text_above, *text_left, *text_right, *infotext;
} checkbutton_info[ED_NUM_CHECKBUTTONS] =
{
- /* ---------- level and editor settings ---------------------------------- */
+ // ---------- level and editor settings -------------------------------------
{
ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(6),
"use template for custom elements", "use template for custom properties"
},
- /* ---------- element settings: configure (various elements) ------------- */
+ // ---------- element settings: configure (various elements) ----------------
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0),
"blue", "use blue color components in laser"
},
- /* ---------- element settings: configure 1 (custom elements) ----------- */
+ // ---------- element settings: configure 1 (custom elements) ---------------
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
"indestructible", "element is indestructible"
},
- /* ---------- element settings: configure 2 (custom elements) ----------- */
+ // ---------- element settings: configure 2 (custom elements) ---------------
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
"impact", "element can explode on impact"
},
- /* ---------- element settings: advanced (custom elements) --------------- */
+ // ---------- element settings: advanced (custom elements) ------------------
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1),
char *text_left, *text_right, *text_below, *infotext;
} drawingarea_info[ED_NUM_DRAWING_AREAS] =
{
- /* ---------- level playfield content ------------------------------------ */
+ // ---------- level playfield content ---------------------------------------
{
0, 0,
0, 0,
GADGET_ID_DRAWING_LEVEL, GADGET_ID_NONE,
NULL,
- -1, -1, /* these values are not constant, but can change at runtime */
+ -1, -1, // these values are not constant, but can change at runtime
NULL, NULL, NULL, NULL
},
- /* ---------- yam yam content -------------------------------------------- */
+ // ---------- yam yam content -----------------------------------------------
{
ED_AREA_YAMYAM_CONTENT_XPOS, ED_AREA_YAMYAM_CONTENT_YPOS,
NULL, NULL, "8", NULL
},
- /* ---------- magic ball content ----------------------------------------- */
+ // ---------- magic ball content --------------------------------------------
{
ED_AREA_MAGIC_BALL_CONTENT_XPOS, ED_AREA_MAGIC_BALL_CONTENT_YPOS,
NULL, NULL, "8", NULL
},
- /* ---------- android content -------------------------------------------- */
+ // ---------- android content -----------------------------------------------
{
ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(5),
"elements:", NULL, NULL, "elements android can clone"
},
- /* ---------- amoeba content --------------------------------------------- */
+ // ---------- amoeba content ------------------------------------------------
{
ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(3),
"content:", NULL, NULL, "amoeba content"
},
- /* ---------- level start element ---------------------------------------- */
+ // ---------- level start element -------------------------------------------
{
-1, ED_AREA_1X1_SETTINGS_YPOS(10),
NULL, NULL, NULL, "level start element"
},
- /* ---------- player artwork element ------------------------------------- */
+ // ---------- player artwork element ----------------------------------------
{
-1, ED_AREA_1X1_SETTINGS_YPOS(11),
NULL, NULL, NULL, "element for player artwork"
},
- /* ---------- player explosion element ----------------------------------- */
+ // ---------- player explosion element --------------------------------------
{
-1, ED_AREA_1X1_SETTINGS_YPOS(12),
NULL, NULL, NULL, "element for player explosion"
},
- /* ---------- player initial inventory ----------------------------------- */
+ // ---------- player initial inventory --------------------------------------
{
-1, ED_AREA_1X1_SETTINGS_YPOS(1),
NULL, NULL, NULL, "content for initial inventory"
},
- /* ---------- element settings: configure 1 (custom elements) ----------- */
+ // ---------- element settings: configure 1 (custom elements) ---------------
- /* ---------- custom graphic --------------------------------------------- */
+ // ---------- custom graphic ------------------------------------------------
{
-1, ED_AREA_1X1_SETTINGS_YPOS(1),
NULL, NULL, NULL, "custom graphic element"
},
- /* ---------- element settings: configure 2 (custom elements) ----------- */
+ // ---------- element settings: configure 2 (custom elements) ---------------
- /* ---------- custom content (when exploding) ---------------------------- */
+ // ---------- custom content (when exploding) -------------------------------
{
-1, ED_AREA_3X3_SETTINGS_YPOS(10),
0, ED_AREA_3X3_SETTINGS_YOFF,
- GADGET_ID_CUSTOM_CONTENT, GADGET_ID_NONE, /* align three rows */
+ GADGET_ID_CUSTOM_CONTENT, GADGET_ID_NONE, // align three rows
&custom_element.content.e[0][0], 3, 3,
"content:", NULL, NULL, NULL
},
- /* ---------- custom enter and leave element (when moving) --------------- */
+ // ---------- custom enter and leave element (when moving) ------------------
{
ED_AREA_1X1_SETTINGS_XPOS(1), ED_AREA_1X1_SETTINGS_YPOS(3),
NULL, NULL, NULL, "element that will be left behind"
},
- /* ---------- element settings: advanced (custom elements) --------------- */
+ // ---------- element settings: advanced (custom elements) ------------------
- /* ---------- custom change target --------------------------------------- */
+ // ---------- custom change target ------------------------------------------
{
-1, ED_AREA_1X1_SETTINGS_YPOS(1),
NULL, "after/when:", NULL, "new target element after change"
},
- /* ---------- custom change content (extended change target) ------------- */
+ // ---------- custom change content (extended change target) ----------------
{
-1, ED_AREA_3X3_SETTINGS_YPOS(9),
0, ED_AREA_3X3_SETTINGS_YOFF,
- GADGET_ID_CUSTOM_CHANGE_CONTENT, GADGET_ID_NONE, /* align three rows */
+ GADGET_ID_CUSTOM_CHANGE_CONTENT, GADGET_ID_NONE, // align three rows
&custom_element_change.target_content.e[0][0], 3, 3,
NULL, NULL, NULL, "new extended elements after change"
},
- /* ---------- custom change trigger (element causing change) ------------- */
+ // ---------- custom change trigger (element causing change) ----------------
{
-1, ED_AREA_1X1_SETTINGS_YPOS(5),
NULL, NULL, NULL, "other element triggering change"
},
- /* ---------- custom change action (element used for action) ------------- */
+ // ---------- custom change action (element used for action) ----------------
{
-1, ED_AREA_1X1_SETTINGS_YPOS(13),
NULL, NULL, NULL, "element used as action parameter"
},
- /* ---------- group element content -------------------------------------- */
+ // ---------- group element content -----------------------------------------
{
ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(2),
"content:", NULL, NULL, NULL
},
- /* ---------- random background (for random painting) -------------------- */
+ // ---------- random background (for random painting) -----------------------
{
-1, ED_AREA_1X1_LSETTINGS_YPOS(1),
-----------------------------------------------------------------------------
*/
-/* maximal size of level editor drawing area */
+// maximal size of level editor drawing area
static int MAX_ED_FIELDX, MAX_ED_FIELDY;
-/* actual size of level editor drawing area */
+// actual size of level editor drawing area
static int ed_fieldx, ed_fieldy;
-/* actual position of level editor drawing area in level playfield */
+// actual position of level editor drawing area in level playfield
static int level_xpos = -1, level_ypos = -1;
-/* actual tile size used to display playfield drawing area */
+// actual tile size used to display playfield drawing area
static int ed_tilesize = DEFAULT_EDITOR_TILESIZE;
static int ed_tilesize_default = DEFAULT_EDITOR_TILESIZE;
#define IN_ED_FIELD(x,y) IN_FIELD(x, y, ed_fieldx, ed_fieldy)
-/* drawing elements on the three mouse buttons */
+// drawing elements on the three mouse buttons
static int new_element1 = EL_WALL;
static int new_element2 = EL_EMPTY;
static int new_element3 = EL_SAND;
#define PXSIZE (use_permanent_palette ? DXSIZE : SXSIZE)
#define PYSIZE (use_permanent_palette ? DYSIZE : SYSIZE)
-/* forward declaration for internal use */
+// forward declaration for internal use
static void ModifyEditorCounterValue(int, int);
static void ModifyEditorCounterLimits(int, int, int);
static void ModifyEditorSelectboxValue(int, int);
static int getTabulatorBarHeight(void);
static Pixel getTabulatorBarColor(void);
-static int num_editor_gadgets = 0; /* dynamically determined */
+static int num_editor_gadgets = 0; // dynamically determined
static struct GadgetInfo **level_editor_gadget = NULL;
static int *right_gadget_border = NULL;
static int editor_el_rnd[] =
{
- EL_DYNAMITE, /* RND */
- EL_DYNAMITE_ACTIVE, /* RND */
+ EL_DYNAMITE, // RND
+ EL_DYNAMITE_ACTIVE, // RND
EL_EMPTY,
EL_EMPTY,
EL_PACMAN_LEFT,
EL_DARK_YAMYAM,
EL_PACMAN_RIGHT,
- EL_YAMYAM, /* RND */
+ EL_YAMYAM, // RND
EL_BLACK_ORB,
EL_PACMAN_DOWN,
static int editor_el_diamond_caves[] =
{
- EL_EM_STEEL_EXIT_CLOSED, /* DC2 */
- EL_EM_STEEL_EXIT_OPEN, /* DC2 */
- EL_WALL_EMERALD, /* DC2 */
- EL_WALL_DIAMOND, /* DC2 */
+ EL_EM_STEEL_EXIT_CLOSED, // DC2
+ EL_EM_STEEL_EXIT_OPEN, // DC2
+ EL_WALL_EMERALD, // DC2
+ EL_WALL_DIAMOND, // DC2
EL_PEARL,
EL_CRYSTAL,
static int num_editor_el_dynamic = 0;
static int editor_hl_empty[] = { EL_EMPTY };
-static int *editor_el_empty = NULL; /* dynamically allocated */
+static int *editor_el_empty = NULL; // dynamically allocated
static int *editor_hl_empty_ptr = editor_hl_empty;
static int *editor_el_empty_ptr = NULL;
static int num_editor_hl_empty = 0;
-static int num_editor_el_empty = 0; /* dynamically determined, if needed */
+static int num_editor_el_empty = 0; // dynamically determined, if needed
static boolean use_el_empty = FALSE;
-static int *editor_elements = NULL; /* dynamically allocated */
-static int num_editor_elements = 0; /* dynamically determined */
+static int *editor_elements = NULL; // dynamically allocated
+static int num_editor_elements = 0; // dynamically determined
static boolean setup_editor_cascade_never = FALSE;
checked_free(filename);
- /* 1st try: look for element description in current level set directory */
+ // 1st try: look for element description in current level set directory
filename = getPath3(getCurrentLevelDir(), elements_subdir2, basename);
if (fileExists(filename))
return filename;
free(filename);
- /* 2nd try: look for element description in the game's base directory */
+ // 2nd try: look for element description in the game's base directory
filename = getPath3(options.docs_directory, elements_subdir, basename);
if (fileExists(filename))
return filename;
char basename[MAX_FILENAME_LEN];
char *filename;
- /* 1st try: look for element description file for exactly this element */
+ // 1st try: look for element description file for exactly this element
sprintf(basename, "%s.txt", element_info[element].token_name);
filename = getElementDescriptionFilenameExt(basename);
if (filename != NULL)
return filename;
- /* 2nd try: look for element description file for this element's class */
+ // 2nd try: look for element description file for this element's class
sprintf(basename, "%s.txt", element_info[element].class_name);
filename = getElementDescriptionFilenameExt(basename);
if (filename != NULL)
boolean element_found[NUM_FILE_ELEMENTS];
int i, x, y;
- /* initialize list of used elements to "not used" */
+ // initialize list of used elements to "not used"
for (i = 0; i < NUM_FILE_ELEMENTS; i++)
element_found[i] = FALSE;
- /* find all elements used in current level */
+ // find all elements used in current level
for (y = 0; y < lev_fieldy; y++)
for (x = 0; x < lev_fieldx; x++)
- if (Feld[x][y] < NUM_FILE_ELEMENTS) /* should always be true */
+ if (Feld[x][y] < NUM_FILE_ELEMENTS) // should always be true
element_found[Feld[x][y]] = TRUE;
*num_elements = 0;
- /* count number of elements used in current level */
+ // count number of elements used in current level
for (i = 0; i < NUM_FILE_ELEMENTS; i++)
if (element_found[i])
(*num_elements)++;
- /* add space for up to 3 more elements for padding that may be needed */
+ // add space for up to 3 more elements for padding that may be needed
*num_elements += 3;
- /* free memory for old list of elements, if needed */
+ // free memory for old list of elements, if needed
checked_free(*elements);
- /* allocate memory for new list of elements */
+ // allocate memory for new list of elements
*elements = checked_malloc(*num_elements * sizeof(int));
*num_elements = 0;
- /* add all elements used in current level (non-custom/group elements) */
+ // add all elements used in current level (non-custom/group elements)
for (i = 0; i < NUM_FILE_ELEMENTS; i++)
if (element_found[i] && !(IS_CUSTOM_ELEMENT(i) || IS_GROUP_ELEMENT(i)))
(*elements)[(*num_elements)++] = i;
- /* add all elements used in current level (custom/group elements) */
+ // add all elements used in current level (custom/group elements)
for (i = 0; i < NUM_FILE_ELEMENTS; i++)
if (element_found[i] && (IS_CUSTOM_ELEMENT(i) || IS_GROUP_ELEMENT(i)))
(*elements)[(*num_elements)++] = i;
- while (*num_elements % 4) /* pad with empty elements, if needed */
+ while (*num_elements % 4) // pad with empty elements, if needed
(*elements)[(*num_elements)++] = EL_EMPTY;
}
static void ReinitializeElementList_EnableSections(void)
{
- /* default: enable all element sections */
+ // default: enable all element sections
setup_editor_el_players = TRUE;
setup_editor_el_boulderdash = TRUE;
setup_editor_el_user_defined = TRUE;
setup_editor_el_dynamic = TRUE;
- /* now disable all element sections not to be displayed */
+ // now disable all element sections not to be displayed
if (!setup.editor.el_classic)
{
if (initialization_needed)
{
- LoadSetup_EditorCascade(); /* load last editor cascade state */
+ LoadSetup_EditorCascade(); // load last editor cascade state
- /* initialize editor cascade element from saved cascade state */
+ // initialize editor cascade element from saved cascade state
for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
{
int *cascade_element = &(*editor_elements_info[i].headline_list)[0];
checked_free(editor_elements);
- /* reload optional user defined element list for each invocation of editor */
+ // reload optional user defined element list for each invocation of editor
LoadUserDefinedEditorElementList(&editor_el_user_defined_ptr,
&num_editor_el_user_defined);
- /* initialize dynamic level element list for each invocation of editor */
+ // initialize dynamic level element list for each invocation of editor
InitDynamicEditorElementList(&editor_el_dynamic_ptr,
&num_editor_el_dynamic);
- /* initialize list of empty elements (used for padding, if needed) */
+ // initialize list of empty elements (used for padding, if needed)
for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
editor_el_empty[i] = EL_EMPTY;
- /* do some sanity checks for each element from element list */
+ // do some sanity checks for each element from element list
for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
{
for (j = 0; j < *editor_elements_info[i].element_list_size; j++)
num_editor_elements = 0;
use_el_empty = FALSE;
- /* determine size of element list */
+ // determine size of element list
for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
{
boolean found_inactive_cascade = FALSE;
if (num_editor_elements < ED_NUM_ELEMENTLIST_BUTTONS)
{
- /* offer at least as many elements as element buttons exist */
+ // offer at least as many elements as element buttons exist
use_el_empty = TRUE;
num_editor_el_empty = ED_NUM_ELEMENTLIST_BUTTONS - num_editor_elements;
editor_elements = checked_malloc(num_editor_elements * sizeof(int));
- /* fill element list */
+ // fill element list
for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
{
boolean found_inactive_cascade = FALSE;
}
}
- /* (this function is also called before editor gadgets are initialized!) */
+ // (this function is also called before editor gadgets are initialized!)
AdjustElementListScrollbar();
}
static boolean initialization_needed = TRUE;
int i;
- if (!initialization_needed) /* check if editor element setup has changed */
+ if (!initialization_needed) // check if editor element setup has changed
{
if (last_setup_value_headlines != setup.editor.el_headlines)
initialization_needed = TRUE;
FreeLevelEditorGadgets();
CreateLevelEditorGadgets();
- /* store current setup values for next invocation of this function */
+ // store current setup values for next invocation of this function
last_setup_value_headlines = setup.editor.el_headlines;
for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
editor_elements_info[i].last_setup_value =
int ysize_thin = (ysize < ed_tilesize ? 1 : ysize);
Pixel line_color = getTabulatorBarColor();
- if (line_color == BLACK_PIXEL) /* black => transparent */
+ if (line_color == BLACK_PIXEL) // black => transparent
return;
FillRectangle(drawto, SX + x, SY + y, xsize_tile, ysize_tile, BLACK_PIXEL);
if (!suppressBorderElement())
return;
- /* draw little border line around editable level playfield */
+ // draw little border line around editable level playfield
if (xsize < SXSIZE)
DrawEditorLevelBorderLine(xsize, 0, line_size, ysize);
struct GadgetInfo *gi;
int i;
- /* create toolbox buttons */
+ // create toolbox buttons
for (i = 0; i < ED_NUM_CTRL_BUTTONS; i++)
{
int id = controlbutton_info[i].gadget_id;
level_editor_gadget[id] = gi;
}
- /* these values are not constant, but can change at runtime */
+ // these values are not constant, but can change at runtime
scrollbutton_pos[ED_SCROLLBUTTON_ID_AREA_UP].x = ED_SCROLL_UP_XPOS;
scrollbutton_pos[ED_SCROLLBUTTON_ID_AREA_UP].y = ED_SCROLL_UP_YPOS;
scrollbutton_pos[ED_SCROLLBUTTON_ID_AREA_DOWN].x = ED_SCROLL_DOWN_XPOS;
scrollbutton_pos[ED_SCROLLBUTTON_ID_LIST_DOWN].x = ED_SCROLL2_DOWN_XPOS;
scrollbutton_pos[ED_SCROLLBUTTON_ID_LIST_DOWN].y = ED_SCROLL2_DOWN_YPOS;
- /* create buttons for scrolling of drawing area and element list */
+ // create buttons for scrolling of drawing area and element list
for (i = 0; i < ED_NUM_SCROLLBUTTONS; i++)
{
int id = scrollbutton_info[i].gadget_id;
level_editor_gadget[id] = gi;
}
- /* create buttons for element list */
+ // create buttons for element list
for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
{
int id = GADGET_ID_ELEMENTLIST_FIRST + i;
for (i = 0; i < ED_NUM_COUNTERBUTTONS; i++)
{
int j;
- int x = SX + ED_SETTINGS_X(counterbutton_info[i].x); /* down count button */
+ int x = SX + ED_SETTINGS_X(counterbutton_info[i].x); // down count button
int y = SY + ED_SETTINGS_Y(counterbutton_info[i].y);
- /* determine horizontal position to the right of specified gadget */
+ // determine horizontal position to the right of specified gadget
if (counterbutton_info[i].gadget_id_align != GADGET_ID_NONE)
x = (right_gadget_border[counterbutton_info[i].gadget_id_align] +
ED_GADGET_TEXT_DISTANCE);
- /* determine horizontal offset for leading text */
+ // determine horizontal offset for leading text
if (counterbutton_info[i].text_left != NULL)
x += getTextWidthForGadget(counterbutton_info[i].text_left);
right_gadget_border[id] =
getRightGadgetBorder(gi, counterbutton_info[i].text_right);
- x += gi->width + ED_GADGET_SMALL_DISTANCE; /* text count button */
+ x += gi->width + ED_GADGET_SMALL_DISTANCE; // text count button
if (j == 0)
{
GDI_NUMBER_VALUE, 0,
GDI_NUMBER_MIN, counterbutton_info[i].min_value,
GDI_NUMBER_MAX, counterbutton_info[i].max_value,
- GDI_TEXT_SIZE, 3, /* minimal counter text size */
+ GDI_TEXT_SIZE, 3, // minimal counter text size
GDI_TEXT_FONT, font_type,
GDI_TEXT_FONT_ACTIVE, font_type_active,
GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y1,
right_gadget_border[id] =
getRightGadgetBorder(gi, counterbutton_info[i].text_right);
- x += gi->width + ED_GADGET_SMALL_DISTANCE; /* up count button */
+ x += gi->width + ED_GADGET_SMALL_DISTANCE; // up count button
}
}
}
{
int i;
- /* these values are not constant, but can change at runtime */
+ // these values are not constant, but can change at runtime
drawingarea_info[ED_DRAWING_ID_DRAWING_LEVEL].area_xsize = MAX_ED_FIELDX;
drawingarea_info[ED_DRAWING_ID_DRAWING_LEVEL].area_ysize = MAX_ED_FIELDY;
GD_EVENT_PRESSED | GD_EVENT_RELEASED | GD_EVENT_MOVING |
GD_EVENT_OFF_BORDERS | GD_EVENT_PIXEL_PRECISE;
- /* determine horizontal position to the right of specified gadget */
+ // determine horizontal position to the right of specified gadget
if (drawingarea_info[i].gadget_id_align != GADGET_ID_NONE)
x = (right_gadget_border[drawingarea_info[i].gadget_id_align] +
ED_DRAWINGAREA_TEXT_DISTANCE);
- /* determine horizontal offset for leading text */
+ // determine horizontal offset for leading text
if (drawingarea_info[i].text_left != NULL)
x += getTextWidthForDrawingArea(drawingarea_info[i].text_left);
int x = SX + ED_SETTINGS_X(selectbox_info[i].x);
int y = SY + ED_SETTINGS_Y(selectbox_info[i].y);
- if (selectbox_info[i].size == -1) /* dynamically determine size */
+ if (selectbox_info[i].size == -1) // dynamically determine size
{
/* (we cannot use -1 for uninitialized values if we directly compare
with results from strlen(), because the '<' and '>' operation will
if (strlen(selectbox_info[i].options[j].text) > selectbox_info[i].size)
selectbox_info[i].size = strlen(selectbox_info[i].options[j].text);
- selectbox_info[i].size++; /* add one character empty space */
+ selectbox_info[i].size++; // add one character empty space
}
event_mask = GD_EVENT_RELEASED |
GD_EVENT_TEXT_RETURN | GD_EVENT_TEXT_LEAVING;
- /* determine horizontal position to the right of specified gadget */
+ // determine horizontal position to the right of specified gadget
if (selectbox_info[i].gadget_id_align != GADGET_ID_NONE)
x = (right_gadget_border[selectbox_info[i].gadget_id_align] +
ED_GADGET_TEXT_DISTANCE);
- /* determine horizontal offset for leading text */
+ // determine horizontal offset for leading text
if (selectbox_info[i].text_left != NULL)
x += getTextWidthForGadget(selectbox_info[i].text_left);
int x = SX + ED_SETTINGS_X(textbutton_info[i].x);
int y = SY + ED_SETTINGS_Y(textbutton_info[i].y);
- if (textbutton_info[i].size == -1) /* dynamically determine size */
+ if (textbutton_info[i].size == -1) // dynamically determine size
textbutton_info[i].size = strlen(textbutton_info[i].text);
event_mask = GD_EVENT_RELEASED;
sprintf(infotext, "%s", textbutton_info[i].infotext);
infotext[max_infotext_len] = '\0';
- /* determine horizontal position to the right of specified gadget */
+ // determine horizontal position to the right of specified gadget
if (textbutton_info[i].gadget_id_align != GADGET_ID_NONE)
{
int gadget_id_align = textbutton_info[i].gadget_id_align;
y = level_editor_gadget[gadget_id_align]->y;
}
- /* determine horizontal offset for leading text */
+ // determine horizontal offset for leading text
if (textbutton_info[i].text_left != NULL)
x += getTextWidthForGadget(textbutton_info[i].text_left);
unsigned int event_mask;
int i;
- /* create buttons for scrolling of drawing area and element list */
+ // create buttons for scrolling of drawing area and element list
for (i = 0; i < ED_NUM_GRAPHICBUTTONS; i++)
{
int id = graphicbutton_info[i].gadget_id;
event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED;
- /* determine horizontal position to the right of specified gadget */
+ // determine horizontal position to the right of specified gadget
if (graphicbutton_info[i].gadget_id_align != GADGET_ID_NONE)
x = (right_gadget_border[graphicbutton_info[i].gadget_id_align] +
ED_GADGET_TEXT_DISTANCE);
- /* determine horizontal offset for leading text */
+ // determine horizontal offset for leading text
if (graphicbutton_info[i].text_left != NULL)
x += getTextWidthForGadget(graphicbutton_info[i].text_left);
{
int i;
- /* these values are not constant, but can change at runtime */
+ // these values are not constant, but can change at runtime
scrollbar_pos[ED_SCROLLBAR_ID_AREA_HORIZONTAL].x =
SX + ED_SCROLL_HORIZONTAL_XPOS;
scrollbar_pos[ED_SCROLLBAR_ID_AREA_HORIZONTAL].y =
items_visible = ED_ELEMENTLIST_BUTTONS_VERT;
item_position = element_shift / ED_ELEMENTLIST_BUTTONS_HORIZ;
}
- else /* drawing area scrollbars */
+ else // drawing area scrollbars
{
if (scrollbar_info[i].type == GD_TYPE_SCROLLBAR_HORIZONTAL)
{
int x = SX + ED_SETTINGS_X(checkbutton_info[i].x);
int y = SY + ED_SETTINGS_Y(checkbutton_info[i].y);
- /* determine horizontal position to the right of specified gadget */
+ // determine horizontal position to the right of specified gadget
if (checkbutton_info[i].gadget_id_align != GADGET_ID_NONE)
x = (right_gadget_border[checkbutton_info[i].gadget_id_align] +
ED_GADGET_TEXT_DISTANCE);
- /* determine horizontal offset for leading text */
+ // determine horizontal offset for leading text
if (checkbutton_info[i].text_left != NULL)
x += getTextWidthForGadget(checkbutton_info[i].text_left);
int checked =
(*radiobutton_info[i].value == radiobutton_info[i].checked_value);
- /* determine horizontal position to the right of specified gadget */
+ // determine horizontal position to the right of specified gadget
if (radiobutton_info[i].gadget_id_align != GADGET_ID_NONE)
x = (right_gadget_border[radiobutton_info[i].gadget_id_align] +
ED_GADGET_TEXT_DISTANCE);
- /* determine horizontal offset for leading text */
+ // determine horizontal offset for leading text
if (radiobutton_info[i].text_left != NULL)
x += getTextWidthForGadget(radiobutton_info[i].text_left);
void CreateLevelEditorGadgets(void)
{
- /* force EDITOR font inside level editor */
+ // force EDITOR font inside level editor
SetFontStatus(GAME_MODE_EDITOR);
- /* these values are not constant, but can change at runtime */
+ // these values are not constant, but can change at runtime
ed_fieldx = MAX_ED_FIELDX - 1;
ed_fieldy = MAX_ED_FIELDY - 1;
CreateControlButtons();
CreateScrollbarGadgets();
- /* order of function calls is important because of cross-references */
+ // order of function calls is important because of cross-references
CreateCheckbuttonGadgets();
CreateCounterButtons();
CreateRadiobuttonGadgets();
int yoffset_above = font_height + ED_GADGET_LINE_DISTANCE;
int yoffset = (gi_down->height - font_height) / 2;
int x_left = gi_down->x - xoffset_left;
- int x_right; /* set after gadget position was modified */
+ int x_right; // set after gadget position was modified
int y_above = gi_down->y - yoffset_above;
int x = gi_down->x;
- int y; /* set after gadget position was modified */
+ int y; // set after gadget position was modified
- /* counter limits must be changed first to prevent value truncation */
+ // counter limits must be changed first to prevent value truncation
ModifyEditorCounterLimits(id, counterbutton_info[id].min_value,
counterbutton_info[id].max_value);
- /* right text position might have changed after setting position above */
+ // right text position might have changed after setting position above
x_right = gi_up->x + gi_up->width + xoffset_right;
ModifyEditorCounterValue(id, *counterbutton_info[id].value);
- /* set position for "value[1,2,3,4]" counter gadgets (score in most cases) */
+ // set position for "value[1,2,3,4]" counter gadgets (score in most cases)
if (id >= ED_COUNTER_ID_ELEMENT_VALUE1 &&
id <= ED_COUNTER_ID_ELEMENT_VALUE4)
{
SY + ED_SETTINGS_Y(counterbutton_info[id].y), GDI_END);
}
- /* vertical position might have changed after setting position above */
+ // vertical position might have changed after setting position above
y = gi_up->y + yoffset;
if (counterbutton_info[id].text_above)
int counter_id;
int i;
- /* map toolbox buttons (excluding special CE toolbox buttons) */
+ // map toolbox buttons (excluding special CE toolbox buttons)
for (i = 0; i < ED_NUM_CTRL1_2_BUTTONS; i++)
MapGadget(level_editor_gadget[i]);
- /* map toolbox buttons (element properties buttons) */
+ // map toolbox buttons (element properties buttons)
for (i = ED_NUM_CTRL1_4_BUTTONS; i < ED_NUM_CTRL1_7_BUTTONS; i++)
MapGadget(level_editor_gadget[i]);
if (use_permanent_palette)
{
- /* map buttons to select elements */
+ // map buttons to select elements
for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
MapGadget(level_editor_gadget[GADGET_ID_ELEMENTLIST_FIRST + i]);
MapGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL]);
MapGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_DOWN]);
}
- /* map buttons to select level */
+ // map buttons to select level
counter_id = ED_COUNTER_ID_SELECT_LEVEL;
counterbutton_info[counter_id].min_value = leveldir_current->first_level;
counterbutton_info[counter_id].max_value = leveldir_current->last_level;
int x = gi->x;
int y = gi->y + yoffset;
- /* only show button to delete change pages when more than minimum pages */
+ // only show button to delete change pages when more than minimum pages
if (id == ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE &&
custom_element.num_change_pages == MIN_CHANGE_PAGES)
return;
int yoffset = (gi->height - font_height) / 2;
int y_above = gi->y - yoffset_above;
int x = gi->x;
- int x_left, x_right, y; /* set after gadget position was modified */
+ int x_left, x_right, y; // set after gadget position was modified
- /* set position for gadgets with dynamically determined position */
- if (checkbutton_info[id].x != -1) /* do not change dynamic positions */
+ // set position for gadgets with dynamically determined position
+ if (checkbutton_info[id].x != -1) // do not change dynamic positions
ModifyGadget(gi, GDI_X, SX + ED_SETTINGS_X(checkbutton_info[id].x),GDI_END);
ModifyGadget(gi, GDI_Y, SY + ED_SETTINGS_Y(checkbutton_info[id].y), GDI_END);
DrawPropertiesWindow();
else if (edit_mode == ED_MODE_PALETTE)
DrawPaletteWindow();
- else /* edit_mode == ED_MODE_DRAWING */
+ else // edit_mode == ED_MODE_DRAWING
DrawDrawingWindowExt(remap_toolbox_gadgets);
}
{
int i;
- /* change action mode and arg variables according to action type variable */
+ // change action mode and arg variables according to action type variable
for (i = 0; action_arg_options[i].value != -1; i++)
{
if (action_arg_options[i].value == custom_element_change.action_type)
{
int mode = action_arg_options[i].mode;
- /* only change if corresponding selectbox has changed */
+ // only change if corresponding selectbox has changed
if (selectbox_info[ED_SELECTBOX_ID_ACTION_MODE].options !=
action_arg_modes[mode])
custom_element_change.action_mode = -1;
- /* only change if corresponding selectbox has changed */
+ // only change if corresponding selectbox has changed
if (selectbox_info[ED_SELECTBOX_ID_ACTION_ARG].options !=
action_arg_options[i].options)
custom_element_change.action_arg = -1;
{
int i;
- /* change action mode and arg selectbox according to action type selectbox */
+ // change action mode and arg selectbox according to action type selectbox
for (i = 0; action_arg_options[i].value != -1; i++)
{
if (action_arg_options[i].value == custom_element_change.action_type)
change->target_content.e[x][y] = element_to;
}
- if (ei->group != NULL) /* group or internal */
+ if (ei->group != NULL) // group or internal
for (j = 0; j < MAX_ELEMENTS_IN_GROUP; j++)
if (ei->group->element[j] == element_from)
ei->group->element[j] = element_to;
level.changed = TRUE;
}
- /* when modifying custom/group element, ask for copying level template */
+ // when modifying custom/group element, ask for copying level template
if (copy_mode_orig != GADGET_ID_CUSTOM_COPY && level.use_custom_template)
{
if (!AskToCopyAndModifyLevelTemplate())
int i;
int current_change_page = element_info[element].current_change_page;
- /* dynamically (re)build selectbox for selecting change page */
+ // dynamically (re)build selectbox for selecting change page
for (i = 0; i < element_info[element].num_change_pages; i++)
{
sprintf(options_change_page_strings[i], "%d", i + 1);
options_change_page[i].value = -1;
options_change_page[i].text = NULL;
- /* needed here to initialize combined element properties */
+ // needed here to initialize combined element properties
InitElementPropertiesEngine(level.game_version);
element_info[element].change =
custom_element = element_info[element];
custom_element_change = *element_info[element].change;
- /* needed to initially set selectbox options for special action options */
+ // needed to initially set selectbox options for special action options
setSelectboxSpecialActionOptions();
- /* needed to initially set selectbox value variables to reliable defaults */
+ // needed to initially set selectbox value variables to reliable defaults
for (i = 0; i < ED_NUM_SELECTBOX; i++)
setSelectboxValue(i, *selectbox_info[i].value);
for (i = 0; i < NUM_CHANGE_EVENTS; i++)
custom_element_change_events[i] = HAS_CHANGE_EVENT(element, i);
- /* ---------- element settings: configure (custom elements) ------------- */
+ // ---------- element settings: configure (custom elements) -----------------
- /* set accessible layer selectbox help value */
+ // set accessible layer selectbox help value
custom_element.access_type =
(IS_WALKABLE(element) ? EP_WALKABLE :
IS_PASSABLE(element) ? EP_PASSABLE :
IS_ACCESSIBLE_INSIDE(element) ||
IS_ACCESSIBLE_UNDER(element));
- /* set walk-to-object action selectbox help value */
+ // set walk-to-object action selectbox help value
custom_element.walk_to_action =
(IS_DIGGABLE(element) ? EP_DIGGABLE :
IS_COLLECTIBLE_ONLY(element) ? EP_COLLECTIBLE_ONLY :
IS_THROWABLE(element) ||
IS_PUSHABLE(element));
- /* set smash targets selectbox help value */
+ // set smash targets selectbox help value
custom_element.smash_targets =
(CAN_SMASH_EVERYTHING(element) ? EP_CAN_SMASH_EVERYTHING :
CAN_SMASH_ENEMIES(element) ? EP_CAN_SMASH_ENEMIES :
CAN_SMASH_ENEMIES(element) ||
CAN_SMASH_PLAYER(element));
- /* set deadliness selectbox help value */
+ // set deadliness selectbox help value
custom_element.deadliness =
(DONT_TOUCH(element) ? EP_DONT_TOUCH :
DONT_GET_HIT_BY(element) ? EP_DONT_GET_HIT_BY :
DONT_COLLIDE_WITH(element) ||
DONT_RUN_INTO(element));
- /* ---------- element settings: advanced (custom elements) --------------- */
+ // ---------- element settings: advanced (custom elements) ------------------
- /* set "change by direct action" selectbox help value */
+ // set "change by direct action" selectbox help value
custom_element_change.direct_action =
(HAS_CHANGE_EVENT(element, CE_TOUCHED_BY_PLAYER) ? CE_TOUCHED_BY_PLAYER :
HAS_CHANGE_EVENT(element, CE_PRESSED_BY_PLAYER) ? CE_PRESSED_BY_PLAYER :
HAS_CHANGE_EVENT(element, CE_SCORE_GETS_ZERO) ? CE_SCORE_GETS_ZERO :
custom_element_change.direct_action);
- /* set "change by other element action" selectbox help value */
+ // set "change by other element action" selectbox help value
custom_element_change.other_action =
(HAS_CHANGE_EVENT(element, CE_PLAYER_TOUCHES_X) ? CE_PLAYER_TOUCHES_X :
HAS_CHANGE_EVENT(element, CE_PLAYER_PRESSES_X) ? CE_PLAYER_PRESSES_X :
static void CopyGroupElementPropertiesToEditor(int element)
{
group_element_info = *element_info[element].group;
- custom_element = element_info[element]; /* needed for description */
+ custom_element = element_info[element]; // needed for description
}
static void CopyClassicElementPropertiesToEditor(int element)
}
else
{
- LoadLevelTemplate(-1); /* this resets all element modifications ... */
+ LoadLevelTemplate(-1); // this resets all element modifications ...
- DrawEditModeWindow(); /* ... and copies them to 'custom_element' */
+ DrawEditModeWindow(); // ... and copies them to 'custom_element'
return FALSE;
}
int i;
int access_type_and_layer;
- /* mark that this custom element has been modified */
+ // mark that this custom element has been modified
custom_element.modified_settings = TRUE;
level.changed = TRUE;
element_info[element] = custom_element;
*element_info[element].change = custom_element_change;
- /* ---------- element settings: configure (custom elements) ------------- */
+ // ---------- element settings: configure (custom elements) -----------------
- /* set accessible property from checkbox and selectbox */
+ // set accessible property from checkbox and selectbox
custom_element_properties[EP_WALKABLE_OVER] = FALSE;
custom_element_properties[EP_WALKABLE_INSIDE] = FALSE;
custom_element_properties[EP_WALKABLE_UNDER] = FALSE;
(custom_element.access_protected != 0 &&
custom_element_properties[EP_ACCESSIBLE]);
- /* set walk-to-object property from checkbox and selectbox */
+ // set walk-to-object property from checkbox and selectbox
custom_element_properties[EP_DIGGABLE] = FALSE;
custom_element_properties[EP_COLLECTIBLE_ONLY] = FALSE;
custom_element_properties[EP_DROPPABLE] = FALSE;
custom_element_properties[custom_element.walk_to_action] =
custom_element_properties[EP_WALK_TO_OBJECT];
- /* set smash property from checkbox and selectbox */
+ // set smash property from checkbox and selectbox
custom_element_properties[EP_CAN_SMASH_PLAYER] = FALSE;
custom_element_properties[EP_CAN_SMASH_ENEMIES] = FALSE;
custom_element_properties[EP_CAN_SMASH_EVERYTHING] = FALSE;
custom_element_properties[custom_element.smash_targets] =
custom_element_properties[EP_CAN_SMASH];
- /* set deadliness property from checkbox and selectbox */
+ // set deadliness property from checkbox and selectbox
custom_element_properties[EP_DONT_RUN_INTO] = FALSE;
custom_element_properties[EP_DONT_COLLIDE_WITH] = FALSE;
custom_element_properties[EP_DONT_GET_HIT_BY] = FALSE;
custom_element_properties[custom_element.deadliness] =
custom_element_properties[EP_DEADLY];
- /* ---------- element settings: advanced (custom elements) --------------- */
+ // ---------- element settings: advanced (custom elements) ------------------
- /* set player change event from checkbox and selectbox */
+ // set player change event from checkbox and selectbox
custom_element_change_events[CE_TOUCHED_BY_PLAYER] = FALSE;
custom_element_change_events[CE_PRESSED_BY_PLAYER] = FALSE;
custom_element_change_events[CE_SWITCHED_BY_PLAYER] = FALSE;
custom_element_change_events[custom_element_change.direct_action] =
custom_element_change_events[CE_BY_DIRECT_ACTION];
- /* set other element action change event from checkbox and selectbox */
+ // set other element action change event from checkbox and selectbox
custom_element_change_events[CE_PLAYER_TOUCHES_X] = FALSE;
custom_element_change_events[CE_PLAYER_PRESSES_X] = FALSE;
custom_element_change_events[CE_PLAYER_SWITCHES_X] = FALSE;
for (i = 0; i < NUM_CHANGE_EVENTS; i++)
SET_CHANGE_EVENT(element, i, custom_element_change_events[i]);
- /* copy change events also to special level editor variable */
+ // copy change events also to special level editor variable
custom_element = element_info[element];
custom_element_change = *element_info[element].change;
}
static void CopyGroupElementPropertiesToGame(int element)
{
- /* mark that this group element has been modified */
+ // mark that this group element has been modified
custom_element.modified_settings = TRUE;
level.changed = TRUE;
static void DrawEditorDoorContent(void)
{
- /* needed for gadgets drawn on background (like palette scrollbar) */
+ // needed for gadgets drawn on background (like palette scrollbar)
SetDoorBackgroundImage(IMG_UNDEFINED);
- /* copy default editor door content to main double buffer */
+ // copy default editor door content to main double buffer
BlitBitmap(graphic_info[IMG_BACKGROUND_PALETTE].bitmap, drawto,
graphic_info[IMG_BACKGROUND_PALETTE].src_x,
graphic_info[IMG_BACKGROUND_PALETTE].src_y,
MIN(DYSIZE, graphic_info[IMG_BACKGROUND_PALETTE].height),
DX, DY);
- /* draw bigger door */
+ // draw bigger door
DrawSpecialEditorDoor();
- /* draw new control window */
+ // draw new control window
BlitBitmap(graphic_info[IMG_BACKGROUND_TOOLBOX].bitmap, drawto,
graphic_info[IMG_BACKGROUND_TOOLBOX].src_x,
graphic_info[IMG_BACKGROUND_TOOLBOX].src_y,
MIN(EYSIZE, graphic_info[IMG_BACKGROUND_TOOLBOX].height),
EX, EY);
- /* draw all toolbox gadgets to editor doors */
+ // draw all toolbox gadgets to editor doors
MapControlButtons();
- /* draw all palette gadgets to editor doors */
+ // draw all palette gadgets to editor doors
ModifyEditorElementList();
RedrawDrawingElements();
- /* copy actual editor door content to door double buffer for OpenDoor() */
+ // copy actual editor door content to door double buffer for OpenDoor()
BlitBitmap(drawto, bitmap_db_door_1, DX, DY, DXSIZE, DYSIZE, 0, 0);
}
FadeOut(fade_mask);
- /* needed if different viewport properties defined for editor */
+ // needed if different viewport properties defined for editor
ChangeViewportPropertiesIfNeeded();
ClearField();
FreeLevelEditorGadgets();
CreateLevelEditorGadgets();
- ReinitializeElementList(); /* update dynamic level element list */
- ReinitializeElementListButtons(); /* custom element may look different */
+ ReinitializeElementList(); // update dynamic level element list
+ ReinitializeElementListButtons(); // custom element may look different
InitElementPropertiesGfxElement();
ed_ysize = max_ed_fieldy;
}
- /* check if we need any scrollbars */
+ // check if we need any scrollbars
horizontal_scrollbar_needed = (ed_xsize > max_ed_fieldx);
vertical_scrollbar_needed = (ed_ysize > max_ed_fieldy);
- /* check if we have a smaller editor field because of scrollbars */
+ // check if we have a smaller editor field because of scrollbars
max_ed_fieldx = getMaxEdFieldX(vertical_scrollbar_needed);
max_ed_fieldy = getMaxEdFieldY(horizontal_scrollbar_needed);
- /* check again if we now need more scrollbars because of less space */
+ // check again if we now need more scrollbars because of less space
horizontal_scrollbar_needed = (ed_xsize > max_ed_fieldx);
vertical_scrollbar_needed = (ed_ysize > max_ed_fieldy);
- /* check if editor field gets even smaller after adding new scrollbars */
+ // check if editor field gets even smaller after adding new scrollbars
max_ed_fieldx = getMaxEdFieldX(vertical_scrollbar_needed);
max_ed_fieldy = getMaxEdFieldY(horizontal_scrollbar_needed);
width = ed_fieldx * ed_tilesize - 2 * ED_SCROLLBUTTON_XSIZE;
height = ed_fieldy * ed_tilesize - 2 * ED_SCROLLBUTTON_YSIZE;
- /* adjust drawing area gadget */
+ // adjust drawing area gadget
ModifyGadget(level_editor_gadget[GADGET_ID_DRAWING_LEVEL],
GDI_AREA_SIZE, ed_fieldx, ed_fieldy,
GDI_ITEM_SIZE, ed_tilesize, ed_tilesize,
GDI_END);
- /* adjust horizontal scrollbar gadgets */
+ // adjust horizontal scrollbar gadgets
ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_LEFT],
GDI_Y, y,
GDI_END);
GDI_SCROLLBAR_ITEMS_VISIBLE, ed_fieldx,
GDI_END);
- /* adjust vertical scrollbar gadgets */
+ // adjust vertical scrollbar gadgets
ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_UP],
GDI_X, x,
GDI_END);
struct GadgetInfo *gi = level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL];
int items_max, items_visible, item_position;
- /* correct position of element list scrollbar */
+ // correct position of element list scrollbar
if (element_shift < 0)
element_shift = 0;
if (element_shift > num_editor_elements - ED_NUM_ELEMENTLIST_BUTTONS)
selectbox_info[selectbox_id].options = options;
- /* set index to zero -- list may be shorter now (correct later, if needed) */
+ // set index to zero -- list may be shorter now (correct later, if needed)
ModifyGadget(gi, GDI_SELECTBOX_INDEX, 0,
GDI_SELECTBOX_OPTIONS, options, GDI_END);
}
struct GadgetInfo *gi = level_editor_gadget[gadget_id];
boolean active = (i != edit_mode_levelinfo);
- /* draw background line below tabulator button */
+ // draw background line below tabulator button
ClearRectangleOnBackground(drawto, gi->x, gi->y + gi->height, gi->width, 1);
- /* draw solid line below inactive tabulator buttons */
- if (!active && tab_color != BLACK_PIXEL) /* black => transparent */
+ // draw solid line below inactive tabulator buttons
+ if (!active && tab_color != BLACK_PIXEL) // black => transparent
FillRectangle(drawto, gi->x, gi->y + gi->height, gi->width,
ED_GADGET_TINY_DISTANCE, tab_color);
MapTextbuttonGadget(i);
}
- /* draw little border line below tabulator buttons */
- if (tab_color != BLACK_PIXEL) /* black => transparent */
+ // draw little border line below tabulator buttons
+ if (tab_color != BLACK_PIXEL) // black => transparent
FillRectangle(drawto, gd_gi1->x, gd_gi1->y + gd_gi1->height +
ED_GADGET_TINY_DISTANCE,
getTabulatorBarWidth(), getTabulatorBarHeight(), tab_color);
int id_last = ED_TEXTBUTTON_ID_PROPERTIES_CONFIG;
int i;
- /* draw two config tabulators for player elements */
+ // draw two config tabulators for player elements
if (ELEM_IS_PLAYER(properties_element))
id_last = ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_2;
- /* draw two config and one "change" tabulator for custom elements */
+ // draw two config and one "change" tabulator for custom elements
if (IS_CUSTOM_ELEMENT(properties_element))
id_last = ED_TEXTBUTTON_ID_PROPERTIES_CHANGE;
struct GadgetInfo *gi = level_editor_gadget[gadget_id];
boolean active = (i != edit_mode_properties);
- /* use "config 1" and "config 2" instead of "config" for players and CEs */
+ // use "config 1" and "config 2" instead of "config" for players and CEs
if (i == ED_TEXTBUTTON_ID_PROPERTIES_CONFIG &&
(ELEM_IS_PLAYER(properties_element) ||
IS_CUSTOM_ELEMENT(properties_element)))
continue;
- /* draw background line below tabulator button */
+ // draw background line below tabulator button
ClearRectangleOnBackground(drawto, gi->x, gi->y + gi->height, gi->width, 1);
- /* draw solid line below inactive tabulator buttons */
- if (!active && tab_color != BLACK_PIXEL) /* black => transparent */
+ // draw solid line below inactive tabulator buttons
+ if (!active && tab_color != BLACK_PIXEL) // black => transparent
FillRectangle(drawto, gi->x, gi->y + gi->height, gi->width,
ED_GADGET_TINY_DISTANCE, tab_color);
MapTextbuttonGadget(i);
}
- /* draw little border line below tabulator buttons */
- if (tab_color != BLACK_PIXEL) /* black => transparent */
+ // draw little border line below tabulator buttons
+ if (tab_color != BLACK_PIXEL) // black => transparent
FillRectangle(drawto, gd_gi1->x, gd_gi1->y + gd_gi1->height +
ED_GADGET_TINY_DISTANCE,
getTabulatorBarWidth(), getTabulatorBarHeight(), tab_color);
{
int i;
- /* draw counter gadgets */
+ // draw counter gadgets
for (i = ED_COUNTER_ID_LEVEL_FIRST; i <= ED_COUNTER_ID_LEVEL_LAST; i++)
MapCounterButtons(i);
- /* draw checkbutton gadgets */
+ // draw checkbutton gadgets
for (i = ED_CHECKBUTTON_ID_LEVEL_FIRST; i<= ED_CHECKBUTTON_ID_LEVEL_LAST; i++)
MapCheckbuttonGadget(i);
- /* draw selectbox gadgets */
+ // draw selectbox gadgets
for (i = ED_SELECTBOX_ID_LEVEL_FIRST; i <= ED_SELECTBOX_ID_LEVEL_LAST; i++)
MapSelectboxGadget(i);
- /* draw text input gadgets */
+ // draw text input gadgets
for (i = ED_TEXTINPUT_ID_LEVEL_FIRST; i <= ED_TEXTINPUT_ID_LEVEL_LAST; i++)
MapTextInputGadget(i);
}
boolean template_exists = fileExists(getLocalLevelTemplateFilename());
int i;
- /* draw counter gadgets */
+ // draw counter gadgets
for (i = ED_COUNTER_ID_LEVELSET_FIRST; i <= ED_COUNTER_ID_LEVELSET_LAST; i++)
MapCounterButtons(i);
- /* draw checkbutton gadgets */
+ // draw checkbutton gadgets
for (i = ED_CHECKBUTTON_ID_LEVELSET_FIRST; i <= ED_CHECKBUTTON_ID_LEVELSET_LAST; i++)
{
if (levelset_save_mode == LEVELSET_SAVE_MODE_UPDATE ||
MapCheckbuttonGadget(i);
}
- /* draw selectbox gadgets */
+ // draw selectbox gadgets
for (i = ED_SELECTBOX_ID_LEVELSET_FIRST; i <= ED_SELECTBOX_ID_LEVELSET_LAST; i++)
MapSelectboxGadget(i);
- /* draw text input gadgets */
+ // draw text input gadgets
for (i = ED_TEXTINPUT_ID_LEVELSET_FIRST; i <= ED_TEXTINPUT_ID_LEVELSET_LAST; i++)
MapTextInputGadget(i);
- /* draw textbutton gadgets */
+ // draw textbutton gadgets
MapTextbuttonGadget(ED_TEXTBUTTON_ID_SAVE_LEVELSET);
- /* draw info text */
+ // draw info text
DrawLevelInfoLevelSet_DirectoryInfo();
}
{
int i;
- /* draw counter gadgets */
+ // draw counter gadgets
for (i = ED_COUNTER_ID_EDITOR_FIRST; i <= ED_COUNTER_ID_EDITOR_LAST; i++)
MapCounterButtons(i);
- /* draw checkbutton gadgets */
+ // draw checkbutton gadgets
for (i=ED_CHECKBUTTON_ID_EDITOR_FIRST; i<= ED_CHECKBUTTON_ID_EDITOR_LAST; i++)
MapCheckbuttonGadget(i);
- /* draw radiobutton gadgets */
+ // draw radiobutton gadgets
for (i=ED_RADIOBUTTON_ID_EDITOR_FIRST; i<= ED_RADIOBUTTON_ID_EDITOR_LAST; i++)
MapRadiobuttonGadget(i);
- /* draw drawing area */
+ // draw drawing area
MapDrawingArea(ED_DRAWING_ID_RANDOM_BACKGROUND);
- /* draw textbutton gadgets */
+ // draw textbutton gadgets
MapTextbuttonGadget(ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_2);
}
int x3 = right_gadget_border[GADGET_ID_CUSTOM_EXPLODE_IMPACT];
int xoffset = ED_GADGET_SPACE_DISTANCE;
- /* add distance for potential left text (without drawing area border) */
+ // add distance for potential left text (without drawing area border)
x2 += getTextWidthForGadget(drawingarea_info[id].text_left);
ModifyGadget(gi, GDI_X, MAX(x1, MAX(x2, x3)) + xoffset, GDI_END);
int y = SY + ED_AREA_YAMYAM_CONTENT_Y(3) + yoffset;
int i;
- /* display counter to choose number of element content areas */
+ // display counter to choose number of element content areas
MapCounterButtons(ED_COUNTER_ID_YAMYAM_CONTENT);
for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
{
UnmapDrawingArea(id);
- /* delete content areas in case of reducing number of them */
+ // delete content areas in case of reducing number of them
RemoveElementContentArea(id, font_height);
}
}
int y = SY + ED_AREA_MAGIC_BALL_CONTENT_Y(3) + yoffset;
int i;
- /* display counter to choose number of element content areas */
+ // display counter to choose number of element content areas
MapCounterButtons(ED_COUNTER_ID_BALL_CONTENT);
for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
{
UnmapDrawingArea(id);
- /* delete content areas in case of reducing number of them */
+ // delete content areas in case of reducing number of them
RemoveElementContentArea(id, font_height);
}
}
int xsize = MAX_ANDROID_ELEMENTS;
int ysize = 1;
- /* display counter to choose number of element areas */
+ // display counter to choose number of element areas
MapCounterButtons(ED_COUNTER_ID_ANDROID_CONTENT);
if (drawingarea_info[id].text_left != NULL)
ModifyEditorDrawingArea(id, num_elements, 1);
- /* delete content areas in case of reducing number of them */
+ // delete content areas in case of reducing number of them
DrawBackground(sx, sy,
xsize * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size,
ysize * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size);
ModifyEditorDrawingArea(id, num_elements, 1);
- /* delete content areas in case of reducing number of them */
+ // delete content areas in case of reducing number of them
DrawBackground(sx, sy,
xsize * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size,
ysize * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size);
int xsize = MAX_INITIAL_INVENTORY_SIZE;
int ysize = 1;
- /* determine horizontal position to the right of specified gadget */
+ // determine horizontal position to the right of specified gadget
if (drawingarea_info[id].gadget_id_align != GADGET_ID_NONE)
sx = (right_gadget_border[drawingarea_info[id].gadget_id_align] +
ED_DRAWINGAREA_TEXT_DISTANCE);
- /* determine horizontal offset for leading text */
+ // determine horizontal offset for leading text
if (drawingarea_info[id].text_left != NULL)
sx += getTextWidthForDrawingArea(drawingarea_info[id].text_left);
ModifyEditorDrawingArea(id, num_elements, 1);
- /* delete content areas in case of reducing number of them */
+ // delete content areas in case of reducing number of them
DrawBackground(sx, sy,
xsize * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size,
ysize * ED_DRAWINGAREA_TILE_SIZE + 2 * border_size);
}
properties[] =
{
- /* configurable properties */
+ // configurable properties
{ EP_WALKABLE_OVER, "- player can walk over it" },
{ EP_WALKABLE_INSIDE, "- player can walk inside it" },
{ EP_CAN_CHANGE, "- can change to other element" },
- /* pre-defined properties */
+ // pre-defined properties
{ EP_CAN_PASS_MAGIC_WALL, "- can pass magic walls" },
{ EP_CAN_PASS_DC_MAGIC_WALL,"- can pass magic walls (DC style)" },
{ EP_SWITCHABLE, "- can be switched" },
ypos += 2 * font3_height;
}
- /* ----- print number of elements / percentage of this element in level */
+ // ----- print number of elements / percentage of this element in level
num_elements_in_level = 0;
for (y = 0; y < lev_fieldy; y++)
ypos += 2 * MAX(font1_height, font2_height);
- /* ----- print standard properties of this element */
+ // ----- print standard properties of this element
DrawTextS(xpos, ypos, font1_nr, properties_text);
ypos += MAX(font1_height, font2_height);
- /* ----- print special description of this element */
+ // ----- print special description of this element
PrintInfoText(description_text, font1_nr, xpos, ypos);
return;
}
- /* check if there are elements where a value can be chosen for */
+ // check if there are elements where a value can be chosen for
for (i = 0; elements_with_counter[i].element != -1; i++)
{
if (elements_with_counter[i].element == properties_element)
if (properties_element == EL_GAME_OF_LIFE ||
properties_element == EL_BIOMAZE)
{
- counterbutton_info[counter_id].min_value = 0; /* min neighbours */
- counterbutton_info[counter_id].max_value = 8; /* max neighbours */
+ counterbutton_info[counter_id].min_value = 0; // min neighbours
+ counterbutton_info[counter_id].max_value = 8; // max neighbours
}
else
{
- /* !!! CHANGE THIS FOR CERTAIN ELEMENTS !!! */
+ // !!! CHANGE THIS FOR CERTAIN ELEMENTS !!!
counterbutton_info[counter_id].min_value = MIN_SCORE;
counterbutton_info[counter_id].max_value = MAX_SCORE;
}
if (HAS_EDITOR_CONTENT(properties_element))
{
- /* draw stickybutton gadget */
+ // draw stickybutton gadget
MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
if (IS_AMOEBOID(properties_element))
{
int player_nr = GET_PLAYER_NR(properties_element);
- /* these properties can be set for every player individually */
+ // these properties can be set for every player individually
if (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG_1)
{
checkbutton_info[ED_CHECKBUTTON_ID_USE_INITIAL_INVENTORY].value =
&level.use_initial_inventory[player_nr];
- /* draw checkbutton gadgets */
+ // draw checkbutton gadgets
MapCheckbuttonGadget(ED_CHECKBUTTON_ID_USE_INITIAL_INVENTORY);
- /* draw counter gadgets */
+ // draw counter gadgets
MapCounterButtons(ED_COUNTER_ID_INVENTORY_SIZE);
- /* draw drawing area gadgets */
+ // draw drawing area gadgets
DrawPlayerInitialInventoryArea(properties_element);
}
}
(!IS_CUSTOM_ELEMENT(properties_element) ||
edit_mode_properties == ED_MODE_PROPERTIES_CONFIG_2))
{
- /* set position for checkbutton for "can move into acid" */
+ // set position for checkbutton for "can move into acid"
checkbutton_info[ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID].x =
ED_ELEMENT_SETTINGS_XPOS(IS_CUSTOM_ELEMENT(properties_element) ? 1 : 0);
checkbutton_info[ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID].y =
checkbutton_info[button1_id].value = &level.envelope[envelope_nr].autowrap;
checkbutton_info[button2_id].value = &level.envelope[envelope_nr].centered;
- /* display counter to choose size of envelope text area */
+ // display counter to choose size of envelope text area
MapCounterButtons(counter1_id);
MapCounterButtons(counter2_id);
- /* display checkbuttons to choose auto-wrap and alignment properties */
+ // display checkbuttons to choose auto-wrap and alignment properties
MapCheckbuttonGadget(button1_id);
MapCheckbuttonGadget(button2_id);
if (IS_CUSTOM_ELEMENT(properties_element))
{
- /* draw stickybutton gadget */
+ // draw stickybutton gadget
MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
if (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG_1)
{
- /* draw checkbutton gadgets */
+ // draw checkbutton gadgets
for (i = ED_CHECKBUTTON_ID_CUSTOM1_FIRST;
i <= ED_CHECKBUTTON_ID_CUSTOM1_LAST; i++)
MapCheckbuttonGadget(i);
- /* draw counter gadgets */
+ // draw counter gadgets
for (i = ED_COUNTER_ID_CUSTOM1_FIRST;
i <= ED_COUNTER_ID_CUSTOM1_LAST; i++)
MapCounterButtons(i);
- /* draw selectbox gadgets */
+ // draw selectbox gadgets
for (i = ED_SELECTBOX_ID_CUSTOM1_FIRST;
i <= ED_SELECTBOX_ID_CUSTOM1_LAST; i++)
MapSelectboxGadget(i);
- /* draw textbutton gadgets */
+ // draw textbutton gadgets
MapTextbuttonGadget(ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_1);
- /* draw text input gadgets */
+ // draw text input gadgets
MapTextInputGadget(ED_TEXTINPUT_ID_ELEMENT_NAME);
- /* draw drawing area gadgets */
+ // draw drawing area gadgets
MapDrawingArea(ED_DRAWING_ID_CUSTOM_GRAPHIC);
draw_footer_line = TRUE;
}
else if (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG_2)
{
- /* draw checkbutton gadgets */
+ // draw checkbutton gadgets
for (i = ED_CHECKBUTTON_ID_CUSTOM2_FIRST;
i <= ED_CHECKBUTTON_ID_CUSTOM2_LAST; i++)
MapCheckbuttonGadget(i);
- /* draw counter gadgets */
+ // draw counter gadgets
for (i = ED_COUNTER_ID_CUSTOM2_FIRST;
i <= ED_COUNTER_ID_CUSTOM2_LAST; i++)
MapCounterButtons(i);
- /* draw selectbox gadgets */
+ // draw selectbox gadgets
for (i = ED_SELECTBOX_ID_CUSTOM2_FIRST;
i <= ED_SELECTBOX_ID_CUSTOM2_LAST; i++)
MapSelectboxGadget(i);
- /* draw drawing area gadgets */
+ // draw drawing area gadgets
MapDrawingArea(ED_DRAWING_ID_CUSTOM_MOVE_ENTER);
MapDrawingArea(ED_DRAWING_ID_CUSTOM_MOVE_LEAVE);
DrawCustomContentArea();
}
else if (IS_GROUP_ELEMENT(properties_element))
{
- /* draw stickybutton gadget */
+ // draw stickybutton gadget
MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
- /* draw checkbutton gadgets */
+ // draw checkbutton gadgets
MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC);
MapCheckbuttonGadget(ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_1);
- /* draw counter gadgets */
+ // draw counter gadgets
MapCounterButtons(ED_COUNTER_ID_GROUP_CONTENT);
- /* draw selectbox gadgets */
+ // draw selectbox gadgets
MapSelectboxGadget(ED_SELECTBOX_ID_GROUP_CHOICE_MODE);
- /* draw textbutton gadgets */
+ // draw textbutton gadgets
MapTextbuttonGadget(ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE_1);
- /* draw drawing area gadgets */
+ // draw drawing area gadgets
DrawGroupElementArea(properties_element);
- /* draw text input gadgets */
+ // draw text input gadgets
MapTextInputGadget(ED_TEXTINPUT_ID_ELEMENT_NAME);
- /* draw drawing area gadgets */
+ // draw drawing area gadgets
MapDrawingArea(ED_DRAWING_ID_CUSTOM_GRAPHIC);
draw_footer_line = TRUE;
}
- /* draw little footer border line above CE/GE use/save template gadgets */
+ // draw little footer border line above CE/GE use/save template gadgets
if (draw_footer_line)
{
struct GadgetInfo *gd_gi1 = level_editor_gadget[GADGET_ID_PROPERTIES_INFO];
int gd_y = gd->y + gd_gi1->height - 1;
Pixel tab_color = GetPixel(gd->bitmap, gd_x, gd_y);
- if (tab_color != BLACK_PIXEL) /* black => transparent */
+ if (tab_color != BLACK_PIXEL) // black => transparent
FillRectangle(drawto,
SX + ED_ELEMENT_SETTINGS_X(0),
SY + ED_ELEMENT_SETTINGS_Y(14) - ED_SETTINGS_TABS_YOFFSET -
{
int i;
- /* needed to initially set selectbox options for special action options */
+ // needed to initially set selectbox options for special action options
setSelectboxSpecialActionOptions();
- /* draw stickybutton gadget */
+ // draw stickybutton gadget
MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
- /* draw checkbutton gadgets */
+ // draw checkbutton gadgets
for (i = ED_CHECKBUTTON_ID_CHANGE_FIRST;
i <= ED_CHECKBUTTON_ID_CHANGE_LAST; i++)
MapCheckbuttonGadget(i);
- /* draw counter gadgets */
+ // draw counter gadgets
for (i = ED_COUNTER_ID_CHANGE_FIRST;
i <= ED_COUNTER_ID_CHANGE_LAST; i++)
MapCounterButtons(i);
- /* draw selectbox gadgets */
+ // draw selectbox gadgets
for (i = ED_SELECTBOX_ID_CHANGE_FIRST;
i <= ED_SELECTBOX_ID_CHANGE_LAST; i++)
MapSelectboxGadget(i);
- /* draw textbutton gadgets */
+ // draw textbutton gadgets
for (i = ED_TEXTBUTTON_ID_CHANGE_FIRST;
i <= ED_TEXTBUTTON_ID_CHANGE_LAST; i++)
MapTextbuttonGadget(i);
- /* draw graphicbutton gadgets */
+ // draw graphicbutton gadgets
for (i = ED_GRAPHICBUTTON_ID_CHANGE_FIRST;
i <= ED_GRAPHICBUTTON_ID_CHANGE_LAST; i++)
MapGraphicbuttonGadget(i);
- /* draw drawing area gadgets */
+ // draw drawing area gadgets
DrawPropertiesChangeDrawingAreas();
}
stick_element_properties_window = FALSE;
- /* make sure that previous properties edit mode exists for this element */
+ // make sure that previous properties edit mode exists for this element
if (edit_mode_properties > ED_MODE_PROPERTIES_CONFIG_2 &&
!IS_CUSTOM_ELEMENT(properties_element))
edit_mode_properties = ED_MODE_PROPERTIES_CONFIG_2;
DrawText(sx, sy, text, font2_nr);
- FrameCounter = 0; /* restart animation frame counter */
+ FrameCounter = 0; // restart animation frame counter
DrawElementBorder(SX + x1, SY + y1, TILEX, TILEY, FALSE);
DrawEditorElementAnimation(SX + x1, SY + y1);
DrawPropertiesInfo();
else if (edit_mode_properties == ED_MODE_PROPERTIES_CHANGE)
DrawPropertiesChange();
- else /* (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG[_1|_2]) */
+ else // (edit_mode_properties == ED_MODE_PROPERTIES_CONFIG[_1|_2])
DrawPropertiesConfig();
}
SetMainBackgroundImage(IMG_BACKGROUND_EDITOR);
ClearField();
- /* map buttons to select elements */
+ // map buttons to select elements
for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++)
MapGadget(level_editor_gadget[GADGET_ID_ELEMENTLIST_FIRST + i]);
MapGadget(level_editor_gadget[GADGET_ID_SCROLL_LIST_VERTICAL]);
ModifyEditorElementList();
RedrawDrawingElements();
- /* force redraw of all mapped drawing area gadgets */
+ // force redraw of all mapped drawing area gadgets
for (i = 0; i < ED_NUM_DRAWING_AREAS; i++)
{
struct GadgetInfo *gi = level_editor_gadget[drawingarea_info[i].gadget_id];
case (MV_VERTICAL | MV_RIGHT): return EL_TUBE_VERTICAL_RIGHT;
case (MV_ANY_DIRECTION): return EL_TUBE_ANY;
- /* if only one direction, fall back to simple tube with that direction */
+ // if only one direction, fall back to simple tube with that direction
case (MV_LEFT): return EL_TUBE_HORIZONTAL;
case (MV_RIGHT): return EL_TUBE_HORIZONTAL;
case (MV_UP): return EL_TUBE_VERTICAL;
int (*close_function)(int, int),
boolean change_level)
{
- /* set neighbour elements to newly determined connections */
+ // set neighbour elements to newly determined connections
SetElementSimple(x1, y1, *element1, change_level);
SetElementSimple(x2, y2, *element2, change_level);
- /* remove all open connections of neighbour elements */
+ // remove all open connections of neighbour elements
*element1 = close_function(x1, y1);
*element2 = close_function(x2, y2);
- /* set neighbour elements to new, minimized connections */
+ // set neighbour elements to new, minimized connections
SetElementSimple(x1, y1, *element1, change_level);
SetElementSimple(x2, y2, *element2, change_level);
}
int direction = MV_NONE;
int i;
- /* if old element is of same kind, keep all existing directions */
+ // if old element is of same kind, keep all existing directions
if (IS_TUBE(old_element))
direction |= getOpenDirectionFromTube(old_element);
int direction = MV_NONE;
int i;
- /* if old element is of same kind, keep all existing directions */
+ // if old element is of same kind, keep all existing directions
if (IS_BELT(old_element))
direction |= getOpenDirectionFromBelt(old_element);
int direction = MV_NONE;
int i;
- /* if old element is of same kind, keep all existing directions */
+ // if old element is of same kind, keep all existing directions
if (IS_ACID_POOL_OR_ACID(old_element))
direction |= getOpenDirectionFromPool(old_element);
}
}
- /* special corrections needed for intuitively correct acid pool drawing */
+ // special corrections needed for intuitively correct acid pool drawing
if (last_element_new == EL_EMPTY)
last_element_new = new_element;
else if (last_element_new != EL_UNDEFINED)
int direction = MV_NONE;
int i;
- /* if old element is of same kind, keep all existing directions */
+ // if old element is of same kind, keep all existing directions
if (IS_EMC_PILLAR(old_element))
direction |= getOpenDirectionFromPillar(old_element);
int direction = MV_NONE;
int i;
- /* if old element is of same kind, keep all existing directions */
+ // if old element is of same kind, keep all existing directions
if (IS_DC_STEELWALL_2(old_element))
direction |= getOpenDirectionFromSteel2(old_element);
int direction = MV_NONE;
int i;
- /* (do not keep existing directions, regardless of kind of old element) */
+ // (do not keep existing directions, regardless of kind of old element)
for (i = 0; i < NUM_DIRECTIONS; i++)
{
int dy = (to_y < from_y ? -1 : +1);
int i;
- if (from_y == to_y) /* horizontal line */
+ if (from_y == to_y) // horizontal line
{
for (i = 0; i <= xsize; i++)
DrawLineElement(from_x + i * dx, from_y, element, change_level);
}
- else if (from_x == to_x) /* vertical line */
+ else if (from_x == to_x) // vertical line
{
for (i = 0; i <= ysize; i++)
DrawLineElement(from_x, from_y + i * dy, element, change_level);
}
- else /* diagonal line */
+ else // diagonal line
{
- if (ysize < xsize) /* a < 1 */
+ if (ysize < xsize) // a < 1
{
float a = (float)ysize / (float)xsize;
DrawLineElement(from_x + x, from_y + y, element, change_level);
}
}
- else /* a >= 1 */
+ else // a >= 1
{
float a = (float)xsize / (float)ysize;
DrawAreaBorder(from_x, from_y, to_x, to_y);
}
-/* values for CopyBrushExt() */
+// values for CopyBrushExt()
#define CB_AREA_TO_BRUSH 0
#define CB_BRUSH_TO_CURSOR 1
#define CB_BRUSH_TO_LEVEL 2
SetLevelElementHiRes(x, y, FillFeld[x][y]);
}
-/* values for DrawLevelText() modes */
+// values for DrawLevelText() modes
#define TEXT_INIT 0
#define TEXT_SETCURSOR 1
#define TEXT_WRITECHAR 2
int letter_element = EL_CHAR_ASCII0 + letter;
int lx = 0, ly = 0;
- /* map lower case letters to upper case and convert special characters */
+ // map lower case letters to upper case and convert special characters
if (letter >= 'a' && letter <= 'z')
letter_element = EL_CHAR_ASCII0 + letter + (int)('A' - 'a');
else if (letter == CHAR_BYTE_UMLAUT_a || letter == CHAR_BYTE_UMLAUT_A)
if (new_undo_buffer_position)
{
- /* advance position in undo buffer ring */
+ // advance position in undo buffer ring
undo_buffer_position = (undo_buffer_position + 1) % NUM_UNDO_STEPS;
if (undo_buffer_steps < NUM_UNDO_STEPS - 1)
undo_buffer_steps++;
}
- /* always reset redo buffer when storing level change into undo buffer */
+ // always reset redo buffer when storing level change into undo buffer
redo_buffer_steps = 0;
for (x = 0; x < lev_fieldx; x++)
for (y = 0; y < lev_fieldy; y++)
UndoBuffer[undo_buffer_position][x][y] = Feld[x][y];
- /* check if drawing operation forces change of border style */
+ // check if drawing operation forces change of border style
CheckLevelBorderElement(TRUE);
level.changed = TRUE;
ResetIntelliDraw();
- /* determine number of free positions for randomly placing the new element */
+ // determine number of free positions for randomly placing the new element
for (x = 0; x < lev_fieldx; x++) for (y = 0; y < lev_fieldy; y++)
{
free_position[x][y] =
num_free_positions++;
}
- /* determine number of new elements to place there */
+ // determine number of new elements to place there
num_percentage = num_free_positions * random_placement_value / 100;
num_elements = (random_placement_method == RANDOM_USE_PERCENTAGE ?
num_percentage : random_placement_value);
- /* if less free positions than elements to place, fill all these positions */
+ // if less free positions than elements to place, fill all these positions
if (num_free_positions < num_elements)
{
for (x = 0; x < lev_fieldx; x++)
x = GetSimpleRandom(lev_fieldx);
y = GetSimpleRandom(lev_fieldy);
- /* don't place element at the same position twice */
+ // don't place element at the same position twice
if (free_position[x][y])
{
free_position[x][y] = FALSE;
button_press_event = (gi->event.type == GD_EVENT_PRESSED);
button_release_event = (gi->event.type == GD_EVENT_RELEASED);
- /* make sure to stay inside drawing area boundaries */
+ // 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 (draw_level)
{
- /* get positions inside level field */
+ // get positions inside level field
lx = sx + level_xpos;
ly = sy + level_ypos;
if (!IN_LEV_FIELD(lx, ly))
inside_drawing_area = FALSE;
- /* make sure to stay inside level field boundaries */
+ // make sure to stay inside level field boundaries
lx = (lx < min_lx ? min_lx : lx > max_lx ? max_lx : lx);
ly = (ly < min_ly ? min_ly : ly > max_ly ? max_ly : ly);
- /* correct drawing area positions accordingly */
+ // correct drawing area positions accordingly
sx = lx - level_xpos;
sy = ly - level_ypos;
}
- /* also correct MM wall-sized (double) drawing area positions accordingly */
+ // also correct MM wall-sized (double) drawing area positions accordingly
if (sx2 / 2 < sx || sx2 / 2 > sx)
{
dx = (sx2 / 2 < sx ? 0 : 1);
}
else if (!button_press_event)
{
- /* prevent handling events for every pixel position when moving mouse */
+ // prevent handling events for every pixel position when moving mouse
if ((sx == last_sx && sy == last_sy &&
!IS_MM_WALL_EDITOR(new_element) && new_element != EL_EMPTY) ||
(sx2 == last_sx2 && sy2 == last_sy2))
if (!button && !button_release_event)
return;
- /* handle info callback for each invocation of action callback */
+ // handle info callback for each invocation of action callback
gi->callback_info(gi);
- /* automatically switch to 'single item' drawing mode, if needed */
+ // automatically switch to 'single item' drawing mode, if needed
actual_drawing_function =
(draw_level || drawing_function == GADGET_ID_PICK_ELEMENT ?
drawing_function : GADGET_ID_SINGLE_ITEMS);
- /* clicking into drawing area with pressed Control key picks element */
+ // clicking into drawing area with pressed Control key picks element
if (GetKeyModState() & KMOD_Control)
{
last_drawing_function = drawing_function;
ResetIntelliDraw();
}
- SetDrawModeHiRes(-1); /* reset to normal draw mode */
+ SetDrawModeHiRes(-1); // reset to normal draw mode
switch (actual_drawing_function)
{
if (new_element == EL_PLAYER_1)
{
- /* remove player at old position */
+ // remove player at old position
for (y = 0; y < lev_fieldy; y++)
for (x = 0; x < lev_fieldx; x++)
if (Feld[x][y] == EL_PLAYER_1)
{
UpdateCustomElementGraphicGadgets();
- FrameCounter = 0; /* restart animation frame counter */
+ FrameCounter = 0; // restart animation frame counter
}
}
break;
sx = sx2;
sy = sy2;
}
- /* FALLTHROUGH */
+ // FALLTHROUGH
case GADGET_ID_GRAB_BRUSH:
case GADGET_ID_TEXT:
{
draw_func = DrawFilledBox;
else if (drawing_function == GADGET_ID_GRAB_BRUSH)
draw_func = SelectArea;
- else /* (drawing_function == GADGET_ID_TEXT) */
+ else // (drawing_function == GADGET_ID_TEXT)
draw_func = SetTextCursor;
if (button_press_event)
else if (last_sx != sx || last_sy != sy)
{
draw_func(start_sx, start_sy, last_sx, last_sy, -1, FALSE);
- if (IS_MM_WALL_EDITOR(new_element)) /* clear wall background */
+ if (IS_MM_WALL_EDITOR(new_element)) // clear wall background
draw_func(start_sx, start_sy, sx, sy, EL_EMPTY, FALSE);
draw_func(start_sx, start_sy, sx, sy, new_element, FALSE);
last_sx = sx;
break;
}
- /* do not mark level as modified for certain non-level-changing gadgets */
+ // do not mark level as modified for certain non-level-changing gadgets
if ((type_id >= ED_DRAWING_ID_EDITOR_FIRST &&
type_id <= ED_DRAWING_ID_EDITOR_LAST) ||
actual_drawing_function == GADGET_ID_GRAB_BRUSH ||
if (level.game_engine_type != last_game_engine_type)
{
- /* update element selection list */
+ // update element selection list
ReinitializeElementList();
ModifyEditorElementList();
}
lev_fieldx = level.fieldx;
lev_fieldy = level.fieldy;
- /* check if resizing of level results in change of border border */
+ // check if resizing of level results in change of border border
SetBorderElement();
break;
counter_id <= ED_COUNTER_ID_CHANGE_LAST))
CopyElementPropertiesToGame(properties_element);
- /* do not mark level as modified for certain non-level-changing gadgets */
+ // do not mark level as modified for certain non-level-changing gadgets
if ((counter_id >= ED_COUNTER_ID_LEVELSET_FIRST &&
counter_id <= ED_COUNTER_ID_LEVELSET_LAST) ||
(counter_id >= ED_COUNTER_ID_EDITOR_FIRST &&
{
CopyElementPropertiesToGame(properties_element);
- ModifyEditorElementList(); /* update changed button info text */
+ ModifyEditorElementList(); // update changed button info text
}
- /* do not mark level as modified for certain non-level-changing gadgets */
+ // do not mark level as modified for certain non-level-changing gadgets
if (type_id >= ED_TEXTINPUT_ID_LEVELSET_FIRST &&
type_id <= ED_TEXTINPUT_ID_LEVELSET_LAST)
return;
{
if (type_id == ED_SELECTBOX_ID_ACTION_TYPE)
{
- /* when changing action type, also check action mode and action arg */
+ // when changing action type, also check action mode and action arg
if (value_old != value_new)
setSelectboxSpecialActionVariablesIfNeeded();
}
else if (type_id == ED_SELECTBOX_ID_GAME_ENGINE_TYPE)
{
- /* update element selection list */
+ // update element selection list
ReinitializeElementList();
ModifyEditorElementList();
}
- /* do not mark level as modified for certain non-level-changing gadgets */
+ // do not mark level as modified for certain non-level-changing gadgets
if (type_id == ED_SELECTBOX_ID_LEVELSET_SAVE_MODE ||
type_id == ED_SELECTBOX_ID_SELECT_CHANGE_PAGE)
return;
{
boolean new_template = !fileExists(getLocalLevelTemplateFilename());
- /* backup original "level.field" (needed to track playfield changes) */
+ // backup original "level.field" (needed to track playfield changes)
CopyPlayfield(level.field, FieldBackup);
- /* "SaveLevelTemplate()" uses "level.field", so copy editor playfield */
+ // "SaveLevelTemplate()" uses "level.field", so copy editor playfield
CopyPlayfield(Feld, level.field);
if (new_template ||
if (new_template)
Request("Template saved!", REQ_CONFIRM);
- /* restore original "level.field" (needed to track playfield changes) */
+ // restore original "level.field" (needed to track playfield changes)
CopyPlayfield(FieldBackup, level.field);
}
else if (type_id == ED_TEXTBUTTON_ID_SAVE_LEVELSET)
{
struct ElementInfo *ei = &element_info[properties_element];
- /* when modifying custom element, ask for copying level template */
+ // when modifying custom element, ask for copying level template
if (level.use_custom_template && !AskToCopyAndModifyLevelTemplate())
return;
setElementChangePages(ei, ei->num_change_pages + 1);
- /* set new change page to be new current change page */
+ // set new change page to be new current change page
ei->current_change_page = ei->num_change_pages - 1;
ei->change = &ei->change_page[ei->current_change_page];
{
struct ElementInfo *ei = &element_info[properties_element];
- /* when modifying custom element, ask for copying level template */
+ // when modifying custom element, ask for copying level template
if (level.use_custom_template && !AskToCopyAndModifyLevelTemplate())
return;
- /* copy all change pages after change page to be deleted */
+ // copy all change pages after change page to be deleted
for (i = ei->current_change_page; i < ei->num_change_pages - 1; i++)
ei->change_page[i] = ei->change_page[i + 1];
}
else if (type_id == ED_GRAPHICBUTTON_ID_PASTE_CHANGE_PAGE)
{
- /* when modifying custom element, ask for copying level template */
+ // when modifying custom element, ask for copying level template
if (level.use_custom_template && !AskToCopyAndModifyLevelTemplate())
return;
*radiobutton_info[type_id].value =
radiobutton_info[type_id].checked_value;
- /* do not mark level as modified for certain non-level-changing gadgets */
+ // do not mark level as modified for certain non-level-changing gadgets
if (type_id >= ED_RADIOBUTTON_ID_EDITOR_FIRST &&
type_id <= ED_RADIOBUTTON_ID_EDITOR_LAST)
return;
boolean template_related_changes_found = FALSE;
int i;
- /* check if any custom or group elements have been changed */
+ // check if any custom or group elements have been changed
for (i = 0; i < NUM_FILE_ELEMENTS; i++)
if ((IS_CUSTOM_ELEMENT(i) || IS_GROUP_ELEMENT(i)) &&
element_info[i].modified_settings)
SetAutomaticNumberOfGemsNeeded();
}
- /* do not mark level as modified for certain non-level-changing gadgets */
+ // do not mark level as modified for certain non-level-changing gadgets
if ((type_id >= ED_CHECKBUTTON_ID_LEVELSET_FIRST &&
type_id <= ED_CHECKBUTTON_ID_LEVELSET_LAST) ||
(type_id >= ED_CHECKBUTTON_ID_EDITOR_FIRST &&
!(GetKeyModState() & KMOD_Control))
ChangeEditModeWindow(ED_MODE_DRAWING);
- /* element copy mode active, but no element button pressed => deactivate */
+ // element copy mode active, but no element button pressed => deactivate
if (last_custom_copy_mode != -1 && id < ED_NUM_CTRL_BUTTONS)
last_custom_copy_mode = -1;
- /* when showing palette on element buttons, change element of button used */
+ // when showing palette on element buttons, change element of button used
if (editor.palette.show_on_element_buttons &&
id >= GADGET_ID_ELEMENT_LEFT && id <= GADGET_ID_ELEMENT_RIGHT)
{
{
DrawDrawingWindow();
- /* redraw zoom gadget info text */
+ // redraw zoom gadget info text
PrintEditorGadgetInfoText(level_editor_gadget[id]);
}
- /* save current editor zoom tilesize */
+ // save current editor zoom tilesize
SaveSetup_AutoSetup();
break;
if (button == 1)
{
- /* undo */
+ // undo
undo_buffer_position =
(undo_buffer_position - 1 + NUM_UNDO_STEPS) % NUM_UNDO_STEPS;
}
else
{
- /* redo */
+ // redo
undo_buffer_position = (undo_buffer_position + 1) % NUM_UNDO_STEPS;
for (y = 0; y < lev_fieldy; y++)
Feld[x][y] = UndoBuffer[undo_buffer_position][x][y];
- /* check if undo operation forces change of border style */
+ // check if undo operation forces change of border style
CheckLevelBorderElement(FALSE);
DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
}
}
- /* "cd" back to copied-from levelset (in case of saved read-only level) */
+ // "cd" back to copied-from levelset (in case of saved read-only level)
leveldir_current = leveldir_former;
level_nr = level_nr_former;
CloseDoor(DOOR_CLOSE_ALL);
- /* needed before playing if editor playfield area has different size */
+ // needed before playing if editor playfield area has different size
ClearRectangle(drawto, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
// redraw_mask = REDRAW_ALL;
break;
case GADGET_ID_EXIT:
- RequestExitLevelEditor(TRUE, FALSE); /* if level has changed, ask user */
+ RequestExitLevelEditor(TRUE, FALSE); // if level has changed, ask user
break;
default:
*cascade_element = EL_CASCADE_TOGGLE(*cascade_element);
*cascade_value = IS_EDITOR_CASCADE_ACTIVE(*cascade_element);
- /* update element selection list */
+ // update element selection list
ReinitializeElementList();
ModifyEditorElementList();
- /* update cascading gadget info text */
+ // update cascading gadget info text
PrintEditorGadgetInfoText(level_editor_gadget[id]);
- /* save current editor cascading state */
+ // save current editor cascading state
SaveSetup_EditorCascade();
break;
break;
}
- /* change element of button used to show palette */
+ // change element of button used to show palette
if (editor.palette.show_on_element_buttons)
button = last_button;
case KSYM_Insert:
case KSYM_Delete:
- /* this is needed to prevent interference with running "True X-Mouse" */
+ // this is needed to prevent interference with running "True X-Mouse"
if (GetKeyModStateFromEvents() & KMOD_Control)
break;
- /* check for last or next editor cascade block in element list */
+ // check for last or next editor cascade block in element list
for (i = 0; i < num_editor_elements; i++)
{
if ((key == KSYM_Insert && i == element_shift) ||
(key == KSYM_Delete && new_element_shift > element_shift))
break;
- /* jump to next cascade block (or to start of element list) */
+ // jump to next cascade block (or to start of element list)
if (i == 0 || IS_EDITOR_CASCADE(editor_elements[i]))
new_element_shift = i;
}
{
HandleControlButtons(level_editor_gadget[GADGET_ID_PALETTE]);
}
- else /* should never happen */
+ else // should never happen
{
ChangeEditModeWindow(ED_MODE_DRAWING);
}
redraw_mask |= REDRAW_FIELD;
- FrameCounter++; /* increase animation frame counter */
+ FrameCounter++; // increase animation frame counter
}
static void ClearEditorGadgetInfoText(void)
if (gi == NULL || gi->event.type == GD_EVENT_INFO_LEAVING)
return;
- /* misuse this function to delete brush cursor, if needed */
+ // misuse this function to delete brush cursor, if needed
if (edit_mode == ED_MODE_DRAWING && draw_with_brush)
DeleteBrushFromCursor();
char infotext[MAX_OUTPUT_LINESIZE + 1];
char *text;
- infotext[0] = '\0'; /* start with empty info text */
+ infotext[0] = '\0'; // start with empty info text
- /* pressed Control key: simulate picking element */
+ // pressed Control key: simulate picking element
if (GetKeyModState() & KMOD_Control)
actual_drawing_function = GADGET_ID_PICK_ELEMENT;
if (gi->event.type == GD_EVENT_INFO_LEAVING)
return;
- /* make sure to stay inside drawing area boundaries */
+ // 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);
int min_lx = 0, min_ly = 0;
int max_lx = lev_fieldx - 1, max_ly = lev_fieldy - 1;
- /* get positions inside level field */
+ // get positions inside level field
lx = sx + level_xpos;
ly = sy + level_ypos;
- /* make sure to stay inside level field boundaries */
+ // make sure to stay inside level field boundaries
lx = (lx < min_lx ? min_lx : lx > max_lx ? max_lx : lx);
ly = (ly < min_ly ? min_ly : ly > max_ly ? max_ly : ly);
- /* correct drawing area positions accordingly */
+ // correct drawing area positions accordingly
sx = lx - level_xpos;
sy = ly - level_ypos;
}
if (IN_ED_FIELD(sx,sy) && IN_LEV_FIELD(lx, ly))
{
- if (button_status) /* if (gi->state == GD_BUTTON_PRESSED) */
+ if (button_status) // if (gi->state == GD_BUTTON_PRESSED)
{
if (gi->event.type == GD_EVENT_PRESSED)
{
sprintf(infotext, "Level position: %d, %d", lx, ly);
}
- /* misuse this function to draw brush cursor, if needed */
+ // misuse this function to draw brush cursor, if needed
if (edit_mode == ED_MODE_DRAWING && draw_with_brush && !button_status)
{
if (IN_ED_FIELD(sx, sy) && IN_LEV_FIELD(lx, ly))
struct RectWithBorder *vp_door_1 = &viewport.door_1[GAME_MODE_MAIN];
struct RectWithBorder *vp_door_2 = &viewport.door_2[GAME_MODE_MAIN];
- /* draw normal door */
+ // draw normal door
UndrawSpecialEditorDoor();
// use door animation if door 1 viewport is unchanged and contains toolbox
#include "game.h"
-/* ========================================================================= */
-/* functions and definitions exported from main program to game_em */
-/* ========================================================================= */
+// ============================================================================
+// functions and definitions exported from main program to game_em
+// ============================================================================
void SetBitmaps_EM(Bitmap **);
void UpdateEngineValues(int, int, int, int);
void getGraphicSourcePlayerExt_EM(struct GraphicInfo_EM *, int, int, int);
-/* ========================================================================= */
-/* functions and definitions exported from main program to game_sp */
-/* ========================================================================= */
+// ============================================================================
+// functions and definitions exported from main program to game_sp
+// ============================================================================
void CheckSingleStepMode_SP(boolean, boolean);
boolean isNextAnimationFrame_SP(int, int);
-/* ========================================================================= */
-/* functions and definitions exported from main program to game_mm */
-/* ========================================================================= */
+// ============================================================================
+// functions and definitions exported from main program to game_mm
+// ============================================================================
void SetDrawtoField(int);
void getSizedGraphicSource(int, int, int, Bitmap **, int *, int *);
-#endif /* ENGINES_H */
+#endif // ENGINES_H
static unsigned int special_cursor_delay_value = 1000;
-/* forward declarations for internal use */
+// forward declarations for internal use
static void HandleNoEvent(void);
static void HandleEventActions(void);
MotionEvent *motion;
#if defined(TARGET_SDL2)
- /* skip repeated key press events if keyboard auto-repeat is disabled */
+ // skip repeated key press events if keyboard auto-repeat is disabled
if (event->type == EVENT_KEYPRESS &&
event->key.repeat &&
!keyrepeat_status)
((MotionEvent *)event)->y -= video.screen_yoffset;
}
- /* non-motion events are directly passed to event handler functions */
+ // non-motion events are directly passed to event handler functions
if (event->type != EVENT_MOTIONNOTIFY)
return 1;
cursor_inside_playfield = (motion->x >= SX && motion->x < SX + SXSIZE &&
motion->y >= SY && motion->y < SY + SYSIZE);
- /* do no reset mouse cursor before all pending events have been processed */
+ // do no reset mouse cursor before all pending events have been processed
if (gfx.cursor_mode == cursor_mode_last &&
((game_status == GAME_MODE_TITLE &&
gfx.cursor_mode == CURSOR_NONE) ||
cursor_mode_last = CURSOR_DEFAULT;
}
- /* skip mouse motion events without pressed button outside level editor */
+ // skip mouse motion events without pressed button outside level editor
if (button_status == MB_RELEASED &&
game_status != GAME_MODE_EDITOR && game_status != GAME_MODE_PLAYING)
return 0;
static boolean SkipPressedMouseMotionEvent(const Event *event)
{
- /* nothing to do if the current event is not a mouse motion event */
+ // nothing to do if the current event is not a mouse motion event
if (event->type != EVENT_MOTIONNOTIFY)
return FALSE;
- /* only skip motion events with pressed button outside the game */
+ // only skip motion events with pressed button outside the game
if (button_status == MB_RELEASED || game_status == GAME_MODE_PLAYING)
return FALSE;
PeekEvent(&next_event);
- /* if next event is also a mouse motion event, skip the current one */
+ // if next event is also a mouse motion event, skip the current one
if (next_event.type == EVENT_MOTIONNOTIFY)
return TRUE;
}
HandleSpecialGameControllerButtons(event);
- /* FALL THROUGH */
+ // FALL THROUGH
case SDL_CONTROLLERDEVICEADDED:
case SDL_CONTROLLERDEVICEREMOVED:
case SDL_CONTROLLERAXISMOTION:
{
if (game_status == GAME_MODE_TITLE)
{
- /* when showing title screens, hide mouse pointer (if not moved) */
+ // when showing title screens, hide mouse pointer (if not moved)
if (gfx.cursor_mode != CURSOR_NONE &&
DelayReached(&special_cursor_delay, special_cursor_delay_value))
else if (game_status == GAME_MODE_PLAYING && (!tape.pausing ||
tape.single_step))
{
- /* when playing, display a special mouse pointer inside the playfield */
+ // when playing, display a special mouse pointer inside the playfield
if (gfx.cursor_mode != CURSOR_PLAYFIELD &&
cursor_inside_playfield &&
SetMouseCursor(CURSOR_DEFAULT);
}
- /* this is set after all pending events have been processed */
+ // this is set after all pending events have been processed
cursor_mode_last = gfx.cursor_mode;
}
else
HandleNoEvent();
- /* execute event related actions after pending events have been processed */
+ // execute event related actions after pending events have been processed
HandleEventActions();
/* don't use all CPU time when idle; the main loop while playing
if (game_status == GAME_MODE_PLAYING)
HandleGameActions();
- /* always copy backbuffer to visible screen for every video frame */
+ // always copy backbuffer to visible screen for every video frame
BackToFront();
- /* reset video frame delay to default (may change again while playing) */
+ // reset video frame delay to default (may change again while playing)
SetVideoFrameDelay(MenuFrameDelay);
if (game_status == GAME_MODE_QUIT)
PeekEvent(&next_event);
- /* if event is repeated key press event, remove it from event queue */
+ // if event is repeated key press event, remove it from event queue
if (next_event.type == EVENT_KEYPRESS &&
next_event.key.repeat)
WaitEvent(&next_event);
{
int i;
- /* simulate key release events for still pressed keys */
+ // simulate key release events for still pressed keys
key_joystick_mapping = 0;
for (i = 0; i < MAX_PLAYERS; i++)
stored_player[i].action = 0;
if (tape.recording && tape.pausing && tape.use_mouse)
{
- /* un-pause a paused game only if mouse button was newly pressed down */
+ // un-pause a paused game only if mouse button was newly pressed down
if (new_button)
TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
}
else if (strEqual(setup.touch.control_type, TOUCH_CONTROL_FOLLOW_FINGER))
HandleButtonOrFinger_FollowFinger_MM(mx, my, button);
else if (strEqual(setup.touch.control_type, TOUCH_CONTROL_VIRTUAL_BUTTONS))
- SetPlayerMouseAction(mx, my, button); /* special case */
+ SetPlayerMouseAction(mx, my, button); // special case
}
else
{
if (HandleGlobalAnimClicks(mx, my, button))
{
- /* do not handle this button event anymore */
- return; /* force mouse event not to be handled at all */
+ // do not handle this button event anymore
+ return; // force mouse event not to be handled at all
}
if (handle_gadgets && HandleGadgets(mx, my, button))
{
- /* do not handle this button event anymore */
- mx = my = -32; /* force mouse event to be outside screen tiles */
+ // do not handle this button event anymore
+ mx = my = -32; // force mouse event to be outside screen tiles
}
if (button_hold && game_status == GAME_MODE_PLAYING && tape.pausing)
return;
- /* do not use scroll wheel button events for anything other than gadgets */
+ // do not use scroll wheel button events for anything other than gadgets
if (IS_WHEEL_BUTTON(button_nr))
return;
in playing levels with more than one player in multi-player mode,
even though the tape was originally recorded in single-player mode */
- /* remove player input actions for all players but the first one */
+ // remove player input actions for all players but the first one
for (i = 1; i < MAX_PLAYERS; i++)
tape.player_participates[i] = FALSE;
}
}
- /* special key shortcuts for all game modes */
+ // special key shortcuts for all game modes
if (is_string_suffix(cheat_input, ":dump-event-actions") ||
is_string_suffix(cheat_input, ":dea") ||
is_string_suffix(cheat_input, ":DEA"))
int i;
#if defined(TARGET_SDL2)
- /* map special keys (media keys / remote control buttons) to default keys */
+ // map special keys (media keys / remote control buttons) to default keys
if (key == KSYM_PlayPause)
key = KSYM_space;
else if (key == KSYM_Select)
if (game_status == GAME_MODE_PLAYING)
{
- /* only needed for single-step tape recording mode */
+ // only needed for single-step tape recording mode
static boolean has_snapped[MAX_PLAYERS] = { FALSE, FALSE, FALSE, FALSE };
int pnr;
if (key == *key_info[i].key_custom)
key_action |= key_info[i].action;
- /* use combined snap+direction keys for the first player only */
+ // use combined snap+direction keys for the first player only
if (pnr == 0)
{
ssi = setup.shortcut;
{
TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
- /* if snap key already pressed, keep pause mode when releasing */
+ // if snap key already pressed, keep pause mode when releasing
if (stored_player[pnr].action & KEY_BUTTON_SNAP)
has_snapped[pnr] = TRUE;
}
if (level.game_engine_type == GAME_ENGINE_TYPE_SP &&
getRedDiskReleaseFlag_SP() == 0)
{
- /* add a single inactive frame before dropping starts */
+ // add a single inactive frame before dropping starts
stored_player[pnr].action &= ~KEY_BUTTON_DROP;
stored_player[pnr].force_dropping = TRUE;
}
}
else if (key_status == KEY_RELEASED && key_action & KEY_BUTTON_SNAP)
{
- /* if snap key was pressed without direction, leave pause mode */
+ // if snap key was pressed without direction, leave pause mode
if (!has_snapped[pnr])
TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
}
else if (tape.recording && tape.pausing && !tape.use_mouse)
{
- /* prevent key release events from un-pausing a paused game */
+ // prevent key release events from un-pausing a paused game
if (key_status == KEY_PRESSED && key_action & KEY_ACTION)
TapeTogglePause(TAPE_TOGGLE_MANUAL);
}
key == KSYM_Return ||
key == KSYM_Escape)))
{
- /* do not handle this key event anymore */
- if (key != KSYM_Escape) /* always allow ESC key to be handled */
+ // do not handle this key event anymore
+ if (key != KSYM_Escape) // always allow ESC key to be handled
return;
}
if (HandleGadgetsKeyInput(key))
{
- if (key != KSYM_Escape) /* always allow ESC key to be handled */
+ if (key != KSYM_Escape) // always allow ESC key to be handled
key = KSYM_UNDEFINED;
}
if (setup.input[i].use_joystick)
no_joysticks_configured = FALSE;
- /* if no joysticks configured, map connected joysticks to players */
+ // if no joysticks configured, map connected joysticks to players
if (no_joysticks_configured)
use_as_joystick_nr = TRUE;
if (HandleGlobalAnimClicks(-1, -1, newbutton))
{
- /* do not handle this button event anymore */
+ // do not handle this button event anymore
return;
}
if (joytest && !button && !DelayReached(&joytest_delay, joytest_delay_value))
{
- /* delay joystick/keyboard actions if axes/keys continually pressed */
+ // delay joystick/keyboard actions if axes/keys continually pressed
newbutton = dx = dy = 0;
}
else
{
- /* first start with longer delay, then continue with shorter delay */
+ // first start with longer delay, then continue with shorter delay
joytest_delay_value =
(use_delay_value_first ? delay_value_first : delay_value);
}
#if defined(KSYM_Rewind) && defined(KSYM_FastForward)
int button = SDL_CONTROLLER_BUTTON_INVALID;
- /* map keys to joystick buttons (special hack for Amazon Fire TV remote) */
+ // map keys to joystick buttons (special hack for Amazon Fire TV remote)
if (key == KSYM_Rewind)
button = SDL_CONTROLLER_BUTTON_A;
else if (key == KSYM_FastForward || key == KSYM_Menu)
event.type = (key_status == KEY_PRESSED ? SDL_CONTROLLERBUTTONDOWN :
SDL_CONTROLLERBUTTONUP);
- event.cbutton.which = 0; /* first joystick (Amazon Fire TV remote) */
+ event.cbutton.which = 0; // first joystick (Amazon Fire TV remote)
event.cbutton.button = button;
event.cbutton.state = (key_status == KEY_PRESSED ? SDL_PRESSED :
SDL_RELEASED);
#include "tape.h"
#include "config.h"
-#define ENABLE_UNUSED_CODE 0 /* currently unused functions */
-#define ENABLE_HISTORIC_CHUNKS 0 /* only for historic reference */
-#define ENABLE_RESERVED_CODE 0 /* reserved for later use */
+#define ENABLE_UNUSED_CODE 0 // currently unused functions
+#define ENABLE_HISTORIC_CHUNKS 0 // only for historic reference
+#define ENABLE_RESERVED_CODE 0 // reserved for later use
-#define CHUNK_ID_LEN 4 /* IFF style chunk id length */
-#define CHUNK_SIZE_UNDEFINED 0 /* undefined chunk size == 0 */
-#define CHUNK_SIZE_NONE -1 /* do not write chunk size */
+#define CHUNK_ID_LEN 4 // IFF style chunk id length
+#define CHUNK_SIZE_UNDEFINED 0 // undefined chunk size == 0
+#define CHUNK_SIZE_NONE -1 // do not write chunk size
#define LEVEL_CHUNK_NAME_SIZE MAX_LEVEL_NAME_LEN
#define LEVEL_CHUNK_AUTH_SIZE MAX_LEVEL_AUTHOR_LEN
-#define LEVEL_CHUNK_VERS_SIZE 8 /* size of file version chunk */
-#define LEVEL_CHUNK_DATE_SIZE 4 /* size of file date chunk */
-#define LEVEL_CHUNK_HEAD_SIZE 80 /* size of level file header */
-#define LEVEL_CHUNK_HEAD_UNUSED 0 /* unused level header bytes */
-#define LEVEL_CHUNK_CNT2_SIZE 160 /* size of level CNT2 chunk */
-#define LEVEL_CHUNK_CNT2_UNUSED 11 /* unused CNT2 chunk bytes */
-#define LEVEL_CHUNK_CNT3_HEADER 16 /* size of level CNT3 header */
-#define LEVEL_CHUNK_CNT3_UNUSED 10 /* unused CNT3 chunk bytes */
-#define LEVEL_CPART_CUS3_SIZE 134 /* size of CUS3 chunk part */
-#define LEVEL_CPART_CUS3_UNUSED 15 /* unused CUS3 bytes / part */
-#define LEVEL_CHUNK_GRP1_SIZE 74 /* size of level GRP1 chunk */
-
-/* (element number, number of change pages, change page number) */
+#define LEVEL_CHUNK_VERS_SIZE 8 // size of file version chunk
+#define LEVEL_CHUNK_DATE_SIZE 4 // size of file date chunk
+#define LEVEL_CHUNK_HEAD_SIZE 80 // size of level file header
+#define LEVEL_CHUNK_HEAD_UNUSED 0 // unused level header bytes
+#define LEVEL_CHUNK_CNT2_SIZE 160 // size of level CNT2 chunk
+#define LEVEL_CHUNK_CNT2_UNUSED 11 // unused CNT2 chunk bytes
+#define LEVEL_CHUNK_CNT3_HEADER 16 // size of level CNT3 header
+#define LEVEL_CHUNK_CNT3_UNUSED 10 // unused CNT3 chunk bytes
+#define LEVEL_CPART_CUS3_SIZE 134 // size of CUS3 chunk part
+#define LEVEL_CPART_CUS3_UNUSED 15 // unused CUS3 bytes / part
+#define LEVEL_CHUNK_GRP1_SIZE 74 // size of level GRP1 chunk
+
+// (element number, number of change pages, change page number)
#define LEVEL_CHUNK_CUSX_UNCHANGED (2 + (1 + 1) + (1 + 1))
-/* (element number only) */
+// (element number only)
#define LEVEL_CHUNK_GRPX_UNCHANGED 2
#define LEVEL_CHUNK_NOTE_UNCHANGED 2
-/* (nothing at all if unchanged) */
+// (nothing at all if unchanged)
#define LEVEL_CHUNK_ELEM_UNCHANGED 0
-#define TAPE_CHUNK_VERS_SIZE 8 /* size of file version chunk */
-#define TAPE_CHUNK_HEAD_SIZE 20 /* size of tape file header */
-#define TAPE_CHUNK_HEAD_UNUSED 2 /* unused tape header bytes */
+#define TAPE_CHUNK_VERS_SIZE 8 // size of file version chunk
+#define TAPE_CHUNK_HEAD_SIZE 20 // size of tape file header
+#define TAPE_CHUNK_HEAD_UNUSED 2 // unused tape header bytes
#define LEVEL_CHUNK_CNT3_SIZE(x) (LEVEL_CHUNK_CNT3_HEADER + (x))
#define LEVEL_CHUNK_CUS3_SIZE(x) (2 + (x) * LEVEL_CPART_CUS3_SIZE)
#define LEVEL_CHUNK_CUS4_SIZE(x) (96 + (x) * 48)
-/* file identifier strings */
+// file identifier strings
#define LEVEL_COOKIE_TMPL "ROCKSNDIAMONDS_LEVEL_FILE_VERSION_x.x"
#define TAPE_COOKIE_TMPL "ROCKSNDIAMONDS_TAPE_FILE_VERSION_x.x"
#define SCORE_COOKIE "ROCKSNDIAMONDS_SCORE_FILE_VERSION_1.2"
-/* values for deciding when (not) to save configuration data */
+// values for deciding when (not) to save configuration data
#define SAVE_CONF_NEVER 0
#define SAVE_CONF_ALWAYS 1
#define SAVE_CONF_WHEN_CHANGED -1
-/* values for chunks using micro chunks */
+// values for chunks using micro chunks
#define CONF_MASK_1_BYTE 0x00
#define CONF_MASK_2_BYTE 0x40
#define CONF_MASK_4_BYTE 0x80
#define CONF_VALUE_4_BYTE(x) (CONF_MASK_4_BYTE | (x))
#define CONF_VALUE_MULTI_BYTES(x) (CONF_MASK_MULTI_BYTES | (x))
-/* these definitions are just for convenience of use and readability */
+// these definitions are just for convenience of use and readability
#define CONF_VALUE_8_BIT(x) CONF_VALUE_1_BYTE(x)
#define CONF_VALUE_16_BIT(x) CONF_VALUE_2_BYTE(x)
#define CONF_VALUE_32_BIT(x) CONF_VALUE_4_BYTE(x)
#define CONF_CONTENTS_ELEMENT(b,c,x,y) ((b[CONF_CONTENT_BYTE_POS(c,x,y)]<< 8)|\
(b[CONF_CONTENT_BYTE_POS(c,x,y) + 1]))
-/* temporary variables used to store pointers to structure members */
+// temporary variables used to store pointers to structure members
static struct LevelInfo li;
static struct ElementInfo xx_ei, yy_ei;
static struct ElementChangeInfo xx_change;
struct LevelFileConfigInfo
{
- int element; /* element for which data is to be stored */
- int save_type; /* save data always, never or when changed */
- int data_type; /* data type (used internally, not stored) */
- int conf_type; /* micro chunk identifier (stored in file) */
-
- /* (mandatory) */
- void *value; /* variable that holds the data to be stored */
- int default_value; /* initial default value for this variable */
-
- /* (optional) */
- void *value_copy; /* variable that holds the data to be copied */
- void *num_entities; /* number of entities for multi-byte data */
- int default_num_entities; /* default number of entities for this data */
- int max_num_entities; /* maximal number of entities for this data */
- char *default_string; /* optional default string for string data */
+ int element; // element for which data is to be stored
+ int save_type; // save data always, never or when changed
+ int data_type; // data type (used internally, not stored)
+ int conf_type; // micro chunk identifier (stored in file)
+
+ // (mandatory)
+ void *value; // variable that holds the data to be stored
+ int default_value; // initial default value for this variable
+
+ // (optional)
+ void *value_copy; // variable that holds the data to be copied
+ void *num_entities; // number of entities for multi-byte data
+ int default_num_entities; // default number of entities for this data
+ int max_num_entities; // maximal number of entities for this data
+ char *default_string; // optional default string for string data
};
static struct LevelFileConfigInfo chunk_config_INFO[] =
{
- /* ---------- values not related to single elements ----------------------- */
+ // ---------- values not related to single elements -------------------------
{
-1, SAVE_CONF_ALWAYS,
{
-1, -1,
TYPE_BITFIELD, CONF_VALUE_32_BIT(1),
- &li.can_move_into_acid_bits, ~0 /* default: everything can */
+ &li.can_move_into_acid_bits, ~0 // default: everything can
},
{
-1, -1,
TYPE_BITFIELD, CONF_VALUE_8_BIT(7),
- &li.dont_collide_with_bits, ~0 /* default: always deadly */
+ &li.dont_collide_with_bits, ~0 // default: always deadly
},
{
static struct LevelFileConfigInfo chunk_config_ELEM[] =
{
- /* (these values are the same for each player) */
+ // (these values are the same for each player)
{
EL_PLAYER_1, -1,
TYPE_BOOLEAN, CONF_VALUE_8_BIT(1),
- &li.block_last_field, FALSE /* default case for EM levels */
+ &li.block_last_field, FALSE // default case for EM levels
},
{
EL_PLAYER_1, -1,
TYPE_BOOLEAN, CONF_VALUE_8_BIT(2),
- &li.sp_block_last_field, TRUE /* default case for SP levels */
+ &li.sp_block_last_field, TRUE // default case for SP levels
},
{
EL_PLAYER_1, -1,
&li.lazy_relocation, FALSE
},
- /* (these values are different for each player) */
+ // (these values are different for each player)
{
EL_PLAYER_1, -1,
TYPE_INTEGER, CONF_VALUE_8_BIT(7),
&li.score[SC_ELEM_BONUS], 10
},
- /* ---------- unused values ----------------------------------------------- */
+ // ---------- unused values -------------------------------------------------
{
EL_UNKNOWN, SAVE_CONF_NEVER,
&yy_ei.properties[EP_BITFIELD_BASE_NR]
},
#if ENABLE_RESERVED_CODE
- /* (reserved for later use) */
+ // (reserved for later use)
{
-1, -1,
TYPE_BITFIELD, CONF_VALUE_32_BIT(2),
&xx_num_contents, 1, 1
},
- /* ---------- "num_change_pages" must be the last entry ------------------- */
+ // ---------- "num_change_pages" must be the last entry ---------------------
{
-1, SAVE_CONF_ALWAYS,
static struct LevelFileConfigInfo chunk_config_CUSX_change[] =
{
- /* ---------- "current_change_page" must be the first entry --------------- */
+ // ---------- "current_change_page" must be the first entry -----------------
{
-1, SAVE_CONF_ALWAYS,
&xx_current_change_page, -1
},
- /* ---------- (the remaining entries can be in any order) ----------------- */
+ // ---------- (the remaining entries can be in any order) -------------------
{
-1, -1,
}
};
-static struct LevelFileConfigInfo chunk_config_CONF[] = /* (OBSOLETE) */
+static struct LevelFileConfigInfo chunk_config_CONF[] = // (OBSOLETE)
{
{
EL_PLAYER_1, -1,
};
-/* ========================================================================= */
-/* level file functions */
-/* ========================================================================= */
+// ============================================================================
+// level file functions
+// ============================================================================
static boolean check_special_flags(char *flag)
{
ei->editor_description);
int i;
- /* always start with reliable default values */
+ // always start with reliable default values
for (i = 0; i < MAX_ELEMENT_NAME_LEN + 1; i++)
description[i] = '\0';
- /* truncate element description to MAX_ELEMENT_NAME_LEN bytes */
+ // truncate element description to MAX_ELEMENT_NAME_LEN bytes
strncpy(description, default_description, MAX_ELEMENT_NAME_LEN);
return &description[0];
content[c].e[x][y] = default_value;
}
}
- else /* constant size configuration data (1, 2 or 4 bytes) */
+ else // constant size configuration data (1, 2 or 4 bytes)
{
if (data_type == TYPE_BOOLEAN)
*(boolean *)(conf[i].value) = default_value;
content_copy[c].e[x][y] = content[c].e[x][y];
}
}
- else /* constant size configuration data (1, 2 or 4 bytes) */
+ else // constant size configuration data (1, 2 or 4 bytes)
{
if (data_type == TYPE_BOOLEAN)
*(boolean *)(conf[i].value_copy) = *(boolean *)(conf[i].value);
{
int i;
- xx_ei = *ei_from; /* copy element data into temporary buffer */
- yy_ei = *ei_to; /* copy element data into temporary buffer */
+ xx_ei = *ei_from; // copy element data into temporary buffer
+ yy_ei = *ei_to; // copy element data into temporary buffer
copyConfigFromConfigList(chunk_config_CUSX_base);
*ei_from = xx_ei;
*ei_to = yy_ei;
- /* ---------- reinitialize and copy change pages ---------- */
+ // ---------- reinitialize and copy change pages ----------
ei_to->num_change_pages = ei_from->num_change_pages;
ei_to->current_change_page = ei_from->current_change_page;
for (i = 0; i < ei_to->num_change_pages; i++)
ei_to->change_page[i] = ei_from->change_page[i];
- /* ---------- copy group element info ---------- */
- if (ei_from->group != NULL && ei_to->group != NULL) /* group or internal */
+ // ---------- copy group element info ----------
+ if (ei_from->group != NULL && ei_to->group != NULL) // group or internal
*ei_to->group = *ei_from->group;
- /* mark this custom element as modified */
+ // mark this custom element as modified
ei_to->modified_settings = TRUE;
}
void setElementChangeInfoToDefaults(struct ElementChangeInfo *change)
{
- xx_change = *change; /* copy change data into temporary buffer */
+ xx_change = *change; // copy change data into temporary buffer
setConfigToDefaultsFromConfigList(chunk_config_CUSX_change);
{
int i, x, y;
- li = *level; /* copy level data into temporary buffer */
+ li = *level; // copy level data into temporary buffer
setConfigToDefaultsFromConfigList(chunk_config_INFO);
- *level = li; /* copy temporary buffer back to level data */
+ *level = li; // copy temporary buffer back to level data
setLevelInfoToDefaults_EM();
setLevelInfoToDefaults_SP();
level->encoding_16bit_yamyam = TRUE;
level->encoding_16bit_amoeba = TRUE;
- /* clear level name and level author string buffers */
+ // clear level name and level author string buffers
for (i = 0; i < MAX_LEVEL_NAME_LEN; i++)
level->name[i] = '\0';
for (i = 0; i < MAX_LEVEL_AUTHOR_LEN; i++)
level->author[i] = '\0';
- /* set level name and level author to default values */
+ // set level name and level author to default values
strcpy(level->name, NAMELESS_LEVEL_NAME);
strcpy(level->author, ANONYMOUS_NAME);
- /* set level playfield to playable default level with player and exit */
+ // set level playfield to playable default level with player and exit
for (x = 0; x < MAX_LEV_FIELDX; x++)
for (y = 0; y < MAX_LEV_FIELDY; y++)
level->field[x][y] = EL_SAND;
BorderElement = EL_STEELWALL;
- /* detect custom elements when loading them */
+ // detect custom elements when loading them
level->file_has_custom_elements = FALSE;
- /* set all bug compatibility flags to "false" => do not emulate this bug */
+ // set all bug compatibility flags to "false" => do not emulate this bug
level->use_action_after_change_bug = FALSE;
if (leveldir_current)
{
- /* try to determine better author name than 'anonymous' */
+ // try to determine better author name than 'anonymous'
if (!strEqual(leveldir_current->author, ANONYMOUS_NAME))
{
strncpy(level->author, leveldir_current->author, MAX_LEVEL_AUTHOR_LEN);
break;
default:
- /* keep default value */
+ // keep default value
break;
}
}
InitElementPropertiesStatic();
- li = *level; /* copy level data into temporary buffer */
+ li = *level; // copy level data into temporary buffer
setConfigToDefaultsFromConfigList(chunk_config_ELEM);
- *level = li; /* copy temporary buffer back to level data */
+ *level = li; // copy temporary buffer back to level data
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
int element = i;
struct ElementInfo *ei = &element_info[element];
- /* never initialize clipboard elements after the very first time */
- /* (to be able to use clipboard elements between several levels) */
+ // never initialize clipboard elements after the very first time
+ // (to be able to use clipboard elements between several levels)
if (IS_CLIPBOARD_ELEMENT(element) && clipboard_elements_initialized)
continue;
IS_GROUP_ELEMENT(element) ||
IS_INTERNAL_ELEMENT(element))
{
- xx_ei = *ei; /* copy element data into temporary buffer */
+ xx_ei = *ei; // copy element data into temporary buffer
setConfigToDefaultsFromConfigList(chunk_config_CUSX_base);
if (IS_CUSTOM_ELEMENT(element) ||
IS_INTERNAL_ELEMENT(element))
{
- /* internal values used in level editor */
+ // internal values used in level editor
ei->access_type = 0;
ei->access_layer = 0;
{
struct ElementGroupInfo *group;
- /* initialize memory for list of elements in group */
+ // initialize memory for list of elements in group
if (ei->group == NULL)
ei->group = checked_malloc(sizeof(struct ElementGroupInfo));
group = ei->group;
- xx_group = *group; /* copy group data into temporary buffer */
+ xx_group = *group; // copy group data into temporary buffer
setConfigToDefaultsFromConfigList(chunk_config_GRPX);
if (check_special_flags("load_xsb_to_ces"))
{
- /* fill smaller playfields with padding "beyond border wall" elements */
+ // fill smaller playfields with padding "beyond border wall" elements
if (level.fieldx < level_template.fieldx ||
level.fieldy < level_template.fieldy)
{
int pos_fieldx = (new_fieldx - level.fieldx) / 2;
int pos_fieldy = (new_fieldy - level.fieldy) / 2;
- /* copy old playfield (which is smaller than the visible area) */
+ // copy old playfield (which is smaller than the visible area)
for (y = 0; y < level.fieldy; y++) for (x = 0; x < level.fieldx; x++)
field[x][y] = level.field[x][y];
- /* fill new, larger playfield with "beyond border wall" elements */
+ // fill new, larger playfield with "beyond border wall" elements
for (y = 0; y < new_fieldy; y++) for (x = 0; x < new_fieldx; x++)
level.field[x][y] = getMappedElement_SB('_', TRUE);
- /* copy the old playfield to the middle of the new playfield */
+ // copy the old playfield to the middle of the new playfield
for (y = 0; y < level.fieldy; y++) for (x = 0; x < level.fieldx; x++)
level.field[pos_fieldx + x][pos_fieldy + y] = field[x][y];
{
struct LevelInfo level_backup = level;
- /* overwrite all individual level settings from template level settings */
+ // overwrite all individual level settings from template level settings
level = level_template;
- /* restore level file info */
+ // restore level file info
level.file_info = level_backup.file_info;
- /* restore playfield size */
+ // restore playfield size
level.fieldx = level_backup.fieldx;
level.fieldy = level_backup.fieldy;
- /* restore playfield content */
+ // restore playfield content
for (x = 0; x < level.fieldx; x++)
for (y = 0; y < level.fieldy; y++)
level.field[x][y] = level_backup.field[x][y];
- /* restore name and author from individual level */
+ // restore name and author from individual level
strcpy(level.name, level_backup.name);
strcpy(level.author, level_backup.author);
- /* restore flag "use_custom_template" */
+ // restore flag "use_custom_template"
level.use_custom_template = level_backup.use_custom_template;
}
}
static int getFileTypeFromBasename(char *basename)
{
- /* !!! ALSO SEE COMMENT IN checkForPackageFromBasename() !!! */
+ // !!! ALSO SEE COMMENT IN checkForPackageFromBasename() !!!
static char *filename = NULL;
struct stat file_status;
- /* ---------- try to determine file type from filename ---------- */
+ // ---------- try to determine file type from filename ----------
- /* check for typical filename of a Supaplex level package file */
+ // check for typical filename of a Supaplex level package file
if (strlen(basename) == 10 && strPrefixLower(basename, "levels.d"))
return LEVEL_FILE_TYPE_SP;
- /* check for typical filename of a Diamond Caves II level package file */
+ // check for typical filename of a Diamond Caves II level package file
if (strSuffixLower(basename, ".dc") ||
strSuffixLower(basename, ".dc2"))
return LEVEL_FILE_TYPE_DC;
- /* check for typical filename of a Sokoban level package file */
+ // check for typical filename of a Sokoban level package file
if (strSuffixLower(basename, ".xsb") &&
strchr(basename, '%') == NULL)
return LEVEL_FILE_TYPE_SB;
- /* ---------- try to determine file type from filesize ---------- */
+ // ---------- try to determine file type from filesize ----------
checked_free(filename);
filename = getPath2(getCurrentLevelDir(), basename);
if (stat(filename, &file_status) == 0)
{
- /* check for typical filesize of a Supaplex level package file */
+ // check for typical filesize of a Supaplex level package file
if (file_status.st_size == 170496)
return LEVEL_FILE_TYPE_SP;
}
Directory *dir;
DirectoryEntry *dir_entry;
- strcpy(basename, UNDEFINED_FILENAME); /* default: undefined file */
+ strcpy(basename, UNDEFINED_FILENAME); // default: undefined file
if ((dir = openDirectory(directory)) == NULL)
{
return basename;
}
- while ((dir_entry = readDirectory(dir)) != NULL) /* loop all entries */
+ while ((dir_entry = readDirectory(dir)) != NULL) // loop all entries
{
char *entry_basename = dir_entry->basename;
int entry_type = getFileTypeFromBasename(entry_basename);
- if (entry_type != LEVEL_FILE_TYPE_UNKNOWN) /* found valid level package */
+ if (entry_type != LEVEL_FILE_TYPE_UNKNOWN) // found valid level package
{
if (type == LEVEL_FILE_TYPE_UNKNOWN ||
type == entry_type)
char *getGlobalLevelTemplateFilename(void)
{
- /* global variable "leveldir_current" must be modified in the loop below */
+ // global variable "leveldir_current" must be modified in the loop below
LevelDirTree *leveldir_current_last = leveldir_current;
char *filename = NULL;
- /* check for template level in path from current to topmost tree node */
+ // check for template level in path from current to topmost tree node
while (leveldir_current != NULL)
{
leveldir_current = leveldir_current->node_parent;
}
- /* restore global variable "leveldir_current" modified in above loop */
+ // restore global variable "leveldir_current" modified in above loop
leveldir_current = leveldir_current_last;
return filename;
{
int nr = lfi->nr;
- /* special case: level number is negative => check for level template file */
+ // special case: level number is negative => check for level template file
if (nr < 0)
{
setLevelFileInfo_FormatLevelFilename(lfi, LEVEL_FILE_TYPE_RND,
getSingleLevelBasename(-1));
- /* replace local level template filename with global template filename */
+ // replace local level template filename with global template filename
setString(&lfi->filename, getGlobalLevelTemplateFilename());
- /* no fallback if template file not existing */
+ // no fallback if template file not existing
return;
}
- /* special case: check for file name/pattern specified in "levelinfo.conf" */
+ // special case: check for file name/pattern specified in "levelinfo.conf"
if (leveldir_current->level_filename != NULL)
{
int filetype = getFiletypeFromID(leveldir_current->level_filetype);
{
int filetype = getFiletypeFromID(leveldir_current->level_filetype);
- /* check for specified native level file with standard file name */
+ // check for specified native level file with standard file name
setLevelFileInfo_FormatLevelFilename(lfi, filetype,
"%03d.%s", nr, LEVELFILE_EXTENSION);
if (fileExists(lfi->filename))
return;
}
- /* check for native Rocks'n'Diamonds level file */
+ // check for native Rocks'n'Diamonds level file
setLevelFileInfo_FormatLevelFilename(lfi, LEVEL_FILE_TYPE_RND,
"%03d.%s", nr, LEVELFILE_EXTENSION);
if (fileExists(lfi->filename))
return;
- /* check for Emerald Mine level file (V1) */
+ // check for Emerald Mine level file (V1)
setLevelFileInfo_FormatLevelFilename(lfi, LEVEL_FILE_TYPE_EM, "a%c%c",
'a' + (nr / 10) % 26, '0' + nr % 10);
if (fileExists(lfi->filename))
if (fileExists(lfi->filename))
return;
- /* check for Emerald Mine level file (V2 to V5) */
+ // check for Emerald Mine level file (V2 to V5)
setLevelFileInfo_FormatLevelFilename(lfi, LEVEL_FILE_TYPE_EM, "%d", nr);
if (fileExists(lfi->filename))
return;
- /* check for Emerald Mine level file (V6 / single mode) */
+ // check for Emerald Mine level file (V6 / single mode)
setLevelFileInfo_FormatLevelFilename(lfi, LEVEL_FILE_TYPE_EM, "%02ds", nr);
if (fileExists(lfi->filename))
return;
if (fileExists(lfi->filename))
return;
- /* check for Emerald Mine level file (V6 / teamwork mode) */
+ // check for Emerald Mine level file (V6 / teamwork mode)
setLevelFileInfo_FormatLevelFilename(lfi, LEVEL_FILE_TYPE_EM, "%02dt", nr);
if (fileExists(lfi->filename))
return;
if (fileExists(lfi->filename))
return;
- /* check for various packed level file formats */
+ // check for various packed level file formats
setLevelFileInfo_PackedLevelFilename(lfi, LEVEL_FILE_TYPE_UNKNOWN);
if (fileExists(lfi->filename))
return;
- /* no known level file found -- use default values (and fail later) */
+ // no known level file found -- use default values (and fail later)
setLevelFileInfo_FormatLevelFilename(lfi, LEVEL_FILE_TYPE_RND,
"%03d.%s", nr, LEVELFILE_EXTENSION);
}
static void setLevelFileInfo(struct LevelFileInfo *level_file_info, int nr)
{
- /* always start with reliable default values */
+ // always start with reliable default values
setFileInfoToDefaults(level_file_info);
- level_file_info->nr = nr; /* set requested level number */
+ level_file_info->nr = nr; // set requested level number
determineLevelFileInfo_Filename(level_file_info);
determineLevelFileInfo_Filetype(level_file_info);
setString(&lfi_to->filename, lfi_from->filename);
}
-/* ------------------------------------------------------------------------- */
-/* functions for loading R'n'D level */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for loading R'n'D level
+// ----------------------------------------------------------------------------
static int getMappedElement(int element)
{
- /* remap some (historic, now obsolete) elements */
+ // remap some (historic, now obsolete) elements
switch (element)
{
static int getMappedElementByVersion(int element, int game_version)
{
- /* remap some elements due to certain game version */
+ // remap some elements due to certain game version
if (game_version <= VERSION_IDENT(2,2,0,0))
{
- /* map game font elements */
+ // map game font elements
element = (element == EL_CHAR('[') ? EL_CHAR_AUMLAUT :
element == EL_CHAR('\\') ? EL_CHAR_OUMLAUT :
element == EL_CHAR(']') ? EL_CHAR_UUMLAUT :
if (game_version < VERSION_IDENT(3,0,0,0))
{
- /* map Supaplex gravity tube elements */
+ // map Supaplex gravity tube elements
element = (element == EL_SP_GRAVITY_PORT_LEFT ? EL_SP_PORT_LEFT :
element == EL_SP_GRAVITY_PORT_RIGHT ? EL_SP_PORT_RIGHT :
element == EL_SP_GRAVITY_PORT_UP ? EL_SP_PORT_UP :
getFile8Bit(file);
getFile8Bit(file);
- /* correct invalid number of content fields -- should never happen */
+ // correct invalid number of content fields -- should never happen
if (level->num_yamyam_contents < 1 ||
level->num_yamyam_contents > MAX_ELEMENT_CONTENTS)
level->num_yamyam_contents = STD_ELEMENT_CONTENTS;
element = getMappedElement(getFile16BitBE(file));
num_contents = getFile8Bit(file);
- getFile8Bit(file); /* content x size (unused) */
- getFile8Bit(file); /* content y size (unused) */
+ getFile8Bit(file); // content x size (unused)
+ getFile8Bit(file); // content y size (unused)
ReadUnusedBytesFromFile(file, LEVEL_CHUNK_CNT2_UNUSED);
for (x = 0; x < 3; x++)
content_array[i][x][y] = getMappedElement(getFile16BitBE(file));
- /* correct invalid number of content fields -- should never happen */
+ // correct invalid number of content fields -- should never happen
if (num_contents < 1 || num_contents > MAX_ELEMENT_CONTENTS)
num_contents = STD_ELEMENT_CONTENTS;
ei->properties[EP_BITFIELD_BASE_NR] = getFile32BitBE(file);
- /* some free bytes for future properties and padding */
+ // some free bytes for future properties and padding
ReadUnusedBytesFromFile(file, 7);
ei->use_gfx_element = getFile8Bit(file);
ei->slippery_type = getFile8Bit(file);
- /* some free bytes for future properties and padding */
+ // some free bytes for future properties and padding
ReadUnusedBytesFromFile(file, LEVEL_CPART_CUS3_UNUSED);
- /* mark that this custom element has been modified */
+ // mark that this custom element has been modified
ei->modified_settings = TRUE;
}
int element;
int i, j, x, y;
- /* ---------- custom element base property values (96 bytes) ------------- */
+ // ---------- custom element base property values (96 bytes) ----------------
element = getMappedElement(getFile16BitBE(file));
ei->properties[EP_BITFIELD_BASE_NR] = getFile32BitBE(file);
- ReadUnusedBytesFromFile(file, 4); /* reserved for more base properties */
+ ReadUnusedBytesFromFile(file, 4); // reserved for more base properties
ei->num_change_pages = getFile8Bit(file);
ei->move_delay_fixed = getFile16BitBE(file);
ei->move_delay_random = getFile16BitBE(file);
- /* bits 0 - 15 of "move_pattern" ... */
+ // bits 0 - 15 of "move_pattern" ...
ei->move_pattern = getFile16BitBE(file);
ei->move_direction_initial = getFile8Bit(file);
ei->move_stepsize = getFile8Bit(file);
ei->move_leave_element = getMappedElement(getFile16BitBE(file));
ei->move_leave_type = getFile8Bit(file);
- /* ... bits 16 - 31 of "move_pattern" (not nice, but downward compatible) */
+ // ... bits 16 - 31 of "move_pattern" (not nice, but downward compatible)
ei->move_pattern |= (getFile16BitBE(file) << 16);
ei->access_direction = getFile8Bit(file);
ei->ignition_delay = getFile8Bit(file);
ei->explosion_type = getFile8Bit(file);
- /* some free bytes for future custom property values and padding */
+ // some free bytes for future custom property values and padding
ReadUnusedBytesFromFile(file, 1);
- /* ---------- change page property values (48 bytes) --------------------- */
+ // ---------- change page property values (48 bytes) ------------------------
setElementChangePages(ei, ei->num_change_pages);
struct ElementChangeInfo *change = &ei->change_page[i];
unsigned int event_bits;
- /* always start with reliable default values */
+ // always start with reliable default values
setElementChangeInfoToDefaults(change);
- /* bits 0 - 31 of "has_event[]" ... */
+ // bits 0 - 31 of "has_event[]" ...
event_bits = getFile32BitBE(file);
for (j = 0; j < MIN(NUM_CHANGE_EVENTS, 32); j++)
if (event_bits & (1 << j))
change->action_mode = getFile8Bit(file);
change->action_arg = getFile16BitBE(file);
- /* ... bits 32 - 39 of "has_event[]" (not nice, but downward compatible) */
+ // ... bits 32 - 39 of "has_event[]" (not nice, but downward compatible)
event_bits = getFile8Bit(file);
for (j = 32; j < NUM_CHANGE_EVENTS; j++)
if (event_bits & (1 << (j - 32)))
change->has_event[j] = TRUE;
}
- /* mark this custom element as modified */
+ // mark this custom element as modified
ei->modified_settings = TRUE;
level->file_has_custom_elements = TRUE;
group->choice_mode = getFile8Bit(file);
- /* some free bytes for future values and padding */
+ // some free bytes for future values and padding
ReadUnusedBytesFromFile(file, 3);
for (i = 0; i < MAX_ELEMENTS_IN_GROUP; i++)
group->element[i] = getMappedElement(getFile16BitBE(file));
- /* mark this group element as modified */
+ // mark this group element as modified
element_info[element].modified_settings = TRUE;
level->file_has_custom_elements = TRUE;
if (num_entities == 0 && (data_type == TYPE_ELEMENT_LIST ||
data_type == TYPE_CONTENT_LIST))
{
- /* for element and content lists, zero entities are not allowed */
+ // for element and content lists, zero entities are not allowed
Error(ERR_WARN, "found empty list of entities for element %d",
element);
- /* do not set "num_entities" here to prevent reading behind buffer */
+ // do not set "num_entities" here to prevent reading behind buffer
- *(int *)(conf[i].num_entities) = 1; /* at least one is required */
+ *(int *)(conf[i].num_entities) = 1; // at least one is required
}
else
{
micro_chunk_size += 2 + num_bytes;
}
- else /* constant size configuration data (1, 2 or 4 bytes) */
+ else // constant size configuration data (1, 2 or 4 bytes)
{
int value = (byte_mask == CONF_MASK_1_BYTE ? getFile8Bit (file) :
byte_mask == CONF_MASK_2_BYTE ? getFile16BitBE(file) :
{
int real_chunk_size = 0;
- li = *level; /* copy level data into temporary buffer */
+ li = *level; // copy level data into temporary buffer
while (!checkEndOfFile(file))
{
break;
}
- *level = li; /* copy temporary buffer back to level data */
+ *level = li; // copy temporary buffer back to level data
return real_chunk_size;
}
{
int real_chunk_size = 0;
- li = *level; /* copy level data into temporary buffer */
+ li = *level; // copy level data into temporary buffer
while (!checkEndOfFile(file))
{
break;
}
- *level = li; /* copy temporary buffer back to level data */
+ *level = li; // copy temporary buffer back to level data
return real_chunk_size;
}
{
int real_chunk_size = 0;
- li = *level; /* copy level data into temporary buffer */
+ li = *level; // copy level data into temporary buffer
while (!checkEndOfFile(file))
{
break;
}
- *level = li; /* copy temporary buffer back to level data */
+ *level = li; // copy temporary buffer back to level data
return real_chunk_size;
}
int envelope_nr = element - EL_ENVELOPE_1;
int real_chunk_size = 2;
- xx_envelope = level->envelope[envelope_nr]; /* copy into temporary buffer */
+ xx_envelope = level->envelope[envelope_nr]; // copy into temporary buffer
while (!checkEndOfFile(file))
{
break;
}
- level->envelope[envelope_nr] = xx_envelope; /* copy from temporary buffer */
+ level->envelope[envelope_nr] = xx_envelope; // copy from temporary buffer
return real_chunk_size;
}
struct ElementInfo *ei = &element_info[element];
int i;
- xx_ei = *ei; /* copy element data into temporary buffer */
+ xx_ei = *ei; // copy element data into temporary buffer
xx_ei.num_change_pages = -1;
return real_chunk_size;
}
- /* initialize number of change pages stored for this custom element */
+ // initialize number of change pages stored for this custom element
setElementChangePages(ei, ei->num_change_pages);
for (i = 0; i < ei->num_change_pages; i++)
setElementChangeInfoToDefaults(&ei->change_page[i]);
- /* start with reading properties for the first change page */
+ // start with reading properties for the first change page
xx_current_change_page = 0;
while (!checkEndOfFile(file))
{
struct ElementChangeInfo *change = &ei->change_page[xx_current_change_page];
- xx_change = *change; /* copy change data into temporary buffer */
+ xx_change = *change; // copy change data into temporary buffer
- resetEventBits(); /* reset bits; change page might have changed */
+ resetEventBits(); // reset bits; change page might have changed
real_chunk_size += LoadLevel_MicroChunk(file, chunk_config_CUSX_change,
-1, element);
struct ElementInfo *ei = &element_info[element];
struct ElementGroupInfo *group = ei->group;
- xx_ei = *ei; /* copy element data into temporary buffer */
- xx_group = *group; /* copy group data into temporary buffer */
+ xx_ei = *ei; // copy element data into temporary buffer
+ xx_group = *group; // copy group data into temporary buffer
while (!checkEndOfFile(file))
{
if (!setup.editor.use_template_for_new_levels)
return;
- /* if level file not found, try to initialize level data from template */
+ // if level file not found, try to initialize level data from template
filename = getGlobalLevelTemplateFilename();
if (!(file = openFile(filename, MODE_READ)))
return;
- /* default: for empty levels, use level template for custom elements */
+ // default: for empty levels, use level template for custom elements
level->use_custom_template = TRUE;
level->no_valid_file = FALSE;
getFileChunkBE(file, chunk_name, NULL);
if (strEqual(chunk_name, "RND1"))
{
- getFile32BitBE(file); /* not used */
+ getFile32BitBE(file); // not used
getFileChunkBE(file, chunk_name, NULL);
if (!strEqual(chunk_name, "CAVE"))
return;
}
}
- else /* check for pre-2.0 file format with cookie string */
+ else // check for pre-2.0 file format with cookie string
{
strcpy(cookie, chunk_name);
if (getStringFromFile(file, &cookie[4], MAX_LINE_LEN - 4) == NULL)
return;
}
- /* pre-2.0 level files have no game version, so use file version here */
+ // pre-2.0 level files have no game version, so use file version here
level->game_version = level->file_version;
}
if (level->file_version < FILE_VERSION_1_2)
{
- /* level files from versions before 1.2.0 without chunk structure */
+ // level files from versions before 1.2.0 without chunk structure
LoadLevel_HEAD(file, LEVEL_CHUNK_HEAD_SIZE, level);
LoadLevel_BODY(file, level->fieldx * level->fieldy, level);
}
}
else
{
- /* call function to load this level chunk */
+ // call function to load this level chunk
int chunk_size_expected =
(chunk_info[i].loader)(file, chunk_size, level);
}
-/* ------------------------------------------------------------------------- */
-/* functions for loading EM level */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for loading EM level
+// ----------------------------------------------------------------------------
static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
{
map_android_clone_elements_RND_to_EM(level);
- /* first fill the complete playfield with the default border element */
+ // first fill the complete playfield with the default border element
for (y = 0; y < EM_MAX_CAVE_HEIGHT; y++)
for (x = 0; x < EM_MAX_CAVE_WIDTH; x++)
level_em->cave[x][y] = ZBORDER;
level_em->cave[x + 1][y + 1] = map_element_RND_to_EM(EL_STEELWALL);
}
- /* then copy the real level contents from level file into the playfield */
+ // then copy the real level contents from level file into the playfield
for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++)
{
int new_element = map_element_RND_to_EM(level->field[x][y]);
ply[i]->y_initial = 0;
}
- /* initialize player positions and delete players from the playfield */
+ // initialize player positions and delete players from the playfield
for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++)
{
if (ELEM_IS_PLAYER(level->field[x][y]))
map_android_clone_elements_EM_to_RND(level);
- /* convert the playfield (some elements need special treatment) */
+ // convert the playfield (some elements need special treatment)
for (y = 0; y < level->fieldy; y++) for (x = 0; x < level->fieldx; x++)
{
int new_element = map_element_EM_to_RND(level_em->cave[x + 1][y + 1]);
for (i = 0; i < MAX_PLAYERS; i++)
{
- /* in case of all players set to the same field, use the first player */
+ // in case of all players set to the same field, use the first player
int nr = MAX_PLAYERS - i - 1;
int jx = ply[nr]->x_initial - 1;
int jy = ply[nr]->y_initial - 1;
}
-/* ------------------------------------------------------------------------- */
-/* functions for loading SP level */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for loading SP level
+// ----------------------------------------------------------------------------
static void CopyNativeLevel_RND_to_SP(struct LevelInfo *level)
{
for (i = 0; i < SP_LEVEL_NAME_LEN; i++)
header->LevelTitle[i] = level->name[i];
- /* !!! NO STRING TERMINATION IN SUPAPLEX VB CODE YET -- FIX THIS !!! */
+ // !!! NO STRING TERMINATION IN SUPAPLEX VB CODE YET -- FIX THIS !!!
header->InfotronsNeeded = level->gems_needed;
}
else
{
- /* change special gravity port to normal port */
+ // change special gravity port to normal port
element += EL_SP_PORT_RIGHT - gravity_port_base_element;
}
level->initial_player_gravity[i] =
(header->InitialGravity == 1 ? TRUE : FALSE);
- /* skip leading spaces */
+ // skip leading spaces
for (i = 0; i < SP_LEVEL_NAME_LEN; i++)
if (header->LevelTitle[i] != ' ')
break;
- /* copy level title */
+ // copy level title
for (j = 0; i < SP_LEVEL_NAME_LEN; i++, j++)
level->name[j] = header->LevelTitle[i];
level->name[j] = '\0';
- /* cut trailing spaces */
+ // cut trailing spaces
for (; j > 0; j--)
if (level->name[j - 1] == ' ' && level->name[j] == '\0')
level->name[j - 1] = '\0';
EL_SP_GRAVITY_OFF_PORT_RIGHT) - EL_SP_GRAVITY_PORT_RIGHT;
}
- /* change special gravity ports without database entries to normal ports */
+ // change special gravity ports without database entries to normal ports
for (x = 0; x < level->fieldx; x++)
for (y = 0; y < level->fieldy; y++)
if (level->field[x][y] >= EL_SP_GRAVITY_PORT_RIGHT &&
level->field[x][y] <= EL_SP_GRAVITY_PORT_UP)
level->field[x][y] += EL_SP_PORT_RIGHT - EL_SP_GRAVITY_PORT_RIGHT;
- level->time = 0; /* no time limit */
+ level->time = 0; // no time limit
level->amoeba_speed = 0;
level->time_magic_wall = 0;
level->time_wheel = 0;
level->amoeba_content = EL_EMPTY;
#if 1
- /* original Supaplex does not use score values -- use default values */
+ // original Supaplex does not use score values -- use default values
#else
for (i = 0; i < LEVEL_SCORE_ELEMENTS; i++)
level->score[i] = 0;
#endif
- /* there are no yamyams in supaplex levels */
+ // there are no yamyams in supaplex levels
for (i = 0; i < level->num_yamyam_contents; i++)
for (x = 0; x < 3; x++)
for (y = 0; y < 3; y++)
struct DemoInfo_SP *demo = &level_sp->demo;
int i, j;
- /* always start with reliable default values */
+ // always start with reliable default values
demo->is_available = FALSE;
demo->length = 0;
if (TAPE_IS_EMPTY(tape))
return;
- demo->level_nr = tape.level_nr; /* (currently not used) */
+ demo->level_nr = tape.level_nr; // (currently not used)
level_sp->header.DemoRandomSeed = tape.random_seed;
char *filename = level->file_info.filename;
int i;
- /* always start with reliable default values */
+ // always start with reliable default values
setTapeInfoToDefaults();
if (!demo->is_available)
return;
- tape.level_nr = demo->level_nr; /* (currently not used) */
+ tape.level_nr = demo->level_nr; // (currently not used)
tape.random_seed = level_sp->header.DemoRandomSeed;
TapeSetDateFromEpochSeconds(getFileTimestampEpochSeconds(filename));
}
-/* ------------------------------------------------------------------------- */
-/* functions for loading MM level */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for loading MM level
+// ----------------------------------------------------------------------------
static void CopyNativeLevel_RND_to_MM(struct LevelInfo *level)
{
strcpy(level->name, level_mm->name);
- /* only overwrite author from 'levelinfo.conf' if author defined in level */
+ // only overwrite author from 'levelinfo.conf' if author defined in level
if (!strEqual(level_mm->author, ANONYMOUS_NAME))
strcpy(level->author, level_mm->author);
}
-/* ------------------------------------------------------------------------- */
-/* functions for loading DC level */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for loading DC level
+// ----------------------------------------------------------------------------
#define DC_LEVEL_HEADER_SIZE 344
element = EL_ROCK;
break;
- /* 0x0117 - 0x036e: (?) */
- /* EL_DIAMOND */
+ // 0x0117 - 0x036e: (?)
+ // EL_DIAMOND
- /* 0x042d - 0x0684: (?) */
- /* EL_EMERALD */
+ // 0x042d - 0x0684: (?)
+ // EL_EMERALD
case 0x06f1:
element = EL_NUT;
element = EL_CRYSTAL;
break;
- case 0x0e77: /* quicksand (boulder) */
+ case 0x0e77: // quicksand (boulder)
element = EL_QUICKSAND_FAST_FULL;
break;
- case 0x0e99: /* slow quicksand (boulder) */
+ case 0x0e99: // slow quicksand (boulder)
element = EL_QUICKSAND_FULL;
break;
element = EL_EM_STEEL_EXIT_CLOSED;
break;
- case 0x0f4f: /* dynamite (lit 1) */
+ case 0x0f4f: // dynamite (lit 1)
element = EL_EM_DYNAMITE_ACTIVE;
break;
- case 0x0f57: /* dynamite (lit 2) */
+ case 0x0f57: // dynamite (lit 2)
element = EL_EM_DYNAMITE_ACTIVE;
break;
- case 0x0f5f: /* dynamite (lit 3) */
+ case 0x0f5f: // dynamite (lit 3)
element = EL_EM_DYNAMITE_ACTIVE;
break;
- case 0x0f67: /* dynamite (lit 4) */
+ case 0x0f67: // dynamite (lit 4)
element = EL_EM_DYNAMITE_ACTIVE;
break;
element = EL_TIMEGATE_CLOSED;
break;
- case 0x144c: /* conveyor belt switch (green) */
+ case 0x144c: // conveyor belt switch (green)
element = EL_CONVEYOR_BELT_3_SWITCH_MIDDLE;
break;
- case 0x144f: /* conveyor belt switch (red) */
+ case 0x144f: // conveyor belt switch (red)
element = EL_CONVEYOR_BELT_1_SWITCH_MIDDLE;
break;
- case 0x1452: /* conveyor belt switch (blue) */
+ case 0x1452: // conveyor belt switch (blue)
element = EL_CONVEYOR_BELT_4_SWITCH_MIDDLE;
break;
element = EL_EXPANDABLE_WALL_ANY;
break;
- case 0x14ce: /* growing steel wall (left/right) */
+ case 0x14ce: // growing steel wall (left/right)
element = EL_EXPANDABLE_STEELWALL_HORIZONTAL;
break;
- case 0x14df: /* growing steel wall (up/down) */
+ case 0x14df: // growing steel wall (up/down)
element = EL_EXPANDABLE_STEELWALL_VERTICAL;
break;
- case 0x14e8: /* growing steel wall (up/down/left/right) */
+ case 0x14e8: // growing steel wall (up/down/left/right)
element = EL_EXPANDABLE_STEELWALL_ANY;
break;
element = EL_EMPTY_SPACE;
break;
- case 0x1578: /* quicksand (empty) */
+ case 0x1578: // quicksand (empty)
element = EL_QUICKSAND_FAST_EMPTY;
break;
- case 0x1579: /* slow quicksand (empty) */
+ case 0x1579: // slow quicksand (empty)
element = EL_QUICKSAND_EMPTY;
break;
- /* 0x157c - 0x158b: */
- /* EL_SAND */
+ // 0x157c - 0x158b:
+ // EL_SAND
- /* 0x1590 - 0x159f: */
- /* EL_DC_LANDMINE */
+ // 0x1590 - 0x159f:
+ // EL_DC_LANDMINE
case 0x15a0:
element = EL_EM_DYNAMITE;
break;
- case 0x15a1: /* key (red) */
+ case 0x15a1: // key (red)
element = EL_EM_KEY_1;
break;
- case 0x15a2: /* key (yellow) */
+ case 0x15a2: // key (yellow)
element = EL_EM_KEY_2;
break;
- case 0x15a3: /* key (blue) */
+ case 0x15a3: // key (blue)
element = EL_EM_KEY_4;
break;
- case 0x15a4: /* key (green) */
+ case 0x15a4: // key (green)
element = EL_EM_KEY_3;
break;
- case 0x15a5: /* key (white) */
+ case 0x15a5: // key (white)
element = EL_DC_KEY_WHITE;
break;
element = EL_WALL;
break;
- case 0x15a8: /* wall (not round) */
+ case 0x15a8: // wall (not round)
element = EL_WALL;
break;
- case 0x15a9: /* (blue) */
+ case 0x15a9: // (blue)
element = EL_CHAR_A;
break;
- case 0x15aa: /* (blue) */
+ case 0x15aa: // (blue)
element = EL_CHAR_B;
break;
- case 0x15ab: /* (blue) */
+ case 0x15ab: // (blue)
element = EL_CHAR_C;
break;
- case 0x15ac: /* (blue) */
+ case 0x15ac: // (blue)
element = EL_CHAR_D;
break;
- case 0x15ad: /* (blue) */
+ case 0x15ad: // (blue)
element = EL_CHAR_E;
break;
- case 0x15ae: /* (blue) */
+ case 0x15ae: // (blue)
element = EL_CHAR_F;
break;
- case 0x15af: /* (blue) */
+ case 0x15af: // (blue)
element = EL_CHAR_G;
break;
- case 0x15b0: /* (blue) */
+ case 0x15b0: // (blue)
element = EL_CHAR_H;
break;
- case 0x15b1: /* (blue) */
+ case 0x15b1: // (blue)
element = EL_CHAR_I;
break;
- case 0x15b2: /* (blue) */
+ case 0x15b2: // (blue)
element = EL_CHAR_J;
break;
- case 0x15b3: /* (blue) */
+ case 0x15b3: // (blue)
element = EL_CHAR_K;
break;
- case 0x15b4: /* (blue) */
+ case 0x15b4: // (blue)
element = EL_CHAR_L;
break;
- case 0x15b5: /* (blue) */
+ case 0x15b5: // (blue)
element = EL_CHAR_M;
break;
- case 0x15b6: /* (blue) */
+ case 0x15b6: // (blue)
element = EL_CHAR_N;
break;
- case 0x15b7: /* (blue) */
+ case 0x15b7: // (blue)
element = EL_CHAR_O;
break;
- case 0x15b8: /* (blue) */
+ case 0x15b8: // (blue)
element = EL_CHAR_P;
break;
- case 0x15b9: /* (blue) */
+ case 0x15b9: // (blue)
element = EL_CHAR_Q;
break;
- case 0x15ba: /* (blue) */
+ case 0x15ba: // (blue)
element = EL_CHAR_R;
break;
- case 0x15bb: /* (blue) */
+ case 0x15bb: // (blue)
element = EL_CHAR_S;
break;
- case 0x15bc: /* (blue) */
+ case 0x15bc: // (blue)
element = EL_CHAR_T;
break;
- case 0x15bd: /* (blue) */
+ case 0x15bd: // (blue)
element = EL_CHAR_U;
break;
- case 0x15be: /* (blue) */
+ case 0x15be: // (blue)
element = EL_CHAR_V;
break;
- case 0x15bf: /* (blue) */
+ case 0x15bf: // (blue)
element = EL_CHAR_W;
break;
- case 0x15c0: /* (blue) */
+ case 0x15c0: // (blue)
element = EL_CHAR_X;
break;
- case 0x15c1: /* (blue) */
+ case 0x15c1: // (blue)
element = EL_CHAR_Y;
break;
- case 0x15c2: /* (blue) */
+ case 0x15c2: // (blue)
element = EL_CHAR_Z;
break;
- case 0x15c3: /* (blue) */
+ case 0x15c3: // (blue)
element = EL_CHAR_AUMLAUT;
break;
- case 0x15c4: /* (blue) */
+ case 0x15c4: // (blue)
element = EL_CHAR_OUMLAUT;
break;
- case 0x15c5: /* (blue) */
+ case 0x15c5: // (blue)
element = EL_CHAR_UUMLAUT;
break;
- case 0x15c6: /* (blue) */
+ case 0x15c6: // (blue)
element = EL_CHAR_0;
break;
- case 0x15c7: /* (blue) */
+ case 0x15c7: // (blue)
element = EL_CHAR_1;
break;
- case 0x15c8: /* (blue) */
+ case 0x15c8: // (blue)
element = EL_CHAR_2;
break;
- case 0x15c9: /* (blue) */
+ case 0x15c9: // (blue)
element = EL_CHAR_3;
break;
- case 0x15ca: /* (blue) */
+ case 0x15ca: // (blue)
element = EL_CHAR_4;
break;
- case 0x15cb: /* (blue) */
+ case 0x15cb: // (blue)
element = EL_CHAR_5;
break;
- case 0x15cc: /* (blue) */
+ case 0x15cc: // (blue)
element = EL_CHAR_6;
break;
- case 0x15cd: /* (blue) */
+ case 0x15cd: // (blue)
element = EL_CHAR_7;
break;
- case 0x15ce: /* (blue) */
+ case 0x15ce: // (blue)
element = EL_CHAR_8;
break;
- case 0x15cf: /* (blue) */
+ case 0x15cf: // (blue)
element = EL_CHAR_9;
break;
- case 0x15d0: /* (blue) */
+ case 0x15d0: // (blue)
element = EL_CHAR_PERIOD;
break;
- case 0x15d1: /* (blue) */
+ case 0x15d1: // (blue)
element = EL_CHAR_EXCLAM;
break;
- case 0x15d2: /* (blue) */
+ case 0x15d2: // (blue)
element = EL_CHAR_COLON;
break;
- case 0x15d3: /* (blue) */
+ case 0x15d3: // (blue)
element = EL_CHAR_LESS;
break;
- case 0x15d4: /* (blue) */
+ case 0x15d4: // (blue)
element = EL_CHAR_GREATER;
break;
- case 0x15d5: /* (blue) */
+ case 0x15d5: // (blue)
element = EL_CHAR_QUESTION;
break;
- case 0x15d6: /* (blue) */
+ case 0x15d6: // (blue)
element = EL_CHAR_COPYRIGHT;
break;
- case 0x15d7: /* (blue) */
+ case 0x15d7: // (blue)
element = EL_CHAR_UP;
break;
- case 0x15d8: /* (blue) */
+ case 0x15d8: // (blue)
element = EL_CHAR_DOWN;
break;
- case 0x15d9: /* (blue) */
+ case 0x15d9: // (blue)
element = EL_CHAR_BUTTON;
break;
- case 0x15da: /* (blue) */
+ case 0x15da: // (blue)
element = EL_CHAR_PLUS;
break;
- case 0x15db: /* (blue) */
+ case 0x15db: // (blue)
element = EL_CHAR_MINUS;
break;
- case 0x15dc: /* (blue) */
+ case 0x15dc: // (blue)
element = EL_CHAR_APOSTROPHE;
break;
- case 0x15dd: /* (blue) */
+ case 0x15dd: // (blue)
element = EL_CHAR_PARENLEFT;
break;
- case 0x15de: /* (blue) */
+ case 0x15de: // (blue)
element = EL_CHAR_PARENRIGHT;
break;
- case 0x15df: /* (green) */
+ case 0x15df: // (green)
element = EL_CHAR_A;
break;
- case 0x15e0: /* (green) */
+ case 0x15e0: // (green)
element = EL_CHAR_B;
break;
- case 0x15e1: /* (green) */
+ case 0x15e1: // (green)
element = EL_CHAR_C;
break;
- case 0x15e2: /* (green) */
+ case 0x15e2: // (green)
element = EL_CHAR_D;
break;
- case 0x15e3: /* (green) */
+ case 0x15e3: // (green)
element = EL_CHAR_E;
break;
- case 0x15e4: /* (green) */
+ case 0x15e4: // (green)
element = EL_CHAR_F;
break;
- case 0x15e5: /* (green) */
+ case 0x15e5: // (green)
element = EL_CHAR_G;
break;
- case 0x15e6: /* (green) */
+ case 0x15e6: // (green)
element = EL_CHAR_H;
break;
- case 0x15e7: /* (green) */
+ case 0x15e7: // (green)
element = EL_CHAR_I;
break;
- case 0x15e8: /* (green) */
+ case 0x15e8: // (green)
element = EL_CHAR_J;
break;
- case 0x15e9: /* (green) */
+ case 0x15e9: // (green)
element = EL_CHAR_K;
break;
- case 0x15ea: /* (green) */
+ case 0x15ea: // (green)
element = EL_CHAR_L;
break;
- case 0x15eb: /* (green) */
+ case 0x15eb: // (green)
element = EL_CHAR_M;
break;
- case 0x15ec: /* (green) */
+ case 0x15ec: // (green)
element = EL_CHAR_N;
break;
- case 0x15ed: /* (green) */
+ case 0x15ed: // (green)
element = EL_CHAR_O;
break;
- case 0x15ee: /* (green) */
+ case 0x15ee: // (green)
element = EL_CHAR_P;
break;
- case 0x15ef: /* (green) */
+ case 0x15ef: // (green)
element = EL_CHAR_Q;
break;
- case 0x15f0: /* (green) */
+ case 0x15f0: // (green)
element = EL_CHAR_R;
break;
- case 0x15f1: /* (green) */
+ case 0x15f1: // (green)
element = EL_CHAR_S;
break;
- case 0x15f2: /* (green) */
+ case 0x15f2: // (green)
element = EL_CHAR_T;
break;
- case 0x15f3: /* (green) */
+ case 0x15f3: // (green)
element = EL_CHAR_U;
break;
- case 0x15f4: /* (green) */
+ case 0x15f4: // (green)
element = EL_CHAR_V;
break;
- case 0x15f5: /* (green) */
+ case 0x15f5: // (green)
element = EL_CHAR_W;
break;
- case 0x15f6: /* (green) */
+ case 0x15f6: // (green)
element = EL_CHAR_X;
break;
- case 0x15f7: /* (green) */
+ case 0x15f7: // (green)
element = EL_CHAR_Y;
break;
- case 0x15f8: /* (green) */
+ case 0x15f8: // (green)
element = EL_CHAR_Z;
break;
- case 0x15f9: /* (green) */
+ case 0x15f9: // (green)
element = EL_CHAR_AUMLAUT;
break;
- case 0x15fa: /* (green) */
+ case 0x15fa: // (green)
element = EL_CHAR_OUMLAUT;
break;
- case 0x15fb: /* (green) */
+ case 0x15fb: // (green)
element = EL_CHAR_UUMLAUT;
break;
- case 0x15fc: /* (green) */
+ case 0x15fc: // (green)
element = EL_CHAR_0;
break;
- case 0x15fd: /* (green) */
+ case 0x15fd: // (green)
element = EL_CHAR_1;
break;
- case 0x15fe: /* (green) */
+ case 0x15fe: // (green)
element = EL_CHAR_2;
break;
- case 0x15ff: /* (green) */
+ case 0x15ff: // (green)
element = EL_CHAR_3;
break;
- case 0x1600: /* (green) */
+ case 0x1600: // (green)
element = EL_CHAR_4;
break;
- case 0x1601: /* (green) */
+ case 0x1601: // (green)
element = EL_CHAR_5;
break;
- case 0x1602: /* (green) */
+ case 0x1602: // (green)
element = EL_CHAR_6;
break;
- case 0x1603: /* (green) */
+ case 0x1603: // (green)
element = EL_CHAR_7;
break;
- case 0x1604: /* (green) */
+ case 0x1604: // (green)
element = EL_CHAR_8;
break;
- case 0x1605: /* (green) */
+ case 0x1605: // (green)
element = EL_CHAR_9;
break;
- case 0x1606: /* (green) */
+ case 0x1606: // (green)
element = EL_CHAR_PERIOD;
break;
- case 0x1607: /* (green) */
+ case 0x1607: // (green)
element = EL_CHAR_EXCLAM;
break;
- case 0x1608: /* (green) */
+ case 0x1608: // (green)
element = EL_CHAR_COLON;
break;
- case 0x1609: /* (green) */
+ case 0x1609: // (green)
element = EL_CHAR_LESS;
break;
- case 0x160a: /* (green) */
+ case 0x160a: // (green)
element = EL_CHAR_GREATER;
break;
- case 0x160b: /* (green) */
+ case 0x160b: // (green)
element = EL_CHAR_QUESTION;
break;
- case 0x160c: /* (green) */
+ case 0x160c: // (green)
element = EL_CHAR_COPYRIGHT;
break;
- case 0x160d: /* (green) */
+ case 0x160d: // (green)
element = EL_CHAR_UP;
break;
- case 0x160e: /* (green) */
+ case 0x160e: // (green)
element = EL_CHAR_DOWN;
break;
- case 0x160f: /* (green) */
+ case 0x160f: // (green)
element = EL_CHAR_BUTTON;
break;
- case 0x1610: /* (green) */
+ case 0x1610: // (green)
element = EL_CHAR_PLUS;
break;
- case 0x1611: /* (green) */
+ case 0x1611: // (green)
element = EL_CHAR_MINUS;
break;
- case 0x1612: /* (green) */
+ case 0x1612: // (green)
element = EL_CHAR_APOSTROPHE;
break;
- case 0x1613: /* (green) */
+ case 0x1613: // (green)
element = EL_CHAR_PARENLEFT;
break;
- case 0x1614: /* (green) */
+ case 0x1614: // (green)
element = EL_CHAR_PARENRIGHT;
break;
- case 0x1615: /* (blue steel) */
+ case 0x1615: // (blue steel)
element = EL_STEEL_CHAR_A;
break;
- case 0x1616: /* (blue steel) */
+ case 0x1616: // (blue steel)
element = EL_STEEL_CHAR_B;
break;
- case 0x1617: /* (blue steel) */
+ case 0x1617: // (blue steel)
element = EL_STEEL_CHAR_C;
break;
- case 0x1618: /* (blue steel) */
+ case 0x1618: // (blue steel)
element = EL_STEEL_CHAR_D;
break;
- case 0x1619: /* (blue steel) */
+ case 0x1619: // (blue steel)
element = EL_STEEL_CHAR_E;
break;
- case 0x161a: /* (blue steel) */
+ case 0x161a: // (blue steel)
element = EL_STEEL_CHAR_F;
break;
- case 0x161b: /* (blue steel) */
+ case 0x161b: // (blue steel)
element = EL_STEEL_CHAR_G;
break;
- case 0x161c: /* (blue steel) */
+ case 0x161c: // (blue steel)
element = EL_STEEL_CHAR_H;
break;
- case 0x161d: /* (blue steel) */
+ case 0x161d: // (blue steel)
element = EL_STEEL_CHAR_I;
break;
- case 0x161e: /* (blue steel) */
+ case 0x161e: // (blue steel)
element = EL_STEEL_CHAR_J;
break;
- case 0x161f: /* (blue steel) */
+ case 0x161f: // (blue steel)
element = EL_STEEL_CHAR_K;
break;
- case 0x1620: /* (blue steel) */
+ case 0x1620: // (blue steel)
element = EL_STEEL_CHAR_L;
break;
- case 0x1621: /* (blue steel) */
+ case 0x1621: // (blue steel)
element = EL_STEEL_CHAR_M;
break;
- case 0x1622: /* (blue steel) */
+ case 0x1622: // (blue steel)
element = EL_STEEL_CHAR_N;
break;
- case 0x1623: /* (blue steel) */
+ case 0x1623: // (blue steel)
element = EL_STEEL_CHAR_O;
break;
- case 0x1624: /* (blue steel) */
+ case 0x1624: // (blue steel)
element = EL_STEEL_CHAR_P;
break;
- case 0x1625: /* (blue steel) */
+ case 0x1625: // (blue steel)
element = EL_STEEL_CHAR_Q;
break;
- case 0x1626: /* (blue steel) */
+ case 0x1626: // (blue steel)
element = EL_STEEL_CHAR_R;
break;
- case 0x1627: /* (blue steel) */
+ case 0x1627: // (blue steel)
element = EL_STEEL_CHAR_S;
break;
- case 0x1628: /* (blue steel) */
+ case 0x1628: // (blue steel)
element = EL_STEEL_CHAR_T;
break;
- case 0x1629: /* (blue steel) */
+ case 0x1629: // (blue steel)
element = EL_STEEL_CHAR_U;
break;
- case 0x162a: /* (blue steel) */
+ case 0x162a: // (blue steel)
element = EL_STEEL_CHAR_V;
break;
- case 0x162b: /* (blue steel) */
+ case 0x162b: // (blue steel)
element = EL_STEEL_CHAR_W;
break;
- case 0x162c: /* (blue steel) */
+ case 0x162c: // (blue steel)
element = EL_STEEL_CHAR_X;
break;
- case 0x162d: /* (blue steel) */
+ case 0x162d: // (blue steel)
element = EL_STEEL_CHAR_Y;
break;
- case 0x162e: /* (blue steel) */
+ case 0x162e: // (blue steel)
element = EL_STEEL_CHAR_Z;
break;
- case 0x162f: /* (blue steel) */
+ case 0x162f: // (blue steel)
element = EL_STEEL_CHAR_AUMLAUT;
break;
- case 0x1630: /* (blue steel) */
+ case 0x1630: // (blue steel)
element = EL_STEEL_CHAR_OUMLAUT;
break;
- case 0x1631: /* (blue steel) */
+ case 0x1631: // (blue steel)
element = EL_STEEL_CHAR_UUMLAUT;
break;
- case 0x1632: /* (blue steel) */
+ case 0x1632: // (blue steel)
element = EL_STEEL_CHAR_0;
break;
- case 0x1633: /* (blue steel) */
+ case 0x1633: // (blue steel)
element = EL_STEEL_CHAR_1;
break;
- case 0x1634: /* (blue steel) */
+ case 0x1634: // (blue steel)
element = EL_STEEL_CHAR_2;
break;
- case 0x1635: /* (blue steel) */
+ case 0x1635: // (blue steel)
element = EL_STEEL_CHAR_3;
break;
- case 0x1636: /* (blue steel) */
+ case 0x1636: // (blue steel)
element = EL_STEEL_CHAR_4;
break;
- case 0x1637: /* (blue steel) */
+ case 0x1637: // (blue steel)
element = EL_STEEL_CHAR_5;
break;
- case 0x1638: /* (blue steel) */
+ case 0x1638: // (blue steel)
element = EL_STEEL_CHAR_6;
break;
- case 0x1639: /* (blue steel) */
+ case 0x1639: // (blue steel)
element = EL_STEEL_CHAR_7;
break;
- case 0x163a: /* (blue steel) */
+ case 0x163a: // (blue steel)
element = EL_STEEL_CHAR_8;
break;
- case 0x163b: /* (blue steel) */
+ case 0x163b: // (blue steel)
element = EL_STEEL_CHAR_9;
break;
- case 0x163c: /* (blue steel) */
+ case 0x163c: // (blue steel)
element = EL_STEEL_CHAR_PERIOD;
break;
- case 0x163d: /* (blue steel) */
+ case 0x163d: // (blue steel)
element = EL_STEEL_CHAR_EXCLAM;
break;
- case 0x163e: /* (blue steel) */
+ case 0x163e: // (blue steel)
element = EL_STEEL_CHAR_COLON;
break;
- case 0x163f: /* (blue steel) */
+ case 0x163f: // (blue steel)
element = EL_STEEL_CHAR_LESS;
break;
- case 0x1640: /* (blue steel) */
+ case 0x1640: // (blue steel)
element = EL_STEEL_CHAR_GREATER;
break;
- case 0x1641: /* (blue steel) */
+ case 0x1641: // (blue steel)
element = EL_STEEL_CHAR_QUESTION;
break;
- case 0x1642: /* (blue steel) */
+ case 0x1642: // (blue steel)
element = EL_STEEL_CHAR_COPYRIGHT;
break;
- case 0x1643: /* (blue steel) */
+ case 0x1643: // (blue steel)
element = EL_STEEL_CHAR_UP;
break;
- case 0x1644: /* (blue steel) */
+ case 0x1644: // (blue steel)
element = EL_STEEL_CHAR_DOWN;
break;
- case 0x1645: /* (blue steel) */
+ case 0x1645: // (blue steel)
element = EL_STEEL_CHAR_BUTTON;
break;
- case 0x1646: /* (blue steel) */
+ case 0x1646: // (blue steel)
element = EL_STEEL_CHAR_PLUS;
break;
- case 0x1647: /* (blue steel) */
+ case 0x1647: // (blue steel)
element = EL_STEEL_CHAR_MINUS;
break;
- case 0x1648: /* (blue steel) */
+ case 0x1648: // (blue steel)
element = EL_STEEL_CHAR_APOSTROPHE;
break;
- case 0x1649: /* (blue steel) */
+ case 0x1649: // (blue steel)
element = EL_STEEL_CHAR_PARENLEFT;
break;
- case 0x164a: /* (blue steel) */
+ case 0x164a: // (blue steel)
element = EL_STEEL_CHAR_PARENRIGHT;
break;
- case 0x164b: /* (green steel) */
+ case 0x164b: // (green steel)
element = EL_STEEL_CHAR_A;
break;
- case 0x164c: /* (green steel) */
+ case 0x164c: // (green steel)
element = EL_STEEL_CHAR_B;
break;
- case 0x164d: /* (green steel) */
+ case 0x164d: // (green steel)
element = EL_STEEL_CHAR_C;
break;
- case 0x164e: /* (green steel) */
+ case 0x164e: // (green steel)
element = EL_STEEL_CHAR_D;
break;
- case 0x164f: /* (green steel) */
+ case 0x164f: // (green steel)
element = EL_STEEL_CHAR_E;
break;
- case 0x1650: /* (green steel) */
+ case 0x1650: // (green steel)
element = EL_STEEL_CHAR_F;
break;
- case 0x1651: /* (green steel) */
+ case 0x1651: // (green steel)
element = EL_STEEL_CHAR_G;
break;
- case 0x1652: /* (green steel) */
+ case 0x1652: // (green steel)
element = EL_STEEL_CHAR_H;
break;
- case 0x1653: /* (green steel) */
+ case 0x1653: // (green steel)
element = EL_STEEL_CHAR_I;
break;
- case 0x1654: /* (green steel) */
+ case 0x1654: // (green steel)
element = EL_STEEL_CHAR_J;
break;
- case 0x1655: /* (green steel) */
+ case 0x1655: // (green steel)
element = EL_STEEL_CHAR_K;
break;
- case 0x1656: /* (green steel) */
+ case 0x1656: // (green steel)
element = EL_STEEL_CHAR_L;
break;
- case 0x1657: /* (green steel) */
+ case 0x1657: // (green steel)
element = EL_STEEL_CHAR_M;
break;
- case 0x1658: /* (green steel) */
+ case 0x1658: // (green steel)
element = EL_STEEL_CHAR_N;
break;
- case 0x1659: /* (green steel) */
+ case 0x1659: // (green steel)
element = EL_STEEL_CHAR_O;
break;
- case 0x165a: /* (green steel) */
+ case 0x165a: // (green steel)
element = EL_STEEL_CHAR_P;
break;
- case 0x165b: /* (green steel) */
+ case 0x165b: // (green steel)
element = EL_STEEL_CHAR_Q;
break;
- case 0x165c: /* (green steel) */
+ case 0x165c: // (green steel)
element = EL_STEEL_CHAR_R;
break;
- case 0x165d: /* (green steel) */
+ case 0x165d: // (green steel)
element = EL_STEEL_CHAR_S;
break;
- case 0x165e: /* (green steel) */
+ case 0x165e: // (green steel)
element = EL_STEEL_CHAR_T;
break;
- case 0x165f: /* (green steel) */
+ case 0x165f: // (green steel)
element = EL_STEEL_CHAR_U;
break;
- case 0x1660: /* (green steel) */
+ case 0x1660: // (green steel)
element = EL_STEEL_CHAR_V;
break;
- case 0x1661: /* (green steel) */
+ case 0x1661: // (green steel)
element = EL_STEEL_CHAR_W;
break;
- case 0x1662: /* (green steel) */
+ case 0x1662: // (green steel)
element = EL_STEEL_CHAR_X;
break;
- case 0x1663: /* (green steel) */
+ case 0x1663: // (green steel)
element = EL_STEEL_CHAR_Y;
break;
- case 0x1664: /* (green steel) */
+ case 0x1664: // (green steel)
element = EL_STEEL_CHAR_Z;
break;
- case 0x1665: /* (green steel) */
+ case 0x1665: // (green steel)
element = EL_STEEL_CHAR_AUMLAUT;
break;
- case 0x1666: /* (green steel) */
+ case 0x1666: // (green steel)
element = EL_STEEL_CHAR_OUMLAUT;
break;
- case 0x1667: /* (green steel) */
+ case 0x1667: // (green steel)
element = EL_STEEL_CHAR_UUMLAUT;
break;
- case 0x1668: /* (green steel) */
+ case 0x1668: // (green steel)
element = EL_STEEL_CHAR_0;
break;
- case 0x1669: /* (green steel) */
+ case 0x1669: // (green steel)
element = EL_STEEL_CHAR_1;
break;
- case 0x166a: /* (green steel) */
+ case 0x166a: // (green steel)
element = EL_STEEL_CHAR_2;
break;
- case 0x166b: /* (green steel) */
+ case 0x166b: // (green steel)
element = EL_STEEL_CHAR_3;
break;
- case 0x166c: /* (green steel) */
+ case 0x166c: // (green steel)
element = EL_STEEL_CHAR_4;
break;
- case 0x166d: /* (green steel) */
+ case 0x166d: // (green steel)
element = EL_STEEL_CHAR_5;
break;
- case 0x166e: /* (green steel) */
+ case 0x166e: // (green steel)
element = EL_STEEL_CHAR_6;
break;
- case 0x166f: /* (green steel) */
+ case 0x166f: // (green steel)
element = EL_STEEL_CHAR_7;
break;
- case 0x1670: /* (green steel) */
+ case 0x1670: // (green steel)
element = EL_STEEL_CHAR_8;
break;
- case 0x1671: /* (green steel) */
+ case 0x1671: // (green steel)
element = EL_STEEL_CHAR_9;
break;
- case 0x1672: /* (green steel) */
+ case 0x1672: // (green steel)
element = EL_STEEL_CHAR_PERIOD;
break;
- case 0x1673: /* (green steel) */
+ case 0x1673: // (green steel)
element = EL_STEEL_CHAR_EXCLAM;
break;
- case 0x1674: /* (green steel) */
+ case 0x1674: // (green steel)
element = EL_STEEL_CHAR_COLON;
break;
- case 0x1675: /* (green steel) */
+ case 0x1675: // (green steel)
element = EL_STEEL_CHAR_LESS;
break;
- case 0x1676: /* (green steel) */
+ case 0x1676: // (green steel)
element = EL_STEEL_CHAR_GREATER;
break;
- case 0x1677: /* (green steel) */
+ case 0x1677: // (green steel)
element = EL_STEEL_CHAR_QUESTION;
break;
- case 0x1678: /* (green steel) */
+ case 0x1678: // (green steel)
element = EL_STEEL_CHAR_COPYRIGHT;
break;
- case 0x1679: /* (green steel) */
+ case 0x1679: // (green steel)
element = EL_STEEL_CHAR_UP;
break;
- case 0x167a: /* (green steel) */
+ case 0x167a: // (green steel)
element = EL_STEEL_CHAR_DOWN;
break;
- case 0x167b: /* (green steel) */
+ case 0x167b: // (green steel)
element = EL_STEEL_CHAR_BUTTON;
break;
- case 0x167c: /* (green steel) */
+ case 0x167c: // (green steel)
element = EL_STEEL_CHAR_PLUS;
break;
- case 0x167d: /* (green steel) */
+ case 0x167d: // (green steel)
element = EL_STEEL_CHAR_MINUS;
break;
- case 0x167e: /* (green steel) */
+ case 0x167e: // (green steel)
element = EL_STEEL_CHAR_APOSTROPHE;
break;
- case 0x167f: /* (green steel) */
+ case 0x167f: // (green steel)
element = EL_STEEL_CHAR_PARENLEFT;
break;
- case 0x1680: /* (green steel) */
+ case 0x1680: // (green steel)
element = EL_STEEL_CHAR_PARENRIGHT;
break;
- case 0x1681: /* gate (red) */
+ case 0x1681: // gate (red)
element = EL_EM_GATE_1;
break;
- case 0x1682: /* secret gate (red) */
+ case 0x1682: // secret gate (red)
element = EL_GATE_1_GRAY;
break;
- case 0x1683: /* gate (yellow) */
+ case 0x1683: // gate (yellow)
element = EL_EM_GATE_2;
break;
- case 0x1684: /* secret gate (yellow) */
+ case 0x1684: // secret gate (yellow)
element = EL_GATE_2_GRAY;
break;
- case 0x1685: /* gate (blue) */
+ case 0x1685: // gate (blue)
element = EL_EM_GATE_4;
break;
- case 0x1686: /* secret gate (blue) */
+ case 0x1686: // secret gate (blue)
element = EL_GATE_4_GRAY;
break;
- case 0x1687: /* gate (green) */
+ case 0x1687: // gate (green)
element = EL_EM_GATE_3;
break;
- case 0x1688: /* secret gate (green) */
+ case 0x1688: // secret gate (green)
element = EL_GATE_3_GRAY;
break;
- case 0x1689: /* gate (white) */
+ case 0x1689: // gate (white)
element = EL_DC_GATE_WHITE;
break;
- case 0x168a: /* secret gate (white) */
+ case 0x168a: // secret gate (white)
element = EL_DC_GATE_WHITE_GRAY;
break;
- case 0x168b: /* secret gate (no key) */
+ case 0x168b: // secret gate (no key)
element = EL_DC_GATE_FAKE_GRAY;
break;
element = EL_STEELWALL_SLIPPERY;
break;
- case 0x1695: /* steel wall (not round) */
+ case 0x1695: // steel wall (not round)
element = EL_STEELWALL;
break;
- case 0x1696: /* steel wall (left) */
+ case 0x1696: // steel wall (left)
element = EL_DC_STEELWALL_1_LEFT;
break;
- case 0x1697: /* steel wall (bottom) */
+ case 0x1697: // steel wall (bottom)
element = EL_DC_STEELWALL_1_BOTTOM;
break;
- case 0x1698: /* steel wall (right) */
+ case 0x1698: // steel wall (right)
element = EL_DC_STEELWALL_1_RIGHT;
break;
- case 0x1699: /* steel wall (top) */
+ case 0x1699: // steel wall (top)
element = EL_DC_STEELWALL_1_TOP;
break;
- case 0x169a: /* steel wall (left/bottom) */
+ case 0x169a: // steel wall (left/bottom)
element = EL_DC_STEELWALL_1_BOTTOMLEFT;
break;
- case 0x169b: /* steel wall (right/bottom) */
+ case 0x169b: // steel wall (right/bottom)
element = EL_DC_STEELWALL_1_BOTTOMRIGHT;
break;
- case 0x169c: /* steel wall (right/top) */
+ case 0x169c: // steel wall (right/top)
element = EL_DC_STEELWALL_1_TOPRIGHT;
break;
- case 0x169d: /* steel wall (left/top) */
+ case 0x169d: // steel wall (left/top)
element = EL_DC_STEELWALL_1_TOPLEFT;
break;
- case 0x169e: /* steel wall (right/bottom small) */
+ case 0x169e: // steel wall (right/bottom small)
element = EL_DC_STEELWALL_1_BOTTOMRIGHT_2;
break;
- case 0x169f: /* steel wall (left/bottom small) */
+ case 0x169f: // steel wall (left/bottom small)
element = EL_DC_STEELWALL_1_BOTTOMLEFT_2;
break;
- case 0x16a0: /* steel wall (right/top small) */
+ case 0x16a0: // steel wall (right/top small)
element = EL_DC_STEELWALL_1_TOPRIGHT_2;
break;
- case 0x16a1: /* steel wall (left/top small) */
+ case 0x16a1: // steel wall (left/top small)
element = EL_DC_STEELWALL_1_TOPLEFT_2;
break;
- case 0x16a2: /* steel wall (left/right) */
+ case 0x16a2: // steel wall (left/right)
element = EL_DC_STEELWALL_1_VERTICAL;
break;
- case 0x16a3: /* steel wall (top/bottom) */
+ case 0x16a3: // steel wall (top/bottom)
element = EL_DC_STEELWALL_1_HORIZONTAL;
break;
- case 0x16a4: /* steel wall 2 (left end) */
+ case 0x16a4: // steel wall 2 (left end)
element = EL_DC_STEELWALL_2_LEFT;
break;
- case 0x16a5: /* steel wall 2 (right end) */
+ case 0x16a5: // steel wall 2 (right end)
element = EL_DC_STEELWALL_2_RIGHT;
break;
- case 0x16a6: /* steel wall 2 (top end) */
+ case 0x16a6: // steel wall 2 (top end)
element = EL_DC_STEELWALL_2_TOP;
break;
- case 0x16a7: /* steel wall 2 (bottom end) */
+ case 0x16a7: // steel wall 2 (bottom end)
element = EL_DC_STEELWALL_2_BOTTOM;
break;
- case 0x16a8: /* steel wall 2 (left/right) */
+ case 0x16a8: // steel wall 2 (left/right)
element = EL_DC_STEELWALL_2_HORIZONTAL;
break;
- case 0x16a9: /* steel wall 2 (up/down) */
+ case 0x16a9: // steel wall 2 (up/down)
element = EL_DC_STEELWALL_2_VERTICAL;
break;
- case 0x16aa: /* steel wall 2 (mid) */
+ case 0x16aa: // steel wall 2 (mid)
element = EL_DC_STEELWALL_2_MIDDLE;
break;
element = EL_INVISIBLE_STEELWALL;
break;
- /* 0x16bc - 0x16cb: */
- /* EL_INVISIBLE_SAND */
+ // 0x16bc - 0x16cb:
+ // EL_INVISIBLE_SAND
case 0x16cc:
element = EL_LIGHT_SWITCH;
break;
default:
- if (element >= 0x0117 && element <= 0x036e) /* (?) */
+ if (element >= 0x0117 && element <= 0x036e) // (?)
element = EL_DIAMOND;
- else if (element >= 0x042d && element <= 0x0684) /* (?) */
+ else if (element >= 0x042d && element <= 0x0684) // (?)
element = EL_EMERALD;
else if (element >= 0x157c && element <= 0x158b)
element = EL_SAND;
int num_yamyam_contents;
int i, x, y;
- getDecodedWord_DC(0, TRUE); /* initialize DC2 decoding engine */
+ getDecodedWord_DC(0, TRUE); // initialize DC2 decoding engine
for (i = 0; i < DC_LEVEL_HEADER_SIZE / 2; i++)
{
header[i * 2 + 1] = header_word & 0xff;
}
- /* read some values from level header to check level decoding integrity */
+ // read some values from level header to check level decoding integrity
fieldx = header[6] | (header[7] << 8);
fieldy = header[8] | (header[9] << 8);
num_yamyam_contents = header[60] | (header[61] << 8);
- /* do some simple sanity checks to ensure that level was correctly decoded */
+ // do some simple sanity checks to ensure that level was correctly decoded
if (fieldx < 1 || fieldx > 256 ||
fieldy < 1 || fieldy > 256 ||
num_yamyam_contents < 1 || num_yamyam_contents > 8)
return;
}
- /* maximum envelope header size is 31 bytes */
+ // maximum envelope header size is 31 bytes
envelope_header_len = header[envelope_header_pos];
- /* maximum envelope content size is 110 (156?) bytes */
+ // maximum envelope content size is 110 (156?) bytes
envelope_content_len = header[envelope_content_pos];
- /* maximum level title size is 40 bytes */
+ // maximum level title size is 40 bytes
level_name_len = MIN(header[level_name_pos], MAX_LEVEL_NAME_LEN);
- /* maximum level author size is 30 (51?) bytes */
+ // maximum level author size is 30 (51?) bytes
level_author_len = MIN(header[level_author_pos], MAX_LEVEL_AUTHOR_LEN);
envelope_size = 0;
if (level_file_info->packed)
{
- /* read "magic bytes" from start of file */
+ // read "magic bytes" from start of file
if (getStringFromFile(file, magic_bytes, num_magic_bytes + 1) == NULL)
magic_bytes[0] = '\0';
- /* check "magic bytes" for correct file format */
+ // check "magic bytes" for correct file format
if (!strPrefix(magic_bytes, "DC2"))
{
level->no_valid_file = TRUE;
int extra_bytes = 4;
int skip_bytes;
- /* advance file stream to first level inside the level package */
+ // advance file stream to first level inside the level package
skip_bytes = position_first_level - num_magic_bytes - extra_bytes;
- /* each block of level data is followed by block of non-level data */
+ // each block of level data is followed by block of non-level data
num_levels_to_skip *= 2;
- /* at least skip header bytes, therefore use ">= 0" instead of "> 0" */
+ // at least skip header bytes, therefore use ">= 0" instead of "> 0"
while (num_levels_to_skip >= 0)
{
- /* advance file stream to next level inside the level package */
+ // advance file stream to next level inside the level package
if (seekFile(file, skip_bytes, SEEK_CUR) != 0)
{
level->no_valid_file = TRUE;
return;
}
- /* skip apparently unused extra bytes following each level */
+ // skip apparently unused extra bytes following each level
ReadUnusedBytesFromFile(file, extra_bytes);
- /* read size of next level in level package */
+ // read size of next level in level package
skip_bytes = getFile32BitLE(file);
num_levels_to_skip--;
}
-/* ------------------------------------------------------------------------- */
-/* functions for loading SB level */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for loading SB level
+// ----------------------------------------------------------------------------
int getMappedElement_SB(int element_ascii, boolean use_ces)
{
}
sb_element_mapping[] =
{
- { ' ', EL_EMPTY, EL_CUSTOM_1 }, /* floor (space) */
- { '#', EL_STEELWALL, EL_CUSTOM_2 }, /* wall */
- { '@', EL_PLAYER_1, EL_CUSTOM_3 }, /* player */
- { '$', EL_SOKOBAN_OBJECT, EL_CUSTOM_4 }, /* box */
- { '.', EL_SOKOBAN_FIELD_EMPTY, EL_CUSTOM_5 }, /* goal square */
- { '*', EL_SOKOBAN_FIELD_FULL, EL_CUSTOM_6 }, /* box on goal square */
- { '+', EL_SOKOBAN_FIELD_PLAYER, EL_CUSTOM_7 }, /* player on goal square */
- { '_', EL_INVISIBLE_STEELWALL, EL_FROM_LEVEL_TEMPLATE }, /* floor beyond border */
+ { ' ', EL_EMPTY, EL_CUSTOM_1 }, // floor (space)
+ { '#', EL_STEELWALL, EL_CUSTOM_2 }, // wall
+ { '@', EL_PLAYER_1, EL_CUSTOM_3 }, // player
+ { '$', EL_SOKOBAN_OBJECT, EL_CUSTOM_4 }, // box
+ { '.', EL_SOKOBAN_FIELD_EMPTY, EL_CUSTOM_5 }, // goal square
+ { '*', EL_SOKOBAN_FIELD_FULL, EL_CUSTOM_6 }, // box on goal square
+ { '+', EL_SOKOBAN_FIELD_PLAYER, EL_CUSTOM_7 }, // player on goal square
+ { '_', EL_INVISIBLE_STEELWALL, EL_FROM_LEVEL_TEMPLATE }, // floor beyond border
{ 0, -1, -1 },
};
boolean load_xsb_to_ces = check_special_flags("load_xsb_to_ces");
int file_level_nr = 0;
int line_nr = 0;
- int x = 0, y = 0; /* initialized to make compilers happy */
+ int x = 0, y = 0; // initialized to make compilers happy
last_comment[0] = '\0';
level_name[0] = '\0';
while (!checkEndOfFile(file))
{
- /* level successfully read, but next level may follow here */
+ // level successfully read, but next level may follow here
if (!got_valid_playfield_line && reading_playfield)
{
- /* read playfield from single level file -- skip remaining file */
+ // read playfield from single level file -- skip remaining file
if (!level_file_info->packed)
break;
got_valid_playfield_line = FALSE;
- /* read next line of input file */
+ // read next line of input file
if (!getStringFromFile(file, line, MAX_LINE_LEN))
break;
- /* check if line was completely read and is terminated by line break */
+ // check if line was completely read and is terminated by line break
if (strlen(line) > 0 && line[strlen(line) - 1] == '\n')
line_nr++;
- /* cut trailing line break (this can be newline and/or carriage return) */
+ // cut trailing line break (this can be newline and/or carriage return)
for (line_ptr = &line[strlen(line)]; line_ptr >= line; line_ptr--)
if ((*line_ptr == '\n' || *line_ptr == '\r') && *(line_ptr + 1) == '\0')
*line_ptr = '\0';
- /* copy raw input line for later use (mainly debugging output) */
+ // copy raw input line for later use (mainly debugging output)
strcpy(line_raw, line);
if (read_continued_line)
{
- /* append new line to existing line, if there is enough space */
+ // append new line to existing line, if there is enough space
if (strlen(previous_line) + strlen(line_ptr) < MAX_LINE_LEN)
strcat(previous_line, line_ptr);
- strcpy(line, previous_line); /* copy storage buffer to line */
+ strcpy(line, previous_line); // copy storage buffer to line
read_continued_line = FALSE;
}
- /* if the last character is '\', continue at next line */
+ // if the last character is '\', continue at next line
if (strlen(line) > 0 && line[strlen(line) - 1] == '\\')
{
- line[strlen(line) - 1] = '\0'; /* cut off trailing backslash */
- strcpy(previous_line, line); /* copy line to storage buffer */
+ line[strlen(line) - 1] = '\0'; // cut off trailing backslash
+ strcpy(previous_line, line); // copy line to storage buffer
read_continued_line = TRUE;
continue;
}
- /* skip empty lines */
+ // skip empty lines
if (line[0] == '\0')
continue;
- /* extract comment text from comment line */
+ // extract comment text from comment line
if (line[0] == ';')
{
for (line_ptr = line; *line_ptr; line_ptr++)
continue;
}
- /* extract level title text from line containing level title */
+ // extract level title text from line containing level title
if (line[0] == '\'')
{
strcpy(level_name, &line[1]);
continue;
}
- /* skip lines containing only spaces (or empty lines) */
+ // skip lines containing only spaces (or empty lines)
for (line_ptr = line; *line_ptr; line_ptr++)
if (*line_ptr != ' ')
break;
if (*line_ptr == '\0')
continue;
- /* at this point, we have found a line containing part of a playfield */
+ // at this point, we have found a line containing part of a playfield
got_valid_playfield_line = TRUE;
level->fieldx = 0;
level->fieldy = 0;
- /* start with topmost tile row */
+ // start with topmost tile row
y = 0;
}
- /* skip playfield line if larger row than allowed */
+ // skip playfield line if larger row than allowed
if (y >= MAX_LEV_FIELDY)
continue;
- /* start with leftmost tile column */
+ // start with leftmost tile column
x = 0;
- /* read playfield elements from line */
+ // read playfield elements from line
for (line_ptr = line; *line_ptr; line_ptr++)
{
int mapped_sb_element = getMappedElement_SB(*line_ptr, load_xsb_to_ces);
- /* stop parsing playfield line if larger column than allowed */
+ // stop parsing playfield line if larger column than allowed
if (x >= MAX_LEV_FIELDX)
break;
level->field[x][y] = mapped_sb_element;
- /* continue with next tile column */
+ // continue with next tile column
x++;
level->fieldx = MAX(x, level->fieldx);
if (invalid_playfield_char)
{
- /* if first playfield line, treat invalid lines as comment lines */
+ // if first playfield line, treat invalid lines as comment lines
if (y == 0)
reading_playfield = FALSE;
continue;
}
- /* continue with next tile row */
+ // continue with next tile row
y++;
}
sprintf(level->name, "--> Level %d <--", level_file_info->nr);
}
- /* set all empty fields beyond the border walls to invisible steel wall */
+ // set all empty fields beyond the border walls to invisible steel wall
for (y = 0; y < level->fieldy; y++) for (x = 0; x < level->fieldx; x++)
{
if ((x == 0 || x == level->fieldx - 1 ||
level->field, level->fieldx, level->fieldy);
}
- /* set special level settings for Sokoban levels */
+ // set special level settings for Sokoban levels
level->time = 0;
level->use_step_counter = TRUE;
if (load_xsb_to_ces)
{
- /* special global settings can now be set in level template */
+ // special global settings can now be set in level template
level->use_custom_template = TRUE;
}
}
-/* ------------------------------------------------------------------------- */
-/* functions for handling native levels */
-/* ------------------------------------------------------------------------- */
+// -------------------------------------------------------------------------
+// functions for handling native levels
+// -------------------------------------------------------------------------
static void LoadLevelFromFileInfo_EM(struct LevelInfo *level,
struct LevelFileInfo *level_file_info,
{
int pos = 0;
- /* determine position of requested level inside level package */
+ // determine position of requested level inside level package
if (level_file_info->packed)
pos = level_file_info->nr - leveldir_current->first_level;
}
-/* ------------------------------------------------------------------------- */
-/* functions for loading generic level */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for loading generic level
+// ----------------------------------------------------------------------------
static void LoadLevelFromFileInfo(struct LevelInfo *level,
struct LevelFileInfo *level_file_info,
boolean level_info_only)
{
- /* always start with reliable default values */
+ // always start with reliable default values
setLevelInfoToDefaults(level, level_info_only, TRUE);
switch (level_file_info->type)
break;
}
- /* if level file is invalid, restore level structure to default values */
+ // if level file is invalid, restore level structure to default values
if (level->no_valid_file)
setLevelInfoToDefaults(level, level_info_only, FALSE);
{
static struct LevelFileInfo level_file_info;
- /* always start with reliable default values */
+ // always start with reliable default values
setFileInfoToDefaults(&level_file_info);
- level_file_info.nr = 0; /* unknown level number */
- level_file_info.type = LEVEL_FILE_TYPE_RND; /* no others supported yet */
+ level_file_info.nr = 0; // unknown level number
+ level_file_info.type = LEVEL_FILE_TYPE_RND; // no others supported yet
setString(&level_file_info.filename, filename);
{
int i, j;
- if (leveldir_current == NULL) /* only when dumping level */
+ if (leveldir_current == NULL) // only when dumping level
return;
- /* all engine modifications also valid for levels which use latest engine */
+ // all engine modifications also valid for levels which use latest engine
if (level->game_version < VERSION_IDENT(3,2,0,5))
{
- /* time bonus score was given for 10 s instead of 1 s before 3.2.0-5 */
+ // time bonus score was given for 10 s instead of 1 s before 3.2.0-5
level->score[SC_TIME_BONUS] /= 10;
}
if (leveldir_current->latest_engine)
{
- /* ---------- use latest game engine ----------------------------------- */
+ // ---------- use latest game engine --------------------------------------
/* For all levels which are forced to use the latest game engine version
(normally all but user contributed, private and undefined levels), set
return;
}
- /* ---------- use game engine the level was created with ----------------- */
+ // ---------- use game engine the level was created with --------------------
/* For all levels which are not forced to use the latest game engine
version (normally user contributed, private and undefined levels),
pre-2.0 levels, where the game version is still taken from the
file format version used to store the level -- see above). */
- /* player was faster than enemies in 1.0.0 and before */
+ // player was faster than enemies in 1.0.0 and before
if (level->file_version == FILE_VERSION_1_0)
for (i = 0; i < MAX_PLAYERS; i++)
level->initial_player_stepsize[i] = STEPSIZE_FAST;
- /* default behaviour for EM style gems was "slippery" only in 2.0.1 */
+ // default behaviour for EM style gems was "slippery" only in 2.0.1
if (level->game_version == VERSION_IDENT(2,0,1,0))
level->em_slippery_gems = TRUE;
- /* springs could be pushed over pits before (pre-release version) 2.2.0 */
+ // springs could be pushed over pits before (pre-release version) 2.2.0
if (level->game_version < VERSION_IDENT(2,2,0,0))
level->use_spring_bug = TRUE;
if (level->game_version < VERSION_IDENT(3,2,0,5))
{
- /* time orb caused limited time in endless time levels before 3.2.0-5 */
+ // time orb caused limited time in endless time levels before 3.2.0-5
level->use_time_orb_bug = TRUE;
- /* default behaviour for snapping was "no snap delay" before 3.2.0-5 */
+ // default behaviour for snapping was "no snap delay" before 3.2.0-5
level->block_snap_field = FALSE;
- /* extra time score was same value as time left score before 3.2.0-5 */
+ // extra time score was same value as time left score before 3.2.0-5
level->extra_time_score = level->score[SC_TIME_BONUS];
}
- /* game logic of "game of life" and "biomaze" was buggy before 4.1.1.1 */
+ // game logic of "game of life" and "biomaze" was buggy before 4.1.1.1
if (level->game_version < VERSION_IDENT(4,1,1,1))
level->use_life_bugs = TRUE;
if (level->game_version < VERSION_IDENT(3,2,0,7))
{
- /* default behaviour for snapping was "not continuous" before 3.2.0-7 */
+ // default behaviour for snapping was "not continuous" before 3.2.0-7
level->continuous_snapping = FALSE;
}
- /* only few elements were able to actively move into acid before 3.1.0 */
- /* trigger settings did not exist before 3.1.0; set to default "any" */
+ // only few elements were able to actively move into acid before 3.1.0
+ // trigger settings did not exist before 3.1.0; set to default "any"
if (level->game_version < VERSION_IDENT(3,1,0,0))
{
- /* correct "can move into acid" settings (all zero in old levels) */
+ // correct "can move into acid" settings (all zero in old levels)
- level->can_move_into_acid_bits = 0; /* nothing can move into acid */
- level->dont_collide_with_bits = 0; /* nothing is deadly when colliding */
+ level->can_move_into_acid_bits = 0; // nothing can move into acid
+ level->dont_collide_with_bits = 0; // nothing is deadly when colliding
setMoveIntoAcidProperty(level, EL_ROBOT, TRUE);
setMoveIntoAcidProperty(level, EL_SATELLITE, TRUE);
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
SET_PROPERTY(EL_CUSTOM_START + i, EP_CAN_MOVE_INTO_ACID, TRUE);
- /* correct trigger settings (stored as zero == "none" in old levels) */
+ // correct trigger settings (stored as zero == "none" in old levels)
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
{
}
}
- /* try to detect and fix "Snake Bite" levels, which are broken with 3.2.0 */
+ // try to detect and fix "Snake Bite" levels, which are broken with 3.2.0
{
int element = EL_CUSTOM_256;
struct ElementInfo *ei = &element_info[element];
change->target_element = EL_PLAYER_1;
}
- /* try to detect and fix "Zelda" style levels, which are broken with 3.2.5 */
+ // try to detect and fix "Zelda" style levels, which are broken with 3.2.5
if (level->game_version < VERSION_IDENT(3,2,5,0))
{
/* This is needed to fix a problem that was caused by a bugfix in function
level->use_action_after_change_bug = TRUE;
}
- /* not centering level after relocating player was default only in 3.2.3 */
- if (level->game_version == VERSION_IDENT(3,2,3,0)) /* (no pre-releases) */
+ // not centering level after relocating player was default only in 3.2.3
+ if (level->game_version == VERSION_IDENT(3,2,3,0)) // (no pre-releases)
level->shifted_relocation = TRUE;
- /* EM style elements always chain-exploded in R'n'D engine before 3.2.6 */
+ // EM style elements always chain-exploded in R'n'D engine before 3.2.6
if (level->game_version < VERSION_IDENT(3,2,6,0))
level->em_explodes_by_fire = TRUE;
- /* levels were solved by the first player entering an exit up to 4.1.0.0 */
+ // levels were solved by the first player entering an exit up to 4.1.0.0
if (level->game_version <= VERSION_IDENT(4,1,0,0))
level->solved_by_one_player = TRUE;
}
{
int i, x, y;
- /* map elements that have changed in newer versions */
+ // map elements that have changed in newer versions
level->amoeba_content = getMappedElementByVersion(level->amoeba_content,
level->game_version);
for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
{
int element = EL_CUSTOM_START + i;
- /* order of checking and copying events to be mapped is important */
- /* (do not change the start and end value -- they are constant) */
+ // order of checking and copying events to be mapped is important
+ // (do not change the start and end value -- they are constant)
for (j = CE_BY_OTHER_ACTION; j >= CE_VALUE_GETS_ZERO; j--)
{
if (HAS_CHANGE_EVENT(element, j - 2))
}
}
- /* order of checking and copying events to be mapped is important */
- /* (do not change the start and end value -- they are constant) */
+ // order of checking and copying events to be mapped is important
+ // (do not change the start and end value -- they are constant)
for (j = CE_PLAYER_COLLECTS_X; j >= CE_HITTING_SOMETHING; j--)
{
if (HAS_CHANGE_EVENT(element, j - 1))
}
}
- /* initialize "can_change" field for old levels with only one change page */
+ // initialize "can_change" field for old levels with only one change page
if (level->game_version <= VERSION_IDENT(3,0,2,0))
{
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
}
}
- /* correct custom element values (for old levels without these options) */
+ // correct custom element values (for old levels without these options)
if (level->game_version < VERSION_IDENT(3,1,1,0))
{
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
}
}
- /* correct custom element values (fix invalid values for all versions) */
+ // correct custom element values (fix invalid values for all versions)
if (1)
{
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
}
}
- /* initialize "can_explode" field for old levels which did not store this */
- /* !!! CHECK THIS -- "<= 3,1,0,0" IS PROBABLY WRONG !!! */
+ // initialize "can_explode" field for old levels which did not store this
+ // !!! CHECK THIS -- "<= 3,1,0,0" IS PROBABLY WRONG !!!
if (level->game_version <= VERSION_IDENT(3,1,0,0))
{
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
}
}
- /* correct previously hard-coded move delay values for maze runner style */
+ // correct previously hard-coded move delay values for maze runner style
if (level->game_version < VERSION_IDENT(3,1,1,0))
{
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
if (element_info[element].move_pattern & MV_MAZE_RUNNER_STYLE)
{
- /* previously hard-coded and therefore ignored */
+ // previously hard-coded and therefore ignored
element_info[element].move_delay_fixed = 9;
element_info[element].move_delay_random = 0;
}
}
}
- /* set some other uninitialized values of custom elements in older levels */
+ // set some other uninitialized values of custom elements in older levels
if (level->game_version < VERSION_IDENT(3,1,0,0))
{
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
if (level->file_has_custom_elements)
LoadLevel_InitCustomElements(level);
- /* initialize element properties for level editor etc. */
+ // initialize element properties for level editor etc.
InitElementPropertiesEngine(level->game_version);
InitElementPropertiesGfxElement();
}
{
int x, y;
- /* map elements that have changed in newer versions */
+ // map elements that have changed in newer versions
for (y = 0; y < level->fieldy; y++)
for (x = 0; x < level->fieldx; x++)
level->field[x][y] = getMappedElementByVersion(level->field[x][y],
level->game_version);
- /* clear unused playfield data (nicer if level gets resized in editor) */
+ // clear unused playfield data (nicer if level gets resized in editor)
for (x = 0; x < MAX_LEV_FIELDX; x++)
for (y = 0; y < MAX_LEV_FIELDY; y++)
if (x >= level->fieldx || y >= level->fieldy)
level->field[x][y] = EL_EMPTY;
- /* copy elements to runtime playfield array */
+ // copy elements to runtime playfield array
for (x = 0; x < MAX_LEV_FIELDX; x++)
for (y = 0; y < MAX_LEV_FIELDY; y++)
Feld[x][y] = level->field[x][y];
- /* initialize level size variables for faster access */
+ // initialize level size variables for faster access
lev_fieldx = level->fieldx;
lev_fieldy = level->fieldy;
- /* determine border element for this level */
+ // determine border element for this level
if (level->file_info.type == LEVEL_FILE_TYPE_DC)
- BorderElement = EL_EMPTY; /* (in editor, SetBorderElement() is used) */
+ BorderElement = EL_EMPTY; // (in editor, SetBorderElement() is used)
else
SetBorderElement();
}
}
else
{
- /* chunk header already written -- write empty chunk data */
+ // chunk header already written -- write empty chunk data
WriteUnusedBytesToFile(file, LEVEL_CHUNK_CNT2_SIZE);
Error(ERR_WARN, "cannot save content for element '%d'", element);
}
}
- if (check != num_changed_custom_elements) /* should not happen */
+ if (check != num_changed_custom_elements) // should not happen
Error(ERR_WARN, "inconsistent number of custom element properties");
}
#endif
}
}
- if (check != num_changed_custom_elements) /* should not happen */
+ if (check != num_changed_custom_elements) // should not happen
Error(ERR_WARN, "inconsistent number of custom target elements");
}
#endif
putFile32BitBE(file, ei->properties[EP_BITFIELD_BASE_NR]);
- /* some free bytes for future properties and padding */
+ // some free bytes for future properties and padding
WriteUnusedBytesToFile(file, 7);
putFile8Bit(file, ei->use_gfx_element);
putFile8Bit(file, ei->slippery_type);
- /* some free bytes for future properties and padding */
+ // some free bytes for future properties and padding
WriteUnusedBytesToFile(file, LEVEL_CPART_CUS3_UNUSED);
}
}
}
- if (check != num_changed_custom_elements) /* should not happen */
+ if (check != num_changed_custom_elements) // should not happen
Error(ERR_WARN, "inconsistent number of custom element properties");
}
#endif
struct ElementInfo *ei = &element_info[element];
int i, j, x, y;
- /* ---------- custom element base property values (96 bytes) ------------- */
+ // ---------- custom element base property values (96 bytes) ----------------
putFile16BitBE(file, element);
putFile32BitBE(file, ei->properties[EP_BITFIELD_BASE_NR]);
- WriteUnusedBytesToFile(file, 4); /* reserved for more base properties */
+ WriteUnusedBytesToFile(file, 4); // reserved for more base properties
putFile8Bit(file, ei->num_change_pages);
putFile16BitBE(file, ei->move_delay_fixed);
putFile16BitBE(file, ei->move_delay_random);
- /* bits 0 - 15 of "move_pattern" ... */
+ // bits 0 - 15 of "move_pattern" ...
putFile16BitBE(file, ei->move_pattern & 0xffff);
putFile8Bit(file, ei->move_direction_initial);
putFile8Bit(file, ei->move_stepsize);
putFile16BitBE(file, ei->move_leave_element);
putFile8Bit(file, ei->move_leave_type);
- /* ... bits 16 - 31 of "move_pattern" (not nice, but downward compatible) */
+ // ... bits 16 - 31 of "move_pattern" (not nice, but downward compatible)
putFile16BitBE(file, (ei->move_pattern >> 16) & 0xffff);
putFile8Bit(file, ei->access_direction);
putFile8Bit(file, ei->ignition_delay);
putFile8Bit(file, ei->explosion_type);
- /* some free bytes for future custom property values and padding */
+ // some free bytes for future custom property values and padding
WriteUnusedBytesToFile(file, 1);
- /* ---------- change page property values (48 bytes) --------------------- */
+ // ---------- change page property values (48 bytes) ------------------------
for (i = 0; i < ei->num_change_pages; i++)
{
struct ElementChangeInfo *change = &ei->change_page[i];
unsigned int event_bits;
- /* bits 0 - 31 of "has_event[]" ... */
+ // bits 0 - 31 of "has_event[]" ...
event_bits = 0;
for (j = 0; j < MIN(NUM_CHANGE_EVENTS, 32); j++)
if (change->has_event[j])
putFile8Bit(file, change->action_mode);
putFile16BitBE(file, change->action_arg);
- /* ... bits 32 - 39 of "has_event[]" (not nice, but downward compatible) */
+ // ... bits 32 - 39 of "has_event[]" (not nice, but downward compatible)
event_bits = 0;
for (j = 32; j < NUM_CHANGE_EVENTS; j++)
if (change->has_event[j])
putFile8Bit(file, group->choice_mode);
- /* some free bytes for future values and padding */
+ // some free bytes for future values and padding
WriteUnusedBytesToFile(file, 3);
for (i = 0; i < MAX_ELEMENTS_IN_GROUP; i++)
int value = (data_type == TYPE_BOOLEAN ? *(boolean *)value_ptr :
*(int *)value_ptr);
- /* check if any settings have been modified before saving them */
+ // check if any settings have been modified before saving them
if (value != default_value)
modified = TRUE;
- /* do not save if explicitly told or if unmodified default settings */
+ // do not save if explicitly told or if unmodified default settings
if ((save_type == SAVE_CONF_NEVER) ||
(save_type == SAVE_CONF_WHEN_CHANGED && !modified))
return 0;
int string_length = strlen(string);
int i;
- /* check if any settings have been modified before saving them */
+ // check if any settings have been modified before saving them
if (!strEqual(string, default_string))
modified = TRUE;
- /* do not save if explicitly told or if unmodified default settings */
+ // do not save if explicitly told or if unmodified default settings
if ((save_type == SAVE_CONF_NEVER) ||
(save_type == SAVE_CONF_WHEN_CHANGED && !modified))
return 0;
int num_elements = *(int *)(entry->num_entities);
int i;
- /* check if any settings have been modified before saving them */
+ // check if any settings have been modified before saving them
for (i = 0; i < num_elements; i++)
if (element_array[i] != default_value)
modified = TRUE;
- /* do not save if explicitly told or if unmodified default settings */
+ // do not save if explicitly told or if unmodified default settings
if ((save_type == SAVE_CONF_NEVER) ||
(save_type == SAVE_CONF_WHEN_CHANGED && !modified))
return 0;
int num_contents = *(int *)(entry->num_entities);
int i, x, y;
- /* check if any settings have been modified before saving them */
+ // check if any settings have been modified before saving them
for (i = 0; i < num_contents; i++)
for (y = 0; y < 3; y++)
for (x = 0; x < 3; x++)
if (content[i].e[x][y] != default_value)
modified = TRUE;
- /* do not save if explicitly told or if unmodified default settings */
+ // do not save if explicitly told or if unmodified default settings
if ((save_type == SAVE_CONF_NEVER) ||
(save_type == SAVE_CONF_WHEN_CHANGED && !modified))
return 0;
int chunk_size = 0;
int i;
- li = *level; /* copy level data into temporary buffer */
+ li = *level; // copy level data into temporary buffer
for (i = 0; chunk_config_INFO[i].data_type != -1; i++)
chunk_size += SaveLevel_MicroChunk(file, &chunk_config_INFO[i], FALSE);
int chunk_size = 0;
int i;
- li = *level; /* copy level data into temporary buffer */
+ li = *level; // copy level data into temporary buffer
for (i = 0; chunk_config_ELEM[i].data_type != -1; i++)
chunk_size += SaveLevel_MicroChunk(file, &chunk_config_ELEM[i], TRUE);
chunk_size += putFile16BitBE(file, element);
- /* copy envelope data into temporary buffer */
+ // copy envelope data into temporary buffer
xx_envelope = level->envelope[envelope_nr];
for (i = 0; chunk_config_NOTE[i].data_type != -1; i++)
chunk_size += putFile16BitBE(file, element);
- xx_ei = *ei; /* copy element data into temporary buffer */
+ xx_ei = *ei; // copy element data into temporary buffer
- /* set default description string for this specific element */
+ // set default description string for this specific element
strcpy(xx_default_description, getDefaultElementDescription(ei));
for (i = 0; chunk_config_CUSX_base[i].data_type != -1; i++)
xx_current_change_page = i;
- xx_change = *change; /* copy change data into temporary buffer */
+ xx_change = *change; // copy change data into temporary buffer
resetEventBits();
setEventBitsFromEventFlags(change);
chunk_size += putFile16BitBE(file, element);
- xx_ei = *ei; /* copy element data into temporary buffer */
- xx_group = *group; /* copy group data into temporary buffer */
+ xx_ei = *ei; // copy element data into temporary buffer
+ xx_group = *group; // copy group data into temporary buffer
- /* set default description string for this specific element */
+ // set default description string for this specific element
strcpy(xx_default_description, getDefaultElementDescription(ei));
for (i = 0; chunk_config_GRPX[i].data_type != -1; i++)
SaveLevel_BODY(file, level);
chunk_size = SaveLevel_ELEM(NULL, level);
- if (chunk_size > LEVEL_CHUNK_ELEM_UNCHANGED) /* save if changed */
+ if (chunk_size > LEVEL_CHUNK_ELEM_UNCHANGED) // save if changed
{
putFileChunkBE(file, "ELEM", chunk_size);
SaveLevel_ELEM(file, level);
int element = EL_ENVELOPE_1 + i;
chunk_size = SaveLevel_NOTE(NULL, level, element);
- if (chunk_size > LEVEL_CHUNK_NOTE_UNCHANGED) /* save if changed */
+ if (chunk_size > LEVEL_CHUNK_NOTE_UNCHANGED) // save if changed
{
putFileChunkBE(file, "NOTE", chunk_size);
SaveLevel_NOTE(file, level, element);
}
}
- /* if not using template level, check for non-default custom/group elements */
+ // if not using template level, check for non-default custom/group elements
if (!level->use_custom_template || save_as_template)
{
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
int element = EL_CUSTOM_START + i;
chunk_size = SaveLevel_CUSX(NULL, level, element);
- if (chunk_size > LEVEL_CHUNK_CUSX_UNCHANGED) /* save if changed */
+ if (chunk_size > LEVEL_CHUNK_CUSX_UNCHANGED) // save if changed
{
putFileChunkBE(file, "CUSX", chunk_size);
SaveLevel_CUSX(file, level, element);
int element = EL_GROUP_START + i;
chunk_size = SaveLevel_GRPX(NULL, level, element);
- if (chunk_size > LEVEL_CHUNK_GRPX_UNCHANGED) /* save if changed */
+ if (chunk_size > LEVEL_CHUNK_GRPX_UNCHANGED) // save if changed
{
putFileChunkBE(file, "GRPX", chunk_size);
SaveLevel_GRPX(file, level, element);
}
-/* ========================================================================= */
-/* tape file functions */
-/* ========================================================================= */
+// ============================================================================
+// tape file functions
+// ============================================================================
static void setTapeInfoToDefaults(void)
{
int i;
- /* always start with reliable default values (empty tape) */
+ // always start with reliable default values (empty tape)
TapeErase();
- /* default values (also for pre-1.2 tapes) with only the first player */
+ // default values (also for pre-1.2 tapes) with only the first player
tape.player_participates[0] = TRUE;
for (i = 1; i < MAX_PLAYERS; i++)
tape.player_participates[i] = FALSE;
- /* at least one (default: the first) player participates in every tape */
+ // at least one (default: the first) player participates in every tape
tape.num_participating_players = 1;
tape.level_nr = level_nr;
tape->date = getFile32BitBE(file);
tape->length = getFile32BitBE(file);
- /* read header fields that are new since version 1.2 */
+ // read header fields that are new since version 1.2
if (tape->file_version >= FILE_VERSION_1_2)
{
byte store_participating_players = getFile8Bit(file);
int engine_version;
- /* since version 1.2, tapes store which players participate in the tape */
+ // since version 1.2, tapes store which players participate in the tape
tape->num_participating_players = 0;
for (i = 0; i < MAX_PLAYERS; i++)
{
if (tape->file_version == FILE_VERSION_1_0)
{
- /* eliminate possible diagonal moves in old tapes */
- /* this is only for backward compatibility */
+ // eliminate possible diagonal moves in old tapes
+ // this is only for backward compatibility
byte joy_dir[4] = { JOY_LEFT, JOY_RIGHT, JOY_UP, JOY_DOWN };
byte action = tape->pos[i].action[0];
}
else if (tape->file_version < FILE_VERSION_2_0)
{
- /* convert pre-2.0 tapes to new tape format */
+ // convert pre-2.0 tapes to new tape format
if (tape->pos[i].delay > 1)
{
- /* action part */
+ // action part
tape->pos[i + 1] = tape->pos[i];
tape->pos[i + 1].delay = 1;
- /* delay part */
+ // delay part
for (j = 0; j < MAX_PLAYERS; j++)
tape->pos[i].action[j] = MV_NONE;
tape->pos[i].delay--;
case '\r':
case '\t':
case ' ':
- /* ignore white-space characters */
+ // ignore white-space characters
break;
default:
File *file;
int chunk_size;
- /* always start with reliable default values */
+ // always start with reliable default values
setTapeInfoToDefaults();
if (strSuffix(filename, ".sln"))
getFileChunkBE(file, chunk_name, NULL);
if (strEqual(chunk_name, "RND1"))
{
- getFile32BitBE(file); /* not used */
+ getFile32BitBE(file); // not used
getFileChunkBE(file, chunk_name, NULL);
if (!strEqual(chunk_name, "TAPE"))
return;
}
}
- else /* check for pre-2.0 file format with cookie string */
+ else // check for pre-2.0 file format with cookie string
{
strcpy(cookie, chunk_name);
if (getStringFromFile(file, &cookie[4], MAX_LINE_LEN - 4) == NULL)
return;
}
- /* pre-2.0 tape files have no game version, so use file version here */
+ // pre-2.0 tape files have no game version, so use file version here
tape.game_version = tape.file_version;
}
if (tape.file_version < FILE_VERSION_1_2)
{
- /* tape files from versions before 1.2.0 without chunk structure */
+ // tape files from versions before 1.2.0 without chunk structure
LoadTape_HEAD(file, TAPE_CHUNK_HEAD_SIZE, &tape);
LoadTape_BODY(file, 2 * tape.length, &tape);
}
}
else
{
- /* call function to load this tape chunk */
+ // call function to load this tape chunk
int chunk_size_expected =
(chunk_info[i].loader)(file, chunk_size, &tape);
int i;
byte store_participating_players = 0;
- /* set bits for participating players for compact storage */
+ // set bits for participating players for compact storage
for (i = 0; i < MAX_PLAYERS; i++)
if (tape->player_participates[i])
store_participating_players |= (1 << i);
putFile8Bit(file, (tape->use_mouse ? 1 : 0));
- /* unused bytes not at the end here for 4-byte alignment of engine_version */
+ // unused bytes not at the end here for 4-byte alignment of engine_version
WriteUnusedBytesToFile(file, TAPE_CHUNK_HEAD_UNUSED);
putFileVersion(file, tape->engine_version);
tape.file_version = FILE_VERSION_ACTUAL;
tape.game_version = GAME_VERSION_ACTUAL;
- /* count number of participating players */
+ // count number of participating players
for (i = 0; i < MAX_PLAYERS; i++)
if (tape.player_participates[i])
num_participating_players++;
}
-/* ========================================================================= */
-/* score file functions */
-/* ========================================================================= */
+// ============================================================================
+// score file functions
+// ============================================================================
void LoadScore(int nr)
{
char *line_ptr;
FILE *file;
- /* always start with reliable default values */
+ // always start with reliable default values
for (i = 0; i < MAX_SCORE_ENTRIES; i++)
{
strcpy(highscore[i].Name, EMPTY_PLAYER_NAME);
if (!(file = fopen(filename, MODE_READ)))
return;
- /* check file identifier */
+ // check file identifier
if (fgets(cookie, MAX_LINE_LEN, file) == NULL)
cookie[0] = '\0';
if (strlen(cookie) > 0 && cookie[strlen(cookie) - 1] == '\n')
char *filename = getScoreFilename(nr);
FILE *file;
- /* used instead of "leveldir_current->subdir" (for network games) */
+ // used instead of "leveldir_current->subdir" (for network games)
InitScoreDirectory(levelset.identifier);
if (!(file = fopen(filename, MODE_WRITE)))
}
-/* ========================================================================= */
-/* setup file functions */
-/* ========================================================================= */
+// ============================================================================
+// setup file functions
+// ============================================================================
#define TOKEN_STR_PLAYER_PREFIX "player_"
-/* global setup */
+// global setup
enum
{
SETUP_TOKEN_PLAYER_NAME = 0,
NUM_GLOBAL_SETUP_TOKENS
};
-/* auto setup */
+// auto setup
enum
{
SETUP_TOKEN_AUTO_EDITOR_ZOOM_TILESIZE = 0,
NUM_AUTO_SETUP_TOKENS
};
-/* editor setup */
+// editor setup
enum
{
SETUP_TOKEN_EDITOR_EL_CLASSIC = 0,
NUM_EDITOR_SETUP_TOKENS
};
-/* editor cascade setup */
+// editor cascade setup
enum
{
SETUP_TOKEN_EDITOR_CASCADE_BD = 0,
NUM_EDITOR_CASCADE_SETUP_TOKENS
};
-/* shortcut setup */
+// shortcut setup
enum
{
SETUP_TOKEN_SHORTCUT_SAVE_GAME = 0,
NUM_SHORTCUT_SETUP_TOKENS
};
-/* player setup */
+// player setup
enum
{
SETUP_TOKEN_PLAYER_USE_JOYSTICK = 0,
NUM_PLAYER_SETUP_TOKENS
};
-/* system setup */
+// system setup
enum
{
SETUP_TOKEN_SYSTEM_SDL_VIDEODRIVER = 0,
NUM_SYSTEM_SETUP_TOKENS
};
-/* internal setup */
+// internal setup
enum
{
SETUP_TOKEN_INT_PROGRAM_TITLE = 0,
NUM_INTERNAL_SETUP_TOKENS
};
-/* debug setup */
+// debug setup
enum
{
SETUP_TOKEN_DEBUG_FRAME_DELAY_0 = 0,
NUM_DEBUG_SETUP_TOKENS
};
-/* options setup */
+// options setup
enum
{
SETUP_TOKEN_OPTIONS_VERBOSE = 0,
static char *get_corrected_login_name(char *login_name)
{
- /* needed because player name must be a fixed length string */
+ // needed because player name must be a fixed length string
char *login_name_new = checked_malloc(MAX_PLAYER_NAME_LEN + 1);
strncpy(login_name_new, login_name, MAX_PLAYER_NAME_LEN);
login_name_new[MAX_PLAYER_NAME_LEN] = '\0';
- if (strlen(login_name) > MAX_PLAYER_NAME_LEN) /* name has been cut */
+ if (strlen(login_name) > MAX_PLAYER_NAME_LEN) // name has been cut
if (strchr(login_name_new, ' '))
*strchr(login_name_new, ' ') = '\0';
si->override_level_sounds = FALSE;
si->override_level_music = FALSE;
- si->volume_simple = 100; /* percent */
- si->volume_loops = 100; /* percent */
- si->volume_music = 100; /* percent */
+ si->volume_simple = 100; // percent
+ si->volume_loops = 100; // percent
+ si->volume_music = 100; // percent
si->network_mode = FALSE;
- si->network_player_nr = 0; /* first player */
+ si->network_player_nr = 0; // first player
si->network_server_hostname = getStringCopy(STR_NETWORK_AUTO_DETECT);
si->touch.control_type = getStringCopy(TOUCH_CONTROL_DEFAULT);
- si->touch.move_distance = TOUCH_MOVE_DISTANCE_DEFAULT; /* percent */
- si->touch.drop_distance = TOUCH_DROP_DISTANCE_DEFAULT; /* percent */
- si->touch.transparency = TOUCH_TRANSPARENCY_DEFAULT; /* percent */
+ si->touch.move_distance = TOUCH_MOVE_DISTANCE_DEFAULT; // percent
+ si->touch.drop_distance = TOUCH_DROP_DISTANCE_DEFAULT; // percent
+ si->touch.transparency = TOUCH_TRANSPARENCY_DEFAULT; // percent
si->touch.draw_outlined = TRUE;
si->touch.draw_pressed = TRUE;
static void setHideSetupEntryRaw(char *token_text, void *setup_value_raw)
{
- /* !!! DIRTY WORKAROUND; TO BE FIXED AFTER THE MM ENGINE RELEASE !!! */
+ // !!! DIRTY WORKAROUND; TO BE FIXED AFTER THE MM ENGINE RELEASE !!!
void *setup_value = setup_value_raw - (void *)&si + (void *)&setup;
setHideSetupEntry(setup_value);
char *token_hide_text = getStringCat2(token_text, ".hide");
char *token_hide_value = getHashEntry(setup_file_hash, token_hide_text);
- /* set the value of this setup option in the setup option structure */
+ // set the value of this setup option in the setup option structure
setSetupInfo(token_info, token_nr, getHashEntry(setup_file_hash, token_text));
- /* check if this setup option should be hidden in the setup menu */
+ // check if this setup option should be hidden in the setup menu
if (token_hide_value != NULL && get_boolean_from_string(token_hide_value))
setHideSetupEntryRaw(token_text, token_info[token_nr].value);
}
if (hide_setup_hash == NULL)
hide_setup_hash = newSetupFileHash();
- /* global setup */
+ // global setup
si = setup;
for (i = 0; i < NUM_GLOBAL_SETUP_TOKENS; i++)
setSetupInfoFromTokenInfo(setup_file_hash, global_setup_tokens, i);
setup = si;
- /* virtual buttons setup */
+ // virtual buttons setup
setup.touch.grid_initialized = TRUE;
for (i = 0; i < 2; i++)
{
}
}
- /* editor setup */
+ // editor setup
sei = setup.editor;
for (i = 0; i < NUM_EDITOR_SETUP_TOKENS; i++)
setSetupInfoFromTokenInfo(setup_file_hash, editor_setup_tokens, i);
setup.editor = sei;
- /* shortcut setup */
+ // shortcut setup
ssi = setup.shortcut;
for (i = 0; i < NUM_SHORTCUT_SETUP_TOKENS; i++)
setSetupInfoFromTokenInfo(setup_file_hash, shortcut_setup_tokens, i);
setup.shortcut = ssi;
- /* player setup */
+ // player setup
for (pnr = 0; pnr < MAX_PLAYERS; pnr++)
{
char prefix[30];
setup.input[pnr] = sii;
}
- /* system setup */
+ // system setup
syi = setup.system;
for (i = 0; i < NUM_SYSTEM_SETUP_TOKENS; i++)
setSetupInfoFromTokenInfo(setup_file_hash, system_setup_tokens, i);
setup.system = syi;
- /* internal setup */
+ // internal setup
sxi = setup.internal;
for (i = 0; i < NUM_INTERNAL_SETUP_TOKENS; i++)
setSetupInfoFromTokenInfo(setup_file_hash, internal_setup_tokens, i);
setup.internal = sxi;
- /* debug setup */
+ // debug setup
sdi = setup.debug;
for (i = 0; i < NUM_DEBUG_SETUP_TOKENS; i++)
setSetupInfoFromTokenInfo(setup_file_hash, debug_setup_tokens, i);
setup.debug = sdi;
- /* options setup */
+ // options setup
soi = setup.options;
for (i = 0; i < NUM_OPTIONS_SETUP_TOKENS; i++)
setSetupInfoFromTokenInfo(setup_file_hash, options_setup_tokens, i);
if (!setup_file_hash)
return;
- /* auto setup */
+ // auto setup
sasi = setup.auto_setup;
for (i = 0; i < NUM_AUTO_SETUP_TOKENS; i++)
setSetupInfo(auto_setup_tokens, i,
if (!setup_file_hash)
return;
- /* editor cascade setup */
+ // editor cascade setup
seci = setup.editor_cascade;
for (i = 0; i < NUM_EDITOR_CASCADE_SETUP_TOKENS; i++)
setSetupInfo(editor_cascade_setup_tokens, i,
{
char *player_name_new;
- /* needed to work around problems with fixed length strings */
+ // needed to work around problems with fixed length strings
player_name_new = get_corrected_login_name(setup.player_name);
free(setup.player_name);
setup.player_name = player_name_new;
- /* "scroll_delay: on(3) / off(0)" was replaced by scroll delay value */
+ // "scroll_delay: on(3) / off(0)" was replaced by scroll delay value
if (setup.scroll_delay == FALSE)
{
setup.scroll_delay_value = MIN_SCROLL_DELAY;
- setup.scroll_delay = TRUE; /* now always "on" */
+ setup.scroll_delay = TRUE; // now always "on"
}
- /* make sure that scroll delay value stays inside valid range */
+ // make sure that scroll delay value stays inside valid range
setup.scroll_delay_value =
MIN(MAX(MIN_SCROLL_DELAY, setup.scroll_delay_value), MAX_SCROLL_DELAY);
}
{
char *filename;
- /* always start with reliable default values */
+ // always start with reliable default values
setSetupInfoToDefaults(&setup);
- /* try to load setup values from default setup file */
+ // try to load setup values from default setup file
filename = getDefaultSetupFilename();
if (fileExists(filename))
LoadSetupFromFilename(filename);
- /* try to load setup values from user setup file */
+ // try to load setup values from user setup file
filename = getSetupFilename();
LoadSetupFromFilename(filename);
char *filename = getPath2(getSetupDir(), AUTOSETUP_FILENAME);
SetupFileHash *setup_file_hash = NULL;
- /* always start with reliable default values */
+ // always start with reliable default values
setSetupInfoToDefaults_AutoSetup(&setup);
setup_file_hash = loadSetupFileHash(filename);
char *filename = getPath2(getSetupDir(), EDITORCASCADE_FILENAME);
SetupFileHash *setup_file_hash = NULL;
- /* always start with reliable default values */
+ // always start with reliable default values
setSetupInfoToDefaults_EditorCascade(&setup);
setup_file_hash = loadSetupFileHash(filename);
fprintFileHeader(file, SETUP_FILENAME);
- /* global setup */
+ // global setup
si = setup;
for (i = 0; i < NUM_GLOBAL_SETUP_TOKENS; i++)
{
- /* just to make things nicer :) */
+ // just to make things nicer :)
if (i == SETUP_TOKEN_PLAYER_NAME + 1 ||
i == SETUP_TOKEN_GRAPHICS_SET ||
i == SETUP_TOKEN_VOLUME_SIMPLE ||
fprintf(file, "%s\n", getSetupLine(global_setup_tokens, "", i));
}
- /* virtual buttons setup */
+ // virtual buttons setup
for (i = 0; i < 2; i++)
{
int grid_xsize = setup.touch.grid_xsize[i];
}
}
- /* editor setup */
+ // editor setup
sei = setup.editor;
fprintf(file, "\n");
for (i = 0; i < NUM_EDITOR_SETUP_TOKENS; i++)
fprintf(file, "%s\n", getSetupLine(editor_setup_tokens, "", i));
- /* shortcut setup */
+ // shortcut setup
ssi = setup.shortcut;
fprintf(file, "\n");
for (i = 0; i < NUM_SHORTCUT_SETUP_TOKENS; i++)
fprintf(file, "%s\n", getSetupLine(shortcut_setup_tokens, "", i));
- /* player setup */
+ // player setup
for (pnr = 0; pnr < MAX_PLAYERS; pnr++)
{
char prefix[30];
fprintf(file, "%s\n", getSetupLine(player_setup_tokens, prefix, i));
}
- /* system setup */
+ // system setup
syi = setup.system;
fprintf(file, "\n");
for (i = 0; i < NUM_SYSTEM_SETUP_TOKENS; i++)
fprintf(file, "%s\n", getSetupLine(system_setup_tokens, "", i));
- /* internal setup */
- /* (internal setup values not saved to user setup file) */
+ // internal setup
+ // (internal setup values not saved to user setup file)
- /* debug setup */
+ // debug setup
sdi = setup.debug;
fprintf(file, "\n");
for (i = 0; i < NUM_DEBUG_SETUP_TOKENS; i++)
fprintf(file, "%s\n", getSetupLine(debug_setup_tokens, "", i));
- /* options setup */
+ // options setup
soi = setup.options;
fprintf(file, "\n");
for (i = 0; i < NUM_OPTIONS_SETUP_TOKENS; i++)
if (strEqual(suffix, ".element"))
return getElementFromToken(value_raw);
- /* !!! USE CORRECT VALUE TYPE (currently works also for TYPE_BOOLEAN) !!! */
+ // !!! USE CORRECT VALUE TYPE (currently works also for TYPE_BOOLEAN) !!!
return get_parameter_value(value_raw, suffix, TYPE_INTEGER);
}
{
int i;
- /* always start with reliable default values from static default config */
+ // always start with reliable default values from static default config
for (i = 0; image_config_vars[i].token != NULL; i++)
{
char *value = getHashEntry(image_config_hash, image_config_vars[i].token);
{
int i;
- /* the following initializes hierarchical values from static configuration */
+ // the following initializes hierarchical values from static configuration
- /* special case: initialize "ARG_DEFAULT" values in static default config */
- /* (e.g., initialize "[titlemessage].fade_mode" from "[title].fade_mode") */
+ // special case: initialize "ARG_DEFAULT" values in static default config
+ // (e.g., initialize "[titlemessage].fade_mode" from "[title].fade_mode")
titlescreen_initial_first_default.fade_mode =
title_initial_first_default.fade_mode;
titlescreen_initial_first_default.fade_delay =
titlemessage_default.post_delay = title_default.post_delay;
titlemessage_default.auto_delay = title_default.auto_delay;
- /* special case: initialize "ARG_DEFAULT" values in static default config */
- /* (e.g., init "titlemessage_1.fade_mode" from "[titlemessage].fade_mode") */
+ // special case: initialize "ARG_DEFAULT" values in static default config
+ // (e.g., init "titlemessage_1.fade_mode" from "[titlemessage].fade_mode")
for (i = 0; i < MAX_NUM_TITLE_MESSAGES; i++)
{
titlescreen_initial_first[i] = titlescreen_initial_first_default;
titlemessage[i] = titlemessage_default;
}
- /* special case: initialize "ARG_DEFAULT" values in static default config */
- /* (eg, init "menu.enter_screen.SCORES.xyz" from "menu.enter_screen.xyz") */
+ // special case: initialize "ARG_DEFAULT" values in static default config
+ // (eg, init "menu.enter_screen.SCORES.xyz" from "menu.enter_screen.xyz")
for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++)
{
- if (i == GFX_SPECIAL_ARG_TITLE) /* title values already initialized */
+ if (i == GFX_SPECIAL_ARG_TITLE) // title values already initialized
continue;
menu.enter_screen[i] = menu.enter_screen[GFX_SPECIAL_ARG_DEFAULT];
menu.next_screen[i] = menu.next_screen[GFX_SPECIAL_ARG_DEFAULT];
}
- /* special case: initialize "ARG_DEFAULT" values in static default config */
- /* (eg, init "viewport.door_1.MAIN.xyz" from "viewport.door_1.xyz") */
+ // special case: initialize "ARG_DEFAULT" values in static default config
+ // (eg, init "viewport.door_1.MAIN.xyz" from "viewport.door_1.xyz")
for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++)
{
viewport.window[i] = viewport.window[GFX_SPECIAL_ARG_DEFAULT];
viewport.playfield[i] = viewport.playfield[GFX_SPECIAL_ARG_DEFAULT];
viewport.door_1[i] = viewport.door_1[GFX_SPECIAL_ARG_DEFAULT];
- if (i == GFX_SPECIAL_ARG_EDITOR) /* editor values already initialized */
+ if (i == GFX_SPECIAL_ARG_EDITOR) // editor values already initialized
continue;
viewport.door_2[i] = viewport.door_2[GFX_SPECIAL_ARG_DEFAULT];
};
int i;
- /* special case: initialize later added SETUP list size from LEVELS value */
+ // special case: initialize later added SETUP list size from LEVELS value
if (menu.list_size[GAME_MODE_SETUP] == -1)
menu.list_size[GAME_MODE_SETUP] = menu.list_size[GAME_MODE_LEVELS];
- /* set default position for snapshot buttons to stop/pause/play buttons */
+ // set default position for snapshot buttons to stop/pause/play buttons
for (i = 0; game_buttons_xy[i].dst != NULL; i++)
if ((*game_buttons_xy[i].dst).x == -1 &&
(*game_buttons_xy[i].dst).y == -1)
};
int i;
- /* set default position for element buttons to element graphics */
+ // set default position for element buttons to element graphics
for (i = 0; editor_buttons_xy[i].dst != NULL; i++)
{
if ((*editor_buttons_xy[i].dst).x == -1 &&
}
title_info[] =
{
- /* initialize first titles from "enter screen" definitions, if defined */
+ // initialize first titles from "enter screen" definitions, if defined
{ &title_initial_first_default, "menu.enter_screen.TITLE" },
{ &title_first_default, "menu.enter_screen.TITLE" },
- /* initialize title screens from "next screen" definitions, if defined */
+ // initialize title screens from "next screen" definitions, if defined
{ &title_initial_default, "menu.next_screen.TITLE" },
{ &title_default, "menu.next_screen.TITLE" },
}
titlemessage_arrays[] =
{
- /* initialize first titles from "enter screen" definitions, if defined */
+ // initialize first titles from "enter screen" definitions, if defined
{ titlescreen_initial_first, "menu.enter_screen.TITLE" },
{ titlescreen_first, "menu.enter_screen.TITLE" },
{ titlemessage_initial_first, "menu.enter_screen.TITLE" },
{ titlemessage_first, "menu.enter_screen.TITLE" },
- /* initialize titles from "next screen" definitions, if defined */
+ // initialize titles from "next screen" definitions, if defined
{ titlescreen_initial, "menu.next_screen.TITLE" },
{ titlescreen, "menu.next_screen.TITLE" },
{ titlemessage_initial, "menu.next_screen.TITLE" },
{ titlemessage, "menu.next_screen.TITLE" },
- /* overwrite titles with title definitions, if defined */
+ // overwrite titles with title definitions, if defined
{ titlescreen_initial_first, "[title_initial]" },
{ titlescreen_first, "[title]" },
{ titlemessage_initial_first, "[title_initial]" },
{ titlemessage_initial, "[title_initial]" },
{ titlemessage, "[title]" },
- /* overwrite titles with title screen/message definitions, if defined */
+ // overwrite titles with title screen/message definitions, if defined
{ titlescreen_initial_first, "[titlescreen_initial]" },
{ titlescreen_first, "[titlescreen]" },
{ titlemessage_initial_first, "[titlemessage_initial]" },
if ((setup_file_hash = loadSetupFileHash(filename)) == NULL)
return;
- /* the following initializes hierarchical values from dynamic configuration */
+ // the following initializes hierarchical values from dynamic configuration
- /* special case: initialize with default values that may be overwritten */
- /* (e.g., init "menu.draw_xoffset.INFO" from "menu.draw_xoffset") */
+ // special case: initialize with default values that may be overwritten
+ // (e.g., init "menu.draw_xoffset.INFO" from "menu.draw_xoffset")
for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++)
{
char *value_1 = getHashEntry(setup_file_hash, "menu.draw_xoffset");
menu.list_size[i] = get_integer_from_string(value_3);
}
- /* special case: initialize with default values that may be overwritten */
- /* (eg, init "menu.draw_xoffset.INFO[XXX]" from "menu.draw_xoffset.INFO") */
+ // special case: initialize with default values that may be overwritten
+ // (eg, init "menu.draw_xoffset.INFO[XXX]" from "menu.draw_xoffset.INFO")
for (i = 0; i < NUM_SPECIAL_GFX_INFO_ARGS; i++)
{
char *value_1 = getHashEntry(setup_file_hash, "menu.draw_xoffset.INFO");
}
}
- /* special case: initialize with default values that may be overwritten */
- /* (eg, init "menu.draw_xoffset.SETUP[XXX]" from "menu.draw_xoffset.SETUP") */
+ // special case: initialize with default values that may be overwritten
+ // (eg, init "menu.draw_xoffset.SETUP[XXX]" from "menu.draw_xoffset.SETUP")
for (i = 0; i < NUM_SPECIAL_GFX_SETUP_ARGS; i++)
{
char *value_1 = getHashEntry(setup_file_hash, "menu.draw_xoffset.SETUP");
menu.draw_yoffset_setup[i] = get_integer_from_string(value_2);
}
- /* special case: initialize with default values that may be overwritten */
- /* (eg, init "menu.line_spacing.INFO[XXX]" from "menu.line_spacing.INFO") */
+ // special case: initialize with default values that may be overwritten
+ // (eg, init "menu.line_spacing.INFO[XXX]" from "menu.line_spacing.INFO")
for (i = 0; i < NUM_SPECIAL_GFX_INFO_ARGS; i++)
{
char *value_1 = getHashEntry(setup_file_hash,"menu.left_spacing.INFO");
menu.extra_spacing_info[i] = get_integer_from_string(value_9);
}
- /* special case: initialize with default values that may be overwritten */
- /* (eg, init "menu.enter_screen.SCORES.xyz" from "menu.enter_screen.xyz") */
+ // special case: initialize with default values that may be overwritten
+ // (eg, init "menu.enter_screen.SCORES.xyz" from "menu.enter_screen.xyz")
for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++)
{
char *token_1 = "menu.enter_screen.fade_mode";
value_9);
}
- /* special case: initialize with default values that may be overwritten */
- /* (eg, init "viewport.door_1.MAIN.xyz" from "viewport.door_1.xyz") */
+ // special case: initialize with default values that may be overwritten
+ // (eg, init "viewport.door_1.MAIN.xyz" from "viewport.door_1.xyz")
for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++)
{
char *token_w1 = "viewport.window.width";
value_15);
}
- /* special case: initialize with default values that may be overwritten */
- /* (e.g., init "[title].fade_mode" from "menu.next_screen.TITLE.fade_mode") */
+ // special case: initialize with default values that may be overwritten
+ // (e.g., init "[title].fade_mode" from "menu.next_screen.TITLE.fade_mode")
for (i = 0; title_info[i].info != NULL; i++)
{
struct TitleFadingInfo *info = title_info[i].info;
}
}
- /* special case: initialize with default values that may be overwritten */
- /* (e.g., init "titlemessage_1.fade_mode" from "[titlemessage].fade_mode") */
+ // special case: initialize with default values that may be overwritten
+ // (e.g., init "titlemessage_1.fade_mode" from "[titlemessage].fade_mode")
for (i = 0; titlemessage_arrays[i].array != NULL; i++)
{
struct TitleMessageInfo *array = titlemessage_arrays[i].array;
}
}
- /* read (and overwrite with) values that may be specified in config file */
+ // read (and overwrite with) values that may be specified in config file
for (i = 0; image_config_vars[i].token != NULL; i++)
{
char *value = getHashEntry(setup_file_hash, image_config_vars[i].token);
- /* (ignore definitions set to "[DEFAULT]" which are already initialized) */
+ // (ignore definitions set to "[DEFAULT]" which are already initialized)
if (value != NULL && !strEqual(value, ARG_DEFAULT))
*image_config_vars[i].value =
get_token_parameter_value(image_config_vars[i].token, value);
if (!GFX_OVERRIDE_ARTWORK(ARTWORK_TYPE_GRAPHICS))
{
- /* first look for special settings configured in level series config */
+ // first look for special settings configured in level series config
filename_base = getCustomArtworkLevelConfigFilename(ARTWORK_TYPE_GRAPHICS);
if (fileExists(filename_base))
for (i = 0; i < NUM_FILE_ELEMENTS; i++)
setHashEntry(element_hash, element_info[i].token_name, i_to_a(i));
- /* determined size may be larger than needed (due to unknown elements) */
+ // determined size may be larger than needed (due to unknown elements)
*num_elements = 0;
for (list = setup_file_list; list != NULL; list = list->next)
(*num_elements)++;
- /* add space for up to 3 more elements for padding that may be needed */
+ // add space for up to 3 more elements for padding that may be needed
*num_elements += 3;
- /* free memory for old list of elements, if needed */
+ // free memory for old list of elements, if needed
checked_free(*elements);
- /* allocate memory for new list of elements */
+ // allocate memory for new list of elements
*elements = checked_malloc(*num_elements * sizeof(int));
*num_elements = 0;
{
char *value = getHashEntry(element_hash, list->token);
- if (value == NULL) /* try to find obsolete token mapping */
+ if (value == NULL) // try to find obsolete token mapping
{
char *mapped_token = get_mapped_token(list->token);
if (num_unknown_tokens > 0)
Error(ERR_INFO_LINE, "-");
- while (*num_elements % 4) /* pad with empty elements, if needed */
+ while (*num_elements % 4) // pad with empty elements, if needed
(*elements)[(*num_elements)++] = EL_EMPTY;
freeSetupFileList(setup_file_list);
if (filename_music == NULL)
return NULL;
- /* ---------- try to replace file extension ---------- */
+ // ---------- try to replace file extension ----------
filename_prefix = getStringCopy(filename_music);
if (strrchr(filename_prefix, '.') != NULL)
if (setup_file_hash == NULL)
{
- /* ---------- try to add file extension ---------- */
+ // ---------- try to add file extension ----------
filename_prefix = getStringCopy(filename_music);
filename_info = getStringCat2(filename_prefix, ".txt");
if (setup_file_hash == NULL)
return NULL;
- /* ---------- music file info found ---------- */
+ // ---------- music file info found ----------
clear_mem(&tmp_music_file_info, sizeof(struct MusicFileInfo));
if (strEqual(music->filename, UNDEFINED_FILENAME))
continue;
- /* a configured file may be not recognized as music */
+ // a configured file may be not recognized as music
if (!FileIsMusic(music->filename))
continue;
return;
}
- while ((dir_entry = readDirectory(dir)) != NULL) /* loop all entries */
+ while ((dir_entry = readDirectory(dir)) != NULL) // loop all entries
{
char *basename = dir_entry->basename;
boolean music_already_used = FALSE;
int i;
- /* skip all music files that are configured in music config file */
+ // skip all music files that are configured in music config file
for (i = 0; i < num_music; i++)
{
music = getMusicListEntry(i);
if (strEqual(sound->filename, UNDEFINED_FILENAME))
continue;
- /* a configured file may be not recognized as sound */
+ // a configured file may be not recognized as sound
if (!FileIsSound(sound->filename))
continue;
if (setup_file_list == NULL)
{
- /* use reliable default values from static configuration */
+ // use reliable default values from static configuration
SetupFileList *insert_ptr;
insert_ptr = setup_file_list =
setHashEntry(action_hash, element_action_info[i].suffix,
i_to_a(element_action_info[i].value));
- /* do not store direction index (bit) here, but direction value! */
+ // do not store direction index (bit) here, but direction value!
for (i = 0; i < NUM_DIRECTIONS_FULL; i++)
setHashEntry(direction_hash, element_direction_info[i].suffix,
i_to_a(1 << element_direction_info[i].value));
if this does not work, also accept combined "element[.act][.dir]"
elements (like "dynamite.active"), which are unique elements */
- if (strchr(list->token, '.') == NULL) /* token contains no '.' */
+ if (strchr(list->token, '.') == NULL) // token contains no '.'
{
element_value = getHashEntry(element_hash, list->token);
- if (element_value != NULL) /* element found */
+ if (element_value != NULL) // element found
add_helpanim_entry(atoi(element_value), -1, -1, delay,
&num_list_entries);
else
{
- /* no further suffixes found -- this is not an element */
+ // no further suffixes found -- this is not an element
print_unknown_token(filename, list->token, num_unknown_tokens++);
}
continue;
}
- /* token has format "<prefix>.<something>" */
+ // token has format "<prefix>.<something>"
- action_token = strchr(list->token, '.'); /* suffix may be action ... */
- direction_token = action_token; /* ... or direction */
+ action_token = strchr(list->token, '.'); // suffix may be action ...
+ direction_token = action_token; // ... or direction
element_token = getStringCopy(list->token);
*strchr(element_token, '.') = '\0';
element_value = getHashEntry(element_hash, element_token);
- if (element_value == NULL) /* this is no element */
+ if (element_value == NULL) // this is no element
{
element_value = getHashEntry(element_hash, list->token);
- if (element_value != NULL) /* combined element found */
+ if (element_value != NULL) // combined element found
add_helpanim_entry(atoi(element_value), -1, -1, delay,
&num_list_entries);
else
action_value = getHashEntry(action_hash, action_token);
- if (action_value != NULL) /* action found */
+ if (action_value != NULL) // action found
{
add_helpanim_entry(atoi(element_value), atoi(action_value), -1, delay,
&num_list_entries);
direction_value = getHashEntry(direction_hash, direction_token);
- if (direction_value != NULL) /* direction found */
+ if (direction_value != NULL) // direction found
{
add_helpanim_entry(atoi(element_value), -1, atoi(direction_value), delay,
&num_list_entries);
if (strchr(action_token + 1, '.') == NULL)
{
- /* no further suffixes found -- this is not an action nor direction */
+ // no further suffixes found -- this is not an action nor direction
element_value = getHashEntry(element_hash, list->token);
- if (element_value != NULL) /* combined element found */
+ if (element_value != NULL) // combined element found
add_helpanim_entry(atoi(element_value), -1, -1, delay,
&num_list_entries);
else
continue;
}
- /* token has format "<prefix>.<suffix>.<something>" */
+ // token has format "<prefix>.<suffix>.<something>"
direction_token = strchr(action_token + 1, '.');
action_value = getHashEntry(action_hash, action_token);
- if (action_value == NULL) /* this is no action */
+ if (action_value == NULL) // this is no action
{
element_value = getHashEntry(element_hash, list->token);
- if (element_value != NULL) /* combined element found */
+ if (element_value != NULL) // combined element found
add_helpanim_entry(atoi(element_value), -1, -1, delay,
&num_list_entries);
else
direction_value = getHashEntry(direction_hash, direction_token);
- if (direction_value != NULL) /* direction found */
+ if (direction_value != NULL) // direction found
{
add_helpanim_entry(atoi(element_value), atoi(action_value),
atoi(direction_value), delay, &num_list_entries);
continue;
}
- /* this is no direction */
+ // this is no direction
element_value = getHashEntry(element_hash, list->token);
- if (element_value != NULL) /* combined element found */
+ if (element_value != NULL) // combined element found
add_helpanim_entry(atoi(element_value), -1, -1, delay,
&num_list_entries);
else
if (helptext_info == NULL)
{
- /* use reliable default values from static configuration */
+ // use reliable default values from static configuration
helptext_info = newSetupFileHash();
for (i = 0; helptext_config[i].token; i++)
}
-/* ------------------------------------------------------------------------- */
-/* convert levels */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// convert levels
+// ----------------------------------------------------------------------------
#define MAX_NUM_CONVERT_LEVELS 1000
}
-/* ------------------------------------------------------------------------- */
-/* create and save images for use in level sketches (raw BMP format) */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// create and save images for use in level sketches (raw BMP format)
+// ----------------------------------------------------------------------------
void CreateLevelSketchImages(void)
{
}
-/* ------------------------------------------------------------------------- */
-/* create and save images for custom and group elements (raw BMP format) */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// create and save images for custom and group elements (raw BMP format)
+// ----------------------------------------------------------------------------
void CreateCustomElementImages(char *directory)
{
void CreateLevelSketchImages(void);
void CreateCustomElementImages(char *);
-#endif /* FILES_H */
+#endif // FILES_H
#include "anim.h"
-/* DEBUG SETTINGS */
+// DEBUG SETTINGS
#define DEBUG_INIT_PLAYER 1
#define DEBUG_PLAYER_ACTIONS 0
-/* EXPERIMENTAL STUFF */
+// EXPERIMENTAL STUFF
#define USE_NEW_AMOEBA_CODE FALSE
-/* EXPERIMENTAL STUFF */
+// EXPERIMENTAL STUFF
#define USE_QUICKSAND_BD_ROCK_BUGFIX 0
#define USE_QUICKSAND_IMPACT_BUGFIX 0
#define USE_DELAYED_GFX_REDRAW 0
#endif
-/* for DigField() */
+// for DigField()
#define DF_NO_PUSH 0
#define DF_DIG 1
#define DF_SNAP 2
-/* for MovePlayer() */
+// for MovePlayer()
#define MP_NO_ACTION 0
#define MP_MOVING 1
#define MP_ACTION 2
#define MP_DONT_RUN_INTO (MP_MOVING | MP_ACTION)
-/* for ScrollPlayer() */
+// for ScrollPlayer()
#define SCROLL_INIT 0
#define SCROLL_GO_ON 1
-/* for Bang()/Explode() */
+// for Bang()/Explode()
#define EX_PHASE_START 0
#define EX_TYPE_NONE 0
#define EX_TYPE_NORMAL (1 << 0)
#define PANEL_XPOS(p) (DX + ALIGNED_TEXT_XPOS(p))
#define PANEL_YPOS(p) (DY + ALIGNED_TEXT_YPOS(p))
-/* game panel display and control definitions */
+// game panel display and control definitions
#define GAME_PANEL_LEVEL_NUMBER 0
#define GAME_PANEL_GEMS 1
#define GAME_PANEL_INVENTORY_COUNT 2
}
};
-/* values for delayed check of falling and moving elements and for collision */
+// values for delayed check of falling and moving elements and for collision
#define CHECK_DELAY_MOVING 3
#define CHECK_DELAY_FALLING CHECK_DELAY_MOVING
#define CHECK_DELAY_COLLISION 2
#define CHECK_DELAY_IMPACT CHECK_DELAY_COLLISION
-/* values for initial player move delay (initial delay counter value) */
+// values for initial player move delay (initial delay counter value)
#define INITIAL_MOVE_DELAY_OFF -1
#define INITIAL_MOVE_DELAY_ON 0
-/* values for player movement speed (which is in fact a delay value) */
+// values for player movement speed (which is in fact a delay value)
#define MOVE_DELAY_MIN_SPEED 32
#define MOVE_DELAY_NORMAL_SPEED 8
#define MOVE_DELAY_HIGH_SPEED 4
#define DOUBLE_PLAYER_SPEED(p) (HALVE_MOVE_DELAY( (p)->move_delay_value))
#define HALVE_PLAYER_SPEED(p) (DOUBLE_MOVE_DELAY((p)->move_delay_value))
-/* values for scroll positions */
+// values for scroll positions
#define SCROLL_POSITION_X(x) ((x) < SBX_Left + MIDPOSX ? SBX_Left : \
(x) > SBX_Right + MIDPOSX ? SBX_Right :\
(x) - MIDPOSX)
(y) > SBY_Lower + MIDPOSY ? SBY_Lower :\
(y) - MIDPOSY)
-/* values for other actions */
+// values for other actions
#define MOVE_STEPSIZE_NORMAL (TILEX / MOVE_DELAY_NORMAL_SPEED)
#define MOVE_STEPSIZE_MIN (1)
#define MOVE_STEPSIZE_MAX (TILEX)
#define MM_HEALTH(x) (MIN(MAX(0, MAX_HEALTH - (x)), MAX_HEALTH))
-/* game button identifiers */
+// game button identifiers
#define GAME_CTRL_ID_STOP 0
#define GAME_CTRL_ID_PAUSE 1
#define GAME_CTRL_ID_PLAY 2
#define NUM_GAME_BUTTONS 17
-/* forward declaration for internal use */
+// forward declaration for internal use
static void CreateField(int, int, int);
static struct GadgetInfo *game_gadget[NUM_GAME_BUTTONS];
-/* for detection of endless loops, caused by custom element programming */
-/* (using maximal playfield width x 10 is just a rough approximation) */
+// for detection of endless loops, caused by custom element programming
+// (using maximal playfield width x 10 is just a rough approximation)
#define MAX_ELEMENT_CHANGE_RECURSION_DEPTH (MAX_PLAYFIELD_WIDTH * 10)
#define RECURSION_LOOP_DETECTION_START(e, rc) \
static int map_player_action[MAX_PLAYERS];
-/* ------------------------------------------------------------------------- */
-/* definition of elements that automatically change to other elements after */
-/* a specified time, eventually calling a function when changing */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// definition of elements that automatically change to other elements after
+// a specified time, eventually calling a function when changing
+// ----------------------------------------------------------------------------
-/* forward declaration for changer functions */
+// forward declaration for changer functions
static void InitBuggyBase(int, int);
static void WarnBuggyBase(int, int);
#define CE_PAGE(e, ce) (element_info[e].event_page[ce])
-/* static variables for playfield scan mode (scanning forward or backward) */
+// static variables for playfield scan mode (scanning forward or backward)
static int playfield_scan_start_x = 0;
static int playfield_scan_start_y = 0;
static int playfield_scan_delta_x = 1;
move_stepsize =
MIN(MAX(MOVE_STEPSIZE_MIN, move_stepsize), MOVE_STEPSIZE_MAX);
- /* make sure that stepsize value is always a power of 2 */
+ // make sure that stepsize value is always a power of 2
move_stepsize = (1 << log_2(move_stepsize));
return TILEX / move_stepsize;
int move_delay = get_move_delay_from_stepsize(move_stepsize);
boolean cannot_move = (move_stepsize == STEPSIZE_NOT_MOVING ? TRUE : FALSE);
- /* do no immediately change move delay -- the player might just be moving */
+ // do no immediately change move delay -- the player might just be moving
player->move_delay_value_next = move_delay;
- /* information if player can move must be set separately */
+ // information if player can move must be set separately
player->cannot_move = cannot_move;
if (init_game)
level.sp_block_last_field :
level.block_last_field);
- /* ---------- initialize player's last field block delay --------------- */
+ // ---------- initialize player's last field block delay ------------------
- /* always start with reliable default value (no adjustment needed) */
+ // always start with reliable default value (no adjustment needed)
player->block_delay_adjustment = 0;
- /* special case 1: in Supaplex, Murphy blocks last field one more frame */
+ // special case 1: in Supaplex, Murphy blocks last field one more frame
if (player->block_last_field && element == EL_SP_MURPHY)
player->block_delay_adjustment = 1;
- /* special case 2: in game engines before 3.1.1, blocking was different */
+ // special case 2: in game engines before 3.1.1, blocking was different
if (game.use_block_last_field_bug)
player->block_delay_adjustment = (player->block_last_field ? -1 : 1);
{
player->active = TRUE;
- /* remove potentially duplicate players */
+ // remove potentially duplicate players
if (StorePlayer[jx][jy] == Feld[x][y])
StorePlayer[jx][jy] = 0;
struct PlayerInfo *player = &stored_player[player_nr];
if (player->active && player->killed)
- player->reanimated = TRUE; /* if player was just killed, reanimate him */
+ player->reanimated = TRUE; // if player was just killed, reanimate him
}
}
int belt_dir = getBeltDirFromBeltSwitchElement(Feld[x][y]);
int belt_dir_nr = getBeltDirNrFromBeltSwitchElement(Feld[x][y]);
- if (game.belt_dir_nr[belt_nr] == 3) /* initial value */
+ if (game.belt_dir_nr[belt_nr] == 3) // initial value
{
game.belt_dir[belt_nr] = belt_dir;
game.belt_dir_nr[belt_nr] = belt_dir_nr;
}
- else /* more than one switch -- set it like the first switch */
+ else // more than one switch -- set it like the first switch
{
Feld[x][y] = Feld[x][y] - belt_dir_nr + game.belt_dir_nr[belt_nr];
}
case EL_NEXT_CE_6:
case EL_NEXT_CE_7:
case EL_NEXT_CE_8:
- /* reference elements should not be used on the playfield */
+ // reference elements should not be used on the playfield
Feld[x][y] = EL_EMPTY;
break;
{
InitField(x, y, init_game);
- /* not needed to call InitMovDir() -- already done by InitField()! */
+ // not needed to call InitMovDir() -- already done by InitField()!
if (game.engine_version < VERSION_IDENT(3,1,0,0) &&
CAN_MOVE(Feld[x][y]))
InitMovDir(x, y);
InitField(x, y, init_game);
- /* not needed to call InitMovDir() -- already done by InitField()! */
+ // not needed to call InitMovDir() -- already done by InitField()!
if (game.engine_version < VERSION_IDENT(3,1,0,0) &&
CAN_MOVE(old_element) &&
(old_element < EL_MOLE_LEFT || old_element > EL_MOLE_DOWN))
Error(ERR_EXIT, "this should not happen -- please debug");
}
- /* force update of game controls after initialization */
+ // force update of game controls after initialization
gpc->value = gpc->last_value = -1;
gpc->frame = gpc->last_frame = -1;
gpc->gfx_frame = -1;
- /* determine panel value width for later calculation of alignment */
+ // determine panel value width for later calculation of alignment
if (type == TYPE_INTEGER || type == TYPE_STRING)
{
pos->width = pos->size * getFontWidth(pos->font);
pos->height = pos->size;
}
- /* fill structure for game panel draw order */
+ // fill structure for game panel draw order
gpo->nr = gpc->nr;
gpo->sort_priority = pos->sort_priority;
}
- /* sort game panel controls according to sort_priority and control number */
+ // sort game panel controls according to sort_priority and control number
qsort(game_panel_order, NUM_GAME_PANEL_CONTROLS,
sizeof(struct GamePanelOrderInfo), compareGamePanelOrderInfo);
}
boolean use_element_count = FALSE;
int i, j, x, y;
- /* first check if it is needed at all to calculate playfield element count */
+ // first check if it is needed at all to calculate playfield element count
for (i = GAME_PANEL_ELEMENT_COUNT_1; i <= GAME_PANEL_ELEMENT_COUNT_8; i++)
if (!PANEL_DEACTIVATED(game_panel_controls[i].pos))
use_element_count = TRUE;
UpdatePlayfieldElementCount();
- /* update game panel control values */
+ // update game panel control values
- /* used instead of "level_nr" (for network games) */
+ // used instead of "level_nr" (for network games)
game_panel_controls[GAME_PANEL_LEVEL_NUMBER].value = levelset.level_nr;
game_panel_controls[GAME_PANEL_GEMS].value = gems;
{
for (i = 0; i < MAX_PLAYERS; i++)
{
- /* only one player in Supaplex game engine */
+ // only one player in Supaplex game engine
if (level.game_engine_type == GAME_ENGINE_TYPE_SP && i > 0)
break;
game_panel_controls[GAME_PANEL_LEVEL_NAME].value = 0;
game_panel_controls[GAME_PANEL_LEVEL_AUTHOR].value = 0;
- /* update game panel control frames */
+ // update game panel control frames
for (i = 0; game_panel_controls[i].nr != -1; i++)
{
if (!redraw_panel)
return;
- /* copy default game door content to main double buffer */
+ // copy default game door content to main double buffer
- /* !!! CHECK AGAIN !!! */
+ // !!! CHECK AGAIN !!!
SetPanelBackground();
// SetDoorBackgroundImage(IMG_BACKGROUND_PANEL);
DrawBackground(DX, DY, DXSIZE, DYSIZE);
- /* redraw game control buttons */
+ // redraw game control buttons
RedrawGameButtons();
SetGameStatus(GAME_MODE_PSEUDO_PANEL);
{
boolean use_dynamic_size = (size == -1 ? TRUE : FALSE);
- if (use_dynamic_size) /* use dynamic number of digits */
+ if (use_dynamic_size) // use dynamic number of digits
{
int value_change = (nr == GAME_PANEL_LEVEL_NUMBER ? 100 : 1000);
int size1 = (nr == GAME_PANEL_LEVEL_NUMBER ? 2 : 3);
}
}
- /* correct text size if "digits" is zero or less */
+ // correct text size if "digits" is zero or less
if (size <= 0)
size = strlen(int2str(value, size));
- /* dynamically correct text alignment */
+ // dynamically correct text alignment
pos->width = size * getFontWidth(font);
DrawTextExt(drawto, PANEL_XPOS(pos), PANEL_YPOS(pos),
if (nr == GAME_PANEL_GRAVITY_STATE)
{
- int font1 = pos->font; /* (used for normal state) */
- int font2 = pos->font_alt; /* (used for active state) */
+ int font1 = pos->font; // (used for normal state)
+ int font2 = pos->font_alt; // (used for active state)
font = (active ? font2 : font1);
}
if (size <= 0)
{
- /* don't truncate output if "chars" is zero or less */
+ // don't truncate output if "chars" is zero or less
size = strlen(s);
- /* dynamically correct text alignment */
+ // dynamically correct text alignment
pos->width = size * getFontWidth(font);
}
{
int i, j, k, l, x, y;
- /* set game engine from tape file when re-playing, else from level file */
+ // set game engine from tape file when re-playing, else from level file
game.engine_version = (tape.playing ? tape.engine_version :
level.game_version);
- /* set single or multi-player game mode (needed for re-playing tapes) */
+ // set single or multi-player game mode (needed for re-playing tapes)
game.team_mode = setup.team_mode;
if (tape.playing)
if (tape.player_participates[i])
num_players++;
- /* multi-player tapes contain input data for more than one player */
+ // multi-player tapes contain input data for more than one player
game.team_mode = (num_players > 1);
}
- /* ---------------------------------------------------------------------- */
- /* set flags for bugs and changes according to active game engine version */
- /* ---------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
+ // set flags for bugs and changes according to active game engine version
+ // --------------------------------------------------------------------------
/*
Summary of bugfix/change:
game_em.use_snap_key_bug =
(game.engine_version < VERSION_IDENT(4,0,1,0));
- /* ---------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
- /* set maximal allowed number of custom element changes per game frame */
+ // set maximal allowed number of custom element changes per game frame
game.max_num_changes_per_frame = 1;
- /* default scan direction: scan playfield from top/left to bottom/right */
+ // default scan direction: scan playfield from top/left to bottom/right
InitPlayfieldScanMode(CA_ARG_SCAN_MODE_NORMAL);
- /* dynamically adjust element properties according to game engine version */
+ // dynamically adjust element properties according to game engine version
InitElementPropertiesEngine(game.engine_version);
#if 0
printf(" => game.engine_version == %06d\n", game.engine_version);
#endif
- /* ---------- initialize player's initial move delay --------------------- */
+ // ---------- initialize player's initial move delay ------------------------
- /* dynamically adjust player properties according to level information */
+ // dynamically adjust player properties according to level information
for (i = 0; i < MAX_PLAYERS; i++)
game.initial_move_delay_value[i] =
get_move_delay_from_stepsize(level.initial_player_stepsize[i]);
- /* dynamically adjust player properties according to game engine version */
+ // dynamically adjust player properties according to game engine version
for (i = 0; i < MAX_PLAYERS; i++)
game.initial_move_delay[i] =
(game.engine_version <= VERSION_IDENT(2,0,1,0) ?
game.initial_move_delay_value[i] : 0);
- /* ---------- initialize player's initial push delay --------------------- */
+ // ---------- initialize player's initial push delay ------------------------
- /* dynamically adjust player properties according to game engine version */
+ // dynamically adjust player properties according to game engine version
game.initial_push_delay_value =
(game.engine_version < VERSION_IDENT(3,0,7,1) ? 5 : -1);
- /* ---------- initialize changing elements ------------------------------- */
+ // ---------- initialize changing elements ----------------------------------
- /* initialize changing elements information */
+ // initialize changing elements information
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
struct ElementInfo *ei = &element_info[i];
- /* this pointer might have been changed in the level editor */
+ // this pointer might have been changed in the level editor
ei->change = &ei->change_page[0];
if (!IS_CUSTOM_ELEMENT(i))
}
}
- /* add changing elements from pre-defined list */
+ // add changing elements from pre-defined list
for (i = 0; change_delay_list[i].element != EL_UNDEFINED; i++)
{
struct ChangingElementInfo *ch_delay = &change_delay_list[i];
SET_PROPERTY(ch_delay->element, EP_CAN_CHANGE_OR_HAS_ACTION, TRUE);
}
- /* ---------- initialize internal run-time variables --------------------- */
+ // ---------- initialize internal run-time variables ------------------------
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
{
}
}
- /* add change events from custom element configuration */
+ // add change events from custom element configuration
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
{
struct ElementInfo *ei = &element_info[EL_CUSTOM_START + i];
for (k = 0; k < NUM_CHANGE_EVENTS; k++)
{
- /* only add event page for the first page found with this event */
+ // only add event page for the first page found with this event
if (ei->change_page[j].has_event[k] && !(ei->has_change_event[k]))
{
ei->has_change_event[k] = TRUE;
}
}
- /* ---------- initialize reference elements in change conditions --------- */
+ // ---------- initialize reference elements in change conditions ------------
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
{
}
}
- /* ---------- initialize run-time trigger player and element ------------- */
+ // ---------- initialize run-time trigger player and element ----------------
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
{
}
}
- /* ---------- initialize trigger events ---------------------------------- */
+ // ---------- initialize trigger events -------------------------------------
- /* initialize trigger events information */
+ // initialize trigger events information
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
for (j = 0; j < NUM_CHANGE_EVENTS; j++)
trigger_events[i][j] = FALSE;
- /* add trigger events from element change event properties */
+ // add trigger events from element change event properties
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
struct ElementInfo *ei = &element_info[i];
}
}
- /* ---------- initialize push delay -------------------------------------- */
+ // ---------- initialize push delay -----------------------------------------
- /* initialize push delay values to default */
+ // initialize push delay values to default
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
if (!IS_CUSTOM_ELEMENT(i))
{
- /* set default push delay values (corrected since version 3.0.7-1) */
+ // set default push delay values (corrected since version 3.0.7-1)
if (game.engine_version < VERSION_IDENT(3,0,7,1))
{
element_info[i].push_delay_fixed = 2;
}
}
- /* set push delay value for certain elements from pre-defined list */
+ // set push delay value for certain elements from pre-defined list
for (i = 0; push_delay_list[i].element != EL_UNDEFINED; i++)
{
int e = push_delay_list[i].element;
element_info[e].push_delay_random = push_delay_list[i].push_delay_random;
}
- /* set push delay value for Supaplex elements for newer engine versions */
+ // set push delay value for Supaplex elements for newer engine versions
if (game.engine_version >= VERSION_IDENT(3,1,0,0))
{
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
if (IS_SP_ELEMENT(i))
{
- /* set SP push delay to just enough to push under a falling zonk */
+ // set SP push delay to just enough to push under a falling zonk
int delay = (game.engine_version >= VERSION_IDENT(3,1,1,0) ? 8 : 6);
element_info[i].push_delay_fixed = delay;
}
}
- /* ---------- initialize move stepsize ----------------------------------- */
+ // ---------- initialize move stepsize --------------------------------------
- /* initialize move stepsize values to default */
+ // initialize move stepsize values to default
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
if (!IS_CUSTOM_ELEMENT(i))
element_info[i].move_stepsize = MOVE_STEPSIZE_NORMAL;
- /* set move stepsize value for certain elements from pre-defined list */
+ // set move stepsize value for certain elements from pre-defined list
for (i = 0; move_stepsize_list[i].element != EL_UNDEFINED; i++)
{
int e = move_stepsize_list[i].element;
element_info[e].move_stepsize = move_stepsize_list[i].move_stepsize;
}
- /* ---------- initialize collect score ----------------------------------- */
+ // ---------- initialize collect score --------------------------------------
- /* initialize collect score values for custom elements from initial value */
+ // initialize collect score values for custom elements from initial value
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
if (IS_CUSTOM_ELEMENT(i))
element_info[i].collect_score = element_info[i].collect_score_initial;
- /* ---------- initialize collect count ----------------------------------- */
+ // ---------- initialize collect count --------------------------------------
- /* initialize collect count values for non-custom elements */
+ // initialize collect count values for non-custom elements
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
if (!IS_CUSTOM_ELEMENT(i))
element_info[i].collect_count_initial = 0;
- /* add collect count values for all elements from pre-defined list */
+ // add collect count values for all elements from pre-defined list
for (i = 0; collect_count_list[i].element != EL_UNDEFINED; i++)
element_info[collect_count_list[i].element].collect_count_initial =
collect_count_list[i].count;
- /* ---------- initialize access direction -------------------------------- */
+ // ---------- initialize access direction -----------------------------------
- /* initialize access direction values to default (access from every side) */
+ // initialize access direction values to default (access from every side)
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
if (!IS_CUSTOM_ELEMENT(i))
element_info[i].access_direction = MV_ALL_DIRECTIONS;
- /* set access direction value for certain elements from pre-defined list */
+ // set access direction value for certain elements from pre-defined list
for (i = 0; access_direction_list[i].element != EL_UNDEFINED; i++)
element_info[access_direction_list[i].element].access_direction =
access_direction_list[i].direction;
- /* ---------- initialize explosion content ------------------------------- */
+ // ---------- initialize explosion content ----------------------------------
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
if (IS_CUSTOM_ELEMENT(i))
for (y = 0; y < 3; y++) for (x = 0; x < 3; x++)
{
- /* (content for EL_YAMYAM set at run-time with game.yamyam_content_nr) */
+ // (content for EL_YAMYAM set at run-time with game.yamyam_content_nr)
element_info[i].content.e[x][y] =
(i == EL_PLAYER_1 ? EL_EMERALD_YELLOW :
}
}
- /* ---------- initialize recursion detection ------------------------------ */
+ // ---------- initialize recursion detection --------------------------------
recursion_loop_depth = 0;
recursion_loop_detected = FALSE;
recursion_loop_element = EL_UNDEFINED;
- /* ---------- initialize graphics engine ---------------------------------- */
+ // ---------- initialize graphics engine ------------------------------------
game.scroll_delay_value =
(game.forced_scroll_delay_value != -1 ? game.forced_scroll_delay_value :
setup.scroll_delay ? setup.scroll_delay_value : 0);
game.scroll_delay_value =
MIN(MAX(MIN_SCROLL_DELAY, game.scroll_delay_value), MAX_SCROLL_DELAY);
- /* ---------- initialize game engine snapshots ---------------------------- */
+ // ---------- initialize game engine snapshots ------------------------------
for (i = 0; i < MAX_PLAYERS; i++)
game.snapshot.last_action[i] = 0;
game.snapshot.changed_action = FALSE;
SNAPSHOT_MODE_EVERY_COLLECT : SNAPSHOT_MODE_OFF);
game.snapshot.save_snapshot = FALSE;
- /* ---------- initialize level time for Supaplex engine ------------------- */
- /* Supaplex levels with time limit currently unsupported -- should be added */
+ // ---------- initialize level time for Supaplex engine ---------------------
+ // Supaplex levels with time limit currently unsupported -- should be added
if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
level.time = 0;
}
int full_lev_fieldy = lev_fieldy + (BorderElement != EL_EMPTY ? 2 : 0);
int fade_mask = REDRAW_FIELD;
- boolean emulate_bd = TRUE; /* unless non-BOULDERDASH elements found */
- boolean emulate_sb = TRUE; /* unless non-SOKOBAN elements found */
- boolean emulate_sp = TRUE; /* unless non-SUPAPLEX elements found */
+ boolean emulate_bd = TRUE; // unless non-BOULDERDASH elements found
+ boolean emulate_sb = TRUE; // unless non-SOKOBAN elements found
+ boolean emulate_sp = TRUE; // unless non-SUPAPLEX elements found
int initial_move_dir = MV_DOWN;
int i, j, x, y;
FadeOut(fade_mask);
- /* needed if different viewport properties defined for playing */
+ // needed if different viewport properties defined for playing
ChangeViewportPropertiesIfNeeded();
ClearField();
InitGameEngine();
InitGameControlValues();
- /* don't play tapes over network */
+ // don't play tapes over network
network_playing = (network.enabled && !tape.playing);
for (i = 0; i < MAX_PLAYERS; i++)
player->element_nr);
player->use_murphy = FALSE;
- player->block_last_field = FALSE; /* initialized in InitPlayerField() */
- player->block_delay_adjustment = 0; /* initialized in InitPlayerField() */
+ player->block_last_field = FALSE; // initialized in InitPlayerField()
+ player->block_delay_adjustment = 0; // initialized in InitPlayerField()
player->gravity = level.initial_player_gravity[i];
SetPlayerMoveSpeed(player, level.initial_player_stepsize[i], TRUE);
- player->push_delay = -1; /* initialized when pushing starts */
+ player->push_delay = -1; // initialized when pushing starts
player->push_delay_value = game.initial_push_delay_value;
player->drop_delay = 0;
network_player_action_received = FALSE;
- /* initial null action */
+ // initial null action
if (network_playing)
SendToServer_MovePlayer(MV_NONE);
ScreenMovPos = 0;
ScreenGfxPos = 0;
- ScrollStepSize = 0; /* will be correctly initialized by ScrollScreen() */
+ ScrollStepSize = 0; // will be correctly initialized by ScrollScreen()
AllPlayersGone = FALSE;
for (i = 0; i < NUM_BELTS; i++)
{
game.belt_dir[i] = MV_NONE;
- game.belt_dir_nr[i] = 3; /* not moving, next moving left */
+ game.belt_dir_nr[i] = 3; // not moving, next moving left
}
for (i = 0; i < MAX_NUM_AMOEBA; i++)
MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
ChangeDelay[x][y] = 0;
ChangePage[x][y] = -1;
- CustomValue[x][y] = 0; /* initialized in InitField() */
+ CustomValue[x][y] = 0; // initialized in InitField()
Store[x][y] = Store2[x][y] = StorePlayer[x][y] = Back[x][y] = 0;
AmoebaNr[x][y] = 0;
WasJustMoving[x][y] = 0;
{
struct PlayerInfo *player = &stored_player[i];
- /* set number of special actions for bored and sleeping animation */
+ // set number of special actions for bored and sleeping animation
player->num_special_action_bored =
get_num_special_action(player->artwork_element,
ACTION_BORING_1, ACTION_BORING_LAST);
emulate_sb ? EMU_SOKOBAN :
emulate_sp ? EMU_SUPAPLEX : EMU_NONE);
- /* initialize type of slippery elements */
+ // initialize type of slippery elements
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
if (!IS_CUSTOM_ELEMENT(i))
{
- /* default: elements slip down either to the left or right randomly */
+ // default: elements slip down either to the left or right randomly
element_info[i].slippery_type = SLIPPERY_ANY_RANDOM;
- /* SP style elements prefer to slip down on the left side */
+ // SP style elements prefer to slip down on the left side
if (game.engine_version >= VERSION_IDENT(3,1,1,0) && IS_SP_ELEMENT(i))
element_info[i].slippery_type = SLIPPERY_ANY_LEFT_RIGHT;
- /* BD style elements prefer to slip down on the left side */
+ // BD style elements prefer to slip down on the left side
if (game.emulation == EMU_BOULDERDASH)
element_info[i].slippery_type = SLIPPERY_ANY_LEFT_RIGHT;
}
}
- /* initialize explosion and ignition delay */
+ // initialize explosion and ignition delay
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
if (!IS_CUSTOM_ELEMENT(i))
}
}
- /* correct non-moving belts to start moving left */
+ // correct non-moving belts to start moving left
for (i = 0; i < NUM_BELTS; i++)
if (game.belt_dir[i] == MV_NONE)
- game.belt_dir_nr[i] = 3; /* not moving, next moving left */
+ game.belt_dir_nr[i] = 3; // not moving, next moving left
#if USE_NEW_PLAYER_ASSIGNMENTS
for (i = 0; i < MAX_PLAYERS; i++)
{
stored_player[i].connected = FALSE;
- /* in network game mode, the local player might not be the first player */
+ // in network game mode, the local player might not be the first player
if (stored_player[i].connected_locally)
local_player = &stored_player[i];
}
printf("Reassigning players ...\n");
#endif
- /* check if any connected player was not found in playfield */
+ // check if any connected player was not found in playfield
for (i = 0; i < MAX_PLAYERS; i++)
{
struct PlayerInfo *player = &stored_player[i];
printf("- looking for field player for player %d ...\n", i + 1);
#endif
- /* assign first free player found that is present in the playfield */
+ // assign first free player found that is present in the playfield
- /* first try: look for unmapped playfield player that is not connected */
+ // first try: look for unmapped playfield player that is not connected
for (j = 0; j < MAX_PLAYERS; j++)
if (field_player == NULL &&
stored_player[j].present &&
!stored_player[j].connected)
field_player = &stored_player[j];
- /* second try: look for *any* unmapped playfield player */
+ // second try: look for *any* unmapped playfield player
for (j = 0; j < MAX_PLAYERS; j++)
if (field_player == NULL &&
stored_player[j].present &&
#else
- /* check if any connected player was not found in playfield */
+ // check if any connected player was not found in playfield
for (i = 0; i < MAX_PLAYERS; i++)
{
struct PlayerInfo *player = &stored_player[i];
struct PlayerInfo *field_player = &stored_player[j];
int jx = field_player->jx, jy = field_player->jy;
- /* assign first free player found that is present in the playfield */
+ // assign first free player found that is present in the playfield
if (field_player->present && !field_player->connected)
{
player->present = TRUE;
printf("::: local_player->present == %d\n", local_player->present);
#endif
- /* set focus to local player for network games, else to all players */
+ // set focus to local player for network games, else to all players
game.centered_player_nr = (network_playing ? local_player->index_nr : -1);
game.centered_player_nr_next = game.centered_player_nr;
game.set_centered_player = FALSE;
if (network_playing && tape.recording)
{
- /* store client dependent player focus when recording network games */
+ // store client dependent player focus when recording network games
tape.centered_player_nr_next = game.centered_player_nr_next;
tape.set_centered_player = TRUE;
}
if (tape.playing)
{
- /* when playing a tape, eliminate all players who do not participate */
+ // when playing a tape, eliminate all players who do not participate
#if USE_NEW_PLAYER_ASSIGNMENTS
}
#endif
}
- else if (!network.enabled && !game.team_mode) /* && !tape.playing */
+ else if (!network.enabled && !game.team_mode) // && !tape.playing
{
- /* when in single player mode, eliminate all but the local player */
+ // when in single player mode, eliminate all but the local player
for (i = 0; i < MAX_PLAYERS; i++)
{
if (level.solved_by_one_player)
local_player->players_still_needed = 1;
- /* when recording the game, store which players take part in the game */
+ // when recording the game, store which players take part in the game
if (tape.recording)
{
#if USE_NEW_PLAYER_ASSIGNMENTS
{
for (i = 0; i < element_info[element].num_change_pages; i++)
{
- /* check for player created from custom element as single target */
+ // check for player created from custom element as single target
content = element_info[element].change_page[i].target_element;
is_player = ELEM_IS_PLAYER(content);
for (yy = 0; yy < 3; yy++) for (xx = 0; xx < 3; xx++)
{
- /* check for player created from custom element as explosion content */
+ // check for player created from custom element as explosion content
content = element_info[element].content.e[xx][yy];
is_player = ELEM_IS_PLAYER(content);
for (i = 0; i < element_info[element].num_change_pages; i++)
{
- /* check for player created from custom element as extended target */
+ // check for player created from custom element as extended target
content =
element_info[element].change_page[i].target_content.e[xx][yy];
scroll_y = SCROLL_POSITION_Y(local_player->jy);
}
- /* !!! FIX THIS (START) !!! */
+ // !!! FIX THIS (START) !!!
if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
{
InitGameEngine_EM();
DrawLevel(REDRAW_FIELD);
DrawAllPlayers();
- /* after drawing the level, correct some elements */
+ // after drawing the level, correct some elements
if (game.timegate_time_left == 0)
CloseAllOpenTimegates();
}
- /* blit playfield from scroll buffer to normal back buffer for fading in */
+ // blit playfield from scroll buffer to normal back buffer for fading in
BlitScreenToBitmap(backbuffer);
- /* !!! FIX THIS (END) !!! */
+ // !!! FIX THIS (END) !!!
DrawMaskedBorder(fade_mask);
if (!game.restart_level)
{
- /* copy default game door content to main double buffer */
+ // copy default game door content to main double buffer
- /* !!! CHECK AGAIN !!! */
+ // !!! CHECK AGAIN !!!
SetPanelBackground();
// SetDoorBackgroundImage(IMG_BACKGROUND_PANEL);
DrawBackground(DX, DY, DXSIZE, DYSIZE);
MapGameButtons();
MapTapeButtons();
- /* copy actual game door content to door double buffer for OpenDoor() */
+ // copy actual game door content to door double buffer for OpenDoor()
BlitBitmap(drawto, bitmap_db_door_1, DX, DY, DXSIZE, DYSIZE, 0, 0);
OpenDoor(DOOR_OPEN_ALL);
void UpdateEngineValues(int actual_scroll_x, int actual_scroll_y,
int actual_player_x, int actual_player_y)
{
- /* this is used for non-R'n'D game engines to update certain engine values */
+ // this is used for non-R'n'D game engines to update certain engine values
if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
{
actual_player_y = correctLevelPosY_EM(actual_player_y);
}
- /* needed to determine if sounds are played within the visible screen area */
+ // needed to determine if sounds are played within the visible screen area
scroll_x = actual_scroll_x;
scroll_y = actual_scroll_y;
- /* needed to get player position for "follow finger" playing input method */
+ // needed to get player position for "follow finger" playing input method
local_player->jx = actual_player_x;
local_player->jy = actual_player_y;
}
else if (move_pattern == MV_ALONG_LEFT_SIDE ||
move_pattern == MV_ALONG_RIGHT_SIDE)
{
- /* use random direction as default start direction */
+ // use random direction as default start direction
if (game.engine_version >= VERSION_IDENT(3,1,0,0))
MovDir[x][y] = 1 << RND(4);
{
int i;
- /* do not start end game actions before the player stops moving (to exit) */
+ // do not start end game actions before the player stops moving (to exit)
if (local_player->MovPos)
return;
SaveLevelSetup_SeriesInfo();
}
- if (tape.auto_play) /* tape might already be stopped here */
+ if (tape.auto_play) // tape might already be stopped here
tape.auto_play_level_solved = TRUE;
TapeStop();
if (level.game_engine_type == GAME_ENGINE_TYPE_RND)
{
- if (ExitX >= 0 && ExitY >= 0) /* local player has left the level */
+ if (ExitX >= 0 && ExitY >= 0) // local player has left the level
{
- /* close exit door after last player */
+ // close exit door after last player
if ((AllPlayersGone &&
(Feld[ExitX][ExitY] == EL_EXIT_OPEN ||
Feld[ExitX][ExitY] == EL_SP_EXIT_OPEN ||
PlayLevelSoundElementAction(ExitX, ExitY, element, ACTION_CLOSING);
}
- /* player disappears */
+ // player disappears
DrawLevelField(ExitX, ExitY);
}
{
RemovePlayer(player);
- /* player disappears */
+ // player disappears
DrawLevelField(player->jx, player->jy);
}
}
void GameEnd(void)
{
- /* used instead of "level_nr" (needed for network games) */
+ // used instead of "level_nr" (needed for network games)
int last_level_nr = levelset.level_nr;
int hi_pos;
if (local_player->LevelSolved_SaveTape)
{
- /* make sure that request dialog to save tape does not open door again */
+ // make sure that request dialog to save tape does not open door again
if (!global.use_envelope_request)
CloseDoor(DOOR_CLOSE_1);
- SaveTapeChecked_LevelSolved(tape.level_nr); /* ask to save tape */
+ SaveTapeChecked_LevelSolved(tape.level_nr); // ask to save tape
}
- /* if no tape is to be saved, close both doors simultaneously */
+ // if no tape is to be saved, close both doors simultaneously
CloseDoor(DOOR_CLOSE_ALL);
if (level_editor_test_game)
level_nr < leveldir_current->last_level &&
!network_playing)
{
- level_nr++; /* advance to next level */
- TapeErase(); /* start with empty tape */
+ level_nr++; // advance to next level
+ TapeErase(); // start with empty tape
if (setup.auto_play_next_level)
{
{
if (local_player->score_final > highscore[k].Score)
{
- /* player has made it to the hall of fame */
+ // player has made it to the hall of fame
if (k < MAX_SCORE_ENTRIES - 1)
{
if (strEqual(setup.player_name, highscore[l].Name))
m = l;
- if (m == k) /* player's new highscore overwrites his old one */
+ if (m == k) // player's new highscore overwrites his old one
goto put_into_list;
}
else if (one_score_entry_per_name &&
!strncmp(setup.player_name, highscore[k].Name,
MAX_PLAYER_NAME_LEN))
- break; /* player already there with a higher score */
+ break; // player already there with a higher score
}
if (position >= 0)
int sign = (horiz_move ? dx : dy);
int step = sign * element_info[element].move_stepsize;
- /* special values for move stepsize for spring and things on conveyor belt */
+ // special values for move stepsize for spring and things on conveyor belt
if (horiz_move)
{
if (CAN_FALL(element) &&
int newy = y + dy;
boolean is_moving_before, is_moving_after;
- /* check if element was/is moving or being moved before/after mode change */
+ // check if element was/is moving or being moved before/after mode change
is_moving_before = (WasJustMoving[x][y] != 0);
is_moving_after = (getElementMoveStepsizeExt(x, y, direction) != 0);
direction == MV_DOWN && CAN_FALL(element) ?
ACTION_FALLING : ACTION_MOVING);
- /* this is needed for CEs with property "can move" / "not moving" */
+ // this is needed for CEs with property "can move" / "not moving"
if (is_moving_after)
{
static void CheckDynamite(int x, int y)
{
- if (MovDelay[x][y] != 0) /* dynamite is still waiting to explode */
+ if (MovDelay[x][y] != 0) // dynamite is still waiting to explode
{
MovDelay[x][y]--;
if (level.lazy_relocation && IN_VIS_FIELD(SCREENX(x), SCREENY(y)))
{
- /* case 1: quick relocation inside visible screen (without scrolling) */
+ // case 1: quick relocation inside visible screen (without scrolling)
RedrawPlayfield();
if (!level.shifted_relocation || center_screen)
{
- /* relocation _with_ centering of screen */
+ // relocation _with_ centering of screen
new_scroll_x = SCROLL_POSITION_X(x);
new_scroll_y = SCROLL_POSITION_Y(y);
}
else
{
- /* relocation _without_ centering of screen */
+ // relocation _without_ centering of screen
int center_scroll_x = SCROLL_POSITION_X(old_x);
int center_scroll_y = SCROLL_POSITION_Y(old_y);
int offset_x = x + (scroll_x - center_scroll_x);
int offset_y = y + (scroll_y - center_scroll_y);
- /* for new screen position, apply previous offset to center position */
+ // for new screen position, apply previous offset to center position
new_scroll_x = SCROLL_POSITION_X(offset_x);
new_scroll_y = SCROLL_POSITION_Y(offset_y);
}
if (quick_relocation)
{
- /* case 2: quick relocation (redraw without visible scrolling) */
+ // case 2: quick relocation (redraw without visible scrolling)
scroll_x = new_scroll_x;
scroll_y = new_scroll_y;
return;
}
- /* case 3: visible relocation (with scrolling to new position) */
+ // case 3: visible relocation (with scrolling to new position)
- ScrollScreen(NULL, SCROLL_GO_ON); /* scroll last frame to full tile */
+ ScrollScreen(NULL, SCROLL_GO_ON); // scroll last frame to full tile
SetVideoFrameDelay(wait_delay_value);
dx = (new_scroll_x < scroll_x ? +1 : new_scroll_x > scroll_x ? -1 : 0);
dy = (new_scroll_y < scroll_y ? +1 : new_scroll_y > scroll_y ? -1 : 0);
- if (dx == 0 && dy == 0) /* no scrolling needed at all */
+ if (dx == 0 && dy == 0) // no scrolling needed at all
break;
scroll_x -= dx;
ScrollLevel(dx, dy);
DrawAllPlayers();
- /* scroll in two steps of half tile size to make things smoother */
+ // scroll in two steps of half tile size to make things smoother
BlitBitmap(drawto_field, window, fx, fy, SXSIZE, SYSIZE, SX, SY);
- /* scroll second step to align at full tile size */
+ // scroll second step to align at full tile size
BlitScreenToBitmap(window);
}
int enter_side = enter_side_horiz | enter_side_vert;
int leave_side = leave_side_horiz | leave_side_vert;
- if (player->GameOver) /* do not reanimate dead player */
+ if (player->GameOver) // do not reanimate dead player
return;
- if (!player_relocated) /* no need to relocate the player */
+ if (!player_relocated) // no need to relocate the player
return;
- if (IS_PLAYER(jx, jy)) /* player already placed at new position */
+ if (IS_PLAYER(jx, jy)) // player already placed at new position
{
- RemoveField(jx, jy); /* temporarily remove newly placed player */
+ RemoveField(jx, jy); // temporarily remove newly placed player
DrawLevelField(jx, jy);
}
BackToFront_WithFrameDelay(wait_delay_value);
}
- DrawPlayer(player); /* needed here only to cleanup last field */
- DrawLevelField(player->jx, player->jy); /* remove player graphic */
+ DrawPlayer(player); // needed here only to cleanup last field
+ DrawLevelField(player->jx, player->jy); // remove player graphic
player->is_moving = FALSE;
}
possible that the relocation target field did not contain a player element,
but a walkable element, to which the new player was relocated -- in this
case, restore that (already initialized!) element on the player field */
- if (!ELEM_IS_PLAYER(element)) /* player may be set on walkable element */
+ if (!ELEM_IS_PLAYER(element)) // player may be set on walkable element
{
- Feld[jx][jy] = element; /* restore previously existing element */
+ Feld[jx][jy] = element; // restore previously existing element
}
- /* only visually relocate centered player */
+ // only visually relocate centered player
DrawRelocateScreen(old_jx, old_jy, player->jx, player->jy, player->MovDir,
FALSE, level.instant_relocation);
int last_phase;
int border_element;
- /* !!! eliminate this variable !!! */
+ // !!! eliminate this variable !!!
int delay = (game.emulation == EMU_SUPAPLEX ? 3 : 2);
if (game.explosions_delayed)
return;
}
- if (phase == EX_PHASE_START) /* initialize 'Store[][]' field */
+ if (phase == EX_PHASE_START) // initialize 'Store[][]' field
{
int center_element = Feld[ex][ey];
- int artwork_element, explosion_element; /* set these values later */
+ int artwork_element, explosion_element; // set these values later
- /* remove things displayed in background while burning dynamite */
+ // remove things displayed in background while burning dynamite
if (Back[ex][ey] != EL_EMPTY && !IS_INDESTRUCTIBLE(Back[ex][ey]))
Back[ex][ey] = 0;
if (IS_MOVING(ex, ey) || IS_BLOCKED(ex, ey))
{
- /* put moving element to center field (and let it explode there) */
+ // put moving element to center field (and let it explode there)
center_element = MovingOrBlocked2Element(ex, ey);
RemoveMovingField(ex, ey);
Feld[ex][ey] = center_element;
}
- /* now "center_element" is finally determined -- set related values now */
- artwork_element = center_element; /* for custom player artwork */
- explosion_element = center_element; /* for custom player artwork */
+ // now "center_element" is finally determined -- set related values now
+ artwork_element = center_element; // for custom player artwork
+ explosion_element = center_element; // for custom player artwork
if (IS_PLAYER(ex, ey))
{
RemoveMovingField(x, y);
}
- /* indestructible elements can only explode in center (but not flames) */
+ // indestructible elements can only explode in center (but not flames)
if ((IS_EXPLOSION_PROOF(element) && (x != ex || y != ey ||
mode == EX_TYPE_BORDER)) ||
element == EL_FLAMES)
/* no idea why this was changed from 3.0.8 to 3.1.0 -- this causes buggy
behaviour, for example when touching a yamyam that explodes to rocks
with active deadly shield, a rock is created under the player !!! */
- /* (case 1 (surely buggy): >= 3.1.0, case 2 (maybe buggy): <= 3.0.8) */
+ // (case 1 (surely buggy): >= 3.1.0, case 2 (maybe buggy): <= 3.0.8)
#if 0
if (IS_PLAYER(x, y) && SHIELD_ON(PLAYERINFO(x, y)) &&
(game.engine_version < VERSION_IDENT(3,1,0,0) ||
{
if (IS_ACTIVE_BOMB(element))
{
- /* re-activate things under the bomb like gate or penguin */
+ // re-activate things under the bomb like gate or penguin
Feld[x][y] = (Back[x][y] ? Back[x][y] : EL_EMPTY);
Back[x][y] = 0;
}
continue;
}
- /* save walkable background elements while explosion on same tile */
+ // save walkable background elements while explosion on same tile
if (IS_WALKABLE(element) && IS_INDESTRUCTIBLE(element) &&
(x != ex || y != ey || mode == EX_TYPE_BORDER))
Back[x][y] = element;
- /* ignite explodable elements reached by other explosion */
+ // ignite explodable elements reached by other explosion
if (element == EL_EXPLOSION)
element = Store2[x][y];
y = ey;
if (phase == 1)
- GfxFrame[x][y] = 0; /* restart explosion animation */
+ GfxFrame[x][y] = 0; // restart explosion animation
last_phase = ExplodeDelay[x][y];
ExplodePhase[x][y] = (phase < last_phase ? phase + 1 : 0);
- /* this can happen if the player leaves an explosion just in time */
+ // this can happen if the player leaves an explosion just in time
if (GfxElement[x][y] == EL_UNDEFINED)
GfxElement[x][y] = EL_EMPTY;
Store[x][y] = Store2[x][y] = 0;
GfxElement[x][y] = EL_UNDEFINED;
- /* player can escape from explosions and might therefore be still alive */
+ // player can escape from explosions and might therefore be still alive
if (element >= EL_PLAYER_IS_EXPLODING_1 &&
element <= EL_PLAYER_IS_EXPLODING_4)
{
element_info[explosion_element].content.e[xx][yy]);
}
- /* restore probably existing indestructible background element */
+ // restore probably existing indestructible background element
if (Back[x][y] && IS_INDESTRUCTIBLE(Back[x][y]))
element = Feld[x][y] = Back[x][y];
Back[x][y] = 0;
element = Feld[x][y];
- /* do not restart explosions of fields with active bombs */
+ // do not restart explosions of fields with active bombs
if (element == EL_EXPLOSION && IS_ACTIVE_BOMB(Store2[x][y]))
continue;
case EL_LAMP:
case EL_LAMP_ACTIVE:
case EL_AMOEBA_TO_DIAMOND:
- if (!IS_PLAYER(x, y)) /* penguin and player may be at same field */
+ if (!IS_PLAYER(x, y)) // penguin and player may be at same field
explosion_type = EX_TYPE_CENTER;
break;
int x, y, i, j;
- /* set frame order for belt animation graphic according to belt direction */
+ // set frame order for belt animation graphic according to belt direction
for (i = 0; i < NUM_BELTS; i++)
{
int belt_nr = i;
if (belt_dir_nr == 3)
belt_dir_nr = 1;
- /* set frame order for belt animation graphic according to belt direction */
+ // set frame order for belt animation graphic according to belt direction
for (i = 0; i < NUM_BELT_PARTS; i++)
{
int element = belt_base_active_element[belt_nr] + i;
TEST_DrawLevelField(x, y);
- /* uncrumble neighbour fields, if needed */
+ // uncrumble neighbour fields, if needed
if (element == EL_INVISIBLE_SAND)
TEST_DrawLevelFieldCrumbledNeighbours(x, y);
}
TEST_DrawLevelField(x, y);
- /* re-crumble neighbour fields, if needed */
+ // re-crumble neighbour fields, if needed
if (element == EL_INVISIBLE_SAND)
TEST_DrawLevelFieldCrumbledNeighbours(x, y);
}
TEST_DrawLevelField(x, y);
- /* uncrumble neighbour fields, if needed */
+ // uncrumble neighbour fields, if needed
if (element == EL_INVISIBLE_SAND)
TEST_DrawLevelFieldCrumbledNeighbours(x, y);
}
TEST_DrawLevelField(x, y);
- /* re-crumble neighbour fields, if needed */
+ // re-crumble neighbour fields, if needed
if (element == EL_INVISIBLE_SAND)
TEST_DrawLevelFieldCrumbledNeighbours(x, y);
}
int element = Feld[x][y];
int smashed = EL_STEELWALL;
- if (!last_line) /* check if element below was hit */
+ if (!last_line) // check if element below was hit
{
if (Feld[x][y + 1] == EL_PLAYER_IS_LEAVING)
return;
MovDir[x][y + 1] != MV_DOWN ||
MovPos[x][y + 1] <= TILEY / 2));
- /* do not smash moving elements that left the smashed field in time */
+ // do not smash moving elements that left the smashed field in time
if (game.engine_version >= VERSION_IDENT(2,2,0,7) && IS_MOVING(x, y + 1) &&
ABS(MovPos[x][y + 1] + getElementMoveStepsize(x, y + 1)) >= TILEX)
object_hit = FALSE;
impact = (last_line || object_hit);
}
- if (!last_line && smashed == EL_ACID) /* element falls into acid */
+ if (!last_line && smashed == EL_ACID) // element falls into acid
{
SplashAcid(x, y + 1);
return;
}
- /* !!! not sufficient for all cases -- see EL_PEARL below !!! */
- /* only reset graphic animation if graphic really changes after impact */
+ // !!! not sufficient for all cases -- see EL_PEARL below !!!
+ // only reset graphic animation if graphic really changes after impact
if (impact &&
el_act_dir2img(element, GfxAction[x][y], MV_DOWN) != el2img(element))
{
return;
}
- if (object_hit) /* check which object was hit */
+ if (object_hit) // check which object was hit
{
if ((CAN_PASS_MAGIC_WALL(element) &&
(smashed == EL_MAGIC_WALL ||
smashed == EL_BD_MAGIC_WALL ? EL_BD_MAGIC_WALL_ACTIVE :
EL_DC_MAGIC_WALL_ACTIVE);
- /* activate magic wall / mill */
+ // activate magic wall / mill
SCAN_PLAYFIELD(xx, yy)
{
if (Feld[xx][yy] == smashed)
}
}
- /* play sound of magic wall / mill */
+ // play sound of magic wall / mill
if (!last_line &&
(Feld[x][y + 1] == EL_MAGIC_WALL_ACTIVE ||
Feld[x][y + 1] == EL_BD_MAGIC_WALL_ACTIVE ||
return;
}
- /* play sound of object that hits the ground */
+ // play sound of object that hits the ground
if (last_line || object_hit)
PlayLevelSoundElementAction(x, y, element, ACTION_IMPACT);
}
if (element == EL_BUG && MovDir[x][y] != old_move_dir)
MovDelay[x][y] = 9;
- else if (element == EL_BD_BUTTERFLY) /* && MovDir[x][y] == left_dir) */
+ else if (element == EL_BD_BUTTERFLY) // && MovDir[x][y] == left_dir)
MovDelay[x][y] = 1;
}
else if (element == EL_SPACESHIP || element == EL_BD_FIREFLY)
if (element == EL_SPACESHIP && MovDir[x][y] != old_move_dir)
MovDelay[x][y] = 9;
- else if (element == EL_BD_FIREFLY) /* && MovDir[x][y] == right_dir) */
+ else if (element == EL_BD_FIREFLY) // && MovDir[x][y] == right_dir)
MovDelay[x][y] = 1;
}
else if (element == EL_SP_SNIKSNAK || element == EL_SP_ELECTRON)
{
static int check_pos[16] =
{
- -1, /* 0 => (invalid) */
- 7, /* 1 => MV_LEFT */
- 3, /* 2 => MV_RIGHT */
- -1, /* 3 => (invalid) */
- 1, /* 4 => MV_UP */
- 0, /* 5 => MV_LEFT | MV_UP */
- 2, /* 6 => MV_RIGHT | MV_UP */
- -1, /* 7 => (invalid) */
- 5, /* 8 => MV_DOWN */
- 6, /* 9 => MV_LEFT | MV_DOWN */
- 4, /* 10 => MV_RIGHT | MV_DOWN */
- -1, /* 11 => (invalid) */
- -1, /* 12 => (invalid) */
- -1, /* 13 => (invalid) */
- -1, /* 14 => (invalid) */
- -1, /* 15 => (invalid) */
+ -1, // 0 => (invalid)
+ 7, // 1 => MV_LEFT
+ 3, // 2 => MV_RIGHT
+ -1, // 3 => (invalid)
+ 1, // 4 => MV_UP
+ 0, // 5 => MV_LEFT | MV_UP
+ 2, // 6 => MV_RIGHT | MV_UP
+ -1, // 7 => (invalid)
+ 5, // 8 => MV_DOWN
+ 6, // 9 => MV_LEFT | MV_DOWN
+ 4, // 10 => MV_RIGHT | MV_DOWN
+ -1, // 11 => (invalid)
+ -1, // 12 => (invalid)
+ -1, // 13 => (invalid)
+ -1, // 14 => (invalid)
+ -1, // 15 => (invalid)
};
static struct
{
boolean can_clone = FALSE;
int i;
- /* check if there is any free field around current position */
+ // check if there is any free field around current position
for (i = 0; i < 8; i++)
{
int newx = x + check_xy[i].dx;
}
}
- if (can_clone) /* randomly find an element to clone */
+ if (can_clone) // randomly find an element to clone
{
can_clone = FALSE;
}
}
- if (can_clone) /* randomly find a direction to move */
+ if (can_clone) // randomly find a direction to move
{
can_clone = FALSE;
}
}
- if (can_clone) /* cloning and moving successful */
+ if (can_clone) // cloning and moving successful
return;
- /* cannot clone -- try to move towards player */
+ // cannot clone -- try to move towards player
start_pos = check_pos[MovDir[x][y] & 0x0f];
check_order = (RND(2) ? -1 : +1);
for (i = 0; i < 3; i++)
{
- /* first check start_pos, then previous/next or (next/previous) pos */
+ // first check start_pos, then previous/next or (next/previous) pos
int pos_raw = start_pos + (i < 2 ? i : -1) * check_order;
int pos = (pos_raw + 8) % 8;
int newx = x + check_xy[pos].dx;
boolean can_turn_right =
CUSTOM_ELEMENT_CAN_ENTER_FIELD(element, right_x,right_y);
- if (element_info[element].move_stepsize == 0) /* "not moving" */
+ if (element_info[element].move_stepsize == 0) // "not moving"
return;
if (move_pattern == MV_TURNING_LEFT)
boolean first_horiz = RND(2);
int new_move_dir = MovDir[x][y];
- if (element_info[element].move_stepsize == 0) /* "not moving" */
+ if (element_info[element].move_stepsize == 0) // "not moving"
{
first_horiz = (ABS(attr_x - x) >= ABS(attr_y - y));
MovDir[x][y] &= (first_horiz ? MV_HORIZONTAL : MV_VERTICAL);
MV_RIGHT,
};
boolean hunter_mode = (move_pattern == MV_MAZE_HUNTER);
- int move_preference = -1000000; /* start with very low preference */
+ int move_preference = -1000000; // start with very low preference
int new_move_dir = MV_NONE;
int start_test = RND(4);
int i;
if (move_dir_preference > move_preference)
{
- /* prefer field that has not been visited for the longest time */
+ // prefer field that has not been visited for the longest time
move_preference = move_dir_preference;
new_move_dir = move_dir;
}
else if (move_dir_preference == move_preference &&
move_dir == old_move_dir)
{
- /* prefer last direction when all directions are preferred equally */
+ // prefer last direction when all directions are preferred equally
move_preference = move_dir_preference;
new_move_dir = move_dir;
}
static void StartMoving(int x, int y)
{
- boolean started_moving = FALSE; /* some elements can fall _and_ move */
+ boolean started_moving = FALSE; // some elements can fall _and_ move
int element = Feld[x][y];
if (Stop[x][y])
}
else if (IS_FREE(x, y + 1) || Feld[x][y + 1] == EL_DIAMOND_BREAKING)
{
- if (WasJustFalling[x][y]) /* prevent animation from being restarted */
+ if (WasJustFalling[x][y]) // prevent animation from being restarted
MovDir[x][y] = MV_DOWN;
InitMovingField(x, y, MV_DOWN);
if (can_fall_both)
{
if (element == EL_BD_ROCK || element == EL_BD_DIAMOND)
- can_fall_right = FALSE; /* slip down on left side */
+ can_fall_right = FALSE; // slip down on left side
else
can_fall_left = !(can_fall_right = RND(2));
if (can_fall_any)
{
- /* if not determined otherwise, prefer left side for slipping down */
+ // if not determined otherwise, prefer left side for slipping down
InitMovingField(x, y, can_fall_left ? MV_LEFT : MV_RIGHT);
started_moving = TRUE;
}
}
else
{
- MovDir[x][y] = 0; /* if element was moving, stop it */
+ MovDir[x][y] = 0; // if element was moving, stop it
}
}
}
- /* not "else if" because of elements that can fall and move (EL_SPRING) */
+ // not "else if" because of elements that can fall and move (EL_SPRING)
if (CAN_MOVE(element) && !started_moving)
{
int move_pattern = element_info[element].move_pattern;
TestIfElementHitsCustomElement(x, y, MovDir[x][y]);
- if (Feld[x][y] != element) /* element has changed */
+ if (Feld[x][y] != element) // element has changed
return;
}
- if (!MovDelay[x][y]) /* start new movement phase */
+ if (!MovDelay[x][y]) // start new movement phase
{
/* all objects that can change their move direction after each step
(YAMYAM, DARK_YAMYAM and PACMAN go straight until they hit a wall */
}
}
- if (MovDelay[x][y]) /* wait some time before next movement */
+ if (MovDelay[x][y]) // wait some time before next movement
{
MovDelay[x][y]--;
}
}
- if (MovDelay[x][y]) /* element still has to wait some time */
+ if (MovDelay[x][y]) // element still has to wait some time
{
PlayLevelSoundAction(x, y, ACTION_WAITING);
}
}
- /* now make next step */
+ // now make next step
- Moving2Blocked(x, y, &newx, &newy); /* get next screen position */
+ Moving2Blocked(x, y, &newx, &newy); // get next screen position
if (DONT_COLLIDE_WITH(element) &&
IN_LEV_FIELD(newx, newy) && IS_PLAYER(newx, newy) &&
boolean can_clone = FALSE;
int xx, yy;
- /* check if element to clone is still there */
+ // check if element to clone is still there
for (yy = y - 1; yy <= y + 1; yy++) for (xx = x - 1; xx <= x + 1; xx++)
{
if (IN_LEV_FIELD(xx, yy) && Feld[xx][yy] == Store[x][y])
}
}
- /* cannot clone or target field not free anymore -- do not clone */
+ // cannot clone or target field not free anymore -- do not clone
if (!can_clone || !ANDROID_CAN_ENTER_FIELD(element, newx, newy))
Store[x][y] = EL_EMPTY;
}
int change_delay = 8;
int graphic;
- /* android is moving diagonally */
+ // android is moving diagonally
CreateField(x, y, EL_DIAGONAL_SHRINKING);
if (move_pattern & MV_MAZE_RUNNER_STYLE)
{
RunnerVisit[x][y] = FrameCounter;
- PlayerVisit[x][y] /= 8; /* expire player visit path */
+ PlayerVisit[x][y] /= 8; // expire player visit path
}
}
else if (element == EL_DRAGON && IN_LEV_FIELD(newx, newy))
GfxAction[x][y] = ACTION_DIGGING;
TEST_DrawLevelField(x, y);
- MovDelay[newx][newy] = 0; /* start amoeba shrinking delay */
+ MovDelay[newx][newy] = 0; // start amoeba shrinking delay
- return; /* wait for shrinking amoeba */
+ return; // wait for shrinking amoeba
}
- else /* element == EL_PACMAN */
+ else // element == EL_PACMAN
{
Feld[newx][newy] = EL_EMPTY;
TEST_DrawLevelField(newx, newy);
(Feld[newx][newy] == EL_AMOEBA_SHRINKING ||
(Feld[newx][newy] == EL_EMPTY && Stop[newx][newy])))
{
- /* wait for shrinking amoeba to completely disappear */
+ // wait for shrinking amoeba to completely disappear
return;
}
else if (!IN_LEV_FIELD(newx, newy) || !IS_FREE(newx, newy))
{
- /* object was running against a wall */
+ // object was running against a wall
TurnRound(x, y);
- if (GFX_ELEMENT(element) != EL_SAND) /* !!! FIX THIS (crumble) !!! */
+ if (GFX_ELEMENT(element) != EL_SAND) // !!! FIX THIS (crumble) !!!
DrawLevelElementAnimation(x, y, element);
if (DONT_TOUCH(element))
MovPos[x][y] += getElementMoveStepsize(x, y);
- if (pushed_by_player) /* special case: moving object pushed by player */
+ if (pushed_by_player) // special case: moving object pushed by player
MovPos[x][y] = SIGN(MovPos[x][y]) * (TILEX - ABS(PLAYERINFO(x,y)->MovPos));
if (ABS(MovPos[x][y]) < TILEX)
{
TEST_DrawLevelField(x, y);
- return; /* element is still moving */
+ return; // element is still moving
}
- /* element reached destination field */
+ // element reached destination field
Feld[x][y] = EL_EMPTY;
Feld[newx][newy] = element;
- MovPos[x][y] = 0; /* force "not moving" for "crumbled sand" */
+ MovPos[x][y] = 0; // force "not moving" for "crumbled sand"
- if (Store[x][y] == EL_ACID) /* element is moving into acid pool */
+ if (Store[x][y] == EL_ACID) // element is moving into acid pool
{
element = Feld[newx][newy] = EL_ACID;
}
if (CAN_CHANGE_OR_HAS_ACTION(element))
{
- /* copy element change control values to new field */
+ // copy element change control values to new field
ChangeDelay[newx][newy] = ChangeDelay[x][y];
ChangePage[newx][newy] = ChangePage[x][y];
ChangeCount[newx][newy] = ChangeCount[x][y];
CustomValue[x][y] = 0;
- /* copy animation control values to new field */
+ // copy animation control values to new field
GfxFrame[newx][newy] = GfxFrame[x][y];
- GfxRandom[newx][newy] = GfxRandom[x][y]; /* keep same random value */
- GfxAction[newx][newy] = GfxAction[x][y]; /* keep action one frame */
- GfxDir[newx][newy] = GfxDir[x][y]; /* keep element direction */
+ GfxRandom[newx][newy] = GfxRandom[x][y]; // keep same random value
+ GfxAction[newx][newy] = GfxAction[x][y]; // keep action one frame
+ GfxDir[newx][newy] = GfxDir[x][y]; // keep element direction
Pushed[x][y] = Pushed[newx][newy] = FALSE;
- /* some elements can leave other elements behind after moving */
+ // some elements can leave other elements behind after moving
if (ei->move_leave_element != EL_EMPTY &&
(ei->move_leave_type == LEAVE_TYPE_UNLIMITED || stored != EL_EMPTY) &&
(!IS_PLAYER(x, y) || IS_WALKABLE(ei->move_leave_element)))
{
int move_leave_element = ei->move_leave_element;
- /* this makes it possible to leave the removed element again */
+ // this makes it possible to leave the removed element again
if (ei->move_leave_element == EL_TRIGGER_ELEMENT)
move_leave_element = (stored == EL_ACID ? EL_EMPTY : stored);
RelocatePlayer(x, y, move_leave_element);
}
- /* do this after checking for left-behind element */
- ResetGfxAnimation(x, y); /* reset animation values for old field */
+ // do this after checking for left-behind element
+ ResetGfxAnimation(x, y); // reset animation values for old field
if (!CAN_MOVE(element) ||
(CAN_FALL(element) && direction == MV_DOWN &&
TEST_DrawLevelField(x, y);
TEST_DrawLevelField(newx, newy);
- Stop[newx][newy] = TRUE; /* ignore this element until the next frame */
+ Stop[newx][newy] = TRUE; // ignore this element until the next frame
- /* prevent pushed element from moving on in pushed direction */
+ // prevent pushed element from moving on in pushed direction
if (pushed_by_player && CAN_MOVE(element) &&
element_info[element].move_pattern & MV_ANY_DIRECTION &&
!(element_info[element].move_pattern & direction))
TurnRound(newx, newy);
- /* prevent elements on conveyor belt from moving on in last direction */
+ // prevent elements on conveyor belt from moving on in last direction
if (pushed_by_conveyor && CAN_FALL(element) &&
direction & MV_HORIZONTAL)
MovDir[newx][newy] = 0;
CheckImpact[newx][newy] = CHECK_DELAY_IMPACT;
}
- if (DONT_TOUCH(element)) /* object may be nasty to player or others */
+ if (DONT_TOUCH(element)) // object may be nasty to player or others
{
TestIfBadThingTouchesPlayer(newx, newy);
TestIfBadThingTouchesFriend(newx, newy);
TestIfGoodThingGetsHitByBadThing(newx, newy, direction);
}
- /* give the player one last chance (one more frame) to move away */
+ // give the player one last chance (one more frame) to move away
if (CAN_FALL(element) && direction == MV_DOWN &&
(last_line || (!IS_FREE(x, newy + 1) &&
(!IS_PLAYER(x, newy + 1) ||
player->index_bit, push_side);
}
- if (element == EL_EMC_ANDROID && pushed_by_player) /* make another move */
+ if (element == EL_EMC_ANDROID && pushed_by_player) // make another move
MovDelay[newx][newy] = 1;
CheckTriggeredElementChangeBySide(x, y, element, CE_MOVE_OF_X, direction);
- TestIfElementTouchesCustomElement(x, y); /* empty or new element */
+ TestIfElementTouchesCustomElement(x, y); // empty or new element
TestIfElementHitsCustomElement(newx, newy, direction);
TestIfPlayerTouchesCustomElement(newx, newy);
TestIfElementTouchesCustomElement(newx, newy);
static unsigned int sound_delay = 0;
static unsigned int sound_delay_value = 0;
- if (!MovDelay[x][y]) /* start new growing cycle */
+ if (!MovDelay[x][y]) // start new growing cycle
{
MovDelay[x][y] = 7;
}
}
- if (MovDelay[x][y]) /* wait some time before growing bigger */
+ if (MovDelay[x][y]) // wait some time before growing bigger
{
MovDelay[x][y]--;
if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
static unsigned int sound_delay = 0;
static unsigned int sound_delay_value = 0;
- if (!MovDelay[x][y]) /* start new shrinking cycle */
+ if (!MovDelay[x][y]) // start new shrinking cycle
{
MovDelay[x][y] = 7;
sound_delay_value = 30;
}
- if (MovDelay[x][y]) /* wait some time before shrinking */
+ if (MovDelay[x][y]) // wait some time before shrinking
{
MovDelay[x][y]--;
if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
if (IS_ANIMATED(graphic))
DrawLevelGraphicAnimationIfNeeded(ax, ay, graphic);
- if (!MovDelay[ax][ay]) /* start making new amoeba field */
+ if (!MovDelay[ax][ay]) // start making new amoeba field
MovDelay[ax][ay] = RND(FRAMES_PER_SECOND * 25 / (1 + level.amoeba_speed));
- if (MovDelay[ax][ay]) /* wait some time before making new amoeba */
+ if (MovDelay[ax][ay]) // wait some time before making new amoeba
{
MovDelay[ax][ay]--;
if (MovDelay[ax][ay])
return;
}
- if (can_drop) /* EL_AMOEBA_WET or EL_EMC_DRIPPER */
+ if (can_drop) // EL_AMOEBA_WET or EL_EMC_DRIPPER
{
int start = RND(4);
int x = ax + xy[start][0];
if (newax == ax && neway == ay)
return;
}
- else /* normal or "filled" (BD style) amoeba */
+ else // normal or "filled" (BD style) amoeba
{
int start = RND(4);
boolean waiting_for_player = FALSE;
waiting_for_player = TRUE;
}
- if (newax == ax && neway == ay) /* amoeba cannot grow */
+ if (newax == ax && neway == ay) // amoeba cannot grow
{
if (i == 4 && (!waiting_for_player || element == EL_BD_AMOEBA))
{
TEST_DrawLevelField(ax, ay);
AmoebaCnt[AmoebaNr[ax][ay]]--;
- if (AmoebaCnt[AmoebaNr[ax][ay]] <= 0) /* amoeba is completely dead */
+ if (AmoebaCnt[AmoebaNr[ax][ay]] <= 0) // amoeba is completely dead
{
if (element == EL_AMOEBA_FULL)
AmoebeUmwandeln(ax, ay);
}
else if (element == EL_AMOEBA_FULL || element == EL_BD_AMOEBA)
{
- /* amoeba gets larger by growing in some direction */
+ // amoeba gets larger by growing in some direction
int new_group_nr = AmoebaNr[ax][ay];
AmoebaCnt[new_group_nr]++;
AmoebaCnt2[new_group_nr]++;
- /* if amoeba touches other amoeba(s) after growing, unify them */
+ // if amoeba touches other amoeba(s) after growing, unify them
AmoebenVereinigen(newax, neway);
if (element == EL_BD_AMOEBA && AmoebaCnt2[new_group_nr] >= 200)
if (!can_drop || neway < ay || !IS_FREE(newax, neway) ||
(neway == lev_fieldy - 1 && newax != ax))
{
- Feld[newax][neway] = EL_AMOEBA_GROWING; /* creation of new amoeba */
+ Feld[newax][neway] = EL_AMOEBA_GROWING; // creation of new amoeba
Store[newax][neway] = element;
}
else if (neway == ay || element == EL_EMC_DRIPPER)
{
- Feld[newax][neway] = EL_AMOEBA_DROP; /* drop left/right of amoeba */
+ Feld[newax][neway] = EL_AMOEBA_DROP; // drop left/right of amoeba
PlayLevelSoundAction(newax, neway, ACTION_GROWING);
}
else
{
- InitMovingField(ax, ay, MV_DOWN); /* drop dripping from amoeba */
+ InitMovingField(ax, ay, MV_DOWN); // drop dripping from amoeba
Feld[ax][ay] = EL_AMOEBA_DROPPING;
Store[ax][ay] = EL_AMOEBA_DROP;
ContinueMoving(ax, ay);
if (Stop[ax][ay])
return;
- if (!MovDelay[ax][ay]) /* start new "game of life" cycle */
+ if (!MovDelay[ax][ay]) // start new "game of life" cycle
MovDelay[ax][ay] = life_time;
- if (MovDelay[ax][ay]) /* wait some time before next cycle */
+ if (MovDelay[ax][ay]) // wait some time before next cycle
{
MovDelay[ax][ay]--;
if (MovDelay[ax][ay])
else
is_free = (IS_FREE(xx, yy) && Last[xx][yy] == EL_EMPTY);
- if (xx == ax && yy == ay) /* field in the middle */
+ if (xx == ax && yy == ay) // field in the middle
{
if (num_neighbours < life_parameter[0] ||
num_neighbours > life_parameter[1])
}
}
else if (is_free || CAN_GROW_INTO(Feld[xx][yy]))
- { /* free border field */
+ { // free border field
if (num_neighbours >= life_parameter[2] &&
num_neighbours <= life_parameter[3])
{
if (level.ball_random)
{
- int pos_border = RND(8); /* select one of the eight border elements */
+ int pos_border = RND(8); // select one of the eight border elements
int pos_content = (pos_border > 3 ? pos_border + 1 : pos_border);
int xx = pos_content % 3;
int yy = pos_content / 3;
return;
}
- if (AllPlayersGone) /* do not re-open exit door closed after last player */
+ if (AllPlayersGone) // do not re-open exit door closed after last player
return;
Feld[x][y] = EL_EXIT_OPENING;
return;
}
- if (AllPlayersGone) /* do not re-open exit door closed after last player */
+ if (AllPlayersGone) // do not re-open exit door closed after last player
return;
Feld[x][y] = EL_EM_EXIT_OPENING;
return;
}
- if (AllPlayersGone) /* do not re-open exit door closed after last player */
+ if (AllPlayersGone) // do not re-open exit door closed after last player
return;
Feld[x][y] = EL_STEEL_EXIT_OPENING;
return;
}
- if (AllPlayersGone) /* do not re-open exit door closed after last player */
+ if (AllPlayersGone) // do not re-open exit door closed after last player
return;
Feld[x][y] = EL_EM_STEEL_EXIT_OPENING;
return;
}
- if (AllPlayersGone) /* do not re-open exit door closed after last player */
+ if (AllPlayersGone) // do not re-open exit door closed after last player
return;
Feld[x][y] = EL_SP_EXIT_OPENING;
if (Feld[x][y] == EL_BD_DIAMOND)
return;
- if (MovDelay[x][y] == 0) /* next animation frame */
+ if (MovDelay[x][y] == 0) // next animation frame
MovDelay[x][y] = 11 * !GetSimpleRandom(500);
- if (MovDelay[x][y] != 0) /* wait some time before next frame */
+ if (MovDelay[x][y] != 0) // wait some time before next frame
{
MovDelay[x][y]--;
{
int delay = 6;
- if (!MovDelay[x][y]) /* next animation frame */
+ if (!MovDelay[x][y]) // next animation frame
MovDelay[x][y] = 3 * delay;
- if (MovDelay[x][y]) /* wait some time before next frame */
+ if (MovDelay[x][y]) // wait some time before next frame
{
MovDelay[x][y]--;
if (IS_ANIMATED(graphic))
DrawLevelGraphicAnimationIfNeeded(ax, ay, graphic);
- if (!MovDelay[ax][ay]) /* start building new wall */
+ if (!MovDelay[ax][ay]) // start building new wall
MovDelay[ax][ay] = 6;
- if (MovDelay[ax][ay]) /* wait some time before building new wall */
+ if (MovDelay[ax][ay]) // wait some time before building new wall
{
MovDelay[ax][ay]--;
if (MovDelay[ax][ay])
if (IS_ANIMATED(graphic))
DrawLevelGraphicAnimationIfNeeded(ax, ay, graphic);
- if (!MovDelay[ax][ay]) /* start building new wall */
+ if (!MovDelay[ax][ay]) // start building new wall
MovDelay[ax][ay] = 6;
- if (MovDelay[ax][ay]) /* wait some time before building new wall */
+ if (MovDelay[ax][ay]) // wait some time before building new wall
{
MovDelay[ax][ay]--;
if (MovDelay[ax][ay])
{
int graphic = IMG_TRAP_ACTIVE;
- /* if new animation frame was drawn, correct crumbled sand border */
+ // if new animation frame was drawn, correct crumbled sand border
if (IS_NEW_FRAME(GfxFrame[x][y], graphic))
TEST_DrawLevelFieldCrumbled(x, y);
}
if (!change->has_action)
return;
- /* ---------- determine action paramater values -------------------------- */
+ // ---------- determine action paramater values -----------------------------
int level_time_value =
(level.time > 0 ? TimeLeft :
action_arg == CA_ARG_PLAYER_ACTION ? 1 << GET_PLAYER_NR(action_element) :
PLAYER_BITS_ANY);
- /* ---------- execute action -------------------------------------------- */
+ // ---------- execute action -----------------------------------------------
switch (action_type)
{
return;
}
- /* ---------- level actions ------------------------------------------- */
+ // ---------- level actions ----------------------------------------------
case CA_RESTART_LEVEL:
{
case CA_SET_LEVEL_TIME:
{
- if (level.time > 0) /* only modify limited time value */
+ if (level.time > 0) // only modify limited time value
{
TimeLeft = action_arg_number_new;
case CA_SET_LEVEL_RANDOM_SEED:
{
- /* ensure that setting a new random seed while playing is predictable */
+ // ensure that setting a new random seed while playing is predictable
InitRND(action_arg_number_new ? action_arg_number_new : RND(1000000) + 1);
break;
}
- /* ---------- player actions ------------------------------------------ */
+ // ---------- player actions ---------------------------------------------
case CA_MOVE_PLAYER:
{
- /* automatically move to the next field in specified direction */
+ // automatically move to the next field in specified direction
for (i = 0; i < MAX_PLAYERS; i++)
if (trigger_player_bits & (1 << i))
stored_player[i].programmed_action = action_arg_direction;
SetPlayerWaiting(&stored_player[i], FALSE);
- /* set number of special actions for bored and sleeping animation */
+ // set number of special actions for bored and sleeping animation
stored_player[i].num_special_action_bored =
get_num_special_action(artwork_element,
ACTION_BORING_1, ACTION_BORING_LAST);
break;
}
- /* ---------- CE actions ---------------------------------------------- */
+ // ---------- CE actions -------------------------------------------------
case CA_SET_CE_VALUE:
{
break;
}
- /* ---------- engine actions ------------------------------------------ */
+ // ---------- engine actions ---------------------------------------------
case CA_SET_ENGINE_SCAN_MODE:
{
InitField_WithBug1(x, y, FALSE);
- new_element = Feld[x][y]; /* element may have changed */
+ new_element = Feld[x][y]; // element may have changed
ResetGfxAnimation(x, y);
ResetRandomAnimationValue(x, y);
/* check if element under the player changes from accessible to unaccessible
(needed for special case of dropping element which then changes) */
- /* (must be checked after creating new element for walkable group elements) */
+ // (must be checked after creating new element for walkable group elements)
if (IS_PLAYER(x, y) && !player_explosion_protected &&
IS_ACCESSIBLE(old_element) && !IS_ACCESSIBLE(new_element))
{
return;
}
- /* "ChangeCount" not set yet to allow "entered by player" change one time */
+ // "ChangeCount" not set yet to allow "entered by player" change one time
if (new_element_is_player)
RelocatePlayer(x, y, new_element);
if (is_change)
- ChangeCount[x][y]++; /* count number of changes in the same frame */
+ ChangeCount[x][y]++; // count number of changes in the same frame
TestIfBadThingTouchesPlayer(x, y);
TestIfPlayerTouchesCustomElement(x, y);
int target_element;
int old_element = Feld[x][y];
- /* always use default change event to prevent running into a loop */
+ // always use default change event to prevent running into a loop
if (ChangeEvent[x][y] == -1)
ChangeEvent[x][y] = CE_DELAY;
if (ChangeEvent[x][y] == CE_DELAY)
{
- /* reset actual trigger element, trigger player and action element */
+ // reset actual trigger element, trigger player and action element
change->actual_trigger_element = EL_EMPTY;
change->actual_trigger_player = EL_EMPTY;
change->actual_trigger_player_bits = CH_PLAYER_NONE;
change->actual_trigger_ce_score = 0;
}
- /* do not change elements more than a specified maximum number of changes */
+ // do not change elements more than a specified maximum number of changes
if (ChangeCount[x][y] >= game.max_num_changes_per_frame)
return FALSE;
- ChangeCount[x][y]++; /* count number of changes in the same frame */
+ ChangeCount[x][y]++; // count number of changes in the same frame
if (change->explode)
{
can_replace[xx][yy] = TRUE;
- if (ex == x && ey == y) /* do not check changing element itself */
+ if (ex == x && ey == y) // do not check changing element itself
continue;
if (content_element == EL_EMPTY_SPACE)
{
- can_replace[xx][yy] = FALSE; /* do not replace border with space */
+ can_replace[xx][yy] = FALSE; // do not replace border with space
continue;
}
something_has_changed = TRUE;
- /* for symmetry reasons, freeze newly created border elements */
+ // for symmetry reasons, freeze newly created border elements
if (ex != x || ey != y)
- Stop[ex][ey] = TRUE; /* no more moving in this frame */
+ Stop[ex][ey] = TRUE; // no more moving in this frame
}
}
PlayLevelSoundElementAction(x, y, element, ACTION_PAGE_1 + page);
}
- /* this uses direct change before indirect change */
+ // this uses direct change before indirect change
CheckTriggeredElementChangeByPage(x, y, old_element, CE_CHANGE_OF_X, page);
return TRUE;
}
#endif
- /* this can happen with classic bombs on walkable, changing elements */
+ // this can happen with classic bombs on walkable, changing elements
if (!CAN_CHANGE_OR_HAS_ACTION(element))
{
return;
}
- if (ChangeDelay[x][y] == 0) /* initialize element change */
+ if (ChangeDelay[x][y] == 0) // initialize element change
{
ChangeDelay[x][y] = GET_CHANGE_DELAY(change) + 1;
if (change->can_change)
{
- /* !!! not clear why graphic animation should be reset at all here !!! */
- /* !!! UPDATE: but is needed for correct Snake Bite tail animation !!! */
- /* !!! SOLUTION: do not reset if graphics engine set to 4 or above !!! */
+ // !!! not clear why graphic animation should be reset at all here !!!
+ // !!! UPDATE: but is needed for correct Snake Bite tail animation !!!
+ // !!! SOLUTION: do not reset if graphics engine set to 4 or above !!!
/*
GRAPHICAL BUG ADDRESSED BY CHECKING GRAPHICS ENGINE VERSION:
ChangeDelay[x][y]--;
- if (ChangeDelay[x][y] != 0) /* continue element change */
+ if (ChangeDelay[x][y] != 0) // continue element change
{
if (change->can_change)
{
change->change_function(x, y);
}
}
- else /* finish element change */
+ else // finish element change
{
- if (ChangePage[x][y] != -1) /* remember page from delayed change */
+ if (ChangePage[x][y] != -1) // remember page from delayed change
{
page = ChangePage[x][y];
ChangePage[x][y] = -1;
change = &ei->change_page[page];
}
- if (IS_MOVING(x, y)) /* never change a running system ;-) */
+ if (IS_MOVING(x, y)) // never change a running system ;-)
{
- ChangeDelay[x][y] = 1; /* try change after next move step */
- ChangePage[x][y] = page; /* remember page to use for change */
+ ChangeDelay[x][y] = 1; // try change after next move step
+ ChangePage[x][y] = page; // remember page to use for change
return;
}
- /* special case: set new level random seed before changing element */
+ // special case: set new level random seed before changing element
if (change->has_action && change->action_type == CA_SET_LEVEL_RANDOM_SEED)
handle_action_before_change = TRUE;
element = Feld[x][y];
}
- /* check if element has already changed or is about to change after moving */
+ // check if element has already changed or is about to change after moving
if ((game.engine_version < VERSION_IDENT(3,2,0,7) &&
Feld[x][y] != element) ||
(trigger_event == CE_TOUCHING_X ||
trigger_event == CE_HITTING_X ||
trigger_event == CE_HIT_BY_X ||
- trigger_event == CE_DIGGING_X); /* this one was forgotten until 3.2.3 */
+ trigger_event == CE_DIGGING_X); // this one was forgotten until 3.2.3
if (change->can_change_or_has_action &&
change->has_event[trigger_event] &&
change->actual_trigger_ce_value = CustomValue[x][y];
change->actual_trigger_ce_score = GET_CE_SCORE(trigger_element);
- /* special case: trigger element not at (x,y) position for some events */
+ // special case: trigger element not at (x,y) position for some events
if (check_trigger_element)
{
static struct
if (is_waiting)
{
- if (!last_waiting) /* not waiting -> waiting */
+ if (!last_waiting) // not waiting -> waiting
{
player->is_waiting = TRUE;
if (player->is_sleeping && player->use_murphy)
{
- /* special case for sleeping Murphy when leaning against non-free tile */
+ // special case for sleeping Murphy when leaning against non-free tile
if (!IN_LEV_FIELD(player->jx - 1, player->jy) ||
(Feld[player->jx - 1][player->jy] != EL_EMPTY &&
}
}
}
- else if (last_waiting) /* waiting -> not waiting */
+ else if (last_waiting) // waiting -> not waiting
{
player->is_waiting = FALSE;
player->is_bored = FALSE;
!player->is_dropping_pressed)
{
TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
- SnapField(player, 0, 0); /* stop snapping */
+ SnapField(player, 0, 0); // stop snapping
}
}
}
else
{
- /* no actions for this player (no input at player's configured device) */
+ // no actions for this player (no input at player's configured device)
DigField(player, 0, 0, 0, 0, 0, 0, DF_NO_PUSH);
SnapField(player, 0, 0);
if (player->MovPos == 0)
SetPlayerWaiting(player, TRUE);
- if (player->MovPos == 0) /* needed for tape.playing */
+ if (player->MovPos == 0) // needed for tape.playing
player->is_moving = FALSE;
player->is_dropping = FALSE;
{
if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
{
- if (level.native_em_level->lev->home == 0) /* all players at home */
+ if (level.native_em_level->lev->home == 0) // all players at home
{
PlayerWins(local_player);
if (level.native_em_level->ply[0]->alive == 0 &&
level.native_em_level->ply[1]->alive == 0 &&
level.native_em_level->ply[2]->alive == 0 &&
- level.native_em_level->ply[3]->alive == 0) /* all dead */
+ level.native_em_level->ply[3]->alive == 0) // all dead
AllPlayersGone = TRUE;
}
else if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
{
if (game_sp.LevelSolved &&
- !game_sp.GameOver) /* game won */
+ !game_sp.GameOver) // game won
{
PlayerWins(local_player);
AllPlayersGone = TRUE;
}
- if (game_sp.GameOver) /* game lost */
+ if (game_sp.GameOver) // game lost
AllPlayersGone = TRUE;
}
else if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
{
if (game_mm.level_solved &&
- !game_mm.game_over) /* game won */
+ !game_mm.game_over) // game won
{
PlayerWins(local_player);
AllPlayersGone = TRUE;
}
- if (game_mm.game_over) /* game lost */
+ if (game_mm.game_over) // game lost
AllPlayersGone = TRUE;
}
}
KillPlayer(&stored_player[i]);
}
}
- else if (game.no_time_limit && !AllPlayersGone) /* level w/o time limit */
+ else if (game.no_time_limit && !AllPlayersGone) // level w/o time limit
{
game_panel_controls[GAME_PANEL_TIME].value = TimePlayed;
}
{
int i;
- /* advance frame counters (global frame counter and time frame counter) */
+ // advance frame counters (global frame counter and time frame counter)
FrameCounter++;
TimeFrames++;
- /* advance player counters (counters for move delay, move animation etc.) */
+ // advance player counters (counters for move delay, move animation etc.)
for (i = 0; i < MAX_PLAYERS; i++)
{
boolean advance_player_counters = (player_nr == -1 || player_nr == i);
int move_delay_value = stored_player[i].move_delay_value;
int move_frames = MOVE_DELAY_NORMAL_SPEED / move_delay_value;
- if (!advance_player_counters) /* not all players may be affected */
+ if (!advance_player_counters) // not all players may be affected
continue;
- if (move_frames == 0) /* less than one move per game frame */
+ if (move_frames == 0) // less than one move per game frame
{
int stepsize = TILEX / move_delay_value;
int delay = move_delay_value / MOVE_DELAY_NORMAL_SPEED;
if (stored_player[i].move_delay > 0)
stored_player[i].move_delay--;
- /* due to bugs in previous versions, counter must count up, not down */
+ // due to bugs in previous versions, counter must count up, not down
if (stored_player[i].push_delay != -1)
stored_player[i].push_delay++;
byte tape_action[MAX_PLAYERS];
int i;
- /* detect endless loops, caused by custom element programming */
+ // detect endless loops, caused by custom element programming
if (recursion_loop_detected && recursion_loop_depth == 0)
{
char *message = getStringCat3("Internal Error! Element ",
RequestQuitGameExt(FALSE, level_editor_test_game, message);
- recursion_loop_detected = FALSE; /* if game should be continued */
+ recursion_loop_detected = FALSE; // if game should be continued
free(message);
if (AllPlayersGone && !TAPE_IS_STOPPED(tape))
TapeStop();
- if (game_status != GAME_MODE_PLAYING) /* status might have changed */
+ if (game_status != GAME_MODE_PLAYING) // status might have changed
return;
game_frame_delay_value =
#if 0
#if 0
- /* ---------- main game synchronization point ---------- */
+ // ---------- main game synchronization point ----------
int skip = WaitUntilDelayReached(&game_frame_delay, game_frame_delay_value);
printf("::: skip == %d\n", skip);
#else
- /* ---------- main game synchronization point ---------- */
+ // ---------- main game synchronization point ----------
WaitUntilDelayReached(&game_frame_delay, game_frame_delay_value);
#endif
if (network_playing && !network_player_action_received)
{
- /* try to get network player actions in time */
+ // try to get network player actions in time
- /* last chance to get network player actions without main loop delay */
+ // last chance to get network player actions without main loop delay
HandleNetworking();
- /* game was quit by network peer */
+ // game was quit by network peer
if (game_status != GAME_MODE_PLAYING)
return;
- /* check if network player actions still missing and game still running */
+ // check if network player actions still missing and game still running
if (!network_player_action_received && !checkGameEnded())
- return; /* failed to get network player actions in time */
+ return; // failed to get network player actions in time
- /* do not yet reset "network_player_action_received" (for tape.pausing) */
+ // do not yet reset "network_player_action_received" (for tape.pausing)
}
if (tape.pausing)
return;
- /* at this point we know that we really continue executing the game */
+ // at this point we know that we really continue executing the game
network_player_action_received = FALSE;
- /* when playing tape, read previously recorded player input from tape data */
+ // when playing tape, read previously recorded player input from tape data
recorded_player_action = (tape.playing ? TapePlayAction() : NULL);
local_player->effective_mouse_action = local_player->mouse_action;
SetMouseActionFromTapeAction(&local_player->effective_mouse_action,
recorded_player_action);
- /* TapePlayAction() may return NULL when toggling to "pause before death" */
+ // TapePlayAction() may return NULL when toggling to "pause before death"
if (tape.pausing)
return;
SetTapeActionFromMouseAction(tape_action,
&local_player->effective_mouse_action);
- /* only record actions from input devices, but not programmed actions */
+ // only record actions from input devices, but not programmed actions
if (tape.recording)
TapeRecordAction(tape_action);
CheckLevelSolved();
CheckLevelTime();
- AdvanceFrameAndPlayerCounters(-1); /* advance counters for all players */
+ AdvanceFrameAndPlayerCounters(-1); // advance counters for all players
if (global.show_frames_per_second)
{
fps_frames++;
- if (fps_delay_ms >= 500) /* calculate FPS every 0.5 seconds */
+ if (fps_delay_ms >= 500) // calculate FPS every 0.5 seconds
{
global.frames_per_second = 1000 * (float)fps_frames / fps_delay_ms;
fps_frames = 0;
fps_counter = Counter();
- /* always draw FPS to screen after FPS value was updated */
+ // always draw FPS to screen after FPS value was updated
redraw_mask |= REDRAW_FPS;
}
- /* only draw FPS if no screen areas are deactivated (invisible warp mode) */
+ // only draw FPS if no screen areas are deactivated (invisible warp mode)
if (GetDrawDeactivationMask() == REDRAW_NONE)
redraw_mask |= REDRAW_FPS;
}
{
boolean all_players_fit_to_screen = checkIfAllPlayersFitToScreen_RND();
- /* switching to "all players" only possible if all players fit to screen */
+ // switching to "all players" only possible if all players fit to screen
if (game.centered_player_nr_next == -1 && !all_players_fit_to_screen)
{
game.centered_player_nr_next = game.centered_player_nr;
game.set_centered_player = FALSE;
}
- /* do not switch focus to non-existing (or non-active) player */
+ // do not switch focus to non-existing (or non-active) player
if (game.centered_player_nr_next >= 0 &&
!stored_player[game.centered_player_nr_next].active)
{
}
if (game.set_centered_player &&
- ScreenMovPos == 0) /* screen currently aligned at tile position */
+ ScreenMovPos == 0) // screen currently aligned at tile position
{
int sx, sy;
CheckGravityMovement(&stored_player[i]);
#endif
- /* overwrite programmed action with tape action */
+ // overwrite programmed action with tape action
if (stored_player[i].programmed_action)
actual_player_action = stored_player[i].programmed_action;
{
ContinueMoving(x, y);
- /* continue moving after pushing (this is actually a bug) */
+ // continue moving after pushing (this is actually a bug)
if (!IS_MOVING(x, y))
Stop[x][y] = FALSE;
}
ChangeCount[x][y] = 0;
ChangeEvent[x][y] = -1;
- /* this must be handled before main playfield loop */
+ // this must be handled before main playfield loop
if (Feld[x][y] == EL_PLAYER_IS_LEAVING)
{
MovDelay[x][y]--;
RemoveField(x, y);
TEST_DrawLevelField(x, y);
- TestIfElementTouchesCustomElement(x, y); /* for empty space */
+ TestIfElementTouchesCustomElement(x, y); // for empty space
}
}
continue;
}
- /* this may take place after moving, so 'element' may have changed */
+ // this may take place after moving, so 'element' may have changed
if (IS_CHANGING(x, y) &&
(game.engine_version < VERSION_IDENT(3,0,7,1) || !Stop[x][y]))
{
else if (element == EL_FLAMES)
CheckForDragon(x, y);
else if (element == EL_EXPLOSION)
- ; /* drawing of correct explosion animation is handled separately */
+ ; // drawing of correct explosion animation is handled separately
else if (element == EL_ELEMENT_SNAPPING ||
element == EL_DIAGONAL_SHRINKING ||
element == EL_DIAGONAL_GROWING)
{
int jx = local_player->jx, jy = local_player->jy;
- /* play the element sound at the position nearest to the player */
+ // play the element sound at the position nearest to the player
if ((element == EL_MAGIC_WALL_FULL ||
element == EL_MAGIC_WALL_ACTIVE ||
element == EL_MAGIC_WALL_EMPTYING ||
}
#if USE_NEW_AMOEBA_CODE
- /* new experimental amoeba growth stuff */
+ // new experimental amoeba growth stuff
if (!(FrameCounter % 8))
{
static unsigned int random = 1684108901;
local_player->show_envelope = 0;
}
- /* use random number generator in every frame to make it less predictable */
+ // use random number generator in every frame to make it less predictable
if (game.engine_version >= VERSION_IDENT(3,1,1,0))
RND(1);
}
if (can_move != MP_MOVING)
return can_move;
- /* check if DigField() has caused relocation of the player */
+ // check if DigField() has caused relocation of the player
if (player->jx != jx || player->jy != jy)
- return MP_NO_ACTION; /* <-- !!! CHECK THIS [-> MP_ACTION ?] !!! */
+ return MP_NO_ACTION; // <-- !!! CHECK THIS [-> MP_ACTION ?] !!!
StorePlayer[jx][jy] = 0;
player->last_jx = jx;
player->is_moving = TRUE;
#if 1
- /* should better be called in MovePlayer(), but this breaks some tapes */
+ // should better be called in MovePlayer(), but this breaks some tapes
ScrollPlayer(player, SCROLL_INIT);
#endif
if (player->move_delay > 0)
return FALSE;
- player->move_delay = -1; /* set to "uninitialized" value */
+ player->move_delay = -1; // set to "uninitialized" value
- /* store if player is automatically moved to next field */
+ // store if player is automatically moved to next field
player->is_auto_moving = (player->programmed_action != MV_NONE);
- /* remove the last programmed player action */
+ // remove the last programmed player action
player->programmed_action = 0;
if (player->MovPos)
{
- /* should only happen if pre-1.2 tape recordings are played */
- /* this is only for backward compatibility */
+ // should only happen if pre-1.2 tape recordings are played
+ // this is only for backward compatibility
int original_move_delay_value = player->move_delay_value;
tape.counter);
#endif
- /* scroll remaining steps with finest movement resolution */
+ // scroll remaining steps with finest movement resolution
player->move_delay_value = MOVE_DELAY_NORMAL_SPEED;
while (player->MovPos)
if (!IN_VIS_FIELD(SCREENX(jx), SCREENY(jy)))
{
- /* actual player has left the screen -- scroll in that direction */
- if (jx != old_jx) /* player has moved horizontally */
+ // actual player has left the screen -- scroll in that direction
+ if (jx != old_jx) // player has moved horizontally
scroll_x += (jx - old_jx);
- else /* player has moved vertically */
+ else // player has moved vertically
scroll_y += (jy - old_jy);
}
else
{
- if (jx != old_jx) /* player has moved horizontally */
+ if (jx != old_jx) // player has moved horizontally
{
if ((player->MovDir == MV_LEFT && scroll_x > jx - MIDPOSX + offset) ||
(player->MovDir == MV_RIGHT && scroll_x < jx - MIDPOSX - offset))
scroll_x = jx-MIDPOSX + (scroll_x < jx-MIDPOSX ? -offset : +offset);
- /* don't scroll over playfield boundaries */
+ // don't scroll over playfield boundaries
if (scroll_x < SBX_Left || scroll_x > SBX_Right)
scroll_x = (scroll_x < SBX_Left ? SBX_Left : SBX_Right);
- /* don't scroll more than one field at a time */
+ // don't scroll more than one field at a time
scroll_x = old_scroll_x + SIGN(scroll_x - old_scroll_x);
- /* don't scroll against the player's moving direction */
+ // don't scroll against the player's moving direction
if ((player->MovDir == MV_LEFT && scroll_x > old_scroll_x) ||
(player->MovDir == MV_RIGHT && scroll_x < old_scroll_x))
scroll_x = old_scroll_x;
}
- else /* player has moved vertically */
+ else // player has moved vertically
{
if ((player->MovDir == MV_UP && scroll_y > jy - MIDPOSY + offset) ||
(player->MovDir == MV_DOWN && scroll_y < jy - MIDPOSY - offset))
scroll_y = jy-MIDPOSY + (scroll_y < jy-MIDPOSY ? -offset : +offset);
- /* don't scroll over playfield boundaries */
+ // don't scroll over playfield boundaries
if (scroll_y < SBY_Upper || scroll_y > SBY_Lower)
scroll_y = (scroll_y < SBY_Upper ? SBY_Upper : SBY_Lower);
- /* don't scroll more than one field at a time */
+ // don't scroll more than one field at a time
scroll_y = old_scroll_y + SIGN(scroll_y - old_scroll_y);
- /* don't scroll against the player's moving direction */
+ // don't scroll against the player's moving direction
if ((player->MovDir == MV_UP && scroll_y > old_scroll_y) ||
(player->MovDir == MV_DOWN && scroll_y < old_scroll_y))
scroll_y = old_scroll_y;
else if (old_jx == jx && old_jy != jy)
player->MovDir = (old_jy < jy ? MV_DOWN : MV_UP);
- TEST_DrawLevelField(jx, jy); /* for "crumbled sand" */
+ TEST_DrawLevelField(jx, jy); // for "crumbled sand"
player->last_move_dir = player->MovDir;
player->is_moving = TRUE;
player->drop_pressed_delay = 0;
#if 0
- /* should better be called here than above, but this breaks some tapes */
+ // should better be called here than above, but this breaks some tapes
ScrollPlayer(player, SCROLL_INIT);
#endif
}
the player was forced to wait again for eight frames before next try) */
if (game.engine_version >= VERSION_IDENT(3,1,1,0))
- player->move_delay = 0; /* allow direct movement in the next frame */
+ player->move_delay = 0; // allow direct movement in the next frame
}
- if (player->move_delay == -1) /* not yet initialized by DigField() */
+ if (player->move_delay == -1) // not yet initialized by DigField()
player->move_delay = player->move_delay_value;
if (game.engine_version < VERSION_IDENT(3,0,7,0))
if (!player->active)
return;
- if (player->MovPos == 0 && mode == SCROLL_GO_ON) /* player not moving */
+ if (player->MovPos == 0 && mode == SCROLL_GO_ON) // player not moving
return;
if (mode == SCROLL_INIT)
if ((player->block_last_field || player->block_delay_adjustment > 0) &&
Feld[last_jx][last_jy] == EL_EMPTY)
{
- int last_field_block_delay = 0; /* start with no blocking at all */
+ int last_field_block_delay = 0; // start with no blocking at all
int block_delay_adjustment = player->block_delay_adjustment;
- /* if player blocks last field, add delay for exactly one move */
+ // if player blocks last field, add delay for exactly one move
if (player->block_last_field)
{
last_field_block_delay += player->move_delay_value;
- /* when blocking enabled, prevent moving up despite gravity */
+ // when blocking enabled, prevent moving up despite gravity
if (player->gravity && player->MovDir == MV_UP)
block_delay_adjustment = -1;
}
- /* add block delay adjustment (also possible when not blocking) */
+ // add block delay adjustment (also possible when not blocking)
last_field_block_delay += block_delay_adjustment;
Feld[last_jx][last_jy] = EL_PLAYER_IS_LEAVING;
MovDelay[last_jx][last_jy] = last_field_block_delay + 1;
}
- if (player->MovPos != 0) /* player has not yet reached destination */
+ if (player->MovPos != 0) // player has not yet reached destination
return;
}
else if (!FrameReached(&player->actual_frame_counter, 1))
player->MovPos += (player->MovPos > 0 ? -1 : 1) * move_stepsize;
player->GfxPos = move_stepsize * (player->MovPos / move_stepsize);
- /* before DrawPlayer() to draw correct player graphic for this case */
+ // before DrawPlayer() to draw correct player graphic for this case
if (player->MovPos == 0)
CheckGravityMovement(player);
}
- if (player->MovPos == 0) /* player reached destination field */
+ if (player->MovPos == 0) // player reached destination field
{
if (player->move_delay_reset_counter > 0)
{
if (player->move_delay_reset_counter == 0)
{
- /* continue with normal speed after quickly moving through gate */
+ // continue with normal speed after quickly moving through gate
HALVE_PLAYER_SPEED(player);
- /* be able to make the next move without delay */
+ // be able to make the next move without delay
player->move_delay = 0;
}
}
Feld[jx][jy] == EL_EM_STEEL_EXIT_OPEN ||
Feld[jx][jy] == EL_EM_STEEL_EXIT_OPENING ||
Feld[jx][jy] == EL_SP_EXIT_OPEN ||
- Feld[jx][jy] == EL_SP_EXIT_OPENING) /* <-- special case */
+ Feld[jx][jy] == EL_SP_EXIT_OPENING) // <-- special case
{
ExitPlayer(player);
PlayerWins(local_player);
}
- /* this breaks one level: "machine", level 000 */
+ // this breaks one level: "machine", level 000
{
int move_direction = player->MovDir;
int enter_side = MV_DIR_OPPOSITE(move_direction);
/* needed because pushed element has not yet reached its destination,
so it would trigger a change event at its previous field location */
if (!player->is_pushing)
- TestIfElementTouchesCustomElement(jx, jy); /* for empty space */
+ TestIfElementTouchesCustomElement(jx, jy); // for empty space
if (!player->active)
RemovePlayer(player);
for (i = 0; i < MAX_PLAYERS; i++)
KillPlayer(&stored_player[i]);
}
- else if (game.no_time_limit && !AllPlayersGone) /* level w/o time limit */
+ else if (game.no_time_limit && !AllPlayersGone) // level w/o time limit
{
game_panel_controls[GAME_PANEL_TIME].value = TimePlayed;
if (mode == SCROLL_INIT)
{
- /* set scrolling step size according to actual player's moving speed */
+ // set scrolling step size according to actual player's moving speed
ScrollStepSize = TILEX / player->move_delay_value;
screen_frame_counter = FrameCounter;
};
static int trigger_sides[4][2] =
{
- /* center side border side */
- { CH_SIDE_TOP, CH_SIDE_BOTTOM }, /* check top */
- { CH_SIDE_LEFT, CH_SIDE_RIGHT }, /* check left */
- { CH_SIDE_RIGHT, CH_SIDE_LEFT }, /* check right */
- { CH_SIDE_BOTTOM, CH_SIDE_TOP } /* check bottom */
+ // center side border side
+ { CH_SIDE_TOP, CH_SIDE_BOTTOM }, // check top
+ { CH_SIDE_LEFT, CH_SIDE_RIGHT }, // check left
+ { CH_SIDE_RIGHT, CH_SIDE_LEFT }, // check right
+ { CH_SIDE_BOTTOM, CH_SIDE_TOP } // check bottom
};
static int touch_dir[4] =
{
MV_UP | MV_DOWN,
MV_LEFT | MV_RIGHT
};
- int center_element = Feld[x][y]; /* should always be non-moving! */
+ int center_element = Feld[x][y]; // should always be non-moving!
int i;
for (i = 0; i < NUM_DIRECTIONS; i++)
if (!IN_LEV_FIELD(xx, yy))
continue;
- if (IS_PLAYER(x, y)) /* player found at center element */
+ if (IS_PLAYER(x, y)) // player found at center element
{
struct PlayerInfo *player = PLAYERINFO(x, y);
if (game.engine_version < VERSION_IDENT(3,0,7,0))
- border_element = Feld[xx][yy]; /* may be moving! */
+ border_element = Feld[xx][yy]; // may be moving!
else if (!IS_MOVING(xx, yy) && !IS_BLOCKED(xx, yy))
border_element = Feld[xx][yy];
- else if (MovDir[xx][yy] & touch_dir[i]) /* elements are touching */
+ else if (MovDir[xx][yy] & touch_dir[i]) // elements are touching
border_element = MovingOrBlocked2Element(xx, yy);
else
- continue; /* center and border element do not touch */
+ continue; // center and border element do not touch
CheckElementChangeByPlayer(xx, yy, border_element, CE_TOUCHED_BY_PLAYER,
player->index_bit, border_side);
CE_TOUCHING_X, border_side);
}
}
- else if (IS_PLAYER(xx, yy)) /* player found at border element */
+ else if (IS_PLAYER(xx, yy)) // player found at border element
{
struct PlayerInfo *player = PLAYERINFO(xx, yy);
if (game.engine_version >= VERSION_IDENT(3,0,7,0))
{
if (player->MovPos != 0 && !(player->MovDir & touch_dir[i]))
- continue; /* center and border element do not touch */
+ continue; // center and border element do not touch
}
CheckElementChangeByPlayer(x, y, center_element, CE_TOUCHED_BY_PLAYER,
};
static int trigger_sides[4][2] =
{
- /* center side border side */
- { CH_SIDE_TOP, CH_SIDE_BOTTOM }, /* check top */
- { CH_SIDE_LEFT, CH_SIDE_RIGHT }, /* check left */
- { CH_SIDE_RIGHT, CH_SIDE_LEFT }, /* check right */
- { CH_SIDE_BOTTOM, CH_SIDE_TOP } /* check bottom */
+ // center side border side
+ { CH_SIDE_TOP, CH_SIDE_BOTTOM }, // check top
+ { CH_SIDE_LEFT, CH_SIDE_RIGHT }, // check left
+ { CH_SIDE_RIGHT, CH_SIDE_LEFT }, // check right
+ { CH_SIDE_BOTTOM, CH_SIDE_TOP } // check bottom
};
static int touch_dir[4] =
{
MV_LEFT | MV_RIGHT
};
boolean change_center_element = FALSE;
- int center_element = Feld[x][y]; /* should always be non-moving! */
+ int center_element = Feld[x][y]; // should always be non-moving!
int border_element_old[NUM_DIRECTIONS];
int i;
continue;
if (game.engine_version < VERSION_IDENT(3,0,7,0))
- border_element = Feld[xx][yy]; /* may be moving! */
+ border_element = Feld[xx][yy]; // may be moving!
else if (!IS_MOVING(xx, yy) && !IS_BLOCKED(xx, yy))
border_element = Feld[xx][yy];
- else if (MovDir[xx][yy] & touch_dir[i]) /* elements are touching */
+ else if (MovDir[xx][yy] & touch_dir[i]) // elements are touching
border_element = MovingOrBlocked2Element(xx, yy);
else
- continue; /* center and border element do not touch */
+ continue; // center and border element do not touch
border_element_old[i] = border_element;
}
if (border_element == -1)
continue;
- /* check for change of border element */
+ // check for change of border element
CheckElementChangeBySide(xx, yy, border_element, center_element,
CE_TOUCHING_X, center_side);
- /* (center element cannot be player, so we dont have to check this here) */
+ // (center element cannot be player, so we dont have to check this here)
}
for (i = 0; i < NUM_DIRECTIONS; i++)
if (border_element == -1)
continue;
- /* check for change of center element (but change it only once) */
+ // check for change of center element (but change it only once)
if (!change_center_element)
change_center_element =
CheckElementChangeBySide(x, y, center_element, border_element,
}
}
- /* "hitting something" is also true when hitting the playfield border */
+ // "hitting something" is also true when hitting the playfield border
CheckElementChangeBySide(x, y, hitting_element, touched_element,
CE_HITTING_SOMETHING, direction);
}
MV_DOWN
};
- if (bad_element == EL_EXPLOSION) /* skip just exploding bad things */
+ if (bad_element == EL_EXPLOSION) // skip just exploding bad things
return;
for (i = 0; i < NUM_DIRECTIONS; i++)
if ((DONT_RUN_INTO(bad_element) && bad_move_dir == test_dir[i]) ||
(DONT_TOUCH(bad_element) && test_move_dir != test_dir[i]))
{
- /* good thing is player or penguin that does not move away */
+ // good thing is player or penguin that does not move away
if (IS_PLAYER(test_x, test_y))
{
struct PlayerInfo *player = PLAYERINFO(test_x, test_y);
if (bad_element == EL_ROBOT && player->is_moving)
- continue; /* robot does not kill player if he is moving */
+ continue; // robot does not kill player if he is moving
if (game.engine_version >= VERSION_IDENT(3,0,7,0))
{
if (player->MovPos != 0 && !(player->MovDir & touch_dir[i]))
- continue; /* center and border element do not touch */
+ continue; // center and border element do not touch
}
kill_x = test_x;
if (test_move_dir != bad_move_dir)
{
- /* good thing can be player or penguin that does not move away */
+ // good thing can be player or penguin that does not move away
if (IS_PLAYER(test_x, test_y))
{
struct PlayerInfo *player = PLAYERINFO(test_x, test_y);
player as being hit when he is moving towards the bad thing, because
the "get hit by" condition would be lost after the player stops) */
if (player->MovPos != 0 && player->MovDir == bad_move_dir)
- return; /* player moves away from bad thing */
+ return; // player moves away from bad thing
kill_x = test_x;
kill_y = test_y;
player->killed = TRUE;
- /* remove accessible field at the player's position */
+ // remove accessible field at the player's position
Feld[jx][jy] = EL_EMPTY;
- /* deactivate shield (else Bang()/Explode() would not work right) */
+ // deactivate shield (else Bang()/Explode() would not work right)
player->shield_normal_time_left = 0;
player->shield_deadly_time_left = 0;
player->killed, player->active, player->reanimated);
#endif
- if (player->reanimated) /* killed player may have been reanimated */
+ if (player->reanimated) // killed player may have been reanimated
player->killed = player->reanimated = FALSE;
else
BuryPlayer(player);
void ExitPlayer(struct PlayerInfo *player)
{
- DrawPlayer(player); /* needed here only to cleanup last field */
+ DrawPlayer(player); // needed here only to cleanup last field
RemovePlayer(player);
if (local_player->players_still_needed > 0)
local_player->players_still_needed--;
- /* also set if some players not yet gone, but not needed to solve level */
+ // also set if some players not yet gone, but not needed to solve level
if (local_player->players_still_needed == 0)
AllPlayersGone = TRUE;
}
{
int jx, jy, dx, dy, xx, yy;
- if (real_dx == 0 || real_dy == 0) /* no diagonal direction => push */
+ if (real_dx == 0 || real_dy == 0) // no diagonal direction => push
return TRUE;
- /* diagonal direction: check alternative direction */
+ // diagonal direction: check alternative direction
jx = player->jx;
jy = player->jy;
dx = x - jx;
int element = MovingOrBlocked2ElementIfNotLeaving(x, y);
int collect_count;
- if (is_player) /* function can also be called by EL_PENGUIN */
+ if (is_player) // function can also be called by EL_PENGUIN
{
if (player->MovPos == 0)
{
player->is_collecting = FALSE;
}
- if (player->MovPos == 0) /* last pushing move finished */
+ if (player->MovPos == 0) // last pushing move finished
player->is_pushing = FALSE;
- if (mode == DF_NO_PUSH) /* player just stopped pushing */
+ if (mode == DF_NO_PUSH) // player just stopped pushing
{
player->is_switching = FALSE;
player->push_delay = -1;
if (IS_TUBE(Back[jx][jy]) && game.engine_version >= VERSION_IDENT(2,2,0,0))
old_element = Back[jx][jy];
- /* in case of element dropped at player position, check background */
+ // in case of element dropped at player position, check background
else if (Back[jx][jy] != EL_EMPTY &&
game.engine_version >= VERSION_IDENT(2,2,0,0))
old_element = Back[jx][jy];
if (IS_WALKABLE(old_element) && !ACCESS_FROM(old_element, move_direction))
- return MP_NO_ACTION; /* field has no opening in this direction */
+ return MP_NO_ACTION; // field has no opening in this direction
if (IS_PASSABLE(old_element) && !ACCESS_FROM(old_element,opposite_direction))
- return MP_NO_ACTION; /* field has no opening in this direction */
+ return MP_NO_ACTION; // field has no opening in this direction
if (player_can_move && element == EL_ACID && move_direction == MV_DOWN)
{
collect_count = element_info[element].collect_count_initial;
- if (!is_player && !IS_COLLECTIBLE(element)) /* penguin cannot collect it */
+ if (!is_player && !IS_COLLECTIBLE(element)) // penguin cannot collect it
return MP_NO_ACTION;
if (game.engine_version < VERSION_IDENT(2,2,0,0))
if (element == EL_DC_LANDMINE)
Bang(x, y);
- if (Feld[x][y] != element) /* field changed by snapping */
+ if (Feld[x][y] != element) // field changed by snapping
return MP_ACTION;
return MP_NO_ACTION;
if (player->gravity && is_player && !player->is_auto_moving &&
canFallDown(player) && move_direction != MV_DOWN &&
!canMoveToValidFieldWithGravity(jx, jy, move_direction))
- return MP_NO_ACTION; /* player cannot walk here due to gravity */
+ return MP_NO_ACTION; // player cannot walk here due to gravity
if (player_can_move &&
IS_WALKABLE(element) && ACCESS_FROM(element, opposite_direction))
element == EL_SP_EXIT_OPEN ||
element == EL_SP_EXIT_OPENING)
{
- sound_action = ACTION_PASSING; /* player is passing exit */
+ sound_action = ACTION_PASSING; // player is passing exit
}
else if (element == EL_EMPTY)
{
- sound_action = ACTION_MOVING; /* nothing to walk on */
+ sound_action = ACTION_MOVING; // nothing to walk on
}
- /* play sound from background or player, whatever is available */
+ // play sound from background or player, whatever is available
if (element_info[sound_element].sound[sound_action] != SND_UNDEFINED)
PlayLevelSoundElementAction(x, y, sound_element, sound_action);
else
IS_PASSABLE(element) && canPassField(x, y, move_direction))
{
if (!ACCESS_FROM(element, opposite_direction))
- return MP_NO_ACTION; /* field not accessible from this direction */
+ return MP_NO_ACTION; // field not accessible from this direction
- if (CAN_MOVE(element)) /* only fixed elements can be passed! */
+ if (CAN_MOVE(element)) // only fixed elements can be passed!
return MP_NO_ACTION;
if (IS_EM_GATE(element))
player->gravity = FALSE;
}
- /* automatically move to the next field with double speed */
+ // automatically move to the next field with double speed
player->programmed_action = move_direction;
if (player->move_delay_reset_counter == 0)
{
- player->move_delay_reset_counter = 2; /* two double speed steps */
+ player->move_delay_reset_counter = 2; // two double speed steps
DOUBLE_PLAYER_SPEED(player);
}
if (level.block_snap_field)
setFieldForSnapping(x, y, element, move_direction);
else
- TestIfElementTouchesCustomElement(x, y); /* for empty space */
+ TestIfElementTouchesCustomElement(x, y); // for empty space
CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_SNAPS_X,
player->index_bit, dig_side);
{
player->num_white_keys++;
- /* display white keys? */
- /* DrawGameDoorValues(); */
+ // display white keys?
+ // DrawGameDoorValues();
}
else if (IS_ENVELOPE(element))
{
RedrawAllInvisibleElementsForMagnifier();
}
else if (IS_DROPPABLE(element) ||
- IS_THROWABLE(element)) /* can be collected and dropped */
+ IS_THROWABLE(element)) // can be collected and dropped
{
int i;
if (level.block_snap_field)
setFieldForSnapping(x, y, element, move_direction);
else
- TestIfElementTouchesCustomElement(x, y); /* for empty space */
+ TestIfElementTouchesCustomElement(x, y); // for empty space
CheckTriggeredElementChangeByPlayer(x, y, element, CE_PLAYER_SNAPS_X,
player->index_bit, dig_side);
IN_LEV_FIELD(x, y + 1) && IS_FREE(x, y + 1))))))
return MP_NO_ACTION;
- /* do not push elements already moving away faster than player */
+ // do not push elements already moving away faster than player
if (CAN_MOVE(element) && MovDir[x][y] == move_direction &&
ABS(getElementMoveStepsize(x, y)) > MOVE_STEPSIZE_NORMAL)
return MP_NO_ACTION;
if (!checkDiagonalPushing(player, x, y, real_dx, real_dy))
return MP_NO_ACTION;
- if (player->push_delay == -1) /* new pushing; restart delay */
+ if (player->push_delay == -1) // new pushing; restart delay
player->push_delay = 0;
if (player->push_delay < player->push_delay_value &&
!(tape.playing && tape.file_version < FILE_VERSION_2_0) &&
element != EL_SPRING && element != EL_BALLOON)
{
- /* make sure that there is no move delay before next try to push */
+ // make sure that there is no move delay before next try to push
if (game.engine_version >= VERSION_IDENT(3,0,7,1))
player->move_delay = 0;
if (game.engine_version < VERSION_IDENT(2,2,0,7))
player->push_delay_value = GET_NEW_PUSH_DELAY(element);
else
- player->push_delay_value = -1; /* get new value later */
+ player->push_delay_value = -1; // get new value later
- /* check for element change _after_ element has been pushed */
+ // check for element change _after_ element has been pushed
if (game.use_change_when_pushing_bug)
{
CheckElementChangeByPlayer(x, y, element, CE_PUSHED_BY_PLAYER,
player->push_delay = -1;
- if (is_player) /* function can also be called by EL_PENGUIN */
+ if (is_player) // function can also be called by EL_PENGUIN
{
- if (Feld[x][y] != element) /* really digged/collected something */
+ if (Feld[x][y] != element) // really digged/collected something
{
player->is_collecting = !player->is_digging;
player->is_active = TRUE;
IS_COLLECTIBLE(element) ? ACTION_COLLECTING :
ACTION_BREAKING);
- /* no element can dig solid indestructible elements */
+ // no element can dig solid indestructible elements
if (IS_INDESTRUCTIBLE(element) &&
!IS_DIGGABLE(element) &&
!IS_COLLECTIBLE(element))
TEST_DrawLevelField(x, y);
}
- /* if digged element was about to explode, prevent the explosion */
+ // if digged element was about to explode, prevent the explosion
ExplodeField[x][y] = EX_TYPE_NONE;
PlayLevelSoundAction(x, y, action);
Store[x][y] = EL_EMPTY;
- /* this makes it possible to leave the removed element again */
+ // this makes it possible to leave the removed element again
if (IS_EQUAL_OR_IN_GROUP(element, MOVE_ENTER_EL(digging_element)))
Store[x][y] = element;
return FALSE;
}
- /* prevent snapping with already pressed snap key when not allowed */
+ // prevent snapping with already pressed snap key when not allowed
if (player->is_snapping && !can_continue_snapping)
return FALSE;
player->is_collecting = FALSE;
}
- if (player->MovPos != 0) /* prevent graphic bugs in versions < 2.2.0 */
+ if (player->MovPos != 0) // prevent graphic bugs in versions < 2.2.0
TEST_DrawLevelField(player->last_jx, player->last_jy);
TEST_DrawLevelField(x, y);
return FALSE;
}
- old_element = Feld[dropx][dropy]; /* old element at dropping position */
- new_element = drop_element; /* default: no change when dropping */
+ old_element = Feld[dropx][dropy]; // old element at dropping position
+ new_element = drop_element; // default: no change when dropping
- /* check if player is active, not moving and ready to drop */
+ // check if player is active, not moving and ready to drop
if (!player->active || player->MovPos || player->drop_delay > 0)
return FALSE;
- /* check if player has anything that can be dropped */
+ // check if player has anything that can be dropped
if (new_element == EL_UNDEFINED)
return FALSE;
- /* only set if player has anything that can be dropped */
+ // only set if player has anything that can be dropped
player->is_dropping_pressed = TRUE;
- /* check if drop key was pressed long enough for EM style dynamite */
+ // check if drop key was pressed long enough for EM style dynamite
if (new_element == EL_EM_DYNAMITE && player->drop_pressed_delay < 40)
return FALSE;
- /* check if anything can be dropped at the current position */
+ // check if anything can be dropped at the current position
if (IS_ACTIVE_BOMB(old_element) || old_element == EL_EXPLOSION)
return FALSE;
- /* collected custom elements can only be dropped on empty fields */
+ // collected custom elements can only be dropped on empty fields
if (IS_CUSTOM_ELEMENT(new_element) && old_element != EL_EMPTY)
return FALSE;
if (old_element != EL_EMPTY)
- Back[dropx][dropy] = old_element; /* store old element on this field */
+ Back[dropx][dropy] = old_element; // store old element on this field
ResetGfxAnimation(dropx, dropy);
ResetRandomAnimationValue(dropx, dropy);
PlayLevelSoundAction(dropx, dropy, ACTION_DROPPING);
- /* needed if previous element just changed to "empty" in the last frame */
- ChangeCount[dropx][dropy] = 0; /* allow at least one more change */
+ // needed if previous element just changed to "empty" in the last frame
+ ChangeCount[dropx][dropy] = 0; // allow at least one more change
CheckElementChangeByPlayer(dropx, dropy, new_element, CE_DROPPED_BY_PLAYER,
player->index_bit, drop_side);
TestIfElementTouchesCustomElement(dropx, dropy);
}
- else /* player is dropping a dyna bomb */
+ else // player is dropping a dyna bomb
{
player->dynabombs_left--;
PlayLevelSoundAction(dropx, dropy, ACTION_DROPPING);
}
- if (Feld[dropx][dropy] == new_element) /* uninitialized unless CE change */
+ if (Feld[dropx][dropy] == new_element) // uninitialized unless CE change
InitField_WithBug1(dropx, dropy, FALSE);
- new_element = Feld[dropx][dropy]; /* element might have changed */
+ new_element = Feld[dropx][dropy]; // element might have changed
if (IS_CUSTOM_ELEMENT(new_element) && CAN_MOVE(new_element) &&
element_info[new_element].move_pattern == MV_WHEN_DROPPED)
if (element_info[new_element].move_direction_initial == MV_START_AUTOMATIC)
MovDir[dropx][dropy] = drop_direction;
- ChangeCount[dropx][dropy] = 0; /* allow at least one more change */
+ ChangeCount[dropx][dropy] = 0; // allow at least one more change
- /* do not cause impact style collision by dropping elements that can fall */
+ // do not cause impact style collision by dropping elements that can fall
CheckCollision[dropx][dropy] = CHECK_DELAY_COLLISION;
}
return TRUE;
}
-/* ------------------------------------------------------------------------- */
-/* game sound playing functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// game sound playing functions
+// ----------------------------------------------------------------------------
static int *loop_sound_frame = NULL;
static int *loop_sound_volume = NULL;
static int getLevelMusicNr(void)
{
if (levelset.music[level_nr] != MUS_UNDEFINED)
- return levelset.music[level_nr]; /* from config file */
+ return levelset.music[level_nr]; // from config file
else
- return MAP_NOCONF_MUSIC(level_nr); /* from music dir */
+ return MAP_NOCONF_MUSIC(level_nr); // from music dir
}
static void FadeLevelSounds(void)
break;
case SAMPLE_squash:
- /* !!! CHECK THIS !!! */
+ // !!! CHECK THIS !!!
#if 1
PlayLevelSoundElementAction(x, y, element, ACTION_BREAKING);
#else
{
if (skip_request || Request(message, REQ_ASK | REQ_STAY_CLOSED))
{
- /* closing door required in case of envelope style request dialogs */
+ // closing door required in case of envelope style request dialogs
if (!skip_request)
CloseDoor(DOOR_CLOSE_1);
DrawMainMenu();
}
}
- else /* continue playing the game */
+ else // continue playing the game
{
if (tape.playing && tape.deactivate_display)
TapeDeactivateDisplayOff(TRUE);
int game_over_delay_value = 50;
boolean game_over = checkGameFailed();
- /* do not handle game over if request dialog is already active */
+ // do not handle game over if request dialog is already active
if (game.request_active)
return;
boolean checkGameSolved(void)
{
- /* set for all game engines if level was solved */
+ // set for all game engines if level was solved
return local_player->LevelSolved_GameEnd;
}
return (game_sp.GameOver && !game_sp.LevelSolved);
else if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
return (game_mm.game_over && !game_mm.level_solved);
- else /* GAME_ENGINE_TYPE_RND */
+ else // GAME_ENGINE_TYPE_RND
return (local_player->GameOver && !local_player->LevelSolved);
}
}
-/* ------------------------------------------------------------------------- */
-/* random generator functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// random generator functions
+// ----------------------------------------------------------------------------
unsigned int InitEngineRandom_RND(int seed)
{
}
-/* ------------------------------------------------------------------------- */
-/* game engine snapshot handling functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// game engine snapshot handling functions
+// ----------------------------------------------------------------------------
struct EngineSnapshotInfo
{
- /* runtime values for custom element collect score */
+ // runtime values for custom element collect score
int collect_score[NUM_CUSTOM_ELEMENTS];
- /* runtime values for group element choice position */
+ // runtime values for group element choice position
int choice_pos[NUM_GROUP_ELEMENTS];
- /* runtime values for belt position animations */
+ // runtime values for belt position animations
int belt_graphic[4][NUM_BELT_PARTS];
int belt_anim_mode[4][NUM_BELT_PARTS];
};
{
ListNode *buffers = NULL;
- /* copy some special values to a structure better suited for the snapshot */
+ // copy some special values to a structure better suited for the snapshot
if (level.game_engine_type == GAME_ENGINE_TYPE_RND)
SaveEngineSnapshotValues_RND();
if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
SaveEngineSnapshotValues_MM(&buffers);
- /* save values stored in special snapshot structure */
+ // save values stored in special snapshot structure
if (level.game_engine_type == GAME_ENGINE_TYPE_RND)
SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(engine_snapshot_rnd));
if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(engine_snapshot_mm));
- /* save further RND engine values */
+ // save further RND engine values
SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(stored_player));
SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(game));
{
ListNode *buffers = SaveEngineSnapshotBuffers();
- /* finally save all snapshot buffers to single snapshot */
+ // finally save all snapshot buffers to single snapshot
SaveSnapshotSingle(buffers);
- /* save level identification information */
+ // save level identification information
setString(&snapshot_level_identifier, leveldir_current->identifier);
snapshot_level_nr = level_nr;
}
ListNode *buffers = SaveEngineSnapshotBuffers();
- /* finally save all snapshot buffers to snapshot list */
+ // finally save all snapshot buffers to snapshot list
SaveSnapshotToList(buffers);
}
static void LoadEngineSnapshotValues(void)
{
- /* restore special values from snapshot structure */
+ // restore special values from snapshot structure
if (level.game_engine_type == GAME_ENGINE_TYPE_RND)
LoadEngineSnapshotValues_RND();
}
-/* ---------- new game button stuff ---------------------------------------- */
+// ---------- new game button stuff -------------------------------------------
static struct
{
#ifndef GAME_H
#define GAME_H
-/* (not included here due to collisions with Emerald Mine engine definitions) */
-/* #include "main.h" */
+// (not included here due to collisions with Emerald Mine engine definitions)
+// #include "main.h"
#define MAX_INVENTORY_SIZE 1000
struct TextPosInfo level_name;
struct TextPosInfo level_author;
- /* value to determine if panel will be updated or not */
+ // value to determine if panel will be updated or not
boolean active;
};
struct GameInfo
{
- /* values for control panel */
+ // values for control panel
struct GamePanelInfo panel;
struct GameButtonInfo button;
- /* values for graphics engine customization */
+ // values for graphics engine customization
int graphics_engine_version;
boolean use_native_emc_graphics_engine;
boolean use_native_sp_graphics_engine;
int scroll_delay_value;
int tile_size;
- /* constant within running game */
+ // constant within running game
int engine_version;
int emulation;
int initial_move_delay[MAX_PLAYERS];
int initial_move_delay_value[MAX_PLAYERS];
int initial_push_delay_value;
- /* flag for single or multi-player mode (needed for playing tapes) */
- /* (when playing/recording games, this is identical to "setup.team_mode" */
+ // flag for single or multi-player mode (needed for playing tapes)
+ // (when playing/recording games, this is identical to "setup.team_mode"
boolean team_mode;
- /* flags to handle bugs in and changes between different engine versions */
- /* (for the latest engine version, these flags should always be "FALSE") */
+ // flags to handle bugs in and changes between different engine versions
+ // (for the latest engine version, these flags should always be "FALSE")
boolean use_change_when_pushing_bug;
boolean use_block_last_field_bug;
boolean max_num_changes_per_frame;
boolean use_reverse_scan_direction;
- /* variable within running game */
+ // variable within running game
int yamyam_content_nr;
boolean robot_wheel_active;
boolean magic_wall_active;
int wind_direction;
boolean explosions_delayed;
boolean envelope_active;
- boolean no_time_limit; /* (variable only in very special case) */
+ boolean no_time_limit; // (variable only in very special case)
- /* values for the new EMC elements */
+ // values for the new EMC elements
int lenses_time_left;
int magnify_time_left;
boolean ball_state;
int ball_content_nr;
- /* values for player idle animation (no effect on engine) */
+ // values for player idle animation (no effect on engine)
int player_boring_delay_fixed;
int player_boring_delay_random;
int player_sleeping_delay_fixed;
int player_sleeping_delay_random;
- /* values for special game initialization control */
+ // values for special game initialization control
boolean restart_level;
- /* trigger message to ask for restarting the game */
+ // trigger message to ask for restarting the game
char *restart_game_message;
- /* values for special request dialog control */
+ // values for special request dialog control
boolean request_active;
- /* values for special game control */
+ // values for special game control
int centered_player_nr;
int centered_player_nr_next;
boolean set_centered_player;
- /* values for random number generator initialization after snapshot */
+ // values for random number generator initialization after snapshot
unsigned int num_random_calls;
- /* values for game engine snapshot control */
+ // values for game engine snapshot control
struct GameSnapshotInfo snapshot;
};
struct PlayerInfo
{
- boolean present; /* player present in level playfield */
- boolean connected_locally; /* player connected (locally) */
- boolean connected_network; /* player connected (network) */
- boolean connected; /* player connected (locally or via network) */
- boolean active; /* player present and connected */
- boolean mapped; /* player already mapped to input device */
-
- boolean killed; /* player maybe present/active, but killed */
- boolean reanimated; /* player maybe killed, but reanimated */
-
- int index_nr; /* player number (0 to 3) */
- int index_bit; /* player number bit (1 << 0 to 1 << 3) */
- int element_nr; /* element (EL_PLAYER_1 to EL_PLAYER_4) */
- int client_nr; /* network client identifier */
-
- byte action; /* action from local input device */
- byte mapped_action; /* action mapped from device to player */
+ boolean present; // player present in level playfield
+ boolean connected_locally; // player connected (locally)
+ boolean connected_network; // player connected (network)
+ boolean connected; // player connected (locally or via network)
+ boolean active; // player present and connected
+ boolean mapped; // player already mapped to input device
+
+ boolean killed; // player maybe present/active, but killed
+ boolean reanimated; // player maybe killed, but reanimated
+
+ int index_nr; // player number (0 to 3)
+ int index_bit; // player number bit (1 << 0 to 1 << 3)
+ int element_nr; // element (EL_PLAYER_1 to EL_PLAYER_4)
+ int client_nr; // network client identifier
+
+ byte action; // action from local input device
+ byte mapped_action; // action mapped from device to player
byte effective_action; /* action acknowledged from network server
or summarized over all configured input
devices when in single player mode */
byte programmed_action; /* action forced by game itself (like moving
through doors); overrides other actions */
- struct MouseActionInfo mouse_action; /* (used by MM engine only) */
- struct MouseActionInfo effective_mouse_action; /* (used by MM engine only) */
+ struct MouseActionInfo mouse_action; // (used by MM engine only)
+ struct MouseActionInfo effective_mouse_action; // (used by MM engine only)
int jx, jy, last_jx, last_jy;
int MovDir, MovPos, GfxDir, GfxPos;
int GfxAction;
- int initial_element; /* EL_PLAYER_1 to EL_PLAYER_4 or EL_SP_MURPHY */
+ int initial_element; // EL_PLAYER_1 to EL_PLAYER_4 or EL_SP_MURPHY
int artwork_element;
boolean use_murphy;
boolean block_last_field;
- int block_delay_adjustment; /* needed for different engine versions */
+ int block_delay_adjustment; // needed for different engine versions
boolean can_fall_into_acid;
boolean cannot_move;
- boolean force_dropping; /* needed for single step mode */
+ boolean force_dropping; // needed for single step mode
int frame_counter_bored;
int frame_counter_sleeping;
#ifndef EXPORT_H
#define EXPORT_H
-/* ========================================================================= */
-/* functions and definitions exported from game_em to main program */
-/* ========================================================================= */
+// ============================================================================
+// functions and definitions exported from game_em to main program
+// ============================================================================
-/* ------------------------------------------------------------------------- */
-/* constant definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// constant definitions
+// ----------------------------------------------------------------------------
/* define these for backwards compatibility */
#define EM_ENGINE_BAD_ROLL
};
-/* ------------------------------------------------------------------------- */
-/* data structure definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// data structure definitions
+// ----------------------------------------------------------------------------
struct LEVEL
{
};
-/* ------------------------------------------------------------------------- */
-/* exported functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// exported functions
+// ----------------------------------------------------------------------------
extern struct GlobalInfo_EM global_em_info;
extern struct GameInfo_EM game_em;
void tab_generate(void);
void tab_generate_graphics_info_em(void);
-#endif /* EXPORT_H */
+#endif // EXPORT_H
#ifndef MAIN_EM_H
#define MAIN_EM_H
-/* ========================================================================= */
-/* external functions and definitions imported from main program to game_em */
-/* ========================================================================= */
+// ============================================================================
+// external functions and definitions imported from main program to game_em
+// ============================================================================
#include "../engines.h"
-/* ========================================================================= */
-/* functions and definitions that are exported from game_em to main program */
-/* ========================================================================= */
+// ============================================================================
+// functions and definitions that are exported from game_em to main program
+// ============================================================================
#include "export.h"
-/* ========================================================================= */
-/* internal functions and definitions that are not exported to main program */
-/* ========================================================================= */
+// ============================================================================
+// internal functions and definitions that are not exported to main program
+// ============================================================================
#include "global.h"
#include "sample.h"
-/* ------------------------------------------------------------------------- */
-/* constant definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// constant definitions
+// ----------------------------------------------------------------------------
/* values for native Emerald Mine game version */
#define FILE_VERSION_EM_UNKNOWN 0
#define PLAY_ELEMENT_SOUND FALSE
-/* ------------------------------------------------------------------------- */
-/* macro function definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// macro function definitions
+// ----------------------------------------------------------------------------
#define ROUNDED_DIVIDE(x, y) (((x) + (y) - 1) / (y))
#define DISPLAY_TIME(x) ROUNDED_DIVIDE(x, FRAMES_PER_SECOND)
-/* ------------------------------------------------------------------------- */
-/* data structure definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// data structure definitions
+// ----------------------------------------------------------------------------
-/* ------------------------------------------------------------------------- */
-/* exported variables */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// exported variables
+// ----------------------------------------------------------------------------
extern unsigned int RandomEM;
extern Bitmap *botBitmap;
-/* ------------------------------------------------------------------------- */
-/* exported functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// exported functions
+// ----------------------------------------------------------------------------
-#endif /* MAIN_EM_H */
+#endif // MAIN_EM_H
#ifndef GAME_MM_EXPORT_H
#define GAME_MM_EXPORT_H
-/* ========================================================================= */
-/* functions and definitions exported from game_mm to main program */
-/* ========================================================================= */
+// ============================================================================
+// functions and definitions exported from game_mm to main program
+// ============================================================================
-/* ------------------------------------------------------------------------- */
-/* constant definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// constant definitions
+// ----------------------------------------------------------------------------
#define MM_MAX_PLAYFIELD_WIDTH MAX_PLAYFIELD_WIDTH
#define MM_MAX_PLAYFIELD_HEIGHT MAX_PLAYFIELD_HEIGHT
#define EL_MM_DUMMY_START_NATIVE 700
#define EL_MM_DUMMY_END_NATIVE 709
-/* elements to be specially mapped */
+// elements to be specially mapped
#define EL_MM_EMPTY_NATIVE 0
#define EL_DF_EMPTY_NATIVE 304
-/* sounds */
+// sounds
#define SND_MM_GAME_LEVELTIME_CHARGING 0
#define SND_MM_GAME_HEALTH_CHARGING 1
-/* ------------------------------------------------------------------------- */
-/* data structure definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// data structure definitions
+// ----------------------------------------------------------------------------
struct GlobalInfo_MM
{
struct LevelInfo_MM
{
- int file_version; /* version of file the level was stored with */
- int game_version; /* version of game engine to play this level */
- boolean encoding_16bit_field; /* level contains 16-bit elements */
+ int file_version; // version of file the level was stored with
+ int game_version; // version of game engine to play this level
+ boolean encoding_16bit_field; // level contains 16-bit elements
int fieldx;
int fieldy;
};
-/* ------------------------------------------------------------------------- */
-/* exported functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// exported functions
+// ----------------------------------------------------------------------------
extern struct GlobalInfo_MM global_mm_info;
extern struct GameInfo_MM game_mm;
int getButtonFromTouchPosition(int, int, int, int);
-#endif /* GAME_MM_EXPORT_H */
+#endif // GAME_MM_EXPORT_H
#include "export.h"
-#endif /* GAME_MM_H */
+#endif // GAME_MM_H
#ifndef MAIN_MM_H
#define MAIN_MM_H
-/* ========================================================================= */
-/* external functions and definitions imported from main program to game_mm */
-/* ========================================================================= */
+// ============================================================================
+// external functions and definitions imported from main program to game_mm
+// ============================================================================
#include "../engines.h"
#include "../conf_gfx.h"
-/* ========================================================================= */
-/* functions and definitions that are exported from game_mm to main program */
-/* ========================================================================= */
+// ============================================================================
+// functions and definitions that are exported from game_mm to main program
+// ============================================================================
#include "export.h"
-/* ========================================================================= */
-/* internal functions and definitions that are not exported to main program */
-/* ========================================================================= */
+// ============================================================================
+// internal functions and definitions that are not exported to main program
+// ============================================================================
-/* ------------------------------------------------------------------------- */
-/* constant definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// constant definitions
+// ----------------------------------------------------------------------------
-/* screen sizes and positions for MM engine */
+// screen sizes and positions for MM engine
extern int TILESIZE_VAR;
#define MAX_BUF_XSIZE SCR_FIELDX
#define MAX_BUF_YSIZE SCR_FIELDY
-/* often used screen positions */
+// often used screen positions
extern int SX, SY;
#define FULL_SYSIZE (2 + SYSIZE + 2)
-/* ------------------------------------------------------------------------- */
-/* data structure definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// data structure definitions
+// ----------------------------------------------------------------------------
-/* ------------------------------------------------------------------------- */
-/* exported variables */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// exported variables
+// ----------------------------------------------------------------------------
extern struct LevelInfo_MM native_mm_level;
extern int GfxFrame[MM_MAX_PLAYFIELD_WIDTH][MM_MAX_PLAYFIELD_HEIGHT];
-/* ------------------------------------------------------------------------- */
-/* exported functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// exported functions
+// ----------------------------------------------------------------------------
-#endif /* MAIN_MM_H */
+#endif // MAIN_MM_H
#include "mm_main.h"
-#define CHUNK_ID_LEN 4 /* IFF style chunk id length */
-#define CHUNK_SIZE_UNDEFINED 0 /* undefined chunk size == 0 */
-#define CHUNK_SIZE_NONE -1 /* do not write chunk size */
-#define FILE_VERS_CHUNK_SIZE 8 /* size of file version chunk */
-#define LEVEL_HEADER_SIZE 80 /* size of level file header */
-#define LEVEL_HEADER_UNUSED 19 /* unused level header bytes */
-
-/* file identifier strings */
+#define CHUNK_ID_LEN 4 // IFF style chunk id length
+#define CHUNK_SIZE_UNDEFINED 0 // undefined chunk size == 0
+#define CHUNK_SIZE_NONE -1 // do not write chunk size
+#define FILE_VERS_CHUNK_SIZE 8 // size of file version chunk
+#define LEVEL_HEADER_SIZE 80 // size of level file header
+#define LEVEL_HEADER_UNUSED 19 // unused level header bytes
+
+// file identifier strings
#define LEVEL_COOKIE_TMPL "MIRRORMAGIC_LEVEL_FILE_VERSION_x.x"
#define SCORE_COOKIE "MIRRORMAGIC_SCORE_FILE_VERSION_1.4"
};
-/* ========================================================================= */
-/* level file functions */
-/* ========================================================================= */
+// ============================================================================
+// level file functions
+// ============================================================================
static void ReadChunk_MM_VERS(File *file, int *file_version, int *game_version)
{
file_version_major = getFile8Bit(file);
file_version_minor = getFile8Bit(file);
file_version_patch = getFile8Bit(file);
- getFile8Bit(file); /* not used */
+ getFile8Bit(file); // not used
game_version_major = getFile8Bit(file);
game_version_minor = getFile8Bit(file);
game_version_patch = getFile8Bit(file);
- getFile8Bit(file); /* not used */
+ getFile8Bit(file); // not used
*file_version = MM_VERSION_IDENT(file_version_major,
file_version_minor,
fputc(file_version_major, file);
fputc(file_version_minor, file);
fputc(file_version_patch, file);
- fputc(0, file); /* not used */
+ fputc(0, file); // not used
fputc(game_version_major, file);
fputc(game_version_minor, file);
fputc(game_version_patch, file);
- fputc(0, file); /* not used */
+ fputc(0, file); // not used
}
void setLevelInfoToDefaults_MM(void)
native_mm_level.file_version = MM_FILE_VERSION_ACTUAL;
native_mm_level.game_version = MM_GAME_VERSION_ACTUAL;
- native_mm_level.encoding_16bit_field = FALSE; /* default: only 8-bit elements */
+ native_mm_level.encoding_16bit_field = FALSE; // default: only 8-bit elements
native_mm_level.fieldx = STD_LEV_FIELDX;
native_mm_level.fieldy = STD_LEV_FIELDY;
{ NULL, 0, NULL }
};
- /* always start with reliable default values */
+ // always start with reliable default values
setLevelInfoToDefaults_MM();
if (!(file = openFile(filename, MODE_READ)))
getFileChunk(file, chunk_name, NULL, BYTE_ORDER_BIG_ENDIAN);
if (strcmp(chunk_name, "MMII") == 0)
{
- getFile32BitInteger(file, BYTE_ORDER_BIG_ENDIAN); /* not used */
+ getFile32BitInteger(file, BYTE_ORDER_BIG_ENDIAN); // not used
getFileChunk(file, chunk_name, NULL, BYTE_ORDER_BIG_ENDIAN);
if (strcmp(chunk_name, "CAVE") != 0)
return FALSE;
}
}
- else /* check for pre-2.0 file format with cookie string */
+ else // check for pre-2.0 file format with cookie string
{
strcpy(cookie, chunk_name);
getStringFromFile(file, &cookie[4], MAX_LINE_LEN - 4);
}
else
{
- /* call function to load this level chunk */
+ // call function to load this level chunk
int chunk_size_expected =
(chunk_info[i].loader)(file, chunk_size, &native_mm_level);
return;
}
- /* check level field for 16-bit elements */
+ // check level field for 16-bit elements
native_mm_level.encoding_16bit_field = FALSE;
for (y = 0; y < native_mm_level.fieldy; y++)
#include "mm_game.h"
#include "mm_tools.h"
-/* graphic position values for game controls */
+// graphic position values for game controls
#define ENERGY_XSIZE 32
#define ENERGY_YSIZE MAX_LASER_ENERGY
#define OVERLOAD_XSIZE ENERGY_XSIZE
#define OVERLOAD_YSIZE MAX_LASER_OVERLOAD
-/* values for Explode_MM() */
+// values for Explode_MM()
#define EX_PHASE_START 0
#define EX_NORMAL 0
#define EX_KETTLE 1
#define EX_SHORT 2
-/* special positions in the game control window (relative to control window) */
+// special positions in the game control window (relative to control window)
#define XX_LEVEL 36
#define YY_LEVEL 23
#define XX_KETTLES 29
#define XX_OVERLOAD 60
#define YY_OVERLOAD YY_ENERGY
-/* special positions in the game control window (relative to main window) */
+// special positions in the game control window (relative to main window)
#define DX_LEVEL (DX + XX_LEVEL)
#define DY_LEVEL (DY + YY_LEVEL)
#define DX_KETTLES (DX + XX_KETTLES)
#define IS_LOOP_SOUND(s) ((s) == SND_FUEL)
#define IS_MUSIC_SOUND(s) ((s) == SND_TYGER || (s) == SND_VOYAGER)
-/* game button identifiers */
+// game button identifiers
#define GAME_CTRL_ID_LEFT 0
#define GAME_CTRL_ID_MIDDLE 1
#define GAME_CTRL_ID_RIGHT 2
#define NUM_GAME_BUTTONS 3
-/* values for DrawLaser() */
+// values for DrawLaser()
#define DL_LASER_DISABLED 0
#define DL_LASER_ENABLED 1
-/* values for 'click_delay_value' in ClickElement() */
-#define CLICK_DELAY_FIRST 12 /* delay (frames) after first click */
-#define CLICK_DELAY 6 /* delay (frames) for pressed butten */
+// values for 'click_delay_value' in ClickElement()
+#define CLICK_DELAY_FIRST 12 // delay (frames) after first click
+#define CLICK_DELAY 6 // delay (frames) for pressed butten
#define AUTO_ROTATE_DELAY CLICK_DELAY
#define INIT_GAME_ACTIONS_DELAY (ONE_SECOND_DELAY / GAME_FRAME_DELAY)
program.headless = last_headless; \
} \
-/* forward declaration for internal use */
+// forward declaration for internal use
static int MovingOrBlocked2Element_MM(int, int);
static void Bang_MM(int, int);
static void RaiseScore_MM(int);
static void ContinueMoving_MM(int, int);
static void Moving2Blocked_MM(int, int, int *, int *);
-/* bitmap for laser beam detection */
+// bitmap for laser beam detection
static Bitmap *laser_bitmap = NULL;
-/* variables for laser control */
+// variables for laser control
static int last_LX = 0, last_LY = 0, last_hit_mask = 0;
static int hold_x = -1, hold_y = -1;
-/* variables for pacman control */
+// variables for pacman control
static int pacman_nr = -1;
-/* various game engine delay counters */
+// various game engine delay counters
static unsigned int rotate_delay = 0;
static unsigned int pacman_delay = 0;
static unsigned int energy_delay = 0;
static unsigned int overload_delay = 0;
-/* element masks for scanning pixels of MM elements */
+// element masks for scanning pixels of MM elements
static const char mm_masks[10][16][16 + 1] =
{
{
{
int opposite_angle = angle + ANG_RAY_180;
- /* make sure "opposite_angle" is in valid interval [0, 15] */
+ // make sure "opposite_angle" is in valid interval [0, 15]
return (opposite_angle + 16) % 16;
}
{
int reflected_angle = 16 - laser_angle + mirror_angle;
- /* make sure "reflected_angle" is in valid interval [0, 15] */
+ // make sure "reflected_angle" is in valid interval [0, 15]
return (reflected_angle + 16) % 16;
}
{
if (Feld[x][y] == EL_EXIT_CLOSED)
{
- /* initiate opening animation of exit door */
+ // initiate opening animation of exit door
Feld[x][y] = EL_EXIT_OPENING;
exit_element = EL_EXIT_OPEN;
}
else if (IS_RECEIVER(Feld[x][y]))
{
- /* remove field that blocks receiver */
+ // remove field that blocks receiver
int phase = Feld[x][y] - EL_RECEIVER_START;
int blocking_x, blocking_y;
{
static int steps_grid_auto = 0;
- if (game_mm.num_cycle == 0) /* initialize cycle steps for grids */
+ if (game_mm.num_cycle == 0) // initialize cycle steps for grids
steps_grid_auto = RND(16) * (RND(2) ? -1 : +1);
if (IS_GRID_STEEL_AUTO(element) ||
{
int i;
- if (game_mm.num_cycle == 0) /* no elements to cycle */
+ if (game_mm.num_cycle == 0) // no elements to cycle
return;
for (i = 0; i < game_mm.num_cycle; i++)
laser.dest_element = EL_EMPTY;
laser.wall_mask = 0;
- AddLaserEdge(LX, LY); /* set laser starting edge */
+ AddLaserEdge(LX, LY); // set laser starting edge
pen_ray = GetPixelFromRGB(window,
native_mm_level.laser_red * 0xFF,
BEGIN_NO_HEADLESS
{
- /* initialize laser bitmap to current playfield (screen) size */
+ // initialize laser bitmap to current playfield (screen) size
ReCreateBitmap(&laser_bitmap, drawto->width, drawto->height);
ClearRectangle(laser_bitmap, 0, 0, drawto->width, drawto->height);
}
END_NO_HEADLESS
- /* set global game control values */
+ // set global game control values
game_mm.num_cycle = 0;
game_mm.num_pacman = 0;
game_mm.laser_overload_value = 0;
game_mm.laser_enabled = FALSE;
- /* set global laser control values (must be set before "InitLaser()") */
+ // set global laser control values (must be set before "InitLaser()")
laser.start_edge.x = 0;
laser.start_edge.y = 0;
laser.start_angle = 0;
InitLaser();
#if 0
- /* copy default game door content to main double buffer */
+ // copy default game door content to main double buffer
BlitBitmap(pix[PIX_DOOR], drawto,
DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
#endif
#endif
#if 0
- /* copy actual game door content to door double buffer for OpenDoor() */
+ // copy actual game door content to door double buffer for OpenDoor()
BlitBitmap(drawto, pix[PIX_DB_DOOR],
DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
#endif
LX, LY, LX / TILEX, LY / TILEY, LX % TILEX, LY % TILEY);
#endif
- /* follow laser beam until it hits something (at least the screen border) */
+ // follow laser beam until it hits something (at least the screen border)
while (hit_mask == HIT_MASK_NO_HIT)
{
int i;
#if 0
- /* for safety */
+ // for safety
if (SX + LX < REAL_SX || SX + LX >= REAL_SX + FULL_SXSIZE ||
SY + LY < REAL_SY || SY + LY >= REAL_SY + FULL_SYSIZE)
{
int py = LY + (i / 2) * 2;
int dx = px % TILEX;
int dy = py % TILEY;
- int lx = (px + TILEX) / TILEX - 1; /* ...+TILEX...-1 to get correct */
- int ly = (py + TILEY) / TILEY - 1; /* negative values! */
+ int lx = (px + TILEX) / TILEX - 1; // ...+TILEX...-1 to get correct
+ int ly = (py + TILEY) / TILEY - 1; // negative values!
Pixel pixel;
if (IN_LEV_FIELD(lx, ly))
if (hit_mask == HIT_MASK_NO_HIT)
{
- /* hit nothing -- go on with another step */
+ // hit nothing -- go on with another step
LX += XS;
LY += YS;
}
int element;
int end = 0, rf = laser.num_edges;
- /* do not scan laser again after the game was lost for whatever reason */
+ // do not scan laser again after the game was lost for whatever reason
if (game_mm.game_over)
return;
LX, LY, XS, YS);
#endif
- /* hit something -- check out what it was */
+ // hit something -- check out what it was
ELX = (LX + XS) / TILEX;
ELY = (LY + YS) / TILEY;
{
/* we have hit the top-left and bottom-right element --
choose the top-left one */
- /* !!! SEE ABOVE !!! */
+ // !!! SEE ABOVE !!!
ELX = (LX - 2) / TILEX;
ELY = (LY - 2) / TILEY;
}
}
#endif
- /* now draw the laser to the backbuffer and (if enabled) to the screen */
+ // now draw the laser to the backbuffer and (if enabled) to the screen
DrawLaserLines(&laser.edge[start_edge], num_edges, mode);
redraw_mask |= REDRAW_FIELD;
if (mode == DL_LASER_ENABLED)
return;
- /* after the laser was deleted, the "damaged" graphics must be restored */
+ // after the laser was deleted, the "damaged" graphics must be restored
if (laser.num_damages)
{
int damage_start = 0;
int i;
- /* determine the starting edge, from which graphics need to be restored */
+ // determine the starting edge, from which graphics need to be restored
if (start_edge > 0)
{
for (i = 0; i < laser.num_damages; i++)
}
}
- /* restore graphics from this starting edge to the end of damage list */
+ // restore graphics from this starting edge to the end of damage list
for (i = damage_start; i < laser.num_damages; i++)
{
int lx = laser.damage[i].x;
laser.num_beamers > 0 &&
start_edge == laser.beamer_edge[laser.num_beamers - 1])
{
- /* element is outgoing beamer */
+ // element is outgoing beamer
laser.num_damages = damage_start + 1;
if (IS_BEAMER(element))
}
else
{
- /* element is incoming beamer or other element */
+ // element is incoming beamer or other element
laser.num_damages = damage_start;
laser.current_angle = laser.damage[laser.num_damages].angle;
}
}
else
{
- /* no damages but McDuffin himself (who needs to be redrawn anyway) */
+ // no damages but McDuffin himself (who needs to be redrawn anyway)
elx = laser.start_edge.x;
ely = laser.start_edge.y;
printf("element == %d\n", element);
#endif
- if (IS_22_5_ANGLE(laser.current_angle)) /* neither 90° nor 45° angle */
+ if (IS_22_5_ANGLE(laser.current_angle)) // neither 90° nor 45° angle
step_size = ((IS_BEAMER(element) || IS_FIBRE_OPTIC(element)) ? 4 : 3);
else
step_size = 8;
(laser.num_beamers == 0 ||
start_edge != laser.beamer_edge[laser.num_beamers - 1])))
{
- /* element is incoming beamer or other element */
+ // element is incoming beamer or other element
step_size = -step_size;
laser.num_edges--;
}
return;
}
- /* check if laser is interrupted by beamer element */
+ // check if laser is interrupted by beamer element
if (laser.num_beamers > 0 &&
start_edge < laser.beamer_edge[laser.num_beamers - 1])
{
int i;
int tmp_start_edge = start_edge;
- /* draw laser segments forward from the start to the last beamer */
+ // draw laser segments forward from the start to the last beamer
for (i = 0; i < laser.num_beamers; i++)
{
int tmp_num_edges = laser.beamer_edge[i] - tmp_start_edge;
tmp_start_edge = laser.beamer_edge[i];
}
- /* draw last segment from last beamer to the end */
+ // draw last segment from last beamer to the end
DrawLaserExt(tmp_start_edge, laser.num_edges - tmp_start_edge,
DL_LASER_ENABLED);
}
int last_num_edges = laser.num_edges;
int num_beamers = laser.num_beamers;
- /* delete laser segments backward from the end to the first beamer */
+ // delete laser segments backward from the end to the first beamer
for (i = num_beamers - 1; i >= 0; i--)
{
int tmp_num_edges = last_num_edges - laser.beamer_edge[i];
if (last_num_edges - start_edge == 1 && start_edge > 0)
DrawLaserLines(&laser.edge[start_edge - 1], 2, DL_LASER_DISABLED);
- /* delete first segment from start to the first beamer */
+ // delete first segment from start to the first beamer
DrawLaserExt(start_edge, last_num_edges - start_edge, DL_LASER_DISABLED);
}
}
AddDamagedField(ELX, ELY);
- /* this is more precise: check if laser would go through the center */
+ // this is more precise: check if laser would go through the center
if ((ELX * TILEX + 14 - LX) * YS != (ELY * TILEY + 14 - LY) * XS)
{
- /* skip the whole element before continuing the scan */
+ // skip the whole element before continuing the scan
do
{
LX += XS;
XS = 2 * Step[laser.current_angle].x;
YS = 2 * Step[laser.current_angle].y;
- if (!IS_22_5_ANGLE(laser.current_angle)) /* 90° or 45° angle */
+ if (!IS_22_5_ANGLE(laser.current_angle)) // 90° or 45° angle
step_size = 8;
else
step_size = 4;
LY += step_size * YS;
#if 0
- /* draw sparkles on mirror */
+ // draw sparkles on mirror
if ((IS_MIRROR(element) || IS_MIRROR_FIXED(element)) &&
current_angle != laser.current_angle)
{
boolean HitOnlyAnEdge(int element, int hit_mask)
{
- /* check if the laser hit only the edge of an element and, if so, go on */
+ // check if the laser hit only the edge of an element and, if so, go on
#if 0
printf("LX, LY, hit_mask == %d, %d, %d\n", LX, LY, hit_mask);
hit_mask == HIT_MASK_TOPRIGHT ||
hit_mask == HIT_MASK_BOTTOMLEFT ||
hit_mask == HIT_MASK_BOTTOMRIGHT) &&
- laser.current_angle % 4) /* angle is not 90° */
+ laser.current_angle % 4) // angle is not 90°
{
int dx, dy;
dx = -1;
dy = +1;
}
- else /* (hit_mask == HIT_MASK_BOTTOMRIGHT) */
+ else // (hit_mask == HIT_MASK_BOTTOMRIGHT)
{
dx = +1;
dy = +1;
if (laser.current_angle == grid_angle ||
laser.current_angle == get_opposite_angle(grid_angle))
{
- /* skip the whole element before continuing the scan */
+ // skip the whole element before continuing the scan
do
{
LX += XS;
{
return HitReflectingWalls(element, hit_mask);
}
- else /* IS_GRID_WOOD */
+ else // IS_GRID_WOOD
{
return HitAbsorbingWalls(element, hit_mask);
}
boolean HitReflectingWalls(int element, int hit_mask)
{
- /* check if laser hits side of a wall with an angle that is not 90° */
+ // check if laser hits side of a wall with an angle that is not 90°
if (!IS_90_ANGLE(laser.current_angle) && (hit_mask == HIT_MASK_TOP ||
hit_mask == HIT_MASK_LEFT ||
hit_mask == HIT_MASK_RIGHT ||
if (!IS_DF_GRID(element))
AddLaserEdge(LX, LY);
- /* check if laser hits wall with an angle of 45° */
+ // check if laser hits wall with an angle of 45°
if (!IS_22_5_ANGLE(laser.current_angle))
{
if (hit_mask == HIT_MASK_TOP || hit_mask == HIT_MASK_BOTTOM)
laser.current_angle = get_mirrored_angle(laser.current_angle,
ANG_MIRROR_0);
}
- else /* hit_mask == HIT_MASK_LEFT || hit_mask == HIT_MASK_RIGHT */
+ else // hit_mask == HIT_MASK_LEFT || hit_mask == HIT_MASK_RIGHT
{
LY += 2 * YS;
laser.current_angle = get_mirrored_angle(laser.current_angle,
return FALSE;
}
- else /* hit_mask == HIT_MASK_LEFT || hit_mask == HIT_MASK_RIGHT */
+ else // hit_mask == HIT_MASK_LEFT || hit_mask == HIT_MASK_RIGHT
{
laser.current_angle = get_mirrored_angle(laser.current_angle,
ANG_MIRROR_90);
}
}
- /* reflection at the edge of reflecting DF style wall */
+ // reflection at the edge of reflecting DF style wall
if (IS_DF_WALL_STEEL(element) && IS_22_5_ANGLE(laser.current_angle))
{
if (((laser.current_angle == 1 || laser.current_angle == 3) &&
}
}
- /* reflection inside an edge of reflecting DF style wall */
+ // reflection inside an edge of reflecting DF style wall
if (IS_DF_WALL_STEEL(element) && IS_22_5_ANGLE(laser.current_angle))
{
if (((laser.current_angle == 1 || laser.current_angle == 3) &&
}
}
- /* check if laser hits DF style wall with an angle of 90° */
+ // check if laser hits DF style wall with an angle of 90°
if (IS_DF_WALL(element) && IS_90_ANGLE(laser.current_angle))
{
if ((IS_HORIZ_ANGLE(laser.current_angle) &&
(IS_VERT_ANGLE(laser.current_angle) &&
(!(hit_mask & HIT_MASK_LEFT) || !(hit_mask & HIT_MASK_RIGHT))))
{
- /* laser at last step touched nothing or the same side of the wall */
+ // laser at last step touched nothing or the same side of the wall
if (LX != last_LX || LY != last_LY || hit_mask == last_hit_mask)
{
AddDamagedField(ELX, ELY);
{
int mask;
- mask = (LX + XS) / MINI_TILEX - ELX * 2 + 1; /* Quadrant (horizontal) */
- mask <<= (((LY + YS) / MINI_TILEY - ELY * 2) > 0) * 2; /* || (vertical) */
+ mask = (LX + XS) / MINI_TILEX - ELX * 2 + 1; // Quadrant (horizontal)
+ mask <<= (((LY + YS) / MINI_TILEY - ELY * 2) > 0) * 2; // || (vertical)
- /* check if laser hits wall with an angle of 90° */
+ // check if laser hits wall with an angle of 90°
if (IS_90_ANGLE(laser.current_angle))
mask += mask * (2 + IS_HORIZ_ANGLE(laser.current_angle) * 2);
{
int delay = 6;
- if (!MovDelay[x][y]) /* next animation frame */
+ if (!MovDelay[x][y]) // next animation frame
MovDelay[x][y] = 4 * delay;
- if (MovDelay[x][y]) /* wait some time before next frame */
+ if (MovDelay[x][y]) // wait some time before next frame
{
int phase;
{
int delay = 2;
- if (!MovDelay[x][y]) /* next animation frame */
+ if (!MovDelay[x][y]) // next animation frame
MovDelay[x][y] = 50 * delay;
- if (MovDelay[x][y]) /* wait some time before next frame */
+ if (MovDelay[x][y]) // wait some time before next frame
{
MovDelay[x][y]--;
int frames = 5;
int delay = 5;
- if (!MovDelay[x][y]) /* next animation frame */
+ if (!MovDelay[x][y]) // next animation frame
MovDelay[x][y] = frames * delay;
- if (MovDelay[x][y]) /* wait some time before next frame */
+ if (MovDelay[x][y]) // wait some time before next frame
{
int phase;
int wall_mask = Store2[x][y];
int frames = 5;
int delay = 1;
- if (!MovDelay[x][y]) /* next animation frame */
+ if (!MovDelay[x][y]) // next animation frame
MovDelay[x][y] = frames * delay;
- if (MovDelay[x][y]) /* wait some time before next frame */
+ if (MovDelay[x][y]) // wait some time before next frame
{
int phase;
int wall_mask = Store2[x][y];
laser.redraw = TRUE;
- if (phase == EX_PHASE_START) /* initialize 'Store[][]' field */
+ if (phase == EX_PHASE_START) // initialize 'Store[][]' field
{
int center_element = Feld[x][y];
if (IS_MOVING(x, y) || IS_BLOCKED(x, y))
{
- /* put moving element to center field (and let it explode there) */
+ // put moving element to center field (and let it explode there)
center_element = MovingOrBlocked2Element_MM(x, y);
RemoveMovingField_MM(x, y);
{
int newx, newy;
- if (MovDelay[x][y]) /* wait some time before next movement */
+ if (MovDelay[x][y]) // wait some time before next movement
{
MovDelay[x][y]--;
return;
}
- /* now make next step */
+ // now make next step
- Moving2Blocked_MM(x, y, &newx, &newy); /* get next screen position */
+ Moving2Blocked_MM(x, y, &newx, &newy); // get next screen position
if (element == EL_PACMAN &&
IN_LEV_FIELD(newx, newy) && IS_EATABLE4PACMAN(Feld[newx][newy]) &&
else if (!IN_LEV_FIELD(newx, newy) || !IS_FREE(newx, newy) ||
ObjHit(newx, newy, HIT_POS_CENTER))
{
- /* object was running against a wall */
+ // object was running against a wall
TurnRound(x, y);
MovPos[x][y] += step;
- if (ABS(MovPos[x][y]) >= TILEX) /* object reached its destination */
+ if (ABS(MovPos[x][y]) >= TILEX) // object reached its destination
{
Feld[x][y] = EL_EMPTY;
Feld[newx][newy] = element;
}
}
}
- else /* still moving on */
+ else // still moving on
{
DrawField_MM(x, y);
}
if (button == -1)
{
- /* initialize static variables */
+ // initialize static variables
click_delay = 0;
click_delay_value = CLICK_DELAY;
new_button = TRUE;
return FALSE;
}
- /* do not rotate objects hit by the laser after the game was solved */
+ // do not rotate objects hit by the laser after the game was solved
if (game_mm.level_solved && Hit[x][y])
return FALSE;
new_button = TRUE;
click_delay_value = CLICK_DELAY;
- /* release eventually hold auto-rotating mirror */
+ // release eventually hold auto-rotating mirror
RotateMirror(x, y, MB_RELEASED);
return FALSE;
if (!FrameReached(&click_delay, click_delay_value) && !new_button)
return FALSE;
- if (button == MB_MIDDLEBUTTON) /* middle button has no function */
+ if (button == MB_MIDDLEBUTTON) // middle button has no function
return FALSE;
if (!IN_LEV_FIELD(x, y))
{
if (button == MB_RELEASED)
{
- /* release eventually hold auto-rotating mirror */
+ // release eventually hold auto-rotating mirror
hold_x = -1;
hold_y = -1;
{
int element = Feld[x][y];
- /* do not rotate objects hit by the laser after the game was solved */
+ // do not rotate objects hit by the laser after the game was solved
if (game_mm.level_solved && Hit[x][y])
continue;
AutoRotateMirrors();
#if 1
- /* !!! CHANGE THIS: REDRAW ONLY WHEN NEEDED !!! */
+ // !!! CHANGE THIS: REDRAW ONLY WHEN NEEDED !!!
- /* redraw after Explode_MM() ... */
+ // redraw after Explode_MM() ...
if (laser.redraw)
DrawLaser(0, DL_LASER_ENABLED);
laser.redraw = FALSE;
Store[ELX][ELY] = new_element + RND(get_num_elements(new_element));
Feld[ELX][ELY] = EL_GRAY_BALL_OPENING;
- /* !!! CHECK AGAIN: Laser on Polarizer !!! */
+ // !!! CHECK AGAIN: Laser on Polarizer !!!
ScanLaser();
return;
printf("NEW ELEMENT: (%d, %d)\n", ELX, ELY);
#endif
- /* above stuff: GRAY BALL -> PRISM !!! */
+ // above stuff: GRAY BALL -> PRISM !!!
/*
LX = ELX * TILEX + 14;
LY = ELY * TILEY + 14;
if (setup.sound_loops)
StopSound(SND_SIRR);
}
- else if (native_mm_level.time == 0) /* level without time limit */
+ else if (native_mm_level.time == 0) // level without time limit
{
if (setup.sound_loops)
PlaySoundExt(SND_SIRR, SOUND_MAX_VOLUME, SOUND_MAX_RIGHT,
}
if (level_editor_test_game)
- game_mm.score = -1; /* no highscore when playing from editor */
+ game_mm.score = -1; // no highscore when playing from editor
else if (level_nr < leveldir_current->last_level)
- raise_level = TRUE; /* advance to next level */
+ raise_level = TRUE; // advance to next level
if ((hi_pos = NewHiScore_MM()) >= 0)
{
{
if (game_mm.score > highscore[k].Score)
{
- /* player has made it to the hall of fame */
+ // player has made it to the hall of fame
if (k < MAX_SCORE_ENTRIES - 1)
{
for (l = k; l < MAX_SCORE_ENTRIES; l++)
if (!strcmp(setup.player_name, highscore[l].Name))
m = l;
- if (m == k) /* player's new highscore overwrites his old one */
+ if (m == k) // player's new highscore overwrites his old one
goto put_into_list;
#endif
#ifdef ONE_PER_NAME
else if (!strncmp(setup.player_name, highscore[k].Name,
MAX_PLAYER_NAME_LEN))
- break; /* player already there with a higher score */
+ break; // player already there with a higher score
#endif
}
}
-/* ------------------------------------------------------------------------- */
-/* Mirror Magic game engine snapshot handling functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// Mirror Magic game engine snapshot handling functions
+// ----------------------------------------------------------------------------
void SaveEngineSnapshotValues_MM(ListNode **buffers)
{
{
int x, y;
- /* stored engine snapshot buffers already restored at this point */
+ // stored engine snapshot buffers already restored at this point
game_mm = engine_snapshot_mm.game_mm;
laser = engine_snapshot_mm.laser;
char *element_info_mm[] =
{
- "empty space", /* 0 */
+ "empty space", // 0
"mirror (0\xb0)",
"mirror (11.25\xb0)",
"mirror (22.5\xb0)",
"mirror (67.5\xb0)",
"mirror (78.75\xb0)",
"mirror (90\xb0)",
- "mirror (101.25\xb0)", /* 10 */
+ "mirror (101.25\xb0)", // 10
"mirror (112.5\xb0)",
"mirror (123.75\xb0)",
"mirror (135\xb0)",
"fixed steel polarizer (0\xb0)",
"fixed steel polarizer (90\xb0)",
"fixed steel polarizer (45\xb0)",
- "fixed steel polarizer (135\xb0)", /* 20 */
+ "fixed steel polarizer (135\xb0)", // 20
"Gregor McDuffin (looking right)",
"Gregor McDuffin (looking up)",
"Gregor McDuffin (looking left)",
"opening exit",
"open exit",
"magic kettle",
- "bomb", /* 30 */
+ "bomb", // 30
"prism",
"steel wall",
"steel wall",
"steel wall",
"steel wall",
"steel wall",
- "steel wall", /* 40 */
+ "steel wall", // 40
"steel wall",
"steel wall",
"steel wall",
"steel wall",
"wooden wall",
"wooden wall",
- "wooden wall", /* 50 */
+ "wooden wall", // 50
"wooden wall",
"wooden wall",
"wooden wall",
"wooden wall",
"wooden wall",
"wooden wall",
- "wooden wall", /* 60 */
+ "wooden wall", // 60
"wooden wall",
"wooden wall",
"wooden wall",
"ice wall",
"ice wall",
"ice wall",
- "ice wall", /* 70 */
+ "ice wall", // 70
"ice wall",
"ice wall",
"ice wall",
"ice wall",
"ice wall",
"ice wall",
- "amoeba wall", /* 80 */
+ "amoeba wall", // 80
"amoeba wall",
"amoeba wall",
"amoeba wall",
"amoeba wall",
"amoeba wall",
"amoeba wall",
- "amoeba wall", /* 90 */
+ "amoeba wall", // 90
"amoeba wall",
"amoeba wall",
"amoeba wall",
"gray ball",
"teleporter (0\xb0)",
"teleporter (22.5\xb0)",
- "teleporter (45\xb0)", /* 100 */
+ "teleporter (45\xb0)", // 100
"teleporter (67.5\xb0)",
"teleporter (90\xb0)",
"teleporter (112.5\xb0)",
"teleporter (202.5\xb0)",
"teleporter (225\xb0)",
"teleporter (247.5\xb0)",
- "teleporter (270\xb0)", /* 110 */
+ "teleporter (270\xb0)", // 110
"teleporter (292.5\xb0)",
"teleporter (315\xb0)",
"teleporter (337.5\xb0)",
"pac man (starts moving left)",
"pac man (starts moving down)",
"polarizer (0\xb0)",
- "polarizer (11.25\xb0)", /* 120 */
+ "polarizer (11.25\xb0)", // 120
"polarizer (22.5\xb0)",
"polarizer (33.75\xb0)",
"polarizer (45\xb0)",
"polarizer (90\xb0)",
"polarizer (101.25\xb0)",
"polarizer (112.5\xb0)",
- "polarizer (123.75\xb0)", /* 130 */
+ "polarizer (123.75\xb0)", // 130
"polarizer (135\xb0)",
"polarizer (146.25\xb0)",
"polarizer (157.5\xb0)",
"two-way polarizer (45\xb0)",
"two-way polarizer (67.5\xb0)",
"fixed mirror (0\xb0)",
- "fixed mirror (45\xb0)", /* 140 */
+ "fixed mirror (45\xb0)", // 140
"fixed mirror (90\xb0)",
"fixed mirror (135\xb0)",
"reflecting stone lock",
"bonus ball",
"reflecting stone block",
"wooden lock",
- "extra energy ball (full)", /* 150 */
+ "extra energy ball (full)", // 150
"fixed wooden polarizer (0\xb0)",
"fixed wooden polarizer (90\xb0)",
"fixed wooden polarizer (45\xb0)",
"unused",
"unused",
"unused",
- "letter ' '", /* 160 */
+ "letter ' '", // 160
"letter '!'",
"letter '\"'",
"letter '#'",
"letter '''",
"letter '('",
"letter ')'",
- "letter '*'", /* 170 */
+ "letter '*'", // 170
"letter '+'",
"letter ','",
"letter '-'",
"letter '1'",
"letter '2'",
"letter '3'",
- "letter '4'", /* 180 */
+ "letter '4'", // 180
"letter '5'",
"letter '6'",
"letter '7'",
"letter ';'",
"letter '<'",
"letter '='",
- "letter '>'", /* 190 */
+ "letter '>'", // 190
"letter '?'",
"letter '@'",
"letter 'A'",
"letter 'E'",
"letter 'F'",
"letter 'G'",
- "letter 'H'", /* 200 */
+ "letter 'H'", // 200
"letter 'I'",
"letter 'J'",
"letter 'K'",
"letter 'O'",
"letter 'P'",
"letter 'Q'",
- "letter 'R'", /* 210 */
+ "letter 'R'", // 210
"letter 'S'",
"letter 'T'",
"letter 'U'",
"letter 'Y'",
"letter 'Z'",
"letter '\xc4'",
- "letter '\xd6'", /* 220 */
+ "letter '\xd6'", // 220
"letter '\xdc'",
"letter '^'",
"letter ''",
"letter ''",
"letter ''",
"letter ''",
- "letter ''", /* 230 */
+ "letter ''", // 230
"letter ''",
"letter ''",
"letter ''",
"letter ''",
"letter ''",
"letter ''",
- "mirror (0\xb0)", /* 240 */
+ "mirror (0\xb0)", // 240
"mirror (11.25\xb0)",
"mirror (22.5\xb0)",
"mirror (33.75\xb0)",
"mirror (78.75\xb0)",
"mirror (90\xb0)",
"mirror (101.25\xb0)",
- "mirror (112.5\xb0)", /* 250 */
+ "mirror (112.5\xb0)", // 250
"mirror (123.75\xb0)",
"mirror (135\xb0)",
"mirror (146.25\xb0)",
"fixed wooden polarizer (22.5\xb0)",
"fixed wooden polarizer (45\xb0)",
"fixed wooden polarizer (67.5\xb0)",
- "fixed wooden polarizer (90\xb0)", /* 260 */
+ "fixed wooden polarizer (90\xb0)", // 260
"fixed wooden polarizer (112.5\xb0)",
"fixed wooden polarizer (135\xb0)",
"fixed wooden polarizer (157.5\xb0)",
"fixed steel polarizer (67.5\xb0)",
"fixed steel polarizer (90\xb0)",
"fixed steel polarizer (112.5\xb0)",
- "fixed steel polarizer (135\xb0)", /* 270 */
+ "fixed steel polarizer (135\xb0)", // 270
"fixed steel polarizer (157.5\xb0)",
"deflektor style wooden wall",
"deflektor style wooden wall",
"deflektor style wooden wall",
"deflektor style wooden wall",
"deflektor style wooden wall",
- "deflektor style wooden wall", /* 280 */
+ "deflektor style wooden wall", // 280
"deflektor style wooden wall",
"deflektor style wooden wall",
"deflektor style wooden wall",
"deflektor style wooden wall",
"deflektor style steel wall",
"deflektor style steel wall",
- "deflektor style steel wall", /* 290 */
+ "deflektor style steel wall", // 290
"deflektor style steel wall",
"deflektor style steel wall",
"deflektor style steel wall",
"deflektor style steel wall",
"deflektor style steel wall",
"deflektor style steel wall",
- "deflektor style steel wall", /* 300 */
+ "deflektor style steel wall", // 300
"deflektor style steel wall",
"deflektor style steel wall",
"deflektor style steel wall",
"refractor",
"laser cannon (shooting right)",
"laser cannon (shooting up)",
- "laser cannon (shooting left)", /* 310 */
+ "laser cannon (shooting left)", // 310
"laser cannon (shooting down)",
"laser receiver (directed right)",
"laser receiver (directed up)",
"fibre optic (1b)",
"fibre optic (2a)",
"fibre optic (2b)",
- "fibre optic (3a)", /* 320 */
+ "fibre optic (3a)", // 320
"fibre optic (3b)",
"fibre optic (4a)",
"fibre optic (4b)",
"rotating mirror (33.75\xb0)",
"rotating mirror (45\xb0)",
"rotating mirror (56.25\xb0)",
- "rotating mirror (67.5\xb0)", /* 330 */
+ "rotating mirror (67.5\xb0)", // 330
"rotating mirror (78.75\xb0)",
"rotating mirror (90\xb0)",
"rotating mirror (101.25\xb0)",
"rotating mirror (146.25\xb0)",
"rotating mirror (157.5\xb0)",
"rotating mirror (168.75\xb0)",
- "rotating wooden polarizer (0\xb0)", /* 340 */
+ "rotating wooden polarizer (0\xb0)", // 340
"rotating wooden polarizer (22.5\xb0)",
"rotating wooden polarizer (45\xb0)",
"rotating wooden polarizer (67.5\xb0)",
"rotating wooden polarizer (157.5\xb0)",
"rotating steel polarizer (0\xb0)",
"rotating steel polarizer (22.5\xb0)",
- "rotating steel polarizer (45\xb0)", /* 350 */
+ "rotating steel polarizer (45\xb0)", // 350
"rotating steel polarizer (67.5\xb0)",
"rotating steel polarizer (90\xb0)",
"rotating steel polarizer (112.5\xb0)",
"red teleporter (22.5\xb0)",
"red teleporter (45\xb0)",
"red teleporter (67.5\xb0)",
- "red teleporter (90\xb0)", /* 360 */
+ "red teleporter (90\xb0)", // 360
"red teleporter (112.5\xb0)",
"red teleporter (135\xb0)",
"red teleporter (157.5\xb0)",
"red teleporter (247.5\xb0)",
"red teleporter (270\xb0)",
"red teleporter (292.5\xb0)",
- "red teleporter (315\xb0)", /* 370 */
+ "red teleporter (315\xb0)", // 370
"red teleporter (337.5\xb0)",
"yellow teleporter (0\xb0)",
"yellow teleporter (22.5\xb0)",
"yellow teleporter (112.5\xb0)",
"yellow teleporter (135\xb0)",
"yellow teleporter (157.5\xb0)",
- "yellow teleporter (180\xb0)", /* 380 */
+ "yellow teleporter (180\xb0)", // 380
"yellow teleporter (202.5\xb0)",
"yellow teleporter (225\xb0)",
"yellow teleporter (247.5\xb0)",
"yellow teleporter (337.5\xb0)",
"green teleporter (0\xb0)",
"green teleporter (22.5\xb0)",
- "green teleporter (45\xb0)", /* 390 */
+ "green teleporter (45\xb0)", // 390
"green teleporter (67.5\xb0)",
"green teleporter (90\xb0)",
"green teleporter (112.5\xb0)",
"green teleporter (202.5\xb0)",
"green teleporter (225\xb0)",
"green teleporter (247.5\xb0)",
- "green teleporter (270\xb0)", /* 400 */
+ "green teleporter (270\xb0)", // 400
"green teleporter (292.5\xb0)",
"green teleporter (315\xb0)",
"green teleporter (337.5\xb0)",
"blue teleporter (67.5\xb0)",
"blue teleporter (90\xb0)",
"blue teleporter (112.5\xb0)",
- "blue teleporter (135\xb0)", /* 410 */
+ "blue teleporter (135\xb0)", // 410
"blue teleporter (157.5\xb0)",
"blue teleporter (180\xb0)",
"blue teleporter (202.5\xb0)",
"blue teleporter (292.5\xb0)",
"blue teleporter (315\xb0)",
"blue teleporter (337.5\xb0)",
- "unknown", /* 420 */
+ "unknown", // 420
/*
"-------------------------------",
#define IN_LEV_FIELD(x, y) IN_FIELD(x, y, lev_fieldx, lev_fieldy)
#define IN_SCR_FIELD(x, y) IN_FIELD_MINMAX(x, y, BX1, BY1, BX2, BY2)
-/* values for 'Elementeigenschaften' */
+// values for 'Elementeigenschaften'
#define EP_BIT_GRID (1 << 0)
#define EP_BIT_MCDUFFIN (1 << 1)
#define EP_BIT_RECTANGLE (1 << 2)
#define WALL_BASE(e) ((e) & 0xfff0)
#define WALL_BITS(e) ((e) & 0x000f)
-/* Bitmaps with graphic file */
+// Bitmaps with graphic file
#define PIX_BACK 0
#define PIX_DOOR 1
#define PIX_TOONS 2
#define PIX_BIGFONT 4
#define PIX_SMALLFONT 5
#define PIX_MEDIUMFONT 6
-/* Bitmaps without graphic file */
+// Bitmaps without graphic file
#define PIX_DB_DOOR 7
#define NUM_PICTURES 7
#define NUM_BITMAPS 8
-/* boundaries of arrays etc. */
+// boundaries of arrays etc.
#define MAX_PLAYER_NAME_LEN 10
#define MAX_LEVEL_NAME_LEN 32
#define MAX_LEVEL_AUTHOR_LEN 32
#define MAX_SCORE_ENTRIES 100
-#define MAX_ELEMENTS 700 /* 500 static + 200 runtime */
+#define MAX_ELEMENTS 700 // 500 static + 200 runtime
-#define MICROLEVEL_SCROLL_DELAY 50 /* delay for scrolling micro level */
-#define MICROLEVEL_LABEL_DELAY 250 /* delay for micro level label */
+#define MICROLEVEL_SCROLL_DELAY 50 // delay for scrolling micro level
+#define MICROLEVEL_LABEL_DELAY 250 // delay for micro level label
-/* score for elements */
+// score for elements
#define SC_COLLECTIBLE 0
#define SC_UNUSED_1 1
#define SC_UNUSED_2 2
#define SC_LIGHTBALL 14
#define SC_UNUSED_15 15
-#define LEVEL_SCORE_ELEMENTS 16 /* level elements with score */
+#define LEVEL_SCORE_ELEMENTS 16 // level elements with score
struct HiScore_MM
extern char *element_info[];
extern int num_element_info;
-/* often used screen positions */
+// often used screen positions
#define DX 534
#define DY 60
#define EX DX
#define MICRO_FONT_STARTY (MICRO_DF_STARTY + 8 * MICRO_TILEY)
#define MICRO_FONT_PER_LINE 8
-/* wall positions (that can be OR'ed together) */
+// wall positions (that can be OR'ed together)
#define WALL_TOPLEFT 1
#define WALL_TOPRIGHT 2
#define WALL_BOTTOMLEFT 4
** 0 - 499: real elements, stored in level file
** 500 - 699: flag elements, only used at runtime
*/
-/* "real" level elements */
+// "real" level elements
#define EL_MM_START 0
#define EL_MM_START_1 EL_MM_START
#define EL_MM_START_2 240
-/* elements for "Deflektor" style levels */
+// elements for "Deflektor" style levels
#define EL_DF_START EL_MM_START_2
#define EL_DF_MIRROR_START EL_DF_START
#define EL_DF_MIRROR_END EL_DF_MIRROR_15
#define EL_GRID_WOOD_FIXED_START 256
-#define EL_GRID_WOOD_FIXED_00 (EL_GRID_WOOD_FIXED_START + 0) /* 0.0° */
-#define EL_GRID_WOOD_FIXED_01 (EL_GRID_WOOD_FIXED_START + 1) /* 22.5° */
-#define EL_GRID_WOOD_FIXED_02 (EL_GRID_WOOD_FIXED_START + 2) /* 45.0° */
-#define EL_GRID_WOOD_FIXED_03 (EL_GRID_WOOD_FIXED_START + 3) /* 67.5° */
-#define EL_GRID_WOOD_FIXED_04 (EL_GRID_WOOD_FIXED_START + 4) /* 90.0° */
-#define EL_GRID_WOOD_FIXED_05 (EL_GRID_WOOD_FIXED_START + 5) /* 112.5° */
-#define EL_GRID_WOOD_FIXED_06 (EL_GRID_WOOD_FIXED_START + 6) /* 135.0° */
-#define EL_GRID_WOOD_FIXED_07 (EL_GRID_WOOD_FIXED_START + 7) /* 157.5° */
+#define EL_GRID_WOOD_FIXED_00 (EL_GRID_WOOD_FIXED_START + 0) // 0.0°
+#define EL_GRID_WOOD_FIXED_01 (EL_GRID_WOOD_FIXED_START + 1) // 22.5°
+#define EL_GRID_WOOD_FIXED_02 (EL_GRID_WOOD_FIXED_START + 2) // 45.0°
+#define EL_GRID_WOOD_FIXED_03 (EL_GRID_WOOD_FIXED_START + 3) // 67.5°
+#define EL_GRID_WOOD_FIXED_04 (EL_GRID_WOOD_FIXED_START + 4) // 90.0°
+#define EL_GRID_WOOD_FIXED_05 (EL_GRID_WOOD_FIXED_START + 5) // 112.5°
+#define EL_GRID_WOOD_FIXED_06 (EL_GRID_WOOD_FIXED_START + 6) // 135.0°
+#define EL_GRID_WOOD_FIXED_07 (EL_GRID_WOOD_FIXED_START + 7) // 157.5°
#define EL_GRID_WOOD_FIXED_END EL_GRID_WOOD_FIXED_07
#define EL_GRID_STEEL_FIXED_START 264
-#define EL_GRID_STEEL_FIXED_00 (EL_GRID_STEEL_FIXED_START + 0) /* 0.0° */
-#define EL_GRID_STEEL_FIXED_01 (EL_GRID_STEEL_FIXED_START + 1) /* 22.5° */
-#define EL_GRID_STEEL_FIXED_02 (EL_GRID_STEEL_FIXED_START + 2) /* 45.0° */
-#define EL_GRID_STEEL_FIXED_03 (EL_GRID_STEEL_FIXED_START + 3) /* 67.5° */
-#define EL_GRID_STEEL_FIXED_04 (EL_GRID_STEEL_FIXED_START + 4) /* 90.0° */
-#define EL_GRID_STEEL_FIXED_05 (EL_GRID_STEEL_FIXED_START + 5) /* 112.5° */
-#define EL_GRID_STEEL_FIXED_06 (EL_GRID_STEEL_FIXED_START + 6) /* 135.0° */
-#define EL_GRID_STEEL_FIXED_07 (EL_GRID_STEEL_FIXED_START + 7) /* 157.5° */
+#define EL_GRID_STEEL_FIXED_00 (EL_GRID_STEEL_FIXED_START + 0) // 0.0°
+#define EL_GRID_STEEL_FIXED_01 (EL_GRID_STEEL_FIXED_START + 1) // 22.5°
+#define EL_GRID_STEEL_FIXED_02 (EL_GRID_STEEL_FIXED_START + 2) // 45.0°
+#define EL_GRID_STEEL_FIXED_03 (EL_GRID_STEEL_FIXED_START + 3) // 67.5°
+#define EL_GRID_STEEL_FIXED_04 (EL_GRID_STEEL_FIXED_START + 4) // 90.0°
+#define EL_GRID_STEEL_FIXED_05 (EL_GRID_STEEL_FIXED_START + 5) // 112.5°
+#define EL_GRID_STEEL_FIXED_06 (EL_GRID_STEEL_FIXED_START + 6) // 135.0°
+#define EL_GRID_STEEL_FIXED_07 (EL_GRID_STEEL_FIXED_START + 7) // 157.5°
#define EL_GRID_STEEL_FIXED_END EL_GRID_STEEL_FIXED_07
#define EL_DF_WALL_WOOD 272
#define EL_BEAMER_BLUE_START 404
#define EL_BEAMER_BLUE_END (EL_BEAMER_BLUE_START + 15)
-/* element definitions partially used for drawing graphics */
+// element definitions partially used for drawing graphics
#define EL_MCDUFFIN 420
#define EL_PACMAN 421
#define EL_FUSE_OFF 422
#define EL_MM_END_2 430
#define EL_MM_END EL_MM_END_2
-/* "real" (and therefore drawable) runtime elements */
+// "real" (and therefore drawable) runtime elements
#define EL_EXIT_OPENING 500
#define EL_EXIT_CLOSING 501
#define EL_GRAY_BALL_OPENING 502
#define EL_FIRST_RUNTIME_EL EL_EXIT_OPENING
-/* "unreal" (and therefore not drawable) runtime elements */
+// "unreal" (and therefore not drawable) runtime elements
#define EL_BLOCKED 600
#define EL_EXPLODING_OPAQUE 601
#define EL_EXPLODING_TRANSP 602
-/* dummy elements (never used as game elements, only used as graphics) */
+// dummy elements (never used as game elements, only used as graphics)
#define EL_MM_MASK_MCDUFFIN_RIGHT 700
#define EL_MM_MASK_MCDUFFIN_UP 701
#define EL_MM_MASK_MCDUFFIN_LEFT 702
#define NUM_TILES 512
-/* graphics from "MirrorScreen" */
+// graphics from "MirrorScreen"
#define GFX_EMPTY (-1)
-/* row 0 (0) */
+// row 0 (0)
#define GFX_MIRROR_START 0
#define GFX_MIRROR GFX_MIRROR_START
#define GFX_MIRROR_00 (GFX_MIRROR_START + 0)
#define GFX_MIRROR_14 (GFX_MIRROR_START + 14)
#define GFX_MIRROR_15 (GFX_MIRROR_START + 15)
#define GFX_MIRROR_END GFX_MIRROR_15
-/* row 1 (16) */
+// row 1 (16)
#define GFX_GRID_STEEL_START 16
#define GFX_GRID_STEEL GFX_GRID_STEEL_START
#define GFX_GRID_STEEL_00 (GFX_GRID_STEEL_START + 0)
#define GFX_EXIT_OPEN 27
#define GFX_KETTLE 28
#define GFX_EXPLOSION_KETTLE 29
-/* row 2 (32) */
+// row 2 (32)
#define GFX_PRISM 32
#define GFX_WALL_SEVERAL 33
#define GFX_WALL_ANIMATION 34
#define GFX_BALL_BLUE 45
#define GFX_BALL_YELLOW 46
#define GFX_BALL_GRAY 47
-/* row 3 (48) */
+// row 3 (48)
#define GFX_BEAMER_START 48
#define GFX_BEAMER_END 63
-/* row 4 (64) */
+// row 4 (64)
#define GFX_PACMAN_START 64
#define GFX_PACMAN GFX_PACMAN_START
#define GFX_PACMAN_RIGHT (GFX_PACMAN_START + 0)
#define GFX_EXPLOSION_START 72
#define GFX_EXPLOSION_SHORT 76
#define GFX_EXPLOSION_LAST 78
-/* row 5 (80) */
+// row 5 (80)
#define GFX_POLAR_START 80
#define GFX_POLAR_END 95
-/* row 6 (96) */
+// row 6 (96)
#define GFX_POLAR_CROSS_START 96
#define GFX_POLAR_CROSS GFX_POLAR_CROSS_START
#define GFX_POLAR_CROSS_00 (GFX_POLAR_CROSS_START + 0)
#define GFX_MIRROR_FIXED_01 (GFX_MIRROR_FIXED_START + 1)
#define GFX_MIRROR_FIXED_02 (GFX_MIRROR_FIXED_START + 2)
#define GFX_MIRROR_FIXED_03 (GFX_MIRROR_FIXED_START + 3)
-/* row 7 (112) */
+// row 7 (112)
#define GFX_BLOCK_STONE 112
#define GFX_GATE_WOOD 113
#define GFX_FUEL_FULL 114
#define GFX_GRID_WOOD_01 117
#define GFX_GRID_WOOD_02 118
#define GFX_GRID_WOOD_03 119
-/* row 8 (128) */
+// row 8 (128)
#define GFX_ARROW_BLUE_LEFT 128
#define GFX_ARROW_BLUE_RIGHT 129
#define GFX_ARROW_BLUE_UP 130
#define GFX_ARROW_RED_RIGHT 133
#define GFX_ARROW_RED_UP 134
#define GFX_ARROW_RED_DOWN 135
-/* row 9 (144) */
+// row 9 (144)
#define GFX_SCROLLBAR_BLUE 144
#define GFX_SCROLLBAR_RED 145
-/* row 10 (160) */
+// row 10 (160)
#define GFX_MASK_CIRCLE 160
#define GFX_MASK_RECTANGLE 161
#define GFX_MASK_RECTANGLE2 162
#define GFX_MASK_GRID_01 165
#define GFX_MASK_GRID_02 166
#define GFX_MASK_GRID_03 167
-/* row 11 (176) */
+// row 11 (176)
#define GFX_MASK_MCDUFFIN_00 176
#define GFX_MASK_MCDUFFIN_01 177
#define GFX_MASK_MCDUFFIN_02 178
#define GFX_MASK_MCDUFFIN_03 179
-/* pseudo-graphics; will be mapped to other graphics */
+// pseudo-graphics; will be mapped to other graphics
#define GFX_WALL_STEEL 192
#define GFX_WALL_WOOD 193
#define GFX_WALL_ICE 194
#define GFX_KUGEL_GELB GFX_BALL_YELLOW
#define GFX_KUGEL_GRAU GFX_BALL_GRAY
-/* graphics from "MirrorFont" */
+// graphics from "MirrorFont"
#define GFX_CHAR_START (GFX_START_MIRRORFONT)
#define GFX_CHAR_ASCII0 (GFX_CHAR_START - 32)
#define GFX_CHAR_AUSRUF (GFX_CHAR_ASCII0 + 33)
#define GFX_CHAR_COPY (GFX_CHAR_ASCII0 + 94)
#define GFX_CHAR_END (GFX_CHAR_START + 79)
-/* graphics from "MirrorDF" */
+// graphics from "MirrorDF"
#define GFX_DF_MIRROR_00 (GFX_START_MIRRORDF + 0 * DF_PER_LINE + 0)
#define GFX_DF_MIRROR_01 (GFX_START_MIRRORDF + 0 * DF_PER_LINE + 1)
#define GFX_DF_MIRROR_02 (GFX_START_MIRRORDF + 0 * DF_PER_LINE + 2)
#define GFX_FIBRE_OPTIC_ED_06 (GFX_START_MIRRORDF + 11 * DF_PER_LINE + 6)
#define GFX_FIBRE_OPTIC_ED_07 (GFX_START_MIRRORDF + 11 * DF_PER_LINE + 7)
-/* the names of the sounds */
+// the names of the sounds
#define SND_AMOEBE 0
#define SND_ANTIGRAV 1
#define SND_AUTSCH 2
#define NUM_SOUNDS 20
-/* values for graphics/sounds action types */
+// values for graphics/sounds action types
#define MM_ACTION_DEFAULT 0
#define MM_ACTION_WAITING 1
#define MM_ACTION_FALLING 2
#define MM_ACTION_SPLASHING 51
#define MM_ACTION_HITTING 52
-/* laser angles (directions) */
+// laser angles (directions)
#define ANG_RAY_RIGHT 0
#define ANG_RAY_UP 4
#define ANG_RAY_LEFT 8
#define ANG_RAY_DOWN 12
-/* laser angles (degree) */
+// laser angles (degree)
#define ANG_RAY_0 0
#define ANG_RAY_90 4
#define ANG_RAY_180 8
#define IS_HORIZ_ANGLE(angle) (!((angle) % 8))
#define IS_VERT_ANGLE(angle) ((angle) % 8)
-/* mirror angles */
+// mirror angles
#define ANG_MIRROR_0 0
#define ANG_MIRROR_45 4
#define ANG_MIRROR_90 8
#define ANG_MIRROR_135 12
-/* positions for checking where laser already hits element */
+// positions for checking where laser already hits element
#define HIT_POS_CENTER 1
#define HIT_POS_EDGE 2
#define HIT_POS_BETWEEN 4
-/* masks for scanning elements */
+// masks for scanning elements
#define HIT_MASK_NO_HIT 0
#define HIT_MASK_TOPLEFT 1
#define HIT_MASK_TOPRIGHT 2
#define HIT_MASK_BOTTOM (HIT_MASK_BOTTOMLEFT | HIT_MASK_BOTTOMRIGHT)
#define HIT_MASK_ALL (HIT_MASK_LEFT | HIT_MASK_RIGHT)
-/* step values for rotating elements */
+// step values for rotating elements
#define ROTATE_NO_ROTATING 0
#define ROTATE_LEFT (+1)
#define ROTATE_RIGHT (-1)
(button) == MB_RIGHTBUTTON ? ROTATE_RIGHT : \
ROTATE_NO_ROTATING)
-/* game over values */
+// game over values
#define GAME_OVER_NO_ENERGY 1
#define GAME_OVER_OVERLOADED 2
#define GAME_OVER_BOMB 3
-/* values for game_status */
+// values for game_status
#define EXITGAME 0
#define MAINMENU 1
#define PLAYING 2
#define HALLOFFAME 7
#define SETUP 8
-/* return values for GameActions */
+// return values for GameActions
#define ACT_GO_ON 0
#define ACT_GAME_OVER 1
#define ACT_NEW_GAME 2
-/* values for color_status */
+// values for color_status
#define STATIC_COLORS 0
#define DYNAMIC_COLORS 1
#define X11_ICONMASK_FILENAME "mirrormagic_iconmask.xbm"
#define MSDOS_POINTER_FILENAME "mouse.pcx"
-/* functions for version handling */
+// functions for version handling
#define MM_VERSION_IDENT(x,y,z) VERSION_IDENT(x,y,z,0)
#define MM_VERSION_MAJOR(x) VERSION_PART_1(x)
#define MM_VERSION_MINOR(x) VERSION_PART_2(x)
PROGRAM_VERSION_MINOR, \
PROGRAM_VERSION_PATCH)
-/* sound control */
+// sound control
#define ST(x) (((x) - 8) * 16)
-#endif /* MM_MAIN_H */
+#endif // MM_MAIN_H
return;
}
- if (dx || dy) /* Verschiebung der Grafik? */
+ if (dx || dy) // Verschiebung der Grafik?
{
- if (x < BX1) /* Element kommt von links ins Bild */
+ if (x < BX1) // Element kommt von links ins Bild
{
x = BX1;
width = dx;
cx = TILEX - dx;
dx = 0;
}
- else if (x > BX2) /* Element kommt von rechts ins Bild */
+ else if (x > BX2) // Element kommt von rechts ins Bild
{
x = BX2;
width = -dx;
dx = TILEX + dx;
}
- else if (x==BX1 && dx < 0) /* Element verläßt links das Bild */
+ else if (x==BX1 && dx < 0) // Element verläßt links das Bild
{
width += dx;
cx = -dx;
dx = 0;
}
- else if (x==BX2 && dx > 0) /* Element verläßt rechts das Bild */
+ else if (x==BX2 && dx > 0) // Element verläßt rechts das Bild
width -= dx;
- else if (dx) /* allg. Bewegung in x-Richtung */
+ else if (dx) // allg. Bewegung in x-Richtung
MarkTileDirty(x + SIGN(dx), y);
- if (y < BY1) /* Element kommt von oben ins Bild */
+ if (y < BY1) // Element kommt von oben ins Bild
{
- if (cut_mode==CUT_BELOW) /* Element oberhalb des Bildes */
+ if (cut_mode==CUT_BELOW) // Element oberhalb des Bildes
return;
y = BY1;
cy = TILEY - dy;
dy = 0;
}
- else if (y > BY2) /* Element kommt von unten ins Bild */
+ else if (y > BY2) // Element kommt von unten ins Bild
{
y = BY2;
height = -dy;
dy = TILEY + dy;
}
- else if (y==BY1 && dy < 0) /* Element verläßt oben das Bild */
+ else if (y==BY1 && dy < 0) // Element verläßt oben das Bild
{
height += dy;
cy = -dy;
}
else if (dy > 0 && cut_mode == CUT_ABOVE)
{
- if (y == BY2) /* Element unterhalb des Bildes */
+ if (y == BY2) // Element unterhalb des Bildes
return;
height = dy;
cy = TILEY - dy;
dy = TILEY;
MarkTileDirty(x, y + 1);
- } /* Element verläßt unten das Bild */
+ } // Element verläßt unten das Bild
else if (dy > 0 && (y == BY2 || cut_mode == CUT_BELOW))
{
height -= dy;
}
- else if (dy) /* allg. Bewegung in y-Richtung */
+ else if (dy) // allg. Bewegung in y-Richtung
{
MarkTileDirty(x, y + SIGN(dy));
}
#include "main_mm.h"
-/* for DrawElementShifted */
+// for DrawElementShifted
#define NO_CUTTING 0
#define CUT_ABOVE (1 << 0)
#define CUT_BELOW (1 << 1)
#define CUT_LEFT (1 << 2)
#define CUT_RIGHT (1 << 3)
-/* for masking functions */
+// for masking functions
#define NO_MASKING 0
#define USE_MASKING 1
-/* for MoveDoor */
+// for MoveDoor
#define DOOR_OPEN_1 (1 << 0)
#define DOOR_OPEN_2 (1 << 1)
#define DOOR_CLOSE_1 (1 << 2)
#define DOOR_NO_DELAY (1 << 5)
#define DOOR_GET_STATE (1 << 6)
-/* for Request */
+// for Request
#define REQ_ASK (1 << 0)
#define REQ_OPEN (1 << 1)
#define REQ_CLOSE (1 << 2)
#define REQUEST_WAIT_FOR (REQ_ASK | REQ_CONFIRM)
-/* font types */
+// font types
#define FS_SMALL 0
#define FS_BIG 1
#define FS_MEDIUM 2
int SgnHighByte(int);
int ByteToInt(byte);
-#endif /* ASM_H */
+#endif // ASM_H
if (LowByte(PlayField16[si]) != fiTerminal)
return;
- /* use native frame handling (undo frame incrementation in main loop) */
+ // use native frame handling (undo frame incrementation in main loop)
if (game.use_native_sp_graphics_engine)
GfxFrame[lx][ly]--;
- /* get last random animation delay */
+ // get last random animation delay
bl = SgnHighByte(PlayField16[si]);
bl = bl + 1;
- if (bl <= 0) /* return if random animation delay not yet reached */
+ if (bl <= 0) // return if random animation delay not yet reached
{
MovHighByte(&PlayField16[si], bl);
return;
}
- /* calculate new random animation delay */
+ // calculate new random animation delay
bl = -(subGetRandomNumber() & TerminalMaxCycles); // generate new random number
MovHighByte(&PlayField16[si], bl); // save new sequence number
- /* check terminal state (active or inactive) */
+ // check terminal state (active or inactive)
bl = TerminalState[si] + 1;
if (bl == 8)
bl = 0;
void subRandomize(void);
int subGetRandomNumber(void);
-#endif /* BUGSTERMINALS_H */
+#endif // BUGSTERMINALS_H
{
int px = 2 * TILEX + (mScrollX - mScrollX_last) % TILEX;
- /* scroll correction for even number of visible tiles (half tile shifted) */
+ // scroll correction for even number of visible tiles (half tile shifted)
px += game_sp.scroll_xoffset;
if (ExplosionShakeMurphy != 0)
{
int py = 2 * TILEY + (mScrollY - mScrollY_last) % TILEY;
- /* scroll correction for even number of visible tiles (half tile shifted) */
+ // scroll correction for even number of visible tiles (half tile shifted)
py += game_sp.scroll_yoffset;
if (ExplosionShakeMurphy != 0)
return;
}
- /* check if scrolling the playfield requires redrawing the viewport bitmap */
+ // check if scrolling the playfield requires redrawing the viewport bitmap
if ((mScrollX != mScrollX_last ||
mScrollY != mScrollY_last) &&
(ABS(mScrollX - mScrollX_last) >= TILEX ||
if (element != GfxElementLast[x][y] &&
graphic == GfxGraphicLast[x][y])
{
- /* element changed, but not graphic => disable updating graphic */
+ // element changed, but not graphic => disable updating graphic
GfxElementLast[x][y] = element;
GfxGraphicLast[x][y] = GfxGraphic[x][y] = -1;
void BlitScreenToBitmap_SP(Bitmap *target_bitmap)
{
- /* copy playfield buffer to target bitmap at scroll position */
+ // copy playfield buffer to target bitmap at scroll position
int px = getFieldbufferOffsetX_SP();
int py = getFieldbufferOffsetY_SP();
void DDScrollBuffer_ScrollTowards(int X, int Y, double Step);
void DDScrollBuffer_SoftScrollTo(int X, int Y, int TimeMS, int FPS);
-#endif /* DDSCROLLBUFFER_H */
+#endif // DDSCROLLBUFFER_H
if (NoDisplayFlag)
return;
- /* do not draw fields that are outside the visible screen area */
+ // do not draw fields that are outside the visible screen area
if (pX < sx1 || pX > sx2 || pY < sy1 || pY > sy2)
return;
void DDSpriteBuffer_BltImg(int pX, int pY, int graphic, int sync_frame);
-#endif /* DDSPRITEBUFFER_H */
+#endif // DDSPRITEBUFFER_H
void ScrollTowards(int, int);
void SoftScrollTo(int, int, int, int);
-#endif /* DISPLAY_H */
+#endif // DISPLAY_H
ExplodeFieldSP(MurphyExplodePos); // Explode
LeadOutCounter = 0x40; // quit: start lead-out
- /* give Murphy some more time (LeadOutCounter) to reach the exit */
+ // give Murphy some more time (LeadOutCounter) to reach the exit
}
} // loc_g_22FB:
}
void subDoGameStuff(void);
-#endif /* DOGAMESTUFF_H */
+#endif // DOGAMESTUFF_H
void subElectronTurnLeft(int, int);
void subElectronTurnRight(int, int);
-#endif /* ELECTRONS_H */
+#endif // ELECTRONS_H
void subFollowUpExplosions(void);
void subRedDiskReleaseExplosion(void);
-#endif /* EXPLOSIONS_H */
+#endif // EXPLOSIONS_H
bPlaying = False;
menBorder = False;
- /* add preceding playfield buffer (as large as preceding memory area) */
+ // add preceding playfield buffer (as large as preceding memory area)
PlayField16 = checked_calloc((game_sp.preceding_buffer_size +
SP_MAX_PLAYFIELD_SIZE +
SP_HEADER_SIZE) * sizeof(int));
PlayField16 = &PlayField16[game_sp.preceding_buffer_size];
- /* add preceding playfield buffer (as large as one playfield row) */
+ // add preceding playfield buffer (as large as one playfield row)
PlayField8 = checked_calloc((SP_MAX_PLAYFIELD_WIDTH +
SP_MAX_PLAYFIELD_SIZE +
SP_HEADER_SIZE) * sizeof(byte));
extern int YellowDisksExploded;
extern int YawnSleepCounter;
-#endif /* GLOBALS_H */
+#endif // GLOBALS_H
void subAnimateInfotrons(int);
void subCleanUpForInfotronsAbove(int);
-#endif /* INFOTRONS_H */
+#endif // INFOTRONS_H
void subFetchAndInitLevelB(void);
void subInitGameConditions(void);
-#endif /* INITGAMECONDITIONS_H */
+#endif // INITGAMECONDITIONS_H
void subProcessKeyboardInput(byte);
-#endif /* INPUT_H */
+#endif // INPUT_H
{
DrawFrame(0);
- /* !!! CHECK THIS !!! */
+ // !!! CHECK THIS !!!
if (! menBorder)
DrawFrame(1);
}
int border1_offset = (menBorder ? 1 : 2);
int border2_offset = (menBorder ? 0 : TILESIZE / 2);
- /* scroll correction for border frame (1 tile) or border element (2 tiles) */
+ // scroll correction for border frame (1 tile) or border element (2 tiles)
ScrollMinX = 0;
ScrollMinY = 0;
ScrollMaxX = (DisplayMaxX + border1_offset - SCR_FIELDX) * TILEX;
ScrollMaxY = (DisplayMaxY + border1_offset - SCR_FIELDY) * TILEY;
- /* scroll correction for border element (half tile on left and right side) */
+ // scroll correction for border element (half tile on left and right side)
ScrollMinX += border2_offset;
ScrollMinY += border2_offset;
ScrollMaxX -= border2_offset;
ScrollMaxY -= border2_offset;
- /* scroll correction for even number of visible tiles (half tile shifted) */
+ // scroll correction for even number of visible tiles (half tile shifted)
ScrollMinX -= game_sp.scroll_xoffset;
ScrollMaxX -= game_sp.scroll_xoffset;
ScrollMinY -= game_sp.scroll_yoffset;
void Form_Load(void);
-#endif /* MAINFORM_H */
+#endif // MAINFORM_H
// lead-out done: exit now
// ---------------------- END OF GAME-BUSY LOOP (including lead-out) ---------
- /* if the game is not won when reaching this point, then it is lost */
+ // if the game is not won when reaching this point, then it is lost
if (!game_sp.LevelSolved)
game_sp.GameOver = TRUE;
}
{
int jump_pos = TILEX / 2;
- /* handle wrap-around */
+ // handle wrap-around
if (MurphyScreenXPos < -jump_pos)
{
MurphyScreenXPos = FieldWidth * TILEX + MurphyScreenXPos;
void subMainGameLoop_Main(byte, boolean);
void subCalculateScreenScrollPos(void);
-#endif /* MAINGAMELOOP_H */
+#endif // MAINGAMELOOP_H
void subExplodeSnikSnaksBelow(int);
void subSpPortTest(int);
-#endif /* MURPHY_H */
+#endif // MURPHY_H
void subAnimateOrangeDisks(int);
-#endif /* ORANGEDISK_H */
+#endif // ORANGEDISK_H
if (SnikSnaksElectronsFrozen == 1)
return;
- /* (not sure why this was removed -- this broke several level solutions) */
+ // (not sure why this was removed -- this broke several level solutions)
if (LowByte(PlayField16[si]) != fiSnikSnak)
return;
void subAnimateSnikSnaks(int);
void subDrawAnimatedSnikSnaks(int);
-#endif /* SNIKSNAKS_H */
+#endif // SNIKSNAKS_H
void subSoundFX(int, int, int);
-#endif /* GAME_SP_SOUND_H */
+#endif // GAME_SP_SOUND_H
void subAnimateZonks(int si);
-#endif /* ZONK_H */
+#endif // ZONK_H
#ifndef GAME_SP_EXPORT_H
#define GAME_SP_EXPORT_H
-/* ========================================================================= */
-/* functions and definitions exported from game_sp to main program */
-/* ========================================================================= */
+// ============================================================================
+// functions and definitions exported from game_sp to main program
+// ============================================================================
-/* ------------------------------------------------------------------------- */
-/* constant definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// constant definitions
+// ----------------------------------------------------------------------------
#define SP_MAX_PLAYFIELD_WIDTH MAX_PLAYFIELD_WIDTH
#define SP_MAX_PLAYFIELD_HEIGHT MAX_PLAYFIELD_HEIGHT
// use a much higher value to be able to load ultra-long MPX demo files
// (like for level collection 78, level 88 ("WAITING FOR GODOT AGAIN"))
// #define SP_MAX_TAPE_LEN 500000
-#define SP_MAX_TAPE_LEN 64010 /* (see "spfix63.doc") */
+#define SP_MAX_TAPE_LEN 64010 // (see "spfix63.doc")
-/* sound actions */
+// sound actions
#define actActive 0
#define actImpact 1
#define actDropping 8
-/* ------------------------------------------------------------------------- */
-/* data structure definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// data structure definitions
+// ----------------------------------------------------------------------------
#ifndef HAS_SpecialPortType
typedef struct
{
- short PortLocation; // = 2*(x+(y*60)) /* big endian format */
+ short PortLocation; // = 2*(x+(y*60)) // big endian format
byte Gravity; // 1 = turn on, anything else (0) = turn off
byte FreezeZonks; // 2 = turn on, anything else (0) = turn off (1=off!)
byte FreezeEnemies; // 1 = turn on, anything else (0) = turn off
SpecialPortType SpecialPort[10];
byte SpeedByte; // = Speed XOR Highbyte(RandomSeed)
byte CheckSumByte; // = CheckSum XOR SpeedByte
- short DemoRandomSeed; /* little endian format */
+ short DemoRandomSeed; // little endian format
} LevelInfoType;
#define HAS_LevelInfoType
#endif
boolean LevelSolved;
boolean GameOver;
- /* needed for updating panel */
+ // needed for updating panel
int time_played;
int infotrons_still_needed;
int red_disk_count;
int score;
- /* needed for engine snapshots */
+ // needed for engine snapshots
char **preceding_buffer;
int preceding_buffer_size;
struct DemoInfo_SP
{
- boolean is_available; /* structure contains valid demo */
+ boolean is_available; // structure contains valid demo
- int level_nr; /* number of corresponding level */
+ int level_nr; // number of corresponding level
- int length; /* number of demo entries */
- byte data[SP_MAX_TAPE_LEN]; /* array of demo entries */
+ int length; // number of demo entries
+ byte data[SP_MAX_TAPE_LEN]; // array of demo entries
};
struct LevelInfo_SP
struct DemoInfo_SP demo;
- /* used for runtime values */
+ // used for runtime values
struct GameInfo_SP *game_sp;
};
boolean has_crumbled_graphics;
boolean preserve_background;
- int unique_identifier; /* used to identify needed screen updates */
+ int unique_identifier; // used to identify needed screen updates
};
struct EngineSnapshotInfo_SP
};
-/* ------------------------------------------------------------------------- */
-/* exported functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// exported functions
+// ----------------------------------------------------------------------------
extern struct GlobalInfo_SP global_sp_info;
extern struct GameInfo_SP game_sp;
int getRedDiskReleaseFlag_SP(void);
-#endif /* GAME_SP_EXPORT_H */
+#endif // GAME_SP_EXPORT_H
#include "global.h"
-/* ------------------------------------------------------------------------- */
-/* functions for loading Supaplex level */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for loading Supaplex level
+// ----------------------------------------------------------------------------
static void setTapeInfoToDefaults_SP(void)
{
for (y = 0; y < native_sp_level.height; y++)
native_sp_level.playfield[x][y] = fiSpace;
- /* copy string (without terminating '\0' character!) */
+ // copy string (without terminating '\0' character!)
for (i = 0; i < SP_LEVEL_NAME_LEN; i++)
header->LevelTitle[i] = empty_title[i];
port->FreezeEnemies = 0;
}
- /* set raw header bytes (used for subsequent buffer zone) to "hardware" */
+ // set raw header bytes (used for subsequent buffer zone) to "hardware"
for (i = 0; i < SP_HEADER_SIZE; i++)
native_sp_level.header_raw_bytes[i] = 0x20;
FieldMax = (FieldWidth * FieldHeight) + HeaderSize - 1;
LevelMax = (FieldWidth * FieldHeight) - 1;
- /* initialize preceding playfield buffer */
+ // initialize preceding playfield buffer
for (i = -game_sp.preceding_buffer_size; i < 0; i++)
PlayField16[i] = 0;
- /* initialize preceding playfield buffer */
+ // initialize preceding playfield buffer
for (i = -SP_MAX_PLAYFIELD_WIDTH; i < 0; i++)
PlayField8[i] = 0;
for (i = 0; game_sp.preceding_buffer[i] != NULL; i++)
{
char *s = game_sp.preceding_buffer[i];
- boolean hi_byte = FALSE; /* little endian data => start with low byte */
+ boolean hi_byte = FALSE; // little endian data => start with low byte
while (s[0] != '\0' && s[1] != '\0')
{
for (x = 0; x < native_sp_level.width; x++)
PlayField8[count++] = native_sp_level.playfield[x][y];
- /* add raw header bytes to subsequent playfield buffer zone */
+ // add raw header bytes to subsequent playfield buffer zone
for (i = 0; i < SP_HEADER_SIZE; i++)
PlayField8[count++] = native_sp_level.header_raw_bytes[i];
LevelLoaded = True;
- /* random seed set by main game tape code to native random generator seed */
+ // random seed set by main game tape code to native random generator seed
}
static void LoadNativeLevelFromFileStream_SP(File *file, int width, int height,
native_sp_level.width = MIN(width, SP_MAX_PLAYFIELD_WIDTH);
native_sp_level.height = MIN(height, SP_MAX_PLAYFIELD_HEIGHT);
- /* read level playfield (width * height == 60 * 24 tiles == 1440 bytes) */
- /* (MPX levels may have non-standard playfield size -- check max. size) */
+ // read level playfield (width * height == 60 * 24 tiles == 1440 bytes)
+ // (MPX levels may have non-standard playfield size -- check max. size)
for (y = 0; y < height; y++)
{
for (x = 0; x < width; x++)
}
}
- /* read level header (96 bytes) */
+ // read level header (96 bytes)
- ReadUnusedBytesFromFile(file, 4); /* (not used by Supaplex engine) */
+ ReadUnusedBytesFromFile(file, 4); // (not used by Supaplex engine)
- /* initial gravity: 1 == "on", anything else (0) == "off" */
+ // initial gravity: 1 == "on", anything else (0) == "off"
header->InitialGravity = getFile8Bit(file);
- /* SpeedFixVersion XOR 0x20 */
+ // SpeedFixVersion XOR 0x20
header->Version = getFile8Bit(file);
- /* level title in uppercase letters, padded with dashes ("-") (23 bytes) */
+ // level title in uppercase letters, padded with dashes ("-") (23 bytes)
for (i = 0; i < SP_LEVEL_NAME_LEN; i++)
header->LevelTitle[i] = getFile8Bit(file);
- /* initial "freeze zonks": 2 == "on", anything else (0, 1) == "off" */
+ // initial "freeze zonks": 2 == "on", anything else (0, 1) == "off"
header->InitialFreezeZonks = getFile8Bit(file);
/* number of infotrons needed; 0 means that Supaplex will count the total
(a multiple of 256 infotrons will result in "0 infotrons needed"!) */
header->InfotronsNeeded = getFile8Bit(file);
- /* number of special ("gravity") port entries below (maximum 10 allowed) */
+ // number of special ("gravity") port entries below (maximum 10 allowed)
header->SpecialPortCount = getFile8Bit(file);
- /* database of properties of up to 10 special ports (6 bytes per port) */
+ // database of properties of up to 10 special ports (6 bytes per port)
for (i = 0; i < SP_MAX_SPECIAL_PORTS; i++)
{
SpecialPortType *port = &header->SpecialPort[i];
the 16 bit value here calculates as 2 * (x + (y * 60)) (this is twice
of what may be expected: Supaplex works with a game field in memory
which is 2 bytes per tile) */
- port->PortLocation = getFile16BitBE(file); /* yes, big endian */
+ port->PortLocation = getFile16BitBE(file); // yes, big endian
- /* change gravity: 1 == "turn on", anything else (0) == "turn off" */
+ // change gravity: 1 == "turn on", anything else (0) == "turn off"
port->Gravity = getFile8Bit(file);
- /* "freeze zonks": 2 == "turn on", anything else (0, 1) == "turn off" */
+ // "freeze zonks": 2 == "turn on", anything else (0, 1) == "turn off"
port->FreezeZonks = getFile8Bit(file);
- /* "freeze enemies": 1 == "turn on", anything else (0) == "turn off" */
+ // "freeze enemies": 1 == "turn on", anything else (0) == "turn off"
port->FreezeEnemies = getFile8Bit(file);
- ReadUnusedBytesFromFile(file, 1); /* (not used by Supaplex engine) */
+ ReadUnusedBytesFromFile(file, 1); // (not used by Supaplex engine)
}
- /* SpeedByte XOR Highbyte(RandomSeed) */
+ // SpeedByte XOR Highbyte(RandomSeed)
header->SpeedByte = getFile8Bit(file);
- /* CheckSum XOR SpeedByte */
+ // CheckSum XOR SpeedByte
header->CheckSumByte = getFile8Bit(file);
- /* random seed used for recorded demos */
- header->DemoRandomSeed = getFile16BitLE(file); /* yes, little endian */
+ // random seed used for recorded demos
+ header->DemoRandomSeed = getFile16BitLE(file); // yes, little endian
- /* auto-determine number of infotrons if it was stored as "0" -- see above */
+ // auto-determine number of infotrons if it was stored as "0" -- see above
if (header->InfotronsNeeded == 0)
{
for (x = 0; x < native_sp_level.width; x++)
if (native_sp_level.playfield[x][y] == fiInfotron)
header->InfotronsNeeded++;
- header->InfotronsNeeded &= 0xff; /* only use low byte -- see above */
+ header->InfotronsNeeded &= 0xff; // only use low byte -- see above
}
- /* read raw level header bytes (96 bytes) */
+ // read raw level header bytes (96 bytes)
- seekFile(file, -(SP_HEADER_SIZE), SEEK_CUR); /* rewind file */
+ seekFile(file, -(SP_HEADER_SIZE), SEEK_CUR); // rewind file
for (i = 0; i < SP_HEADER_SIZE; i++)
native_sp_level.header_raw_bytes[i] = getByteFromFile(file);
- /* also load demo tape, if available (only in single level files) */
+ // also load demo tape, if available (only in single level files)
if (demo_available)
{
int level_nr = getFile8Bit(file);
- level_nr &= 0x7f; /* clear highest bit */
+ level_nr &= 0x7f; // clear highest bit
level_nr = (level_nr < 1 ? 1 :
level_nr > 111 ? 111 : level_nr);
{
native_sp_level.demo.data[i] = getFile8Bit(file);
- if (native_sp_level.demo.data[i] == 0xff) /* "end of demo" byte */
+ if (native_sp_level.demo.data[i] == 0xff) // "end of demo" byte
break;
}
int level_width = SP_STD_PLAYFIELD_WIDTH;
int level_height = SP_STD_PLAYFIELD_HEIGHT;
- /* always start with reliable default values */
+ // always start with reliable default values
setLevelInfoToDefaults_SP();
copyInternalEngineVars_SP();
ldesc->Width = getFile16BitLE(file);
ldesc->Height = getFile16BitLE(file);
- ldesc->OffSet = getFile32BitLE(file); /* starts with 1, not with 0 */
+ ldesc->OffSet = getFile32BitLE(file); // starts with 1, not with 0
ldesc->Size = getFile32BitLE(file);
}
file_seek_pos = mpx_level_desc[level_pos].OffSet - 1;
}
- /* position file stream to the requested level (in case of level package) */
+ // position file stream to the requested level (in case of level package)
if (seekFile(file, file_seek_pos, SEEK_SET) != 0)
{
Error(ERR_WARN, "cannot fseek in file '%s' -- using empty level", filename);
LoadNativeLevelFromFileStream_SP(file, level_width, level_height,
demo_available);
- /* check if this level is a part of a bigger multi-part level */
+ // check if this level is a part of a bigger multi-part level
if (is_single_level_file)
break;
if (is_multipart_level)
{
- /* correct leading multipart level meta information in level name */
+ // correct leading multipart level meta information in level name
for (i = 0;
i < SP_LEVEL_NAME_LEN && header->LevelTitle[i] == name_first;
i++)
header->LevelTitle[i] = '-';
- /* correct trailing multipart level meta information in level name */
+ // correct trailing multipart level meta information in level name
for (i = SP_LEVEL_NAME_LEN - 1;
i >= 0 && header->LevelTitle[i] == name_last;
i--)
header->LevelTitle[i] = '-';
}
- /* ---------- check for normal single level ---------- */
+ // ---------- check for normal single level ----------
if (!reading_multipart_level && !is_multipart_level)
{
break;
}
- /* ---------- check for empty level (unused multi-part) ---------- */
+ // ---------- check for empty level (unused multi-part) ----------
if (!reading_multipart_level && is_multipart_level && !is_first_part)
{
break;
}
- /* ---------- check for finished multi-part level ---------- */
+ // ---------- check for finished multi-part level ----------
if (reading_multipart_level &&
(!is_multipart_level ||
break;
}
- /* ---------- here we have one part of a multi-part level ---------- */
+ // ---------- here we have one part of a multi-part level ----------
reading_multipart_level = TRUE;
- if (is_first_part) /* start with first part of new multi-part level */
+ if (is_first_part) // start with first part of new multi-part level
{
- /* copy level info structure from first part */
+ // copy level info structure from first part
multipart_level = native_sp_level;
- /* clear playfield of new multi-part level */
+ // clear playfield of new multi-part level
for (x = 0; x < SP_MAX_PLAYFIELD_WIDTH; x++)
for (y = 0; y < SP_MAX_PLAYFIELD_HEIGHT; y++)
multipart_level.playfield[x][y] = fiSpace;
multipart_level.height = MAX(multipart_level.height,
multipart_ypos * SP_STD_PLAYFIELD_HEIGHT);
- /* copy level part at the right position of multi-part level */
+ // copy level part at the right position of multi-part level
for (x = 0; x < SP_STD_PLAYFIELD_WIDTH; x++)
{
for (y = 0; y < SP_STD_PLAYFIELD_HEIGHT; y++)
return;
}
- /* write level playfield (width * height == 60 * 24 tiles == 1440 bytes) */
+ // write level playfield (width * height == 60 * 24 tiles == 1440 bytes)
for (y = 0; y < native_sp_level.height; y++)
for (x = 0; x < native_sp_level.width; x++)
putFile8Bit(file, native_sp_level.playfield[x][y]);
- /* write level header (96 bytes) */
+ // write level header (96 bytes)
WriteUnusedBytesToFile(file, 4);
putFile8Bit(file, header->CheckSumByte);
putFile16BitLE(file, header->DemoRandomSeed);
- /* also save demo tape, if available */
+ // also save demo tape, if available
if (native_sp_level.demo.is_available)
{
for (i = 0; i < native_sp_level.demo.length; i++)
putFile8Bit(file, native_sp_level.demo.data[i]);
- putFile8Bit(file, 0xff); /* "end of demo" byte */
+ putFile8Bit(file, 0xff); // "end of demo" byte
}
fclose(file);
#include "export.h"
-#endif /* GAME_SP_H */
+#endif // GAME_SP_H
#include "Sound.h"
#include "Zonk.h"
-#endif /* GAME_SP_GLOBAL_H */
+#endif // GAME_SP_GLOBAL_H
int i;
for (i = 0; preceding_playfield_memory[i] != NULL; i++)
- preceding_buffer_size += 8; /* eight 16-bit integer values */
+ preceding_buffer_size += 8; // eight 16-bit integer values
game_sp.preceding_buffer = preceding_playfield_memory;
game_sp.preceding_buffer_size = preceding_buffer_size;
}
-/* ------------------------------------------------------------------------- */
-/* Supaplex game engine snapshot handling functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// Supaplex game engine snapshot handling functions
+// ----------------------------------------------------------------------------
void SaveEngineSnapshotValues_SP(ListNode **buffers)
{
engine_snapshot_sp.game_sp = game_sp;
- /* these arrays have playfield-size dependent variable size */
+ // these arrays have playfield-size dependent variable size
for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
engine_snapshot_sp.PlayField16[i] = PlayField16[i];
for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
engine_snapshot_sp.TerminalState[i] = TerminalState[i];
- /* store special data into engine snapshot buffers */
+ // store special data into engine snapshot buffers
SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(FieldWidth));
SaveSnapshotBuffer(buffers, ARGS_ADDRESS_AND_SIZEOF(FieldHeight));
{
int i;
- /* stored engine snapshot buffers already restored at this point */
+ // stored engine snapshot buffers already restored at this point
game_sp = engine_snapshot_sp.game_sp;
- /* these arrays have playfield-size dependent variable size */
+ // these arrays have playfield-size dependent variable size
for (i = 0; i < FieldWidth * FieldHeight + HeaderSize; i++)
PlayField16[i] = engine_snapshot_sp.PlayField16[i];
int getRedDiskReleaseFlag_SP(void)
{
- /* 0: when Murphy is moving (including the destination tile!) */
- /* 1: when Murphy is not moving for at least one game frame */
+ // 0: when Murphy is moving (including the destination tile!)
+ // 1: when Murphy is not moving for at least one game frame
return RedDiskReleaseFlag;
}
#ifndef MAIN_SP_H
#define MAIN_SP_H
-/* ========================================================================= */
-/* external functions and definitions imported from main program to game_sp */
-/* ========================================================================= */
+// ============================================================================
+// external functions and definitions imported from main program to game_sp
+// ============================================================================
#include "../engines.h"
#include "../conf_gfx.h"
-/* ========================================================================= */
-/* functions and definitions that are exported from game_sp to main program */
-/* ========================================================================= */
+// ============================================================================
+// functions and definitions that are exported from game_sp to main program
+// ============================================================================
#include "export.h"
-/* ========================================================================= */
-/* internal functions and definitions that are not exported to main program */
-/* ========================================================================= */
+// ============================================================================
+// internal functions and definitions that are not exported to main program
+// ============================================================================
-/* ------------------------------------------------------------------------- */
-/* constant definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// constant definitions
+// ----------------------------------------------------------------------------
-/* screen sizes and positions for SP engine */
+// screen sizes and positions for SP engine
extern int TILESIZE_VAR;
#define MAX_BUF_XSIZE (2 + SCR_FIELDX + 2)
#define MAX_BUF_YSIZE (2 + SCR_FIELDY + 2)
-/* often used screen positions */
+// often used screen positions
extern int SX, SY;
#define FULL_SYSIZE (2 + SYSIZE + 2)
-/* ------------------------------------------------------------------------- */
-/* data structure definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// data structure definitions
+// ----------------------------------------------------------------------------
-/* ------------------------------------------------------------------------- */
-/* exported variables */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// exported variables
+// ----------------------------------------------------------------------------
extern struct LevelInfo_SP native_sp_level;
extern int GfxFrame[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
-/* ------------------------------------------------------------------------- */
-/* exported functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// exported functions
+// ----------------------------------------------------------------------------
-#endif /* MAIN_SP_H */
+#endif // MAIN_SP_H
#include "vb_lib.h"
-/* helper functions for constructs not supported by C */
+// helper functions for constructs not supported by C
int MyGetTickCount(void)
{
#define Sqr(x) sqrt(x)
-/* helper functions for constructs not supported by C */
+// helper functions for constructs not supported by C
int MyGetTickCount(void);
-#endif /* VB_LIB_H */
+#endif // VB_LIB_H
#include "anim.h"
#include "config.h"
-#include "conf_e2g.c" /* include auto-generated data structure definitions */
-#include "conf_esg.c" /* include auto-generated data structure definitions */
-#include "conf_e2s.c" /* include auto-generated data structure definitions */
-#include "conf_fnt.c" /* include auto-generated data structure definitions */
-#include "conf_g2s.c" /* include auto-generated data structure definitions */
-#include "conf_g2m.c" /* include auto-generated data structure definitions */
-#include "conf_act.c" /* include auto-generated data structure definitions */
+#include "conf_e2g.c" // include auto-generated data structure definitions
+#include "conf_esg.c" // include auto-generated data structure definitions
+#include "conf_e2s.c" // include auto-generated data structure definitions
+#include "conf_fnt.c" // include auto-generated data structure definitions
+#include "conf_g2s.c" // include auto-generated data structure definitions
+#include "conf_g2m.c" // include auto-generated data structure definitions
+#include "conf_act.c" // include auto-generated data structure definitions
#define CONFIG_TOKEN_FONT_INITIAL "font.initial"
};
-/* forward declaration for internal use */
+// forward declaration for internal use
static int get_graphic_parameter_value(char *, char *, int);
int sync_frame = FrameCounter;
int x, y;
- /* prevent OS (Windows) from complaining about program not responding */
+ // prevent OS (Windows) from complaining about program not responding
CheckQuitEvent();
if (game_status != GAME_MODE_LOADING)
x = ALIGNED_TEXT_XPOS(&init_last.busy);
y = ALIGNED_TEXT_YPOS(&init_last.busy);
- graphic_info = &anim_initial; /* graphic == 0 => anim_initial */
+ graphic_info = &anim_initial; // graphic == 0 => anim_initial
if (sync_frame % anim_initial.anim_delay == 0)
{
print_timestamp_time("getImageListPropertyMapping/Size");
print_timestamp_init("InitElementSmallImagesScaledUp (1)");
- /* initialize normal element images from static configuration */
+ // initialize normal element images from static configuration
for (i = 0; element_to_graphic[i].element > -1; i++)
InitElementSmallImagesScaledUp(element_to_graphic[i].graphic);
print_timestamp_done("InitElementSmallImagesScaledUp (1)");
- /* initialize special element images from static configuration */
+ // initialize special element images from static configuration
for (i = 0; element_to_special_graphic[i].element > -1; i++)
InitElementSmallImagesScaledUp(element_to_special_graphic[i].graphic);
print_timestamp_time("InitElementSmallImagesScaledUp (2)");
- /* initialize element images from dynamic configuration */
+ // initialize element images from dynamic configuration
for (i = 0; i < num_property_mappings; i++)
if (property_mapping[i].base_index < MAX_NUM_ELEMENTS)
InitElementSmallImagesScaledUp(property_mapping[i].artwork_index);
print_timestamp_time("InitElementSmallImagesScaledUp (3)");
- /* initialize special non-element images from above list */
+ // initialize special non-element images from above list
for (i = 0; special_graphics[i] > -1; i++)
InitElementSmallImagesScaledUp(special_graphics[i]);
print_timestamp_time("InitElementSmallImagesScaledUp (4)");
int num_property_mappings = getImageListPropertyMappingSize();
int i;
- /* scale normal images from static configuration, if not already scaled */
+ // scale normal images from static configuration, if not already scaled
for (i = 0; i < NUM_IMAGE_FILES; i++)
InitScaledImagesScaledUp(i);
- /* scale images from dynamic configuration, if not already scaled */
+ // scale images from dynamic configuration, if not already scaled
for (i = 0; i < num_property_mappings; i++)
InitScaledImagesScaledUp(property_mapping[i].artwork_index);
}
}
#if 1
-/* !!! FIX THIS (CHANGE TO USING NORMAL ELEMENT GRAPHIC DEFINITIONS) !!! */
+// !!! FIX THIS (CHANGE TO USING NORMAL ELEMENT GRAPHIC DEFINITIONS) !!!
void SetBitmaps_EM(Bitmap **em_bitmap)
{
em_bitmap[0] = graphic_info[IMG_EMC_OBJECT].bitmap;
#endif
#if 0
-/* !!! FIX THIS (CHANGE TO USING NORMAL ELEMENT GRAPHIC DEFINITIONS) !!! */
+// !!! FIX THIS (CHANGE TO USING NORMAL ELEMENT GRAPHIC DEFINITIONS) !!!
void SetBitmaps_SP(Bitmap **sp_bitmap)
{
*sp_bitmap = graphic_info[IMG_SP_OBJECTS].bitmap;
{
int special = -1;
- /* (special case: do not use special font for GAME_MODE_LOADING) */
+ // (special case: do not use special font for GAME_MODE_LOADING)
if (game_status >= GAME_MODE_TITLE_INITIAL &&
game_status <= GAME_MODE_PSEUDO_PREVIEW)
special = game_status;
if (value != NULL)
return atoi(value);
- /* if font not found, use reliable default value */
+ // if font not found, use reliable default value
return FONT_INITIAL_1;
}
int num_font_bitmaps = NUM_FONTS;
int i, j;
- if (graphic_info == NULL) /* still at startup phase */
+ if (graphic_info == NULL) // still at startup phase
{
InitFontInfo(font_initial, NUM_INITIAL_FONTS,
getFontBitmapID, getFontFromToken);
return;
}
- /* ---------- initialize font graphic definitions ---------- */
+ // ---------- initialize font graphic definitions ----------
- /* always start with reliable default values (normal font graphics) */
+ // always start with reliable default values (normal font graphics)
for (i = 0; i < NUM_FONTS; i++)
font_info[i].graphic = IMG_FONT_INITIAL_1;
- /* initialize normal font/graphic mapping from static configuration */
+ // initialize normal font/graphic mapping from static configuration
for (i = 0; font_to_graphic[i].font_nr > -1; i++)
{
int font_nr = font_to_graphic[i].font_nr;
font_info[font_nr].graphic = graphic;
}
- /* always start with reliable default values (special font graphics) */
+ // always start with reliable default values (special font graphics)
for (i = 0; i < NUM_FONTS; i++)
{
for (j = 0; j < NUM_SPECIAL_GFX_ARGS; j++)
}
}
- /* initialize special font/graphic mapping from static configuration */
+ // initialize special font/graphic mapping from static configuration
for (i = 0; font_to_graphic[i].font_nr > -1; i++)
{
int font_nr = font_to_graphic[i].font_nr;
}
}
- /* initialize special font/graphic mapping from dynamic configuration */
+ // initialize special font/graphic mapping from dynamic configuration
for (i = 0; i < num_property_mappings; i++)
{
int font_nr = property_mapping[i].base_index - MAX_NUM_ELEMENTS;
}
}
- /* reset non-redefined ".active" font graphics if normal font is redefined */
+ // reset non-redefined ".active" font graphics if normal font is redefined
/* (this different treatment is needed because normal and active fonts are
independently defined ("active" is not a property of font definitions!) */
for (i = 0; i < NUM_FONTS; i++)
int font_nr_base = i;
int font_nr_active = FONT_ACTIVE(font_nr_base);
- /* check only those fonts with exist as normal and ".active" variant */
+ // check only those fonts with exist as normal and ".active" variant
if (font_nr_base != font_nr_active)
{
int base_graphic = font_info[font_nr_base].graphic;
if (base_redefined && !active_redefined)
font_info[font_nr_active].graphic = base_graphic;
- /* now also check each "special" font (which may be the same as above) */
+ // now also check each "special" font (which may be the same as above)
for (j = 0; j < NUM_SPECIAL_GFX_ARGS; j++)
{
int base_graphic = font_info[font_nr_base].special_graphic[j];
}
}
- /* ---------- initialize font bitmap array ---------- */
+ // ---------- initialize font bitmap array ----------
if (font_bitmap_info != NULL)
FreeFontInfo(font_bitmap_info);
font_bitmap_info =
checked_calloc(num_font_bitmaps * sizeof(struct FontBitmapInfo));
- /* ---------- initialize font bitmap definitions ---------- */
+ // ---------- initialize font bitmap definitions ----------
for (i = 0; i < NUM_FONTS; i++)
{
int font_bitmap_id = font_info[i].special_bitmap_id[j];
int graphic = font_info[i].special_graphic[j];
- /* set 'graphic_info' for font entries, if uninitialized (guessed) */
+ // set 'graphic_info' for font entries, if uninitialized (guessed)
if (graphic_info[graphic].anim_frames < MIN_NUM_CHARS_PER_FONT)
{
graphic_info[graphic].anim_frames = DEFAULT_NUM_CHARS_PER_FONT;
graphic_info[graphic].anim_frames_per_line = DEFAULT_NUM_CHARS_PER_LINE;
}
- /* copy font relevant information from graphics information */
+ // copy font relevant information from graphics information
font_bitmap_info[font_bitmap_id].bitmap = graphic_info[graphic].bitmap;
font_bitmap_info[font_bitmap_id].src_x = graphic_info[graphic].src_x;
font_bitmap_info[font_bitmap_id].src_y = graphic_info[graphic].src_y;
int num_property_mappings = getImageListPropertyMappingSize();
int i, j, k;
- if (graphic_info == NULL) /* still at startup phase */
+ if (graphic_info == NULL) // still at startup phase
return;
- /* always start with reliable default values (no global animations) */
+ // always start with reliable default values (no global animations)
for (i = 0; i < NUM_GLOBAL_ANIM_TOKENS; i++)
for (j = 0; j < NUM_GLOBAL_ANIM_PARTS_ALL; j++)
for (k = 0; k < NUM_SPECIAL_GFX_ARGS; k++)
global_anim_info[i].graphic[j][k] = IMG_UNDEFINED;
- /* initialize global animation definitions from static configuration */
+ // initialize global animation definitions from static configuration
for (i = 0; i < NUM_GLOBAL_ANIM_TOKENS; i++)
{
int j = GLOBAL_ANIM_ID_PART_BASE;
global_anim_info[i].graphic[j][k] = IMG_GFX_GLOBAL_ANIM_1 + i;
}
- /* initialize global animation definitions from dynamic configuration */
+ // initialize global animation definitions from dynamic configuration
for (i = 0; i < num_property_mappings; i++)
{
int anim_nr = property_mapping[i].base_index - MAX_NUM_ELEMENTS - NUM_FONTS;
if (anim_nr < 0 || anim_nr >= NUM_GLOBAL_ANIM_TOKENS)
continue;
- /* set animation part to base part, if not specified */
+ // set animation part to base part, if not specified
if (!IS_GLOBAL_ANIM_PART(part_nr))
part_nr = GLOBAL_ANIM_ID_PART_BASE;
- /* set animation screen to default, if not specified */
+ // set animation screen to default, if not specified
if (!IS_SPECIAL_GFX_ARG(special))
special = GFX_SPECIAL_ARG_DEFAULT;
global_anim_info[anim_nr].graphic[part_nr][special] = graphic;
- /* fix default value for ".draw_masked" (for backward compatibility) */
+ // fix default value for ".draw_masked" (for backward compatibility)
struct GraphicInfo *g = &graphic_info[graphic];
struct FileInfo *image = getImageListEntryFromImageID(graphic);
char **parameter_raw = image->parameter;
image_config_suffix[p].token,
image_config_suffix[p].type);
- /* if ".draw_masked" parameter is undefined, use default value "TRUE" */
+ // if ".draw_masked" parameter is undefined, use default value "TRUE"
if (draw_masked == ARG_UNDEFINED_VALUE)
g->draw_masked = TRUE;
}
int num_property_mappings = getSoundListPropertyMappingSize();
int i, j, k;
- /* always start with reliable default values (no global animation sounds) */
+ // always start with reliable default values (no global animation sounds)
for (i = 0; i < NUM_GLOBAL_ANIM_TOKENS; i++)
for (j = 0; j < NUM_GLOBAL_ANIM_PARTS_ALL; j++)
for (k = 0; k < NUM_SPECIAL_GFX_ARGS; k++)
global_anim_info[i].sound[j][k] = SND_UNDEFINED;
- /* initialize global animation sound definitions from dynamic configuration */
+ // initialize global animation sound definitions from dynamic configuration
for (i = 0; i < num_property_mappings; i++)
{
int anim_nr = property_mapping[i].base_index - 2 * MAX_NUM_ELEMENTS;
if (anim_nr < 0 || anim_nr >= NUM_GLOBAL_ANIM_TOKENS)
continue;
- /* set animation part to base part, if not specified */
+ // set animation part to base part, if not specified
if (!IS_GLOBAL_ANIM_PART(part_nr))
part_nr = GLOBAL_ANIM_ID_PART_BASE;
- /* set animation screen to default, if not specified */
+ // set animation screen to default, if not specified
if (!IS_SPECIAL_GFX_ARG(special))
special = GFX_SPECIAL_ARG_DEFAULT;
int num_property_mappings = getMusicListPropertyMappingSize();
int i, j, k;
- /* always start with reliable default values (no global animation music) */
+ // always start with reliable default values (no global animation music)
for (i = 0; i < NUM_GLOBAL_ANIM_TOKENS; i++)
for (j = 0; j < NUM_GLOBAL_ANIM_PARTS_ALL; j++)
for (k = 0; k < NUM_SPECIAL_GFX_ARGS; k++)
global_anim_info[i].music[j][k] = MUS_UNDEFINED;
- /* initialize global animation music definitions from dynamic configuration */
+ // initialize global animation music definitions from dynamic configuration
for (i = 0; i < num_property_mappings; i++)
{
int anim_nr = property_mapping[i].base_index - NUM_MUSIC_PREFIXES;
if (anim_nr < 0 || anim_nr >= NUM_GLOBAL_ANIM_TOKENS)
continue;
- /* set animation part to base part, if not specified */
+ // set animation part to base part, if not specified
if (!IS_GLOBAL_ANIM_PART(part_nr))
part_nr = GLOBAL_ANIM_ID_PART_BASE;
- /* set animation screen to default, if not specified */
+ // set animation screen to default, if not specified
if (!IS_SPECIAL_GFX_ARG(special))
special = GFX_SPECIAL_ARG_DEFAULT;
int num_property_mappings = getImageListPropertyMappingSize();
int i, act, dir;
- if (graphic_info == NULL) /* still at startup phase */
+ if (graphic_info == NULL) // still at startup phase
return;
- /* set values to -1 to identify later as "uninitialized" values */
+ // set values to -1 to identify later as "uninitialized" values
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
for (act = 0; act < NUM_ACTIONS; act++)
UPDATE_BUSY_STATE();
- /* initialize normal element/graphic mapping from static configuration */
+ // initialize normal element/graphic mapping from static configuration
for (i = 0; element_to_graphic[i].element > -1; i++)
{
int element = element_to_graphic[i].element;
}
}
- /* initialize normal element/graphic mapping from dynamic configuration */
+ // initialize normal element/graphic mapping from dynamic configuration
for (i = 0; i < num_property_mappings; i++)
{
int element = property_mapping[i].base_index;
}
}
- /* now copy all graphics that are defined to be cloned from other graphics */
+ // now copy all graphics that are defined to be cloned from other graphics
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
int graphic = element_info[i].graphic[ACTION_DEFAULT];
}
}
- /* set hardcoded definitions for some runtime elements without graphic */
+ // set hardcoded definitions for some runtime elements without graphic
element_info[EL_AMOEBA_TO_DIAMOND].graphic[ACTION_DEFAULT] = IMG_AMOEBA_DEAD;
- /* set hardcoded definitions for some internal elements without graphic */
+ // set hardcoded definitions for some internal elements without graphic
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
if (IS_EDITOR_CASCADE_INACTIVE(i))
element_info[i].graphic[ACTION_DEFAULT] = IMG_EDITOR_CASCADE_LIST_ACTIVE;
}
- /* now set all undefined/invalid graphics to -1 to set to default after it */
+ // now set all undefined/invalid graphics to -1 to set to default after it
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
for (act = 0; act < NUM_ACTIONS; act++)
int graphic = element_info[i].direction_graphic[act][dir];
int move_dir = (act == ACTION_FALLING ? MV_BIT_DOWN : dir);
- if (act == ACTION_FALLING) /* special case */
+ if (act == ACTION_FALLING) // special case
graphic = element_info[i].graphic[act];
if (graphic != -1 &&
(move_dir == MV_BIT_RIGHT && front_is_left_or_upper) ||
(move_dir == MV_BIT_DOWN && front_is_left_or_upper)));
- /* swap frontside and backside graphic tile coordinates, if needed */
+ // swap frontside and backside graphic tile coordinates, if needed
if (swap_movement_tiles_always || swap_movement_tiles_autodetected)
{
- /* get current (wrong) backside tile coordinates */
+ // get current (wrong) backside tile coordinates
getGraphicSourceXY(graphic, 0, &src_x_back, &src_y_back, TRUE);
- /* set frontside tile coordinates to backside tile coordinates */
+ // set frontside tile coordinates to backside tile coordinates
g->src_x = src_x_back;
g->src_y = src_y_back;
- /* invert tile offset to point to new backside tile coordinates */
+ // invert tile offset to point to new backside tile coordinates
g->offset2_x *= -1;
g->offset2_y *= -1;
- /* do not swap front and backside tiles again after correction */
+ // do not swap front and backside tiles again after correction
g->swap_double_tiles = 0;
}
}
UPDATE_BUSY_STATE();
- /* now set all '-1' values to element specific default values */
+ // now set all '-1' values to element specific default values
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
int default_graphic = element_info[i].graphic[ACTION_DEFAULT];
act == ACTION_TURNING_FROM_UP ||
act == ACTION_TURNING_FROM_DOWN);
- /* generic default action graphic (defined by "[default]" directive) */
+ // generic default action graphic (defined by "[default]" directive)
int default_action_graphic = element_info[EL_DEFAULT].graphic[act];
int default_action_crumbled = element_info[EL_DEFAULT].crumbled[act];
int default_remove_graphic = IMG_EMPTY;
if (act_remove && default_action_graphic != -1)
default_remove_graphic = default_action_graphic;
- /* look for special default action graphic (classic game specific) */
+ // look for special default action graphic (classic game specific)
if (IS_BD_ELEMENT(i) && element_info[EL_BD_DEFAULT].graphic[act] != -1)
default_action_graphic = element_info[EL_BD_DEFAULT].graphic[act];
if (IS_SP_ELEMENT(i) && element_info[EL_SP_DEFAULT].graphic[act] != -1)
if (IS_MM_ELEMENT(i) && element_info[EL_MM_DEFAULT].crumbled[act] != -1)
default_action_crumbled = element_info[EL_MM_DEFAULT].crumbled[act];
- /* !!! needed because EL_EMPTY_SPACE treated as IS_SP_ELEMENT !!! */
- /* !!! make this better !!! */
+ // !!! needed because EL_EMPTY_SPACE treated as IS_SP_ELEMENT !!!
+ // !!! make this better !!!
if (i == EL_EMPTY_SPACE)
{
default_action_graphic = element_info[EL_DEFAULT].graphic[act];
for (dir = 0; dir < NUM_DIRECTIONS_FULL; dir++)
{
- /* use action graphic as the default direction graphic, if undefined */
+ // use action graphic as the default direction graphic, if undefined
int default_action_direction_graphic = element_info[i].graphic[act];
int default_action_direction_crumbled = element_info[i].crumbled[act];
- /* no graphic for current action -- use default direction graphic */
+ // no graphic for current action -- use default direction graphic
if (default_action_direction_graphic == -1)
default_action_direction_graphic =
(act_remove ? default_remove_graphic :
default_action_direction_crumbled;
}
- /* no graphic for this specific action -- use default action graphic */
+ // no graphic for this specific action -- use default action graphic
if (element_info[i].graphic[act] == -1)
element_info[i].graphic[act] =
(act_remove ? default_remove_graphic :
int num_property_mappings = getImageListPropertyMappingSize();
int i, j;
- /* always start with reliable default values */
+ // always start with reliable default values
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
for (j = 0; j < NUM_SPECIAL_GFX_ARGS; j++)
element_info[i].special_graphic[j] =
element_info[i].graphic[ACTION_DEFAULT];
- /* initialize special element/graphic mapping from static configuration */
+ // initialize special element/graphic mapping from static configuration
for (i = 0; element_to_special_graphic[i].element > -1; i++)
{
int element = element_to_special_graphic[i].element;
element_info[element].special_graphic[special] = graphic;
}
- /* initialize special element/graphic mapping from dynamic configuration */
+ // initialize special element/graphic mapping from dynamic configuration
for (i = 0; i < num_property_mappings; i++)
{
int element = property_mapping[i].base_index;
int special = property_mapping[i].ext3_index;
int graphic = property_mapping[i].artwork_index;
- /* for action ".active", replace element with active element, if exists */
+ // for action ".active", replace element with active element, if exists
if (action == ACTION_ACTIVE && element != ELEMENT_ACTIVE(element))
{
element = ELEMENT_ACTIVE(element);
if (element >= MAX_NUM_ELEMENTS)
continue;
- /* do not change special graphic if action or direction was specified */
+ // do not change special graphic if action or direction was specified
if (action != -1 || direction != -1)
continue;
element_info[element].special_graphic[special] = graphic;
}
- /* now set all undefined/invalid graphics to default */
+ // now set all undefined/invalid graphics to default
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
for (j = 0; j < NUM_SPECIAL_GFX_ARGS; j++)
if (graphic_info[element_info[i].special_graphic[j]].bitmap == NULL)
int anim_frames_per_row = 1, anim_frames_per_col = 1;
int anim_frames_per_line = 1;
- /* always start with reliable default values */
+ // always start with reliable default values
g->src_image_width = 0;
g->src_image_height = 0;
g->src_x = 0;
g->src_y = 0;
- g->width = TILEX; /* default for element graphics */
- g->height = TILEY; /* default for element graphics */
- g->offset_x = 0; /* one or both of these values ... */
- g->offset_y = 0; /* ... will be corrected later */
- g->offset2_x = 0; /* one or both of these values ... */
- g->offset2_y = 0; /* ... will be corrected later */
- g->swap_double_tiles = -1; /* auto-detect tile swapping */
- g->crumbled_like = -1; /* do not use clone element */
- g->diggable_like = -1; /* do not use clone element */
- g->border_size = TILEX / 8; /* "CRUMBLED" border size */
- g->scale_up_factor = 1; /* default: no scaling up */
- g->tile_size = TILESIZE; /* default: standard tile size */
- g->clone_from = -1; /* do not use clone graphic */
+ g->width = TILEX; // default for element graphics
+ g->height = TILEY; // default for element graphics
+ g->offset_x = 0; // one or both of these values ...
+ g->offset_y = 0; // ... will be corrected later
+ g->offset2_x = 0; // one or both of these values ...
+ g->offset2_y = 0; // ... will be corrected later
+ g->swap_double_tiles = -1; // auto-detect tile swapping
+ g->crumbled_like = -1; // do not use clone element
+ g->diggable_like = -1; // do not use clone element
+ g->border_size = TILEX / 8; // "CRUMBLED" border size
+ g->scale_up_factor = 1; // default: no scaling up
+ g->tile_size = TILESIZE; // default: standard tile size
+ g->clone_from = -1; // do not use clone graphic
g->init_delay_fixed = 0;
g->init_delay_random = 0;
g->anim_delay_fixed = 0;
g->fade_delay = -1;
g->post_delay = -1;
g->auto_delay = -1;
- g->align = ALIGN_CENTER; /* default for title screens */
- g->valign = VALIGN_MIDDLE; /* default for title screens */
- g->sort_priority = 0; /* default for title screens */
+ g->align = ALIGN_CENTER; // default for title screens
+ g->valign = VALIGN_MIDDLE; // default for title screens
+ g->sort_priority = 0; // default for title screens
g->class = 0;
g->style = STYLE_DEFAULT;
g->bitmaps = src_bitmaps;
g->bitmap = src_bitmap;
- /* optional zoom factor for scaling up the image to a larger size */
+ // optional zoom factor for scaling up the image to a larger size
if (parameter[GFX_ARG_SCALE_UP_FACTOR] != ARG_UNDEFINED_VALUE)
g->scale_up_factor = parameter[GFX_ARG_SCALE_UP_FACTOR];
if (g->scale_up_factor < 1)
- g->scale_up_factor = 1; /* no scaling */
+ g->scale_up_factor = 1; // no scaling
- /* optional tile size for using non-standard image size */
+ // optional tile size for using non-standard image size
if (parameter[GFX_ARG_TILE_SIZE] != ARG_UNDEFINED_VALUE)
{
g->tile_size = parameter[GFX_ARG_TILE_SIZE];
#if 0
// CHECK: should tile sizes less than standard tile size be allowed?
if (g->tile_size < TILESIZE)
- g->tile_size = TILESIZE; /* standard tile size */
+ g->tile_size = TILESIZE; // standard tile size
#endif
// when setting tile size, also set width and height accordingly
if (g->use_image_size)
{
- /* set new default bitmap size (with scaling, but without small images) */
+ // set new default bitmap size (with scaling, but without small images)
g->width = get_scaled_graphic_width(graphic);
g->height = get_scaled_graphic_height(graphic);
}
- /* optional width and height of each animation frame */
+ // optional width and height of each animation frame
if (parameter[GFX_ARG_WIDTH] != ARG_UNDEFINED_VALUE)
g->width = parameter[GFX_ARG_WIDTH];
if (parameter[GFX_ARG_HEIGHT] != ARG_UNDEFINED_VALUE)
g->height = parameter[GFX_ARG_HEIGHT];
- /* optional x and y tile position of animation frame sequence */
+ // optional x and y tile position of animation frame sequence
if (parameter[GFX_ARG_XPOS] != ARG_UNDEFINED_VALUE)
g->src_x = parameter[GFX_ARG_XPOS] * g->width;
if (parameter[GFX_ARG_YPOS] != ARG_UNDEFINED_VALUE)
g->src_y = parameter[GFX_ARG_YPOS] * g->height;
- /* optional x and y pixel position of animation frame sequence */
+ // optional x and y pixel position of animation frame sequence
if (parameter[GFX_ARG_X] != ARG_UNDEFINED_VALUE)
g->src_x = parameter[GFX_ARG_X];
if (parameter[GFX_ARG_Y] != ARG_UNDEFINED_VALUE)
g->width, getTokenFromImageID(graphic), TILEX);
Error(ERR_INFO_LINE, "-");
- g->width = TILEX; /* will be checked to be inside bitmap later */
+ g->width = TILEX; // will be checked to be inside bitmap later
}
if (g->height <= 0)
g->height, getTokenFromImageID(graphic), TILEY);
Error(ERR_INFO_LINE, "-");
- g->height = TILEY; /* will be checked to be inside bitmap later */
+ g->height = TILEY; // will be checked to be inside bitmap later
}
}
if (src_bitmap)
{
- /* get final bitmap size (with scaling, but without small images) */
+ // get final bitmap size (with scaling, but without small images)
int src_image_width = get_scaled_graphic_width(graphic);
int src_image_height = get_scaled_graphic_height(graphic);
if (src_image_width == 0 || src_image_height == 0)
{
- /* only happens when loaded outside artwork system (like "global.busy") */
+ // only happens when loaded outside artwork system (like "global.busy")
src_image_width = src_bitmap->width;
src_image_height = src_bitmap->height;
}
g->src_image_height = src_image_height;
}
- /* correct x or y offset dependent of vertical or horizontal frame order */
- if (parameter[GFX_ARG_VERTICAL]) /* frames are ordered vertically */
+ // correct x or y offset dependent of vertical or horizontal frame order
+ if (parameter[GFX_ARG_VERTICAL]) // frames are ordered vertically
{
g->offset_y = (parameter[GFX_ARG_OFFSET] != ARG_UNDEFINED_VALUE ?
parameter[GFX_ARG_OFFSET] : g->height);
anim_frames_per_line = anim_frames_per_col;
}
- else /* frames are ordered horizontally */
+ else // frames are ordered horizontally
{
g->offset_x = (parameter[GFX_ARG_OFFSET] != ARG_UNDEFINED_VALUE ?
parameter[GFX_ARG_OFFSET] : g->width);
anim_frames_per_line = anim_frames_per_row;
}
- /* optionally, the x and y offset of frames can be specified directly */
+ // optionally, the x and y offset of frames can be specified directly
if (parameter[GFX_ARG_XOFFSET] != ARG_UNDEFINED_VALUE)
g->offset_x = parameter[GFX_ARG_XOFFSET];
if (parameter[GFX_ARG_YOFFSET] != ARG_UNDEFINED_VALUE)
g->offset_y = parameter[GFX_ARG_YOFFSET];
- /* optionally, moving animations may have separate start and end graphics */
+ // optionally, moving animations may have separate start and end graphics
g->double_movement = parameter[GFX_ARG_2ND_MOVEMENT_TILE];
if (parameter[GFX_ARG_2ND_VERTICAL] == ARG_UNDEFINED_VALUE)
parameter[GFX_ARG_2ND_VERTICAL] = !parameter[GFX_ARG_VERTICAL];
- /* correct x or y offset2 dependent of vertical or horizontal frame order */
- if (parameter[GFX_ARG_2ND_VERTICAL]) /* frames are ordered vertically */
+ // correct x or y offset2 dependent of vertical or horizontal frame order
+ if (parameter[GFX_ARG_2ND_VERTICAL]) // frames are ordered vertically
g->offset2_y = (parameter[GFX_ARG_2ND_OFFSET] != ARG_UNDEFINED_VALUE ?
parameter[GFX_ARG_2ND_OFFSET] : g->height);
- else /* frames are ordered horizontally */
+ else // frames are ordered horizontally
g->offset2_x = (parameter[GFX_ARG_2ND_OFFSET] != ARG_UNDEFINED_VALUE ?
parameter[GFX_ARG_2ND_OFFSET] : g->width);
- /* optionally, the x and y offset of 2nd graphic can be specified directly */
+ // optionally, the x and y offset of 2nd graphic can be specified directly
if (parameter[GFX_ARG_2ND_XOFFSET] != ARG_UNDEFINED_VALUE)
g->offset2_x = parameter[GFX_ARG_2ND_XOFFSET];
if (parameter[GFX_ARG_2ND_YOFFSET] != ARG_UNDEFINED_VALUE)
g->offset2_y = parameter[GFX_ARG_2ND_YOFFSET];
- /* optionally, the second movement tile can be specified as start tile */
+ // optionally, the second movement tile can be specified as start tile
if (parameter[GFX_ARG_2ND_SWAP_TILES] != ARG_UNDEFINED_VALUE)
g->swap_double_tiles= parameter[GFX_ARG_2ND_SWAP_TILES];
- /* automatically determine correct number of frames, if not defined */
+ // automatically determine correct number of frames, if not defined
if (parameter[GFX_ARG_FRAMES] != ARG_UNDEFINED_VALUE)
g->anim_frames = parameter[GFX_ARG_FRAMES];
else if (parameter[GFX_ARG_XPOS] == 0 && !parameter[GFX_ARG_VERTICAL])
else
g->anim_frames = 1;
- if (g->anim_frames == 0) /* frames must be at least 1 */
+ if (g->anim_frames == 0) // frames must be at least 1
g->anim_frames = 1;
g->anim_frames_per_line =
parameter[GFX_ARG_FRAMES_PER_LINE] : anim_frames_per_line);
g->anim_delay = parameter[GFX_ARG_DELAY];
- if (g->anim_delay == 0) /* delay must be at least 1 */
+ if (g->anim_delay == 0) // delay must be at least 1
g->anim_delay = 1;
g->anim_mode = parameter[GFX_ARG_ANIM_MODE];
- /* automatically determine correct start frame, if not defined */
+ // automatically determine correct start frame, if not defined
if (parameter[GFX_ARG_START_FRAME] == ARG_UNDEFINED_VALUE)
g->anim_start_frame = 0;
else if (g->anim_mode & ANIM_REVERSE)
else
g->anim_start_frame = parameter[GFX_ARG_START_FRAME];
- /* animation synchronized with global frame counter, not move position */
+ // animation synchronized with global frame counter, not move position
g->anim_global_sync = parameter[GFX_ARG_GLOBAL_SYNC];
- /* optional element for cloning crumble graphics */
+ // optional element for cloning crumble graphics
if (parameter[GFX_ARG_CRUMBLED_LIKE] != ARG_UNDEFINED_VALUE)
g->crumbled_like = parameter[GFX_ARG_CRUMBLED_LIKE];
- /* optional element for cloning digging graphics */
+ // optional element for cloning digging graphics
if (parameter[GFX_ARG_DIGGABLE_LIKE] != ARG_UNDEFINED_VALUE)
g->diggable_like = parameter[GFX_ARG_DIGGABLE_LIKE];
- /* optional border size for "crumbling" diggable graphics */
+ // optional border size for "crumbling" diggable graphics
if (parameter[GFX_ARG_BORDER_SIZE] != ARG_UNDEFINED_VALUE)
g->border_size = parameter[GFX_ARG_BORDER_SIZE];
- /* used for global animations and player "boring" and "sleeping" actions */
+ // used for global animations and player "boring" and "sleeping" actions
if (parameter[GFX_ARG_INIT_DELAY_FIXED] != ARG_UNDEFINED_VALUE)
g->init_delay_fixed = parameter[GFX_ARG_INIT_DELAY_FIXED];
if (parameter[GFX_ARG_INIT_DELAY_RANDOM] != ARG_UNDEFINED_VALUE)
if (parameter[GFX_ARG_POST_DELAY_RANDOM] != ARG_UNDEFINED_VALUE)
g->post_delay_random = parameter[GFX_ARG_POST_DELAY_RANDOM];
- /* used for global animations */
+ // used for global animations
if (parameter[GFX_ARG_INIT_EVENT] != ARG_UNDEFINED_VALUE)
g->init_event = parameter[GFX_ARG_INIT_EVENT];
if (parameter[GFX_ARG_ANIM_EVENT] != ARG_UNDEFINED_VALUE)
if (parameter[GFX_ARG_ANIM_EVENT_ACTION] != ARG_UNDEFINED_VALUE)
g->anim_event_action = parameter[GFX_ARG_ANIM_EVENT_ACTION];
- /* used for toon animations and global animations */
+ // used for toon animations and global animations
g->step_offset = parameter[GFX_ARG_STEP_OFFSET];
g->step_xoffset = parameter[GFX_ARG_STEP_XOFFSET];
g->step_yoffset = parameter[GFX_ARG_STEP_YOFFSET];
g->x = parameter[GFX_ARG_X]; // (may be uninitialized,
g->y = parameter[GFX_ARG_Y]; // unlike src_x and src_y)
- /* this is only used for drawing font characters */
+ // this is only used for drawing font characters
g->draw_xoffset = parameter[GFX_ARG_DRAW_XOFFSET];
g->draw_yoffset = parameter[GFX_ARG_DRAW_YOFFSET];
- /* use a different default value for global animations and toons */
+ // use a different default value for global animations and toons
if ((graphic >= IMG_GFX_GLOBAL_ANIM_1 && graphic <= IMG_GFX_GLOBAL_ANIM_8) ||
(graphic >= IMG_TOON_1 && graphic <= IMG_TOON_20))
g->draw_masked = TRUE;
- /* this is used for drawing envelopes, global animations and toons */
+ // this is used for drawing envelopes, global animations and toons
if (parameter[GFX_ARG_DRAW_MASKED] != ARG_UNDEFINED_VALUE)
g->draw_masked = parameter[GFX_ARG_DRAW_MASKED];
- /* used for toon animations and global animations */
+ // used for toon animations and global animations
if (parameter[GFX_ARG_DRAW_ORDER] != ARG_UNDEFINED_VALUE)
g->draw_order = parameter[GFX_ARG_DRAW_ORDER];
- /* optional graphic for cloning all graphics settings */
+ // optional graphic for cloning all graphics settings
if (parameter[GFX_ARG_CLONE_FROM] != ARG_UNDEFINED_VALUE)
g->clone_from = parameter[GFX_ARG_CLONE_FROM];
- /* optional settings for drawing title screens and title messages */
+ // optional settings for drawing title screens and title messages
if (parameter[GFX_ARG_FADE_MODE] != ARG_UNDEFINED_VALUE)
g->fade_mode = parameter[GFX_ARG_FADE_MODE];
if (parameter[GFX_ARG_FADE_DELAY] != ARG_UNDEFINED_VALUE)
if (parameter[GFX_ARG_STYLE] != ARG_UNDEFINED_VALUE)
g->style = parameter[GFX_ARG_STYLE];
- /* this is only used for drawing menu buttons and text */
+ // this is only used for drawing menu buttons and text
g->active_xoffset = parameter[GFX_ARG_ACTIVE_XOFFSET];
g->active_yoffset = parameter[GFX_ARG_ACTIVE_YOFFSET];
g->pressed_xoffset = parameter[GFX_ARG_PRESSED_XOFFSET];
int parameter[NUM_GFX_ARGS];
int i;
- /* if fallback to default artwork is done, also use the default parameters */
+ // if fallback to default artwork is done, also use the default parameters
if (image->fallback_to_default)
parameter_raw = image->default_parameter;
- /* get integer values from string parameters */
+ // get integer values from string parameters
for (i = 0; i < NUM_GFX_ARGS; i++)
parameter[i] = get_graphic_parameter_value(parameter_raw[i],
image_config_suffix[i].token,
int num_images = getImageListSize();
int i;
- /* use image size as default values for width and height for these images */
+ // use image size as default values for width and height for these images
static int full_size_graphics[] =
{
IMG_GLOBAL_BORDER,
graphic_info = checked_calloc(num_images * sizeof(struct GraphicInfo));
- /* initialize "use_image_size" flag with default value */
+ // initialize "use_image_size" flag with default value
for (i = 0; i < num_images; i++)
graphic_info[i].use_image_size = FALSE;
- /* initialize "use_image_size" flag from static configuration above */
+ // initialize "use_image_size" flag from static configuration above
for (i = 0; full_size_graphics[i] != -1; i++)
graphic_info[full_size_graphics[i]].use_image_size = TRUE;
- /* first set all graphic paramaters ... */
+ // first set all graphic paramaters ...
for (i = 0; i < num_images; i++)
set_graphic_parameters(i);
- /* ... then copy these parameters for cloned graphics */
+ // ... then copy these parameters for cloned graphics
for (i = 0; i < num_images; i++)
if (graphic_info[i].clone_from != -1)
set_cloned_graphic_parameters(i);
int last_frame;
int src_bitmap_width, src_bitmap_height;
- /* now check if no animation frames are outside of the loaded image */
+ // now check if no animation frames are outside of the loaded image
if (graphic_info[i].bitmap == NULL)
- continue; /* skip check for optional images that are undefined */
+ continue; // skip check for optional images that are undefined
- /* get image size (this can differ from the standard element tile size!) */
+ // get image size (this can differ from the standard element tile size!)
width = graphic_info[i].width;
height = graphic_info[i].height;
- /* get final bitmap size (with scaling, but without small images) */
+ // get final bitmap size (with scaling, but without small images)
src_bitmap_width = graphic_info[i].src_image_width;
src_bitmap_height = graphic_info[i].src_image_height;
- /* check if first animation frame is inside specified bitmap */
+ // check if first animation frame is inside specified bitmap
- /* do not use getGraphicSourceXY() here to get position of first frame; */
- /* this avoids calculating wrong start position for out-of-bounds frame */
+ // do not use getGraphicSourceXY() here to get position of first frame;
+ // this avoids calculating wrong start position for out-of-bounds frame
src_x = graphic_info[i].src_x;
src_y = graphic_info[i].src_y;
graphic_info[i] = graphic_info[fallback_graphic];
- /* if first frame out of bounds, do not check last frame anymore */
+ // if first frame out of bounds, do not check last frame anymore
continue;
}
- /* check if last animation frame is inside specified bitmap */
+ // check if last animation frame is inside specified bitmap
last_frame = graphic_info[i].anim_frames - 1;
getGraphicSourceXY(i, last_frame, &src_x, &src_y, FALSE);
to solve this, remap all those individual definitions that are not
redefined to the new bitmap of "global.door" if it was redefined */
- /* special compatibility handling if image "global.door" was redefined */
+ // special compatibility handling if image "global.door" was redefined
if (fi_global_door->redefined)
{
for (i = 0; i < num_images; i++)
{
struct FileInfo *fi = getImageListEntryFromImageID(i);
- /* process only those images that still use the default settings */
+ // process only those images that still use the default settings
if (!fi->redefined)
{
- /* process all images which default to same image as "global.door" */
+ // process all images which default to same image as "global.door"
if (strEqual(fi->default_filename, fi_global_door->default_filename))
{
// printf("::: special treatment needed for token '%s'\n", fi->token);
int num_property_mappings = getSoundListPropertyMappingSize();
int i, j, act;
- /* set values to -1 to identify later as "uninitialized" values */
+ // set values to -1 to identify later as "uninitialized" values
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
for (act = 0; act < NUM_ACTIONS; act++)
element_info[i].sound[act] = -1;
- /* initialize element/sound mapping from static configuration */
+ // initialize element/sound mapping from static configuration
for (i = 0; element_to_sound[i].element > -1; i++)
{
int element = element_to_sound[i].element;
element_info[j].sound[action] = sound;
}
- /* initialize element class/sound mapping from dynamic configuration */
+ // initialize element class/sound mapping from dynamic configuration
for (i = 0; i < num_property_mappings; i++)
{
int element_class = property_mapping[i].base_index - MAX_NUM_ELEMENTS;
element_info[j].sound[action] = sound;
}
- /* initialize element/sound mapping from dynamic configuration */
+ // initialize element/sound mapping from dynamic configuration
for (i = 0; i < num_property_mappings; i++)
{
int element = property_mapping[i].base_index;
element_info[element].sound[action] = sound;
}
- /* now set all '-1' values to element specific default values */
+ // now set all '-1' values to element specific default values
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
for (act = 0; act < NUM_ACTIONS; act++)
{
- /* generic default action sound (defined by "[default]" directive) */
+ // generic default action sound (defined by "[default]" directive)
int default_action_sound = element_info[EL_DEFAULT].sound[act];
- /* look for special default action sound (classic game specific) */
+ // look for special default action sound (classic game specific)
if (IS_BD_ELEMENT(i) && element_info[EL_BD_DEFAULT].sound[act] != -1)
default_action_sound = element_info[EL_BD_DEFAULT].sound[act];
if (IS_SP_ELEMENT(i) && element_info[EL_SP_DEFAULT].sound[act] != -1)
if (IS_MM_ELEMENT(i) && element_info[EL_MM_DEFAULT].sound[act] != -1)
default_action_sound = element_info[EL_MM_DEFAULT].sound[act];
- /* !!! needed because EL_EMPTY_SPACE treated as IS_SP_ELEMENT !!! */
- /* !!! make this better !!! */
+ // !!! needed because EL_EMPTY_SPACE treated as IS_SP_ELEMENT !!!
+ // !!! make this better !!!
if (i == EL_EMPTY_SPACE)
default_action_sound = element_info[EL_DEFAULT].sound[act];
- /* no sound for this specific action -- use default action sound */
+ // no sound for this specific action -- use default action sound
if (element_info[i].sound[act] == -1)
element_info[i].sound[act] = default_action_sound;
}
{
int i;
- /* set values to -1 to identify later as "uninitialized" values */
+ // set values to -1 to identify later as "uninitialized" values
for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++)
menu.sound[i] = -1;
- /* initialize gamemode/sound mapping from static configuration */
+ // initialize gamemode/sound mapping from static configuration
for (i = 0; gamemode_to_sound[i].sound > -1; i++)
{
int gamemode = gamemode_to_sound[i].gamemode;
menu.sound[gamemode] = sound;
}
- /* now set all '-1' values to levelset specific default values */
+ // now set all '-1' values to levelset specific default values
for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++)
if (menu.sound[i] == -1)
menu.sound[i] = menu.sound[GAME_MODE_DEFAULT];
int parameter[NUM_SND_ARGS];
int i;
- /* get integer values from string parameters */
+ // get integer values from string parameters
for (i = 0; i < NUM_SND_ARGS; i++)
parameter[i] =
get_parameter_value(parameter_raw[i],
sound_config_suffix[i].token,
sound_config_suffix[i].type);
- /* explicit loop mode setting in configuration overrides default value */
+ // explicit loop mode setting in configuration overrides default value
if (parameter[SND_ARG_MODE_LOOP] != ARG_UNDEFINED_VALUE)
sound_info[sound].loop = parameter[SND_ARG_MODE_LOOP];
- /* sound volume to change the original volume when loading the sound file */
+ // sound volume to change the original volume when loading the sound file
sound_info[sound].volume = parameter[SND_ARG_VOLUME];
- /* sound priority to give certain sounds a higher or lower priority */
+ // sound priority to give certain sounds a higher or lower priority
sound_info[sound].priority = parameter[SND_ARG_PRIORITY];
}
sound_effect_properties = checked_calloc(num_sounds * sizeof(int));
sound_info = checked_calloc(num_sounds * sizeof(struct SoundInfo));
- /* initialize sound effect for all elements to "no sound" */
+ // initialize sound effect for all elements to "no sound"
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
for (j = 0; j < NUM_ACTIONS; j++)
element_info[i].sound[j] = SND_UNDEFINED;
int len_effect_text = strlen(sound->token);
sound_effect_properties[i] = ACTION_OTHER;
- sound_info[i].loop = FALSE; /* default: play sound only once */
+ sound_info[i].loop = FALSE; // default: play sound only once
- /* determine all loop sounds and identify certain sound classes */
+ // determine all loop sounds and identify certain sound classes
for (j = 0; element_action_info[j].suffix; j++)
{
}
}
- /* associate elements and some selected sound actions */
+ // associate elements and some selected sound actions
for (j = 0; j < MAX_NUM_ELEMENTS; j++)
{
int default_levelset_music = -1;
int i;
- /* set values to -1 to identify later as "uninitialized" values */
+ // set values to -1 to identify later as "uninitialized" values
for (i = 0; i < MAX_LEVELS; i++)
levelset.music[i] = -1;
for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++)
menu.music[i] = -1;
- /* initialize gamemode/music mapping from static configuration */
+ // initialize gamemode/music mapping from static configuration
for (i = 0; gamemode_to_music[i].music > -1; i++)
{
int gamemode = gamemode_to_music[i].gamemode;
menu.music[gamemode] = music;
}
- /* initialize gamemode/music mapping from dynamic configuration */
+ // initialize gamemode/music mapping from dynamic configuration
for (i = 0; i < num_property_mappings; i++)
{
int prefix = property_mapping[i].base_index;
if (gamemode < 0)
gamemode = GAME_MODE_DEFAULT;
- /* level specific music only allowed for in-game music */
+ // level specific music only allowed for in-game music
if (level != -1 && gamemode == GAME_MODE_DEFAULT)
gamemode = GAME_MODE_PLAYING;
menu.music[gamemode] = music;
}
- /* now set all '-1' values to menu specific default values */
+ // now set all '-1' values to menu specific default values
/* (undefined values of "levelset.music[]" might stay at "-1" to
allow dynamic selection of music files from music directory!) */
for (i = 0; i < MAX_LEVELS; i++)
int parameter[NUM_MUS_ARGS];
int i;
- /* get integer values from string parameters */
+ // get integer values from string parameters
for (i = 0; i < NUM_MUS_ARGS; i++)
parameter[i] =
get_parameter_value(parameter_raw[i],
music_config_suffix[i].token,
music_config_suffix[i].type);
- /* explicit loop mode setting in configuration overrides default value */
+ // explicit loop mode setting in configuration overrides default value
if (parameter[MUS_ARG_MODE_LOOP] != ARG_UNDEFINED_VALUE)
music_info[music].loop = parameter[MUS_ARG_MODE_LOOP];
}
struct FileInfo *music = getMusicListEntry(i);
int len_music_text = strlen(music->token);
- music_info[i].loop = TRUE; /* default: play music in loop mode */
+ music_info[i].loop = TRUE; // default: play music in loop mode
- /* determine all loop music */
+ // determine all loop music
for (j = 0; music_prefix_info[j].prefix; j++)
{
InitGfxTileSizeInfo(game.tile_size, TILESIZE);
- InitGraphicInfo(); /* graphic properties mapping */
+ InitGraphicInfo(); // graphic properties mapping
print_timestamp_time("InitGraphicInfo");
- InitElementGraphicInfo(); /* element game graphic mapping */
+ InitElementGraphicInfo(); // element game graphic mapping
print_timestamp_time("InitElementGraphicInfo");
- InitElementSpecialGraphicInfo(); /* element special graphic mapping */
+ InitElementSpecialGraphicInfo(); // element special graphic mapping
print_timestamp_time("InitElementSpecialGraphicInfo");
- InitElementSmallImages(); /* scale elements to all needed sizes */
+ InitElementSmallImages(); // scale elements to all needed sizes
print_timestamp_time("InitElementSmallImages");
- InitScaledImages(); /* scale all other images, if needed */
+ InitScaledImages(); // scale all other images, if needed
print_timestamp_time("InitScaledImages");
- InitBitmapPointers(); /* set standard size bitmap pointers */
+ InitBitmapPointers(); // set standard size bitmap pointers
print_timestamp_time("InitBitmapPointers");
- InitFontGraphicInfo(); /* initialize text drawing functions */
+ InitFontGraphicInfo(); // initialize text drawing functions
print_timestamp_time("InitFontGraphicInfo");
- InitGlobalAnimGraphicInfo(); /* initialize global animation config */
+ InitGlobalAnimGraphicInfo(); // initialize global animation config
print_timestamp_time("InitGlobalAnimGraphicInfo");
- InitImageTextures(); /* create textures for certain images */
+ InitImageTextures(); // create textures for certain images
print_timestamp_time("InitImageTextures");
- InitGraphicInfo_EM(); /* graphic mapping for EM engine */
+ InitGraphicInfo_EM(); // graphic mapping for EM engine
print_timestamp_time("InitGraphicInfo_EM");
InitGraphicCompatibilityInfo();
static void ReinitializeSounds(void)
{
- InitSoundInfo(); /* sound properties mapping */
- InitElementSoundInfo(); /* element game sound mapping */
- InitGameModeSoundInfo(); /* game mode sound mapping */
- InitGlobalAnimSoundInfo(); /* global animation sound settings */
+ InitSoundInfo(); // sound properties mapping
+ InitElementSoundInfo(); // element game sound mapping
+ InitGameModeSoundInfo(); // game mode sound mapping
+ InitGlobalAnimSoundInfo(); // global animation sound settings
- InitPlayLevelSound(); /* internal game sound settings */
+ InitPlayLevelSound(); // internal game sound settings
}
static void ReinitializeMusic(void)
{
- InitMusicInfo(); /* music properties mapping */
- InitGameModeMusicInfo(); /* game mode music mapping */
- InitGlobalAnimMusicInfo(); /* global animation music settings */
+ InitMusicInfo(); // music properties mapping
+ InitGameModeMusicInfo(); // game mode music mapping
+ InitGlobalAnimMusicInfo(); // global animation music settings
}
static int get_special_property_bit(int element, int property_bit_nr)
static struct PropertyBitInfo pb_can_move_into_acid[] =
{
- /* the player may be able fall into acid when gravity is activated */
+ // the player may be able fall into acid when gravity is activated
{ EL_PLAYER_1, 0 },
{ EL_PLAYER_2, 0 },
{ EL_PLAYER_3, 0 },
{ EL_SP_MURPHY, 0 },
{ EL_SOKOBAN_FIELD_PLAYER, 0 },
- /* all elements that can move may be able to also move into acid */
+ // all elements that can move may be able to also move into acid
{ EL_BUG, 1 },
{ EL_BUG_LEFT, 1 },
{ EL_BUG_RIGHT, 1 },
struct ElementGroupInfo *actual_group = element_info[group_element].group;
int i;
- if (actual_group == NULL) /* not yet initialized */
+ if (actual_group == NULL) // not yet initialized
return;
- if (recursion_depth > NUM_GROUP_ELEMENTS) /* recursion too deep */
+ if (recursion_depth > NUM_GROUP_ELEMENTS) // recursion too deep
{
Error(ERR_WARN, "recursion too deep when resolving group element %d",
group_element - EL_GROUP_START + 1);
- /* replace element which caused too deep recursion by question mark */
+ // replace element which caused too deep recursion by question mark
group->element_resolved[group->num_elements_resolved++] = EL_UNKNOWN;
return;
}
- if (recursion_depth == 0) /* initialization */
+ if (recursion_depth == 0) // initialization
{
group = actual_group;
group_nr = GROUP_NR(group_element);
EL_INVISIBLE_SAND_ACTIVE,
EL_EMC_GRASS,
- /* !!! currently not diggable, but handled by 'ep_dont_run_into' !!! */
- /* (if amoeba can grow into anything diggable, maybe keep these out) */
+ // !!! currently not diggable, but handled by 'ep_dont_run_into' !!!
+ // (if amoeba can grow into anything diggable, maybe keep these out)
#if 0
EL_LANDMINE,
EL_DC_LANDMINE,
EL_EMC_MAGNIFIER,
#if 0
- /* !!! handle separately !!! */
- EL_DC_LANDMINE, /* deadly when running into, but can be snapped */
+ // !!! handle separately !!!
+ EL_DC_LANDMINE, // deadly when running into, but can be snapped
#endif
-1
static int ep_dont_run_into[] =
{
- /* same elements as in 'ep_dont_touch' */
+ // same elements as in 'ep_dont_touch'
EL_BUG,
EL_SPACESHIP,
EL_BD_BUTTERFLY,
EL_BD_FIREFLY,
- /* same elements as in 'ep_dont_collide_with' */
+ // same elements as in 'ep_dont_collide_with'
EL_YAMYAM,
EL_DARK_YAMYAM,
EL_ROBOT,
EL_SP_SNIKSNAK,
EL_SP_ELECTRON,
- /* new elements */
+ // new elements
EL_AMOEBA_DROP,
EL_ACID,
- /* !!! maybe this should better be handled by 'ep_diggable' !!! */
+ // !!! maybe this should better be handled by 'ep_diggable' !!!
#if 1
EL_LANDMINE,
EL_DC_LANDMINE,
static int ep_dont_collide_with[] =
{
- /* same elements as in 'ep_dont_touch' */
+ // same elements as in 'ep_dont_touch'
EL_BUG,
EL_SPACESHIP,
EL_BD_BUTTERFLY,
EL_BD_FIREFLY,
- /* new elements */
+ // new elements
EL_YAMYAM,
EL_DARK_YAMYAM,
EL_ROBOT,
static int ep_can_move[] =
{
- /* same elements as in 'pb_can_move_into_acid' */
+ // same elements as in 'pb_can_move_into_acid'
EL_BUG,
EL_SPACESHIP,
EL_BD_BUTTERFLY,
static int ep_explodes_by_fire[] =
{
- /* same elements as in 'ep_explodes_impact' */
+ // same elements as in 'ep_explodes_impact'
EL_BOMB,
EL_SP_DISK_ORANGE,
EL_DX_SUPABOMB,
- /* same elements as in 'ep_explodes_smashed' */
+ // same elements as in 'ep_explodes_smashed'
EL_SATELLITE,
EL_PIG,
EL_DRAGON,
EL_MOLE,
- /* new elements */
+ // new elements
EL_DYNAMITE,
EL_DYNAMITE_ACTIVE,
EL_EM_DYNAMITE,
static int ep_explodes_smashed[] =
{
- /* same elements as in 'ep_explodes_impact' */
+ // same elements as in 'ep_explodes_impact'
EL_BOMB,
EL_SP_DISK_ORANGE,
EL_DX_SUPABOMB,
- /* new elements */
+ // new elements
EL_SATELLITE,
EL_PIG,
EL_DRAGON,
static int ep_protected[] =
{
- /* same elements as in 'ep_walkable_inside' */
+ // same elements as in 'ep_walkable_inside'
EL_TUBE_ANY,
EL_TUBE_VERTICAL,
EL_TUBE_HORIZONTAL,
EL_TUBE_RIGHT_UP,
EL_TUBE_RIGHT_DOWN,
- /* same elements as in 'ep_passable_over' */
+ // same elements as in 'ep_passable_over'
EL_EM_GATE_1,
EL_EM_GATE_2,
EL_EM_GATE_3,
EL_SWITCHGATE_OPEN,
EL_TIMEGATE_OPEN,
- /* same elements as in 'ep_passable_inside' */
+ // same elements as in 'ep_passable_inside'
EL_SP_PORT_LEFT,
EL_SP_PORT_RIGHT,
EL_SP_PORT_UP,
static int ep_can_explode[] =
{
- /* same elements as in 'ep_explodes_impact' */
+ // same elements as in 'ep_explodes_impact'
EL_BOMB,
EL_SP_DISK_ORANGE,
EL_DX_SUPABOMB,
- /* same elements as in 'ep_explodes_smashed' */
+ // same elements as in 'ep_explodes_smashed'
EL_SATELLITE,
EL_PIG,
EL_DRAGON,
EL_MOLE,
- /* elements that can explode by explosion or by dragonfire */
+ // elements that can explode by explosion or by dragonfire
EL_DYNAMITE,
EL_DYNAMITE_ACTIVE,
EL_EM_DYNAMITE,
EL_SP_SNIKSNAK,
EL_SP_ELECTRON,
- /* elements that can explode only by explosion */
+ // elements that can explode only by explosion
EL_BLACK_ORB,
-1
static int ep_sp_element[] =
{
- /* should always be valid */
+ // should always be valid
EL_EMPTY,
- /* standard classic Supaplex elements */
+ // standard classic Supaplex elements
EL_SP_EMPTY,
EL_SP_ZONK,
EL_SP_BASE,
EL_SP_CHIP_TOP,
EL_SP_CHIP_BOTTOM,
- /* additional elements that appeared in newer Supaplex levels */
+ // additional elements that appeared in newer Supaplex levels
EL_INVISIBLE_WALL,
- /* additional gravity port elements (not switching, but setting gravity) */
+ // additional gravity port elements (not switching, but setting gravity)
EL_SP_GRAVITY_ON_PORT_LEFT,
EL_SP_GRAVITY_ON_PORT_RIGHT,
EL_SP_GRAVITY_ON_PORT_UP,
EL_SP_GRAVITY_OFF_PORT_UP,
EL_SP_GRAVITY_OFF_PORT_DOWN,
- /* more than one Murphy in a level results in an inactive clone */
+ // more than one Murphy in a level results in an inactive clone
EL_SP_MURPHY_CLONE,
- /* runtime Supaplex elements */
+ // runtime Supaplex elements
EL_SP_DISK_RED_ACTIVE,
EL_SP_TERMINAL_ACTIVE,
EL_SP_BUGGY_BASE_ACTIVATING,
static int ep_can_turn_each_move[] =
{
- /* !!! do something with this one !!! */
+ // !!! do something with this one !!!
-1
};
int i, j, k;
- /* always start with reliable default values (element has no properties) */
- /* (but never initialize clipboard elements after the very first time) */
- /* (to be able to use clipboard elements between several levels) */
+ // always start with reliable default values (element has no properties)
+ // (but never initialize clipboard elements after the very first time)
+ // (to be able to use clipboard elements between several levels)
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
if (!IS_CLIPBOARD_ELEMENT(i) || !clipboard_elements_initialized)
for (j = 0; j < NUM_ELEMENT_PROPERTIES; j++)
SET_PROPERTY(i, j, FALSE);
- /* set all base element properties from above array definitions */
+ // set all base element properties from above array definitions
for (i = 0; element_properties[i].elements != NULL; i++)
for (j = 0; (element_properties[i].elements)[j] != -1; j++)
SET_PROPERTY((element_properties[i].elements)[j],
element_properties[i].property, TRUE);
- /* copy properties to some elements that are only stored in level file */
+ // copy properties to some elements that are only stored in level file
for (i = 0; i < NUM_ELEMENT_PROPERTIES; i++)
for (j = 0; copy_properties[j][0] != -1; j++)
if (HAS_PROPERTY(copy_properties[j][0], i))
for (k = 1; k <= 4; k++)
SET_PROPERTY(copy_properties[j][k], i, TRUE);
- /* set static element properties that are not listed in array definitions */
+ // set static element properties that are not listed in array definitions
for (i = EL_STEEL_CHAR_START; i <= EL_STEEL_CHAR_END; i++)
SET_PROPERTY(i, EP_INDESTRUCTIBLE, TRUE);
property (which means that conditional property changes must be set to
a reliable default value before) */
- /* resolve group elements */
+ // resolve group elements
for (i = 0; i < NUM_GROUP_ELEMENTS; i++)
ResolveGroupElement(EL_GROUP_START + i);
- /* set all special, combined or engine dependent element properties */
+ // set all special, combined or engine dependent element properties
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
{
- /* do not change (already initialized) clipboard elements here */
+ // do not change (already initialized) clipboard elements here
if (IS_CLIPBOARD_ELEMENT(i))
continue;
- /* ---------- INACTIVE ------------------------------------------------- */
+ // ---------- INACTIVE ----------------------------------------------------
SET_PROPERTY(i, EP_INACTIVE, ((i >= EL_CHAR_START &&
i <= EL_CHAR_END) ||
(i >= EL_STEEL_CHAR_START &&
i <= EL_STEEL_CHAR_END)));
- /* ---------- WALKABLE, PASSABLE, ACCESSIBLE --------------------------- */
+ // ---------- WALKABLE, PASSABLE, ACCESSIBLE ------------------------------
SET_PROPERTY(i, EP_WALKABLE, (IS_WALKABLE_OVER(i) ||
IS_WALKABLE_INSIDE(i) ||
IS_WALKABLE_UNDER(i)));
SET_PROPERTY(i, EP_ACCESSIBLE, (IS_WALKABLE(i) ||
IS_PASSABLE(i)));
- /* ---------- COLLECTIBLE ---------------------------------------------- */
+ // ---------- COLLECTIBLE -------------------------------------------------
SET_PROPERTY(i, EP_COLLECTIBLE, (IS_COLLECTIBLE_ONLY(i) ||
IS_DROPPABLE(i) ||
IS_THROWABLE(i)));
- /* ---------- SNAPPABLE ------------------------------------------------ */
+ // ---------- SNAPPABLE ---------------------------------------------------
SET_PROPERTY(i, EP_SNAPPABLE, (IS_DIGGABLE(i) ||
IS_COLLECTIBLE(i) ||
IS_SWITCHABLE(i) ||
i == EL_BD_ROCK));
- /* ---------- WALL ----------------------------------------------------- */
- SET_PROPERTY(i, EP_WALL, TRUE); /* default: element is wall */
+ // ---------- WALL --------------------------------------------------------
+ SET_PROPERTY(i, EP_WALL, TRUE); // default: element is wall
for (j = 0; no_wall_properties[j] != -1; j++)
if (HAS_PROPERTY(i, no_wall_properties[j]) ||
if (IS_HISTORIC_WALL(i))
SET_PROPERTY(i, EP_WALL, TRUE);
- /* ---------- SOLID_FOR_PUSHING ---------------------------------------- */
+ // ---------- SOLID_FOR_PUSHING -------------------------------------------
if (engine_version < VERSION_IDENT(2,2,0,0))
SET_PROPERTY(i, EP_SOLID_FOR_PUSHING, IS_HISTORIC_SOLID(i));
else
!IS_DIGGABLE(i) &&
!IS_COLLECTIBLE(i)));
- /* ---------- DRAGONFIRE_PROOF ----------------------------------------- */
+ // ---------- DRAGONFIRE_PROOF --------------------------------------------
if (IS_HISTORIC_SOLID(i) || i == EL_EXPLOSION)
SET_PROPERTY(i, EP_DRAGONFIRE_PROOF, TRUE);
else
SET_PROPERTY(i, EP_DRAGONFIRE_PROOF, (IS_INDESTRUCTIBLE(i) &&
i != EL_ACID));
- /* ---------- EXPLOSION_PROOF ------------------------------------------ */
+ // ---------- EXPLOSION_PROOF ---------------------------------------------
if (i == EL_FLAMES)
SET_PROPERTY(i, EP_EXPLOSION_PROOF, TRUE);
else if (engine_version < VERSION_IDENT(2,2,0,0))
if (IS_CUSTOM_ELEMENT(i))
{
- /* these are additional properties which are initially false when set */
+ // these are additional properties which are initially false when set
- /* ---------- DONT_COLLIDE_WITH / DONT_RUN_INTO ---------------------- */
+ // ---------- DONT_COLLIDE_WITH / DONT_RUN_INTO -------------------------
if (DONT_TOUCH(i))
SET_PROPERTY(i, EP_DONT_COLLIDE_WITH, TRUE);
if (DONT_COLLIDE_WITH(i))
SET_PROPERTY(i, EP_DONT_RUN_INTO, TRUE);
- /* ---------- CAN_SMASH_ENEMIES / CAN_SMASH_PLAYER ------------------- */
+ // ---------- CAN_SMASH_ENEMIES / CAN_SMASH_PLAYER ----------------------
if (CAN_SMASH_EVERYTHING(i))
SET_PROPERTY(i, EP_CAN_SMASH_ENEMIES, TRUE);
if (CAN_SMASH_ENEMIES(i))
SET_PROPERTY(i, EP_CAN_SMASH_PLAYER, TRUE);
}
- /* ---------- CAN_SMASH ------------------------------------------------ */
+ // ---------- CAN_SMASH ---------------------------------------------------
SET_PROPERTY(i, EP_CAN_SMASH, (CAN_SMASH_PLAYER(i) ||
CAN_SMASH_ENEMIES(i) ||
CAN_SMASH_EVERYTHING(i)));
- /* ---------- CAN_EXPLODE_BY_FIRE -------------------------------------- */
+ // ---------- CAN_EXPLODE_BY_FIRE -----------------------------------------
SET_PROPERTY(i, EP_CAN_EXPLODE_BY_FIRE, (CAN_EXPLODE(i) &&
EXPLODES_BY_FIRE(i)));
- /* ---------- CAN_EXPLODE_SMASHED -------------------------------------- */
+ // ---------- CAN_EXPLODE_SMASHED -----------------------------------------
SET_PROPERTY(i, EP_CAN_EXPLODE_SMASHED, (CAN_EXPLODE(i) &&
EXPLODES_SMASHED(i)));
- /* ---------- CAN_EXPLODE_IMPACT --------------------------------------- */
+ // ---------- CAN_EXPLODE_IMPACT ------------------------------------------
SET_PROPERTY(i, EP_CAN_EXPLODE_IMPACT, (CAN_EXPLODE(i) &&
EXPLODES_IMPACT(i)));
- /* ---------- CAN_EXPLODE_BY_DRAGONFIRE -------------------------------- */
+ // ---------- CAN_EXPLODE_BY_DRAGONFIRE -----------------------------------
SET_PROPERTY(i, EP_CAN_EXPLODE_BY_DRAGONFIRE, CAN_EXPLODE_BY_FIRE(i));
- /* ---------- CAN_EXPLODE_BY_EXPLOSION --------------------------------- */
+ // ---------- CAN_EXPLODE_BY_EXPLOSION ------------------------------------
SET_PROPERTY(i, EP_CAN_EXPLODE_BY_EXPLOSION, (CAN_EXPLODE_BY_FIRE(i) ||
i == EL_BLACK_ORB));
- /* ---------- COULD_MOVE_INTO_ACID ------------------------------------- */
+ // ---------- COULD_MOVE_INTO_ACID ----------------------------------------
SET_PROPERTY(i, EP_COULD_MOVE_INTO_ACID, (ELEM_IS_PLAYER(i) ||
CAN_MOVE(i) ||
IS_CUSTOM_ELEMENT(i)));
- /* ---------- MAYBE_DONT_COLLIDE_WITH ---------------------------------- */
+ // ---------- MAYBE_DONT_COLLIDE_WITH -------------------------------------
SET_PROPERTY(i, EP_MAYBE_DONT_COLLIDE_WITH, (i == EL_SP_SNIKSNAK ||
i == EL_SP_ELECTRON));
- /* ---------- CAN_MOVE_INTO_ACID --------------------------------------- */
+ // ---------- CAN_MOVE_INTO_ACID ------------------------------------------
if (COULD_MOVE_INTO_ACID(i) && !IS_CUSTOM_ELEMENT(i))
SET_PROPERTY(i, EP_CAN_MOVE_INTO_ACID,
getMoveIntoAcidProperty(&level, i));
- /* ---------- DONT_COLLIDE_WITH ---------------------------------------- */
+ // ---------- DONT_COLLIDE_WITH -------------------------------------------
if (MAYBE_DONT_COLLIDE_WITH(i))
SET_PROPERTY(i, EP_DONT_COLLIDE_WITH,
getDontCollideWithProperty(&level, i));
- /* ---------- SP_PORT -------------------------------------------------- */
+ // ---------- SP_PORT -----------------------------------------------------
SET_PROPERTY(i, EP_SP_PORT, (IS_SP_ELEMENT(i) &&
IS_PASSABLE_INSIDE(i)));
- /* ---------- CAN_BE_CLONED_BY_ANDROID --------------------------------- */
+ // ---------- CAN_BE_CLONED_BY_ANDROID ------------------------------------
for (j = 0; j < level.num_android_clone_elements; j++)
SET_PROPERTY(i, EP_CAN_BE_CLONED_BY_ANDROID,
(i != EL_EMPTY &&
IS_EQUAL_OR_IN_GROUP(i, level.android_clone_element[j])));
- /* ---------- CAN_CHANGE ----------------------------------------------- */
- SET_PROPERTY(i, EP_CAN_CHANGE, FALSE); /* default: cannot change */
+ // ---------- CAN_CHANGE --------------------------------------------------
+ SET_PROPERTY(i, EP_CAN_CHANGE, FALSE); // default: cannot change
for (j = 0; j < element_info[i].num_change_pages; j++)
if (element_info[i].change_page[j].can_change)
SET_PROPERTY(i, EP_CAN_CHANGE, TRUE);
- /* ---------- HAS_ACTION ----------------------------------------------- */
- SET_PROPERTY(i, EP_HAS_ACTION, FALSE); /* default: has no action */
+ // ---------- HAS_ACTION --------------------------------------------------
+ SET_PROPERTY(i, EP_HAS_ACTION, FALSE); // default: has no action
for (j = 0; j < element_info[i].num_change_pages; j++)
if (element_info[i].change_page[j].has_action)
SET_PROPERTY(i, EP_HAS_ACTION, TRUE);
- /* ---------- CAN_CHANGE_OR_HAS_ACTION --------------------------------- */
+ // ---------- CAN_CHANGE_OR_HAS_ACTION ------------------------------------
SET_PROPERTY(i, EP_CAN_CHANGE_OR_HAS_ACTION, (CAN_CHANGE(i) ||
HAS_ACTION(i)));
- /* ---------- GFX_CRUMBLED --------------------------------------------- */
+ // ---------- GFX_CRUMBLED ------------------------------------------------
SET_PROPERTY(i, EP_GFX_CRUMBLED,
element_info[i].crumbled[ACTION_DEFAULT] !=
element_info[i].graphic[ACTION_DEFAULT]);
- /* ---------- EDITOR_CASCADE ------------------------------------------- */
+ // ---------- EDITOR_CASCADE ----------------------------------------------
SET_PROPERTY(i, EP_EDITOR_CASCADE, (IS_EDITOR_CASCADE_ACTIVE(i) ||
IS_EDITOR_CASCADE_INACTIVE(i)));
}
- /* dynamically adjust element properties according to game engine version */
+ // dynamically adjust element properties according to game engine version
{
static int ep_em_slippery_wall[] =
{
-1
};
- /* special EM style gems behaviour */
+ // special EM style gems behaviour
for (i = 0; ep_em_slippery_wall[i] != -1; i++)
SET_PROPERTY(ep_em_slippery_wall[i], EP_EM_SLIPPERY_WALL,
level.em_slippery_gems);
- /* "EL_EXPANDABLE_WALL_GROWING" wasn't slippery for EM gems in 2.0.1 */
+ // "EL_EXPANDABLE_WALL_GROWING" wasn't slippery for EM gems in 2.0.1
SET_PROPERTY(EL_EXPANDABLE_WALL_GROWING, EP_EM_SLIPPERY_WALL,
(level.em_slippery_gems &&
engine_version > VERSION_IDENT(2,0,1,0)));
- /* special EM style explosion behaviour regarding chain reactions */
+ // special EM style explosion behaviour regarding chain reactions
for (i = 0; ep_em_explodes_by_fire[i] != -1; i++)
SET_PROPERTY(ep_em_explodes_by_fire[i], EP_EXPLODES_BY_FIRE,
level.em_explodes_by_fire);
}
- /* this is needed because some graphics depend on element properties */
+ // this is needed because some graphics depend on element properties
if (game_status == GAME_MODE_PLAYING)
InitElementGraphicInfo();
}
for (i = 0; i < MAX_NUM_ELEMENTS + 1; i++)
{
- /* check if element_name_info entry defined for each element in "main.h" */
+ // check if element_name_info entry defined for each element in "main.h"
if (i < MAX_NUM_ELEMENTS && element_name_info[i].token_name == NULL)
Error(ERR_EXIT, "undefined 'element_name_info' entry for element %d", i);
for (i = 0; i < NUM_GLOBAL_ANIM_TOKENS + 1; i++)
{
- /* check if global_anim_name_info defined for each entry in "main.h" */
+ // check if global_anim_name_info defined for each entry in "main.h"
if (i < NUM_GLOBAL_ANIM_TOKENS &&
global_anim_name_info[i].token_name == NULL)
Error(ERR_EXIT, "undefined 'global_anim_name_info' entry for anim %d", i);
global_anim_info[i].token_name = global_anim_name_info[i].token_name;
}
- /* create hash from image config list */
+ // create hash from image config list
image_config_hash = newSetupFileHash();
for (i = 0; image_config[i].token != NULL; i++)
setHashEntry(image_config_hash,
image_config[i].token,
image_config[i].value);
- /* create hash from element token list */
+ // create hash from element token list
element_token_hash = newSetupFileHash();
for (i = 0; element_name_info[i].token_name != NULL; i++)
setHashEntry(element_token_hash,
element_name_info[i].token_name,
int2str(i, 0));
- /* create hash from graphic token list */
+ // create hash from graphic token list
graphic_token_hash = newSetupFileHash();
for (graphic = 0, i = 0; image_config[i].token != NULL; i++)
if (strSuffix(image_config[i].value, ".png") ||
image_config[i].token,
int2str(graphic++, 0));
- /* create hash from font token list */
+ // create hash from font token list
font_token_hash = newSetupFileHash();
for (i = 0; font_info[i].token_name != NULL; i++)
setHashEntry(font_token_hash,
font_info[i].token_name,
int2str(i, 0));
- /* set default filenames for all cloned graphics in static configuration */
+ // set default filenames for all cloned graphics in static configuration
for (i = 0; image_config[i].token != NULL; i++)
{
if (strEqual(image_config[i].value, UNDEFINED_FILENAME))
if (value_cloned != NULL)
{
- /* set default filename in static configuration */
+ // set default filename in static configuration
image_config[i].value = value_cloned;
- /* set default filename in image config hash */
+ // set default filename in image config hash
setHashEntry(image_config_hash, token, value_cloned);
}
}
}
}
- /* always start with reliable default values (all elements) */
+ // always start with reliable default values (all elements)
for (i = 0; i < MAX_NUM_ELEMENTS; i++)
ActiveElement[i] = i;
- /* now add all entries that have an active state (active elements) */
+ // now add all entries that have an active state (active elements)
for (i = 0; element_with_active_state[i].element != -1; i++)
{
int element = element_with_active_state[i].element;
ActiveElement[element] = element_active;
}
- /* always start with reliable default values (all buttons) */
+ // always start with reliable default values (all buttons)
for (i = 0; i < NUM_IMAGE_FILES; i++)
ActiveButton[i] = i;
- /* now add all entries that have an active state (active buttons) */
+ // now add all entries that have an active state (active buttons)
for (i = 0; button_with_active_state[i].button != -1; i++)
{
int button = button_with_active_state[i].button;
ActiveButton[button] = button_active;
}
- /* always start with reliable default values (all fonts) */
+ // always start with reliable default values (all fonts)
for (i = 0; i < NUM_FONTS; i++)
ActiveFont[i] = i;
- /* now add all entries that have an active state (active fonts) */
+ // now add all entries that have an active state (active fonts)
for (i = 0; font_with_active_state[i].font_nr != -1; i++)
{
int font = font_with_active_state[i].font_nr;
Print("# (The entries below are default and therefore commented out.)\n");
Print("\n");
- /* this is needed to be able to check element list for cascade elements */
+ // this is needed to be able to check element list for cascade elements
InitElementPropertiesStatic();
InitElementPropertiesEngine(GAME_VERSION_ACTUAL);
strPrefix(command, "autoffwd ") ||
strPrefix(command, "autowarp "))
{
- char *str_ptr = getStringCopy(&command[9]); /* read command parameters */
+ char *str_ptr = getStringCopy(&command[9]); // read command parameters
global.autoplay_mode =
(strPrefix(command, "autotest") ? AUTOPLAY_MODE_TEST :
strPrefix(command, "autowarp") ? AUTOPLAY_MODE_WARP :
AUTOPLAY_MODE_NONE);
- while (*str_ptr != '\0') /* continue parsing string */
+ while (*str_ptr != '\0') // continue parsing string
{
- /* cut leading whitespace from string, replace it by string terminator */
+ // cut leading whitespace from string, replace it by string terminator
while (*str_ptr == ' ' || *str_ptr == '\t')
*str_ptr++ = '\0';
- if (*str_ptr == '\0') /* end of string reached */
+ if (*str_ptr == '\0') // end of string reached
break;
- if (global.autoplay_leveldir == NULL) /* read level set string */
+ if (global.autoplay_leveldir == NULL) // read level set string
{
global.autoplay_leveldir = str_ptr;
- global.autoplay_all = TRUE; /* default: play all tapes */
+ global.autoplay_all = TRUE; // default: play all tapes
for (i = 0; i < MAX_TAPES_PER_SET; i++)
global.autoplay_level[i] = FALSE;
}
- else /* read level number string */
+ else // read level number string
{
- int level_nr = atoi(str_ptr); /* get level_nr value */
+ int level_nr = atoi(str_ptr); // get level_nr value
if (level_nr >= 0 && level_nr < MAX_TAPES_PER_SET)
global.autoplay_level[level_nr] = TRUE;
global.autoplay_all = FALSE;
}
- /* advance string pointer to the next whitespace (or end of string) */
+ // advance string pointer to the next whitespace (or end of string)
while (*str_ptr != ' ' && *str_ptr != '\t' && *str_ptr != '\0')
str_ptr++;
}
global.convert_leveldir = str_copy;
global.convert_level_nr = -1;
- if (str_ptr != NULL) /* level number follows */
+ if (str_ptr != NULL) // level number follows
{
- *str_ptr++ = '\0'; /* terminate leveldir string */
- global.convert_level_nr = atoi(str_ptr); /* get level_nr value */
+ *str_ptr++ = '\0'; // terminate leveldir string
+ global.convert_level_nr = atoi(str_ptr); // get level_nr value
}
program.headless = TRUE;
Error(ERR_EXIT_HELP, "unrecognized command '%s'", command);
}
- /* disable networking if any valid command was recognized */
+ // disable networking if any valid command was recognized
options.network = setup.network_mode = FALSE;
}
static void InitSetup(void)
{
- LoadSetup(); /* global setup info */
- LoadSetup_AutoSetup(); /* global auto setup info */
+ LoadSetup(); // global setup info
+ LoadSetup_AutoSetup(); // global auto setup info
- /* set some options from setup file */
+ // set some options from setup file
if (setup.options.verbose)
options.verbose = TRUE;
{
int i;
- /* choose default local player */
+ // choose default local player
local_player = &stored_player[0];
for (i = 0; i < MAX_PLAYERS; i++)
int num_ignore_music_tokens;
int i;
- /* dynamically determine list of generic tokens to be ignored */
+ // dynamically determine list of generic tokens to be ignored
num_ignore_generic_tokens = 0;
for (i = 0; ignore_generic_tokens[i] != NULL; i++)
num_ignore_generic_tokens++;
- /* dynamically determine list of image tokens to be ignored */
+ // dynamically determine list of image tokens to be ignored
num_ignore_image_tokens = num_ignore_generic_tokens;
for (i = 0; image_config_vars[i].token != NULL; i++)
num_ignore_image_tokens++;
image_config_vars[i].token;
ignore_image_tokens[num_ignore_image_tokens] = NULL;
- /* dynamically determine list of sound tokens to be ignored */
+ // dynamically determine list of sound tokens to be ignored
num_ignore_sound_tokens = num_ignore_generic_tokens;
ignore_sound_tokens =
checked_malloc((num_ignore_sound_tokens + 1) * sizeof(char *));
ignore_sound_tokens[i] = ignore_generic_tokens[i];
ignore_sound_tokens[num_ignore_sound_tokens] = NULL;
- /* dynamically determine list of music tokens to be ignored */
+ // dynamically determine list of music tokens to be ignored
num_ignore_music_tokens = num_ignore_generic_tokens;
ignore_music_tokens =
checked_malloc((num_ignore_music_tokens + 1) * sizeof(char *));
static int win_xsize_last = -1;
static int win_ysize_last = -1;
- /* create additional image buffers for double-buffering and cross-fading */
+ // create additional image buffers for double-buffering and cross-fading
if (WIN_XSIZE != win_xsize_last || WIN_YSIZE != win_ysize_last)
{
- /* used to temporarily store the backbuffer -- only re-create if changed */
+ // used to temporarily store the backbuffer -- only re-create if changed
ReCreateBitmap(&bitmap_db_store_1, WIN_XSIZE, WIN_YSIZE);
ReCreateBitmap(&bitmap_db_store_2, WIN_XSIZE, WIN_YSIZE);
ReCreateBitmap(&bitmap_db_door_1, 3 * DXSIZE, DYSIZE);
ReCreateBitmap(&bitmap_db_door_2, 3 * VXSIZE, VYSIZE);
- /* initialize screen properties */
+ // initialize screen properties
InitGfxFieldInfo(SX, SY, SXSIZE, SYSIZE,
REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE,
bitmap_db_field);
InitGfxScrollbufferInfo(FXSIZE, FYSIZE);
InitGfxClipRegion(FALSE, -1, -1, -1, -1);
- /* required if door size definitions have changed */
+ // required if door size definitions have changed
InitGraphicCompatibilityInfo_Doors();
InitGfxBuffers_EM();
Bitmap *bitmap_font_initial = NULL;
int i, j;
- /* determine settings for initial font (for displaying startup messages) */
+ // determine settings for initial font (for displaying startup messages)
for (i = 0; image_config[i].token != NULL; i++)
{
for (j = 0; j < NUM_INITIAL_FONTS; j++)
font_initial[j].num_chars_per_line = DEFAULT_NUM_CHARS_PER_LINE;
}
- if (filename_font_initial == NULL) /* should not happen */
+ if (filename_font_initial == NULL) // should not happen
Error(ERR_EXIT, "cannot get filename for '%s'", CONFIG_TOKEN_FONT_INITIAL);
InitGfxBuffers();
DrawInitText("Loading graphics", 120, FC_GREEN);
- /* initialize settings for busy animation with default values */
+ // initialize settings for busy animation with default values
int parameter[NUM_GFX_ARGS];
for (i = 0; i < NUM_GFX_ARGS; i++)
parameter[i] = get_graphic_parameter_value(image_config_suffix[i].value,
char *anim_token = CONFIG_TOKEN_GLOBAL_BUSY;
int len_anim_token = strlen(anim_token);
- /* read settings for busy animation from default custom artwork config */
+ // read settings for busy animation from default custom artwork config
char *gfx_config_filename = getPath3(options.graphics_directory,
GFX_DEFAULT_SUBDIR,
GRAPHICSINFO_FILENAME);
if (filename_anim_initial == NULL)
{
- /* read settings for busy animation from static default artwork config */
+ // read settings for busy animation from static default artwork config
for (i = 0; image_config[i].token != NULL; i++)
{
if (strEqual(image_config[i].token, anim_token))
}
}
- if (filename_anim_initial == NULL) /* should not happen */
+ if (filename_anim_initial == NULL) // should not happen
Error(ERR_EXIT, "cannot get filename for '%s'", CONFIG_TOKEN_GLOBAL_BUSY);
anim_initial.bitmaps =
checked_free(filename_anim_initial);
- graphic_info = &anim_initial; /* graphic == 0 => anim_initial */
+ graphic_info = &anim_initial; // graphic == 0 => anim_initial
set_graphic_parameters_ext(0, parameter, anim_initial.bitmaps);
gfx.fade_border_target_status = global.border_status;
gfx.masked_border_bitmap_ptr = backbuffer;
- /* use copy of busy animation to prevent change while reloading artwork */
+ // use copy of busy animation to prevent change while reloading artwork
init_last = init;
}
static void InitLevelInfo(void)
{
- LoadLevelInfo(); /* global level info */
- LoadLevelSetup_LastSeries(); /* last played series info */
- LoadLevelSetup_SeriesInfo(); /* last played level info */
+ LoadLevelInfo(); // global level info
+ LoadLevelSetup_LastSeries(); // last played series info
+ LoadLevelSetup_SeriesInfo(); // last played level info
if (global.autoplay_leveldir &&
global.autoplay_mode != AUTOPLAY_MODE_TEST)
if (identifier == NULL)
identifier = artwork.snd_current->identifier;
- /* set artwork path to send it to the sound server process */
+ // set artwork path to send it to the sound server process
setLevelArtworkDir(artwork.snd_first);
InitReloadCustomSounds(identifier);
if (identifier == NULL)
identifier = artwork.mus_current->identifier;
- /* set artwork path to send it to the sound server process */
+ // set artwork path to send it to the sound server process
setLevelArtworkDir(artwork.mus_first);
InitReloadCustomMusic(identifier);
network.connected = TRUE;
}
- /* short time to recognize result of network initialization */
+ // short time to recognize result of network initialization
if (game_status == GAME_MODE_LOADING)
Delay_WithScreenUpdates(1000);
}
SetupFileHash *setup_file_hash;
boolean redefined_ce_found = FALSE;
- /* !!! CACHE THIS BY USING HASH 'filename' => 'true/false' !!! */
+ // !!! CACHE THIS BY USING HASH 'filename' => 'true/false' !!!
if ((setup_file_hash = loadSetupFileHash(filename)) != NULL)
{
LEVELDIR_ARTWORK_SET(leveldir_current, type));
#endif
- /* first look for special artwork configured in level series config */
+ // first look for special artwork configured in level series config
filename_base = getCustomArtworkLevelConfigFilename(type);
#if 0
{
boolean redefined_ce_found = FALSE;
- /* to check if this level set redefines any CEs, do not use overriding */
+ // to check if this level set redefines any CEs, do not use overriding
gfx.override_level_graphics = FALSE;
gfx.override_level_sounds = FALSE;
gfx.override_level_music = FALSE;
- /* now check if this level set has definitions for custom elements */
+ // now check if this level set has definitions for custom elements
if (setup.override_level_graphics == AUTO ||
setup.override_level_sounds == AUTO ||
setup.override_level_music == AUTO)
if (redefined_ce_found)
{
- /* this level set has CE definitions: change "AUTO" to "FALSE" */
+ // this level set has CE definitions: change "AUTO" to "FALSE"
gfx.override_level_graphics = (setup.override_level_graphics == TRUE);
gfx.override_level_sounds = (setup.override_level_sounds == TRUE);
gfx.override_level_music = (setup.override_level_music == TRUE);
}
else
{
- /* this level set has no CE definitions: change "AUTO" to "TRUE" */
+ // this level set has no CE definitions: change "AUTO" to "TRUE"
gfx.override_level_graphics = (setup.override_level_graphics != FALSE);
gfx.override_level_sounds = (setup.override_level_sounds != FALSE);
gfx.override_level_music = (setup.override_level_music != FALSE);
boolean setup_override_artwork = GFX_OVERRIDE_ARTWORK(type);
char *setup_artwork_set = SETUP_ARTWORK_SET(setup, type);
char *leveldir_identifier = leveldir_current->identifier;
- /* !!! setLevelArtworkDir() should be moved to an earlier stage !!! */
+ // !!! setLevelArtworkDir() should be moved to an earlier stage !!!
char *leveldir_artwork_set = setLevelArtworkDir(artwork_first_node);
boolean has_level_artwork_set = (leveldir_artwork_set != NULL);
char *artwork_current_identifier;
- char *artwork_new_identifier = NULL; /* default: nothing has changed */
+ char *artwork_new_identifier = NULL; // default: nothing has changed
- /* leveldir_current may be invalid (level group, parent link) */
+ // leveldir_current may be invalid (level group, parent link)
if (!validLevelSeries(leveldir_current))
return NULL;
/* 2nd step: check if it is really needed to reload artwork set
------------------------------------------------------------ */
- /* ---------- reload if level set and also artwork set has changed ------- */
+ // ---------- reload if level set and also artwork set has changed ----------
if (leveldir_current_identifier[type] != leveldir_identifier &&
(last_has_level_artwork_set[type] || has_level_artwork_set))
artwork_new_identifier = artwork_current_identifier;
leveldir_current_identifier[type] = leveldir_identifier;
last_has_level_artwork_set[type] = has_level_artwork_set;
- /* ---------- reload if "override artwork" setting has changed ----------- */
+ // ---------- reload if "override artwork" setting has changed --------------
if (last_override_level_artwork[type] != setup_override_artwork)
artwork_new_identifier = artwork_current_identifier;
last_override_level_artwork[type] = setup_override_artwork;
- /* ---------- reload if current artwork identifier has changed ----------- */
+ // ---------- reload if current artwork identifier has changed --------------
if (!strEqual(ARTWORK_CURRENT_IDENTIFIER(artwork, type),
artwork_current_identifier))
artwork_new_identifier = artwork_current_identifier;
*(ARTWORK_CURRENT_IDENTIFIER_PTR(artwork, type))= artwork_current_identifier;
- /* ---------- do not reload directly after starting ---------------------- */
+ // ---------- do not reload directly after starting -------------------------
if (!initialized[type])
artwork_new_identifier = NULL;
void ReloadCustomArtwork(int force_reload)
{
- int last_game_status = game_status; /* save current game status */
+ int last_game_status = game_status; // save current game status
char *gfx_new_identifier;
char *snd_new_identifier;
char *mus_new_identifier;
InitArtworkDone();
- SetGameStatus(last_game_status); /* restore current game status */
+ SetGameStatus(last_game_status); // restore current game status
- init_last = init; /* switch to new busy animation */
+ init_last = init; // switch to new busy animation
FadeOut(REDRAW_ALL);
RedrawGlobalBorder();
- /* force redraw of (open or closed) door graphics */
+ // force redraw of (open or closed) door graphics
SetDoorState(DOOR_OPEN_ALL);
CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY);
redraw_mask = REDRAW_ALL;
- /* force drawing exit message even if screen updates are currently limited */
+ // force drawing exit message even if screen updates are currently limited
LimitScreenUpdates(FALSE);
BackToFront();
- /* deactivate toons on error message screen */
+ // deactivate toons on error message screen
setup.toons = FALSE;
WaitForEventToContinue();
}
-/* ========================================================================= */
-/* OpenAll() */
-/* ========================================================================= */
+// ============================================================================
+// OpenAll()
+// ============================================================================
void OpenAll(void)
{
InitCounter();
- InitGlobal(); /* initialize some global variables */
+ InitGlobal(); // initialize some global variables
print_timestamp_time("[init global stuff]");
Error(ERR_WARN, "networking only supported in Unix version");
#endif
- exit(0); /* never reached, server loops forever */
+ exit(0); // never reached, server loops forever
}
InitGameInfo();
print_timestamp_time("[init setup/config stuff (2)]");
InitPlayerInfo();
print_timestamp_time("[init setup/config stuff (3)]");
- InitArtworkInfo(); /* needed before loading gfx, sound & music */
+ InitArtworkInfo(); // needed before loading gfx, sound & music
print_timestamp_time("[init setup/config stuff (4)]");
- InitArtworkConfig(); /* needed before forking sound child process */
+ InitArtworkConfig(); // needed before forking sound child process
print_timestamp_time("[init setup/config stuff (5)]");
InitMixer();
print_timestamp_time("[init setup/config stuff (6)]");
InitLevelArtworkInfo();
print_timestamp_time("InitLevelArtworkInfo");
- InitOverrideArtwork(); /* needs to know current level directory */
+ InitOverrideArtwork(); // needs to know current level directory
print_timestamp_time("InitOverrideArtwork");
- InitImages(); /* needs to know current level directory */
+ InitImages(); // needs to know current level directory
print_timestamp_time("InitImages");
- InitSound(NULL); /* needs to know current level directory */
+ InitSound(NULL); // needs to know current level directory
print_timestamp_time("InitSound");
- InitMusic(NULL); /* needs to know current level directory */
+ InitMusic(NULL); // needs to know current level directory
print_timestamp_time("InitMusic");
InitArtworkDone();
StopSounds();
FreeAllSounds();
FreeAllMusic();
- CloseAudio(); /* called after freeing sounds (needed for SDL) */
+ CloseAudio(); // called after freeing sounds (needed for SDL)
em_close_all();
sp_close_all();
// set a flag to tell the network server thread to quit and wait for it
// using SDL_WaitThread()
#else
- if (network_server) /* terminate network server */
+ if (network_server) // terminate network server
SDL_KillThread(server_thread);
#endif
#endif
if (exit_value != 0 && !options.execute_command)
{
- /* fall back to default level set (current set may have caused an error) */
+ // fall back to default level set (current set may have caused an error)
SaveLevelSetup_LastSeries_Deactivate();
- /* tell user where to find error log file which may contain more details */
+ // tell user where to find error log file which may contain more details
// (error notification now directly displayed on screen inside R'n'D
- // NotifyUserAboutErrorFile(); /* currently only works for Windows */
+ // NotifyUserAboutErrorFile(); // currently only works for Windows
}
exit(exit_value);
#include <android/log.h>
-#endif /* ANDROID_H */
+#endif // ANDROID_H
#include "misc.h"
-/* values for DrawGadget() */
+// values for DrawGadget()
#define DG_UNPRESSED 0
#define DG_PRESSED 1
{
int id = next_free_gadget_id++;
- if (next_free_gadget_id <= 0) /* counter overrun */
+ if (next_free_gadget_id <= 0) // counter overrun
{
- gadget_id_wrapped = TRUE; /* now we must check each ID */
+ gadget_id_wrapped = TRUE; // now we must check each ID
next_free_gadget_id = 0;
}
next_free_gadget_id++;
}
- if (next_free_gadget_id <= 0) /* cannot get new gadget id */
+ if (next_free_gadget_id <= 0) // cannot get new gadget id
Error(ERR_EXIT, "too much gadgets -- this should not happen");
return id;
{
struct GadgetInfo *gi;
- /* first check for scrollbars in case of mouse scroll wheel button events */
+ // first check for scrollbars in case of mouse scroll wheel button events
if (IS_WHEEL_BUTTON(button))
{
- /* real horizontal wheel or vertical wheel with modifier key pressed */
+ // real horizontal wheel or vertical wheel with modifier key pressed
boolean check_horizontal = (IS_WHEEL_BUTTON_HORIZONTAL(button) ||
GetKeyModState() & KMOD_Shift);
- /* check for the first active scrollbar directly under the mouse pointer */
+ // check for the first active scrollbar directly under the mouse pointer
for (gi = gadget_list_first_entry; gi != NULL; gi = gi->next)
{
if (gi->mapped && gi->active &&
return gi;
}
- /* check for the first active scrollbar with matching mouse wheel area */
+ // check for the first active scrollbar with matching mouse wheel area
for (gi = gadget_list_first_entry; gi != NULL; gi = gi->next)
{
if (gi->mapped && gi->active &&
return gi;
}
- /* no active scrollbar found -- ignore this scroll wheel button event */
+ // no active scrollbar found -- ignore this scroll wheel button event
return NULL;
}
- /* open selectboxes may overlap other active gadgets, so check them first */
+ // open selectboxes may overlap other active gadgets, so check them first
for (gi = gadget_list_first_entry; gi != NULL; gi = gi->next)
{
if (gi->mapped && gi->active &&
return gi;
}
- /* check all other gadgets */
+ // check all other gadgets
for (gi = gadget_list_first_entry; gi != NULL; gi = gi->next)
{
if (gi->mapped && gi->active &&
while (*text)
{
- if (set_cursor_pos) /* x/y => position */
+ if (set_cursor_pos) // x/y => position
{
if (y == cursor_y && (x == cursor_x || (x < cursor_x && *text == '\n')))
break;
}
- else /* position => x/y */
+ else // position => x/y
{
if (pos == cursor_position)
break;
int text_size = strlen(gi->textbutton.value);
int text_start = (gi->width - text_size * font_width) / 2;
- /* left part of gadget */
+ // left part of gadget
BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y,
border_x, gi->height, gi->x, gi->y);
- /* middle part of gadget */
+ // middle part of gadget
for (i=0; i < gi->textbutton.size; i++)
BlitBitmapOnBackground(gd->bitmap, drawto, gd->x + border_x, gd->y,
font_width, gi->height,
gi->x + border_x + i * font_width, gi->y);
- /* right part of gadget */
+ // right part of gadget
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + gi->border.width - border_x, gd->y,
border_x, gi->height,
gi->x + gi->width - border_x, gi->y);
- /* gadget text value */
+ // gadget text value
DrawTextExt(drawto,
gi->x + text_start + (pressed ? gi->deco.xshift : 0),
gi->y + border_y + (pressed ? gi->deco.yshift : 0),
int border_x = gi->border.xsize;
int border_y = gi->border.ysize;
- /* left part of gadget */
+ // left part of gadget
BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y,
border_x, gi->height, gi->x, gi->y);
- /* middle part of gadget */
+ // middle part of gadget
for (i=0; i < gi->textinput.size + 1; i++)
BlitBitmapOnBackground(gd->bitmap, drawto, gd->x + border_x, gd->y,
font_width, gi->height,
gi->x + border_x + i * font_width, gi->y);
- /* right part of gadget */
+ // right part of gadget
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + gi->border.width - border_x, gd->y,
border_x, gi->height,
gi->x + gi->width - border_x, gi->y);
- /* set text value */
+ // set text value
strcpy(text, gi->textinput.value);
strcat(text, " ");
- /* gadget text value */
+ // gadget text value
DrawTextExt(drawto,
gi->x + border_x, gi->y + border_y, text,
font_nr, BLIT_MASKED);
cursor_string[0] = (cursor_letter != '\0' ? cursor_letter : ' ');
cursor_string[1] = '\0';
- /* draw cursor, if active */
+ // draw cursor, if active
if (pressed)
DrawTextExt(drawto,
gi->x + border_x +
int border_y = gi->border.ysize;
int gd_height = 2 * border_y + font_height;
- /* top left part of gadget border */
+ // top left part of gadget border
BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y,
border_x, border_y, gi->x, gi->y);
- /* top middle part of gadget border */
+ // top middle part of gadget border
for (i=0; i < gi->textarea.xsize; i++)
BlitBitmapOnBackground(gd->bitmap, drawto, gd->x + border_x, gd->y,
font_width, border_y,
gi->x + border_x + i * font_width, gi->y);
- /* top right part of gadget border */
+ // top right part of gadget border
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + gi->border.width - border_x, gd->y,
border_x, border_y,
gi->x + gi->width - border_x, gi->y);
- /* left and right part of gadget border for each row */
+ // left and right part of gadget border for each row
for (i=0; i < gi->textarea.ysize; i++)
{
BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y + border_y,
gi->y + border_y + i * font_height);
}
- /* bottom left part of gadget border */
+ // bottom left part of gadget border
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x, gd->y + gd_height - border_y,
border_x, border_y,
gi->x, gi->y + gi->height - border_y);
- /* bottom middle part of gadget border */
+ // bottom middle part of gadget border
for (i=0; i < gi->textarea.xsize; i++)
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + border_x,
gi->x + border_x + i * font_width,
gi->y + gi->height - border_y);
- /* bottom right part of gadget border */
+ // bottom right part of gadget border
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + gi->border.width - border_x,
gd->y + gd_height - border_y,
gi->width - 2 * border_x,
gi->height - 2 * border_y);
- /* gadget text value */
+ // gadget text value
DrawTextBuffer(gi->x + border_x, gi->y + border_y, gi->textarea.value,
font_nr, gi->textarea.xsize, -1, gi->textarea.ysize, 0,
BLIT_ON_BACKGROUND, FALSE, FALSE, FALSE);
cursor_string[0] = (cursor_letter != '\0' ? cursor_letter : ' ');
cursor_string[1] = '\0';
- /* draw cursor, if active */
+ // draw cursor, if active
if (pressed)
DrawTextExt(drawto,
gi->x + border_x + gi->textarea.cursor_x * font_width,
int box_width = gi->selectbox.width;
int box_height = gi->selectbox.height;
- /* left part of gadget */
+ // left part of gadget
BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y,
border_x, gi->height, gi->x, gi->y);
- /* middle part of gadget */
+ // middle part of gadget
for (i=0; i < gi->selectbox.size; i++)
BlitBitmapOnBackground(gd->bitmap, drawto, gd->x + border_x, gd->y,
font_width, gi->height,
gi->x + border_x + i * font_width, gi->y);
- /* button part of gadget */
+ // button part of gadget
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + border_x + width_inner, gd->y,
button, gi->height,
gi->x + gi->width - border_x - button, gi->y);
- /* right part of gadget */
+ // right part of gadget
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + gi->border.width - border_x, gd->y,
border_x, gi->height,
gi->x + gi->width - border_x, gi->y);
- /* set text value */
+ // set text value
strncpy(text, gi->selectbox.options[gi->selectbox.index].text,
gi->selectbox.size);
text[gi->selectbox.size] = '\0';
- /* set font value */
+ // set font value
font_nr = (OPTION_TEXT_SELECTABLE(gi, text) ? font_nr_default :
gi->font_unselectable);
- /* gadget text value */
+ // gadget text value
DrawTextExt(drawto, gi->x + border_x, gi->y + border_y, text,
font_nr, BLIT_MASKED);
gi->selectbox.stay_open = FALSE;
gi->selectbox.current_index = gi->selectbox.index;
- /* save background under selectbox */
+ // save background under selectbox
BlitBitmap(drawto, gfx.field_save_buffer,
gi->selectbox.x, gi->selectbox.y,
gi->selectbox.width, gi->selectbox.height,
gi->selectbox.x, gi->selectbox.y);
}
- /* draw open selectbox */
+ // draw open selectbox
- /* top left part of gadget border */
+ // top left part of gadget border
BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y,
border_x, border_y,
gi->selectbox.x, gi->selectbox.y);
- /* top middle part of gadget border */
+ // top middle part of gadget border
for (i=0; i < gi->selectbox.size; i++)
BlitBitmapOnBackground(gd->bitmap, drawto, gd->x + border_x, gd->y,
font_width, border_y,
gi->selectbox.x + border_x + i * font_width,
gi->selectbox.y);
- /* top button part of gadget border */
+ // top button part of gadget border
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + border_x + width_inner, gd->y,
button, border_y,
gi->selectbox.x + box_width -border_x -button,
gi->selectbox.y);
- /* top right part of gadget border */
+ // top right part of gadget border
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + gi->border.width - border_x, gd->y,
border_x, border_y,
gi->selectbox.x + box_width - border_x,
gi->selectbox.y);
- /* left and right part of gadget border for each row */
+ // left and right part of gadget border for each row
for (i=0; i < gi->selectbox.num_values; i++)
{
BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y + border_y,
gi->selectbox.y + border_y + i*font_height);
}
- /* bottom left part of gadget border */
+ // bottom left part of gadget border
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x, gd->y + gi->height - border_y,
border_x, border_y,
gi->selectbox.x,
gi->selectbox.y + box_height - border_y);
- /* bottom middle part of gadget border */
+ // bottom middle part of gadget border
for (i=0; i < gi->selectbox.size; i++)
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + border_x,
gi->selectbox.x + border_x + i * font_width,
gi->selectbox.y + box_height - border_y);
- /* bottom button part of gadget border */
+ // bottom button part of gadget border
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + border_x + width_inner,
gd->y + gi->height - border_y,
gi->selectbox.x + box_width -border_x -button,
gi->selectbox.y + box_height - border_y);
- /* bottom right part of gadget border */
+ // bottom right part of gadget border
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + gi->border.width - border_x,
gd->y + gi->height - border_y,
gi->selectbox.width - 2 * border_x,
gi->selectbox.height - 2 * border_y);
- /* selectbox text values */
+ // selectbox text values
for (i=0; i < gi->selectbox.num_values; i++)
{
int mask_mode = BLIT_MASKED;
gi->selectbox.width - 2 * border_x, font_height,
gi->selectbox.inverse_color);
- /* prevent use of cursor graphic by drawing at least two chars */
+ // prevent use of cursor graphic by drawing at least two chars
strcat(text, " ");
text[gi->selectbox.size] = '\0';
{
gi->selectbox.open = FALSE;
- /* restore background under selectbox */
+ // restore background under selectbox
BlitBitmap(gfx.field_save_buffer, drawto,
gi->selectbox.x, gi->selectbox.y,
gi->selectbox.width, gi->selectbox.height,
gi->selectbox.x, gi->selectbox.y);
- /* redraw closed selectbox */
+ // redraw closed selectbox
DrawGadget(gi, FALSE, FALSE);
redraw_selectbox = TRUE;
int num_steps = size_body / design_body;
int step_size_remain = size_body - num_steps * design_body;
- /* clear scrollbar area */
+ // clear scrollbar area
ClearRectangleOnBackground(backbuffer, gi->x, gi->y,
gi->width, gi->height);
- /* upper part of gadget */
+ // upper part of gadget
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x, gd->y,
gi->width, gi->border.ysize,
xpos, ypos);
- /* middle part of gadget */
+ // middle part of gadget
for (i=0; i < num_steps; i++)
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x, gd->y + gi->border.ysize,
xpos,
ypos + gi->border.ysize + i * design_body);
- /* remaining middle part of gadget */
+ // remaining middle part of gadget
if (step_size_remain > 0)
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x, gd->y + gi->border.ysize,
ypos + gi->border.ysize
+ num_steps * design_body);
- /* lower part of gadget */
+ // lower part of gadget
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x, gd->y + design_full - gi->border.ysize,
gi->width, gi->border.ysize,
int num_steps = size_body / design_body;
int step_size_remain = size_body - num_steps * design_body;
- /* clear scrollbar area */
+ // clear scrollbar area
ClearRectangleOnBackground(backbuffer, gi->x, gi->y,
gi->width, gi->height);
- /* left part of gadget */
+ // left part of gadget
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x, gd->y,
gi->border.xsize, gi->height,
xpos, ypos);
- /* middle part of gadget */
+ // middle part of gadget
for (i=0; i < num_steps; i++)
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + gi->border.xsize, gd->y,
xpos + gi->border.xsize + i * design_body,
ypos);
- /* remaining middle part of gadget */
+ // remaining middle part of gadget
if (step_size_remain > 0)
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + gi->border.xsize, gd->y,
+ num_steps * design_body,
ypos);
- /* right part of gadget */
+ // right part of gadget
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x + design_full - gi->border.xsize, gd->y,
gi->border.xsize, gi->height,
static int get_minimal_size_for_numeric_input(int minmax_value)
{
- int min_size = 1; /* value needs at least one digit */
+ int min_size = 1; // value needs at least one digit
int i;
- /* add number of digits needed for absolute value */
+ // add number of digits needed for absolute value
for (i = 10; i <= ABS(minmax_value); i *= 10)
min_size++;
- /* if min/max value is negative, add one digit for minus sign */
+ // if min/max value is negative, add one digit for minus sign
if (minmax_value < 0)
min_size++;
gi->textinput.value[max_textsize] = '\0';
gi->textinput.cursor_position = strlen(gi->textinput.value);
- /* same tag also used for other gadget definitions */
+ // same tag also used for other gadget definitions
strcpy(gi->textbutton.value, gi->textinput.value);
strcpy(gi->textarea.value, gi->textinput.value);
strcpy(gi->textarea.last_value, gi->textinput.value);
gi->textinput.value[max_textsize] = '\0';
strcpy(gi->textinput.last_value, gi->textinput.value);
- /* same tag also used for other gadget definitions */
+ // same tag also used for other gadget definitions
gi->textarea.size = max_textsize;
gi->textarea.value[max_textsize] = '\0';
gi->drawing.area_xsize = va_arg(ap, int);
gi->drawing.area_ysize = va_arg(ap, int);
- /* determine dependent values for drawing area gadget, if needed */
+ // determine dependent values for drawing area gadget, if needed
if (gi->drawing.item_xsize != 0 && gi->drawing.item_ysize != 0)
{
gi->width = gi->drawing.area_xsize * gi->drawing.item_xsize;
gi->drawing.item_ysize = gi->height / gi->drawing.area_ysize;
}
- /* same tag also used for other gadget definitions */
+ // same tag also used for other gadget definitions
gi->textarea.xsize = gi->drawing.area_xsize;
gi->textarea.ysize = gi->drawing.area_ysize;
- if (gi->type & GD_TYPE_TEXT_AREA) /* force recalculation */
+ if (gi->type & GD_TYPE_TEXT_AREA) // force recalculation
{
gi->width = 0;
gi->height = 0;
gi->drawing.item_xsize = va_arg(ap, int);
gi->drawing.item_ysize = va_arg(ap, int);
- /* determine dependent values for drawing area gadget, if needed */
+ // determine dependent values for drawing area gadget, if needed
if (gi->drawing.area_xsize != 0 && gi->drawing.area_ysize != 0)
{
gi->width = gi->drawing.area_xsize * gi->drawing.item_xsize;
Error(ERR_EXIT, "HandleGadgetTags(): unknown tag %d", tag);
}
- tag = va_arg(ap, int); /* read next tag */
+ tag = va_arg(ap, int); // read next tag
}
gi->deactivated = FALSE;
- /* check if gadget has undefined bitmaps */
+ // check if gadget has undefined bitmaps
if (gi->type != GD_TYPE_DRAWING_AREA &&
(gi->design[GD_BUTTON_UNPRESSED].bitmap == NULL ||
gi->design[GD_BUTTON_PRESSED].bitmap == NULL))
gi->deactivated = TRUE;
- /* check if gadget is placed off-screen */
+ // check if gadget is placed off-screen
if (gi->x < 0 || gi->y < 0)
gi->deactivated = TRUE;
- /* adjust gadget values in relation to other gadget values */
+ // adjust gadget values in relation to other gadget values
if (gi->type & GD_TYPE_TEXT_INPUT)
{
int min_size_max = get_minimal_size_for_numeric_input(number_max);
int min_size = MAX(min_size_min, min_size_max);
- /* expand gadget text input size, if maximal value is too large */
+ // expand gadget text input size, if maximal value is too large
if (gi->textinput.size < min_size)
gi->textinput.size = min_size;
}
while (gi->selectbox.options[gi->selectbox.num_values].text != NULL)
gi->selectbox.num_values++;
- /* calculate values for open selectbox */
+ // calculate values for open selectbox
gi->selectbox.width = gi->width;
gi->selectbox.height =
2 * border_ysize + gi->selectbox.num_values * font_height;
src_x += font_width / 2;
src_y += font_height / 2;
- /* there may be esoteric cases with missing or too small font bitmap */
+ // there may be esoteric cases with missing or too small font bitmap
if (src_bitmap != NULL &&
src_x < src_bitmap->width && src_y < src_bitmap->height)
gi->selectbox.inverse_color = GetPixel(src_bitmap, src_x, src_y);
- /* always start with closed selectbox */
+ // always start with closed selectbox
gi->selectbox.open = FALSE;
}
gs->items_max == 0 || gs->items_visible == 0)
Error(ERR_EXIT, "scrollbar gadget incomplete (missing tags)");
- /* calculate internal scrollbar values */
+ // calculate internal scrollbar values
gs->size_min = (gi->type == GD_TYPE_SCROLLBAR_VERTICAL ?
gi->width : gi->height);
gs->size_max = (gi->type == GD_TYPE_SCROLLBAR_VERTICAL ?
gs->position_max = gs->size_max - gs->size;
gs->correction = gs->size_max / gs->items_max / 2;
- /* finetuning for maximal right/bottom position */
+ // finetuning for maximal right/bottom position
if (gs->item_position == gs->items_max - gs->items_visible)
gs->position = gs->position_max;
}
struct GadgetInfo *new_gadget = checked_calloc(sizeof(struct GadgetInfo));
va_list ap;
- /* always start with reliable default values */
+ // always start with reliable default values
new_gadget->id = getNewGadgetID();
new_gadget->image_id = -1;
new_gadget->callback_info = default_callback_info;
HandleGadgetTags(new_gadget, first_tag, ap);
va_end(ap);
- /* insert new gadget into global gadget list */
+ // insert new gadget into global gadget list
if (gadget_list_last_entry)
{
gadget_list_last_entry->next = new_gadget;
if (gi == NULL)
return;
- /* prevent "last_info_gi" from pointing to memory that will be freed */
+ // prevent "last_info_gi" from pointing to memory that will be freed
if (last_info_gi == gi)
last_info_gi = NULL;
gi->textinput.cursor_position = strlen(gi->textinput.value);
}
-/* global pointer to gadget actually in use (when mouse button pressed) */
+// global pointer to gadget actually in use (when mouse button pressed)
static struct GadgetInfo *last_gi = NULL;
static void MapGadgetExt(struct GadgetInfo *gi, boolean redraw)
if (gi == NULL || gi->deactivated || !gi->mapped)
return;
- /* simulate releasing mouse button over last gadget, if still pressed */
+ // simulate releasing mouse button over last gadget, if still pressed
if (button_status)
HandleGadgets(-1, -1, 0);
int x = gi->x;
int y = gi->y;
- /* set cursor position to the end of the text for text input gadgets */
+ // set cursor position to the end of the text for text input gadgets
if (gi->type & GD_TYPE_TEXT_INPUT)
x = gi->x + gi->width - 1;
- /* simulate pressing mouse button over specified gadget */
+ // simulate pressing mouse button over specified gadget
HandleGadgets(x, y, button);
- /* simulate releasing mouse button over specified gadget */
+ // simulate releasing mouse button over specified gadget
HandleGadgets(x, y, 0);
}
boolean gadget_released_off_borders;
boolean changed_position = FALSE;
- /* check if there are any gadgets defined */
+ // check if there are any gadgets defined
if (gadget_list_first_entry == NULL)
return FALSE;
- /* simulated release of mouse button over last gadget */
+ // simulated release of mouse button over last gadget
if (mx == -1 && my == -1 && button == 0)
{
mx = last_mx;
my = last_my;
}
- /* check which gadget is under the mouse pointer */
+ // check which gadget is under the mouse pointer
new_gi = getGadgetInfoFromMousePosition(mx, my, button);
- /* check if button state has changed since last invocation */
+ // check if button state has changed since last invocation
press_event = (button != 0 && last_button == 0);
release_event = (button == 0 && last_button != 0);
last_button = button;
- /* check if mouse has been moved since last invocation */
+ // check if mouse has been moved since last invocation
mouse_moving = ((mx != last_mx || my != last_my) && motion_status);
last_mx = mx;
last_my = my;
new_gi->type & GD_TYPE_SELECTBOX && new_gi->selectbox.open &&
insideSelectboxLine(new_gi, mx, my));
- /* if mouse button pressed outside text or selectbox gadget, deactivate it */
+ // if mouse button pressed outside text or selectbox gadget, deactivate it
if (anyTextGadgetActive() &&
(gadget_pressed_off_borders ||
(gadget_pressed_inside_select_line && !mouse_inside_select_area)))
struct GadgetInfo *gi = last_gi;
boolean gadget_changed = ((gi->event_mask & GD_EVENT_TEXT_LEAVING) != 0);
- /* check if text gadget has changed its value */
+ // check if text gadget has changed its value
if (gi->type & GD_TYPE_TEXT_INPUT)
{
CheckRangeOfNumericInputGadget(gi);
gadget_changed = FALSE;
}
- /* selectbox does not change its value when closed by clicking outside */
+ // selectbox does not change its value when closed by clicking outside
if (gi->type & GD_TYPE_SELECTBOX)
gadget_changed = FALSE;
gadget_moving_inside = (gadget_moving && new_gi == last_gi);
gadget_moving_off_borders = (gadget_moving && new_gi != last_gi);
- /* when handling selectbox, set additional state values */
+ // when handling selectbox, set additional state values
if (gadget_released_inside && (last_gi->type & GD_TYPE_SELECTBOX))
gadget_released_inside_select_area = insideSelectboxArea(last_gi, mx, my);
else
gadget_released_inside_select_area = FALSE;
- /* setting state for handling over-large selectbox */
+ // setting state for handling over-large selectbox
if (keep_selectbox_open && (press_event || !mouse_inside_select_line))
keep_selectbox_open = FALSE;
- /* if new gadget pressed, store this gadget */
+ // if new gadget pressed, store this gadget
if (gadget_pressed)
last_gi = new_gi;
- /* 'gi' is actually handled gadget */
+ // 'gi' is actually handled gadget
gi = last_gi;
- /* if gadget is scrollbar, choose mouse position value */
+ // if gadget is scrollbar, choose mouse position value
if (gi && gi->type & GD_TYPE_SCROLLBAR)
scrollbar_mouse_pos =
(gi->type == GD_TYPE_SCROLLBAR_HORIZONTAL ? mx - gi->x : my - gi->y);
- /* if mouse button released, no gadget needs to be handled anymore */
+ // if mouse button released, no gadget needs to be handled anymore
if (gadget_released)
{
if (gi->type & GD_TYPE_SELECTBOX &&
(keep_selectbox_open ||
mouse_released_where_pressed ||
!gadget_released_inside_select_area ||
- !CURRENT_OPTION_SELECTABLE(gi))) /* selectbox stays open */
+ !CURRENT_OPTION_SELECTABLE(gi))) // selectbox stays open
{
gi->selectbox.stay_open = TRUE;
pressed_mx = 0;
pressed_my = 0;
}
else if (!(gi->type & GD_TYPE_TEXT_INPUT ||
- gi->type & GD_TYPE_TEXT_AREA)) /* text input stays open */
+ gi->type & GD_TYPE_TEXT_AREA)) // text input stays open
last_gi = NULL;
}
- /* modify event position values even if no gadget is pressed */
+ // modify event position values even if no gadget is pressed
if (button == 0 && !release_event)
gi = new_gi;
- /* if new gadget or if no gadget was pressed, release stopped processing */
+ // if new gadget or if no gadget was pressed, release stopped processing
if (gadget_pressed || new_gi == NULL)
gadget_stopped = FALSE;
- /* if gadget was stopped while being handled, stop gadget processing here */
+ // if gadget was stopped while being handled, stop gadget processing here
if (gadget_stopped)
return TRUE;
{
int old_cursor_position = gi->textinput.cursor_position;
- /* if mouse button pressed inside activated text gadget, set cursor */
+ // if mouse button pressed inside activated text gadget, set cursor
gi->textinput.cursor_position =
(mx - gi->x - gi->border.xsize) / getFontWidth(gi->font);
{
int old_index = gi->selectbox.current_index;
- /* if mouse moving inside activated selectbox, select value */
+ // if mouse moving inside activated selectbox, select value
if (my >= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height)
gi->selectbox.current_index =
(my - gi->selectbox.y - gi->border.ysize) / getFontHeight(gi->font);
}
}
- /* handle gadget popup info text */
+ // handle gadget popup info text
if (last_info_gi != new_gi ||
(new_gi && new_gi->type == GD_TYPE_DRAWING_AREA && changed_position))
{
gadget_draggable = (gi && gi->type & GD_TYPE_SCROLLBAR);
- /* reset drag position for newly pressed scrollbar to "not dragging" */
+ // reset drag position for newly pressed scrollbar to "not dragging"
if (gadget_pressed && gadget_draggable)
gi->scrollbar.drag_position = -1;
gadget_dragging = (gadget_draggable && gi->scrollbar.drag_position != -1);
- /* clicking next to a scrollbar to move it is not considered "moving" */
+ // clicking next to a scrollbar to move it is not considered "moving"
if (gadget_draggable && !gadget_dragging)
gadget_moving = FALSE;
- /* when leaving scrollbar area when jump-scrolling, stop gadget processing */
+ // when leaving scrollbar area when jump-scrolling, stop gadget processing
if (gadget_draggable && !gadget_dragging && gadget_moving_off_borders)
gadget_stopped = TRUE;
if ((gadget_pressed) ||
(gadget_pressed_repeated && gadget_pressed_delay_reached))
{
- if (gadget_pressed) /* gadget pressed the first time */
+ if (gadget_pressed) // gadget pressed the first time
{
- /* initialize delay counter */
+ // initialize delay counter
DelayReached(&pressed_delay, 0);
- /* start gadget delay with longer delay after first click on gadget */
+ // start gadget delay with longer delay after first click on gadget
pressed_delay_value = GADGET_FRAME_DELAY_FIRST;
}
- else /* gadget hold pressed for some time */
+ else // gadget hold pressed for some time
{
- /* after first repeated gadget click, continue with shorter delay value */
+ // after first repeated gadget click, continue with shorter delay value
pressed_delay_value = GADGET_FRAME_DELAY;
}
if (IS_WHEEL_BUTTON(button) || !inside_slider)
{
- /* click scrollbar one scrollbar length up/left or down/right */
+ // click scrollbar one scrollbar length up/left or down/right
struct GadgetScrollbar *gs = &gi->scrollbar;
int old_item_position = gs->item_position;
}
else
{
- /* don't handle this scrollbar anymore when mouse position reached */
+ // don't handle this scrollbar anymore when mouse position reached
if (gadget_pressed_repeated)
{
gadget_stopped = TRUE;
if (!IS_WHEEL_BUTTON(button) && inside_slider)
{
- /* start dragging scrollbar */
+ // start dragging scrollbar
gi->scrollbar.drag_position =
scrollbar_mouse_pos - gi->scrollbar.position;
}
}
else if (gi->type & GD_TYPE_SELECTBOX)
{
- /* keep selectbox open in case of over-large selectbox */
+ // keep selectbox open in case of over-large selectbox
keep_selectbox_open = (mouse_inside_select_line &&
mouse_inside_select_area);
}
{
int old_index = gi->selectbox.current_index;
- /* if mouse moving inside activated selectbox, select value */
+ // if mouse moving inside activated selectbox, select value
if (my >= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height)
gi->selectbox.current_index =
(my - gi->selectbox.y - gi->border.ysize) / getFontHeight(gi->font);
gs->position = scrollbar_mouse_pos - gs->drag_position;
- /* make sure to always precisely reach end positions when dragging */
+ // make sure to always precisely reach end positions when dragging
if (gs->position <= 0)
{
gs->position = 0;
if (keep_selectbox_open ||
mouse_released_where_pressed ||
!gadget_released_inside_select_area ||
- !CURRENT_OPTION_SELECTABLE(gi)) /* selectbox stays open */
+ !CURRENT_OPTION_SELECTABLE(gi)) // selectbox stays open
{
deactivate_gadget = FALSE;
gadget_changed = FALSE;
if (deactivate_gadget &&
!(gi->type & GD_TYPE_TEXT_INPUT ||
- gi->type & GD_TYPE_TEXT_AREA)) /* text input stays open */
+ gi->type & GD_TYPE_TEXT_AREA)) // text input stays open
DrawGadget(gi, DG_UNPRESSED, gi->direct_draw);
gi->state = GD_BUTTON_UNPRESSED;
gi->callback_action(gi);
}
- /* handle gadgets unmapped/mapped between pressing and releasing */
+ // handle gadgets unmapped/mapped between pressing and releasing
if (release_event && !gadget_released && new_gi)
new_gi->state = GD_BUTTON_UNPRESSED;
char text[MAX_GADGET_TEXTSIZE + 1];
int cursor_position = gi->textarea.cursor_position;
- if (strlen(gi->textarea.value) >= MAX_GADGET_TEXTSIZE) /* no space left */
+ if (strlen(gi->textarea.value) >= MAX_GADGET_TEXTSIZE) // no space left
return;
strcpy(text, gi->textarea.value);
{
StopTextInput();
}
- else if (key == KSYM_Return) /* valid for both text input and selectbox */
+ else if (key == KSYM_Return) // valid for both text input and selectbox
{
boolean gadget_changed = ((gi->event_mask & GD_EVENT_TEXT_RETURN) != 0);
DoGadgetCallbackAction(gi, gadget_changed);
}
- else if (gi->type & GD_TYPE_TEXT_INPUT) /* only valid for text input */
+ else if (gi->type & GD_TYPE_TEXT_INPUT) // only valid for text input
{
char text[MAX_GADGET_TEXTSIZE + 1];
int text_length = strlen(gi->textinput.value);
DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
}
- else if (gi->type & GD_TYPE_TEXT_AREA) /* only valid for text area */
+ else if (gi->type & GD_TYPE_TEXT_AREA) // only valid for text area
{
char text[MAX_GADGET_TEXTSIZE + 1];
int text_length = strlen(gi->textarea.value);
DrawGadget(gi, DG_PRESSED, gi->direct_draw);
}
}
- else if (gi->type & GD_TYPE_SELECTBOX) /* only valid for selectbox */
+ else if (gi->type & GD_TYPE_SELECTBOX) // only valid for selectbox
{
int index = gi->selectbox.current_index;
int num_values = gi->selectbox.num_values;
#include "system.h"
-#define GADGET_FRAME_DELAY_FIRST 250 /* delay after first click */
-#define GADGET_FRAME_DELAY 100 /* delay for pressed butten */
+#define GADGET_FRAME_DELAY_FIRST 250 // delay after first click
+#define GADGET_FRAME_DELAY 100 // delay for pressed butten
-/* gadget types */
+// gadget types
#define GD_TYPE_NORMAL_BUTTON (1 << 0)
#define GD_TYPE_TEXT_BUTTON (1 << 1)
#define GD_TYPE_CHECK_BUTTON (1 << 2)
#define GD_TYPE_TEXT_INPUT (GD_TYPE_TEXT_INPUT_ALPHANUMERIC | \
GD_TYPE_TEXT_INPUT_NUMERIC)
-/* gadget events */
+// gadget events
#define GD_EVENT_PRESSED (1 << 0)
#define GD_EVENT_RELEASED (1 << 1)
#define GD_EVENT_MOVING (1 << 2)
#define GD_EVENT_INFO_LEAVING (1 << 8)
#define GD_EVENT_PIXEL_PRECISE (1 << 9)
-/* gadget button states */
+// gadget button states
#define GD_BUTTON_UNPRESSED 0
#define GD_BUTTON_PRESSED 1
-/* gadget structure constants */
+// gadget structure constants
#define MAX_GADGET_TEXTSIZE 1024
#define MAX_INFO_TEXTSIZE 1024
-/* gadget creation tags */
+// gadget creation tags
#define GDI_END 0
#define GDI_IMAGE_ID 1
#define GDI_CUSTOM_ID 2
#define GDI_DIRECT_DRAW 50
#define GDI_CALLBACK_ACTION_ALWAYS 51
-/* gadget deactivation hack */
+// gadget deactivation hack
#define GDI_ACTIVE_POS(a) ((a) < 0 ? POS_OFFSCREEN : (a))
struct GadgetBorder
{
- int xsize, ysize; /* size of gadget border */
- int xsize_selectbutton; /* for selectbox gadgets */
- int width; /* for selectbox/text input gadgets */
+ int xsize, ysize; // size of gadget border
+ int xsize_selectbutton; // for selectbox gadgets
+ int width; // for selectbox/text input gadgets
};
struct GadgetDesign
{
- Bitmap *bitmap; /* Bitmap with gadget surface */
- int x, y; /* position of rectangle in Bitmap */
+ Bitmap *bitmap; // Bitmap with gadget surface
+ int x, y; // position of rectangle in Bitmap
};
struct GadgetDecoration
{
- struct GadgetDesign design; /* decoration design structure */
- int x, y; /* position of deco on the gadget */
- int width, height; /* width and height of decoration */
- int xshift, yshift; /* deco shifting when gadget pressed */
- boolean masked; /* draw decoration masked over button */
+ struct GadgetDesign design; // decoration design structure
+ int x, y; // position of deco on the gadget
+ int width, height; // width and height of decoration
+ int xshift, yshift; // deco shifting when gadget pressed
+ boolean masked; // draw decoration masked over button
};
struct GadgetEvent
{
- unsigned int type; /* event type */
- int button; /* button number for button events */
- int mx, my; /* raw gadget position at event time */
- int x, y; /* gadget position at event time */
- boolean off_borders; /* mouse pointer outside gadget? */
- int item_x, item_y, item_position; /* new item position */
+ unsigned int type; // event type
+ int button; // button number for button events
+ int mx, my; // raw gadget position at event time
+ int x, y; // gadget position at event time
+ boolean off_borders; // mouse pointer outside gadget?
+ int item_x, item_y, item_position; // new item position
};
struct GadgetDrawingArea
{
- int area_xsize, area_ysize; /* size of drawing area (in items) */
- int item_xsize, item_ysize; /* size of each item in drawing area */
+ int area_xsize, area_ysize; // size of drawing area (in items)
+ int item_xsize, item_ysize; // size of each item in drawing area
};
struct GadgetTextButton
{
- char value[MAX_GADGET_TEXTSIZE + 1]; /* text written on the button */
- int size; /* maximal size of button text */
+ char value[MAX_GADGET_TEXTSIZE + 1]; // text written on the button
+ int size; // maximal size of button text
};
struct GadgetTextInput
{
- char value[MAX_GADGET_TEXTSIZE + 1]; /* text string in input field */
- char last_value[MAX_GADGET_TEXTSIZE + 1];/* last text string in input field */
- int cursor_position; /* actual text cursor position */
- int number_value; /* integer value, if numeric */
- int number_min; /* minimal allowed numeric value */
- int number_max; /* maximal allowed numeric value */
- int size; /* maximal size of input text */
+ char value[MAX_GADGET_TEXTSIZE + 1]; // text string in input field
+ char last_value[MAX_GADGET_TEXTSIZE + 1];// last text string in input field
+ int cursor_position; // actual text cursor position
+ int number_value; // integer value, if numeric
+ int number_min; // minimal allowed numeric value
+ int number_max; // maximal allowed numeric value
+ int size; // maximal size of input text
};
struct GadgetTextArea
{
- char value[MAX_GADGET_TEXTSIZE + 1]; /* text string in input field */
- char last_value[MAX_GADGET_TEXTSIZE + 1];/* last text string in input field */
- int cursor_position; /* actual text cursor position */
- int cursor_x; /* actual x cursor position */
- int cursor_y; /* actual y cursor position */
- int cursor_x_preferred; /* "preferred" x cursor position */
- int size; /* maximal size of input text */
- int xsize, ysize; /* size of text area (in chars) */
+ char value[MAX_GADGET_TEXTSIZE + 1]; // text string in input field
+ char last_value[MAX_GADGET_TEXTSIZE + 1];// last text string in input field
+ int cursor_position; // actual text cursor position
+ int cursor_x; // actual x cursor position
+ int cursor_y; // actual y cursor position
+ int cursor_x_preferred; // "preferred" x cursor position
+ int size; // maximal size of input text
+ int xsize, ysize; // size of text area (in chars)
};
struct GadgetSelectbox
{
- struct ValueTextInfo *options; /* pointer to text/value array */
- int index; /* index of actual text string */
- int size; /* maximal size of text strings */
- char char_unselectable; /* first char of unselectable options */
-
- /* automatically determined values */
- int x, y; /* open selectbox position */
- int width, height; /* open selectbox size */
- int num_values; /* number of text strings */
- Pixel inverse_color; /* color for highlighting */
-
- /* runtime values */
- boolean open; /* opening state of selectbox */
- boolean stay_open; /* open after button release */
- int current_index; /* index of text while selecting */
+ struct ValueTextInfo *options; // pointer to text/value array
+ int index; // index of actual text string
+ int size; // maximal size of text strings
+ char char_unselectable; // first char of unselectable options
+
+ // automatically determined values
+ int x, y; // open selectbox position
+ int width, height; // open selectbox size
+ int num_values; // number of text strings
+ Pixel inverse_color; // color for highlighting
+
+ // runtime values
+ boolean open; // opening state of selectbox
+ boolean stay_open; // open after button release
+ int current_index; // index of text while selecting
};
struct GadgetScrollbar
{
- int items_max; /* number of items to access */
- int items_visible; /* number of visible items */
- int item_position; /* actual item position */
- int size_min; /* minimal scrollbar size */
- int size_max; /* this is either width or height */
- int size_max_cmp; /* needed for minimal scrollbar size */
- int size; /* scrollbar size on screen */
- int position; /* scrollbar position on screen */
- int position_max; /* bottom/right scrollbar position */
- int drag_position; /* drag position on scrollbar */
- int correction; /* scrollbar position correction */
+ int items_max; // number of items to access
+ int items_visible; // number of visible items
+ int item_position; // actual item position
+ int size_min; // minimal scrollbar size
+ int size_max; // this is either width or height
+ int size_max_cmp; // needed for minimal scrollbar size
+ int size; // scrollbar size on screen
+ int position; // scrollbar position on screen
+ int position_max; // bottom/right scrollbar position
+ int drag_position; // drag position on scrollbar
+ int correction; // scrollbar position correction
};
struct GadgetWheelArea
{
- int x, y; /* active area for wheel (start) */
- int width, height; /* active area for wheel (size) */
+ int x, y; // active area for wheel (start)
+ int width, height; // active area for wheel (size)
};
struct GadgetInfo
{
- boolean deactivated; /* flag to deactivate gadget */
-
- int id; /* internal gadget identifier */
- int image_id; /* internal gadget image identifier */
- int custom_id; /* custom gadget identifier */
- int custom_type_id; /* custom gadget type identifier */
- char info_text[MAX_INFO_TEXTSIZE + 1];/* short popup info text */
- int x, y; /* gadget position */
- int width, height; /* gadget size */
- unsigned int type; /* type (button, text input, ...) */
- unsigned int state; /* state (pressed, released, ...) */
- boolean checked; /* check/radio button state */
- int radio_nr; /* number of radio button series */
- boolean mapped; /* gadget is mapped on the screen */
- boolean active; /* gadget is active */
- boolean direct_draw; /* directly draw to frontbuffer */
- boolean callback_action_always; /* also callback if gadget unchanged */
- int font; /* font to use when inactive */
- int font_active; /* font to use when active */
- int font_unselectable; /* font to use when unselectable */
- struct GadgetBorder border; /* gadget border design */
- struct GadgetDesign design[2]; /* 0: normal; 1: pressed */
- struct GadgetDesign alt_design[2]; /* alternative design */
- struct GadgetDecoration deco; /* decoration on top of gadget */
- unsigned int event_mask; /* possible events for this gadget */
- struct GadgetEvent event; /* actual gadget event */
- gadget_function callback_info; /* function for pop-up info text */
- gadget_function callback_action; /* function for gadget action */
- struct GadgetDrawingArea drawing; /* fields for drawing area gadget */
- struct GadgetTextButton textbutton; /* fields for text button gadget */
- struct GadgetTextInput textinput; /* fields for text input gadget */
- struct GadgetTextArea textarea; /* fields for text area gadget */
- struct GadgetSelectbox selectbox; /* fields for selectbox gadget */
- struct GadgetScrollbar scrollbar; /* fields for scrollbar gadget */
- struct GadgetWheelArea wheelarea; /* fields for scroll wheel area */
- struct GadgetInfo *next; /* next list entry */
+ boolean deactivated; // flag to deactivate gadget
+
+ int id; // internal gadget identifier
+ int image_id; // internal gadget image identifier
+ int custom_id; // custom gadget identifier
+ int custom_type_id; // custom gadget type identifier
+ char info_text[MAX_INFO_TEXTSIZE + 1];// short popup info text
+ int x, y; // gadget position
+ int width, height; // gadget size
+ unsigned int type; // type (button, text input, ...)
+ unsigned int state; // state (pressed, released, ...)
+ boolean checked; // check/radio button state
+ int radio_nr; // number of radio button series
+ boolean mapped; // gadget is mapped on the screen
+ boolean active; // gadget is active
+ boolean direct_draw; // directly draw to frontbuffer
+ boolean callback_action_always; // also callback if gadget unchanged
+ int font; // font to use when inactive
+ int font_active; // font to use when active
+ int font_unselectable; // font to use when unselectable
+ struct GadgetBorder border; // gadget border design
+ struct GadgetDesign design[2]; // 0: normal; 1: pressed
+ struct GadgetDesign alt_design[2]; // alternative design
+ struct GadgetDecoration deco; // decoration on top of gadget
+ unsigned int event_mask; // possible events for this gadget
+ struct GadgetEvent event; // actual gadget event
+ gadget_function callback_info; // function for pop-up info text
+ gadget_function callback_action; // function for gadget action
+ struct GadgetDrawingArea drawing; // fields for drawing area gadget
+ struct GadgetTextButton textbutton; // fields for text button gadget
+ struct GadgetTextInput textinput; // fields for text input gadget
+ struct GadgetTextArea textarea; // fields for text area gadget
+ struct GadgetSelectbox selectbox; // fields for selectbox gadget
+ struct GadgetScrollbar scrollbar; // fields for scrollbar gadget
+ struct GadgetWheelArea wheelarea; // fields for scroll wheel area
+ struct GadgetInfo *next; // next list entry
};
void DumpGadgetIdentifiers(void);
boolean DoGadgetAction(int);
-#endif /* GADGETS_H */
+#endif // GADGETS_H
Bitmap *bitmaps[NUM_IMG_BITMAP_POINTERS];
- int original_width; /* original image file width */
- int original_height; /* original image file height */
+ int original_width; // original image file width
+ int original_height; // original image file height
- boolean contains_small_images; /* set after adding small images */
- boolean contains_textures; /* set after adding GPU textures */
- boolean scaled_up; /* set after scaling up */
+ boolean contains_small_images; // set after adding small images
+ boolean contains_textures; // set after adding GPU textures
+ boolean scaled_up; // set after scaling up
- int conf_tile_size; /* tile size as defined in config */
- int game_tile_size; /* tile size as resized for game */
+ int conf_tile_size; // tile size as defined in config
+ int game_tile_size; // tile size as resized for game
- char *leveldir; /* level set when image was loaded */
+ char *leveldir; // level set when image was loaded
};
typedef struct ImageInfo ImageInfo;
image_info = checked_calloc(sizeof(struct ArtworkListInfo));
image_info->type = ARTWORK_TYPE_GRAPHICS;
- /* ---------- initialize file list and suffix lists ---------- */
+ // ---------- initialize file list and suffix lists ----------
image_info->num_file_list_entries = num_file_list_entries;
image_info->num_dynamic_file_list_entries = 0;
image_info->suffix_list = config_suffix_list;
- /* ---------- initialize base prefix and suffixes lists ---------- */
+ // ---------- initialize base prefix and suffixes lists ----------
image_info->num_base_prefixes = 0;
for (i = 0; base_prefixes[i] != NULL; i++)
image_info->property_mapping = NULL;
- /* ---------- initialize artwork reference and content lists ---------- */
+ // ---------- initialize artwork reference and content lists ----------
image_info->sizeof_artwork_list_entry = sizeof(ImageInfo *);
image_info->content_list = NULL;
- /* ---------- initialize artwork loading/freeing functions ---------- */
+ // ---------- initialize artwork loading/freeing functions ----------
image_info->load_artwork = Load_Image;
image_info->free_artwork = FreeImage;
void FreeAllImages(void);
-#endif /* IMAGE_H */
+#endif // IMAGE_H
#include "misc.h"
-/* ========================================================================= */
-/* platform independent joystick functions */
-/* ========================================================================= */
+// ============================================================================
+// platform independent joystick functions
+// ============================================================================
#define TRANSLATE_JOYSYMBOL_TO_JOYNAME 0
#define TRANSLATE_JOYNAME_TO_JOYSYMBOL 1
void ActivateJoystick(void)
{
- /* reactivate temporarily deactivated joystick */
+ // reactivate temporarily deactivated joystick
if (joystick.status & JOYSTICK_AVAILABLE)
joystick.status |= JOYSTICK_ACTIVE;
#define DEV_JOYSTICK_3 "/dev/js3"
#endif
-/* get these values from the program 'js' from the joystick package, */
-/* set JOYSTICK_PERCENT to a threshold appropriate for your joystick */
+// get these values from the program 'js' from the joystick package,
+// set JOYSTICK_PERCENT to a threshold appropriate for your joystick
#define JOYSTICK_MAX_AXIS_POS 32767
void DeactivateJoystick(void);
void ActivateJoystick(void);
-#endif /* JOYSTICK_H */
+#endif // JOYSTICK_H
#include "setup.h"
#include "misc.h"
-#endif /* LIBGAME_H */
+#endif // LIBGAME_H
#define MACOSX_H
-/* define some Mac OS X specific paths */
+// define some Mac OS X specific paths
#define MAC_APP_BINARY_SUBDIR "Contents/MacOS"
#define MAC_APP_FILES_SUBDIR "Contents/Resources"
-/* some symbols are already defined on Mac OS X */
+// some symbols are already defined on Mac OS X
#define Delay Delay_internal
#define DrawLine DrawLine_internal
#define DrawText DrawText_internal
#define GetPixel GetPixel_internal
-#endif /* MACOSX_H */
+#endif // MACOSX_H
#include "image.h"
-/* ========================================================================= */
-/* some generic helper functions */
-/* ========================================================================= */
+// ============================================================================
+// some generic helper functions
+// ============================================================================
-/* ------------------------------------------------------------------------- */
-/* logging functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// logging functions
+// ----------------------------------------------------------------------------
#define DUPLICATE_LOG_OUT_TO_STDOUT TRUE
#define DUPLICATE_LOG_ERR_TO_STDERR TRUE
}
-/* ------------------------------------------------------------------------- */
-/* platform independent wrappers for printf() et al. */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// platform independent wrappers for printf() et al.
+// ----------------------------------------------------------------------------
void fprintf_line(FILE *file, char *line_chars, int line_length)
{
}
-/* ------------------------------------------------------------------------- */
-/* string functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// string functions
+// ----------------------------------------------------------------------------
/* int2str() returns a number converted to a string;
the used memory is static, but will be overwritten by later calls,
checked_free(a);
- if (i > 2147483647) /* yes, this is a kludge */
+ if (i > 2147483647) // yes, this is a kludge
i = 2147483647;
a = checked_malloc(10 + 1);
while ((1 << e) < x)
{
- x -= (1 << e); /* for rounding down (rounding up: remove this line) */
+ x -= (1 << e); // for rounding down (rounding up: remove this line)
e++;
}
}
-/* ------------------------------------------------------------------------- */
-/* counter functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// counter functions
+// ----------------------------------------------------------------------------
-/* maximal allowed length of a command line option */
+// maximal allowed length of a command line option
#define MAX_OPTION_LEN 256
static unsigned int getCurrentMS(void)
static unsigned int base_ms = 0;
unsigned int current_ms;
- /* get current system milliseconds */
+ // get current system milliseconds
current_ms = getCurrentMS();
- /* reset base timestamp in case of counter reset or wrap-around */
+ // reset base timestamp in case of counter reset or wrap-around
if (mode == INIT_COUNTER || current_ms < base_ms)
base_ms = current_ms;
- /* return milliseconds since last counter reset */
+ // return milliseconds since last counter reset
return current_ms - base_ms;
}
-void InitCounter() /* set counter back to zero */
+void InitCounter() // set counter back to zero
{
mainCounter(INIT_COUNTER);
}
-unsigned int Counter() /* get milliseconds since last call of InitCounter() */
+unsigned int Counter() // get milliseconds since last call of InitCounter()
{
return mainCounter(READ_COUNTER);
}
SDL_Delay(milliseconds_delay);
}
-void Delay(unsigned int delay) /* Sleep specified number of milliseconds */
+void Delay(unsigned int delay) // Sleep specified number of milliseconds
{
sleep_milliseconds(delay);
}
}
-/* ------------------------------------------------------------------------- */
-/* random generator functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// random generator functions
+// ----------------------------------------------------------------------------
unsigned int init_random_number(int nr, int seed)
{
if (seed == NEW_RANDOMIZE)
{
- /* default random seed */
+ // default random seed
seed = (int)time(NULL); // seconds since the epoch
#if !defined(PLATFORM_WIN32)
- /* add some more randomness */
+ // add some more randomness
struct timeval current_time;
gettimeofday(¤t_time, NULL);
seed += (int)current_time.tv_usec; // microseconds since the epoch
#endif
- /* add some more randomness */
+ // add some more randomness
seed += (int)SDL_GetTicks(); // milliseconds since SDL init
- /* add some more randomness */
+ // add some more randomness
seed += GetSimpleRandom(1000000);
}
}
-/* ------------------------------------------------------------------------- */
-/* system info functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// system info functions
+// ----------------------------------------------------------------------------
#if !defined(PLATFORM_ANDROID)
static char *get_corrected_real_name(char *real_name)
char *from_ptr = real_name;
char *to_ptr = real_name_new;
- /* copy the name string, but not more than MAX_USERNAME_LEN characters */
+ // copy the name string, but not more than MAX_USERNAME_LEN characters
while (*from_ptr && (int)(to_ptr - real_name_new) < MAX_USERNAME_LEN - 1)
{
/* the name field read from "passwd" file may also contain additional
{
struct stat file_status;
- if (stat(filename, &file_status) != 0) /* cannot stat file */
+ if (stat(filename, &file_status) != 0) // cannot stat file
return 0;
return file_status.st_mtime;
}
-/* ------------------------------------------------------------------------- */
-/* path manipulation functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// path manipulation functions
+// ----------------------------------------------------------------------------
static char *getLastPathSeparatorPtr(char *filename)
{
char *last_separator = strrchr(filename, CHAR_PATH_SEPARATOR_UNIX);
- if (last_separator == NULL) /* also try DOS/Windows variant */
+ if (last_separator == NULL) // also try DOS/Windows variant
last_separator = strrchr(filename, CHAR_PATH_SEPARATOR_DOS);
return last_separator;
char *last_separator = getLastPathSeparatorPtr(filename);
if (last_separator != NULL)
- return last_separator + 1; /* separator found: strip base path */
+ return last_separator + 1; // separator found: strip base path
else
- return filename; /* no separator found: filename has no path */
+ return filename; // no separator found: filename has no path
}
char *getBaseName(char *filename)
char *basepath = getStringCopy(filename);
char *last_separator = getLastPathSeparatorPtr(basepath);
- /* if no separator was found, use current directory */
+ // if no separator was found, use current directory
if (last_separator == NULL)
{
free(basepath);
return getStringCopy(".");
}
- /* separator found: strip basename */
+ // separator found: strip basename
*last_separator = '\0';
return basepath;
}
-/* ------------------------------------------------------------------------- */
-/* various string functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// various string functions
+// ----------------------------------------------------------------------------
char *getStringCat2WithSeparator(char *s1, char *s2, char *sep)
{
}
-/* ------------------------------------------------------------------------- */
-/* command line option handling functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// command line option handling functions
+// ----------------------------------------------------------------------------
void GetOptions(int argc, char *argv[],
void (*print_usage_function)(void),
char **argvplus = checked_calloc((argc + 1) * sizeof(char **));
char **options_left = &argvplus[1];
- /* replace original "argv" with null-terminated array of string pointers */
+ // replace original "argv" with null-terminated array of string pointers
while (argc--)
argvplus[argc] = argv[argc];
- /* initialize global program options */
+ // initialize global program options
options.server_host = NULL;
options.server_port = 0;
options.verbose = TRUE;
#else
#if !defined(PLATFORM_UNIX)
- if (*options_left == NULL) /* no options given -- enable verbose mode */
+ if (*options_left == NULL) // no options given -- enable verbose mode
options.verbose = TRUE;
#endif
#endif
if (option_len >= MAX_OPTION_LEN)
Error(ERR_EXIT_HELP, "unrecognized option '%s'", option);
- strcpy(option_str, option); /* copy argument into buffer */
+ strcpy(option_str, option); // copy argument into buffer
option = option_str;
- if (strEqual(option, "--")) /* stop scanning arguments */
+ if (strEqual(option, "--")) // stop scanning arguments
break;
- if (strPrefix(option, "--")) /* treat '--' like '-' */
+ if (strPrefix(option, "--")) // treat '--' like '-'
option++;
option_arg = strchr(option, '=');
- if (option_arg == NULL) /* no '=' in option */
+ if (option_arg == NULL) // no '=' in option
option_arg = next_option;
else
{
- *option_arg++ = '\0'; /* cut argument from option */
- if (*option_arg == '\0') /* no argument after '=' */
+ *option_arg++ = '\0'; // cut argument from option
+ if (*option_arg == '\0') // no argument after '='
Error(ERR_EXIT_HELP, "option '%s' has invalid argument", option_str);
}
if (option_arg == NULL)
Error(ERR_EXIT_HELP, "option '%s' requires an argument", option_str);
- /* this should be extended to separate options for ro and rw data */
+ // this should be extended to separate options for ro and rw data
options.ro_base_directory = ro_base_path = option_arg;
options.rw_base_directory = rw_base_path = option_arg;
if (option_arg == next_option)
options_left++;
- /* adjust paths for sub-directories in base directory accordingly */
+ // adjust paths for sub-directories in base directory accordingly
options.level_directory = getPath2(ro_base_path, LEVELS_DIRECTORY);
options.graphics_directory = getPath2(ro_base_path, GRAPHICS_DIRECTORY);
options.sounds_directory = getPath2(ro_base_path, SOUNDS_DIRECTORY);
if (option_arg == next_option)
options_left++;
- /* when doing batch processing, always enable verbose mode (warnings) */
+ // when doing batch processing, always enable verbose mode (warnings)
options.verbose = TRUE;
}
#if defined(PLATFORM_MACOSX)
else if (strPrefix(option, "-psn"))
{
- /* ignore process serial number when launched via GUI on Mac OS X */
+ // ignore process serial number when launched via GUI on Mac OS X
}
#endif
else if (*option == '-')
}
-/* ------------------------------------------------------------------------- */
-/* error handling functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// error handling functions
+// ----------------------------------------------------------------------------
#define MAX_INTERNAL_ERROR_SIZE 1024
-/* used by SetError() and GetError() to store internal error messages */
+// used by SetError() and GetError() to store internal error messages
static char internal_error[MAX_INTERNAL_ERROR_SIZE];
void SetError(char *format, ...)
ANDROID_LOG_UNKNOWN);
#endif
- /* display debug messages only when running in debug mode */
+ // display debug messages only when running in debug mode
if (mode & ERR_DEBUG && !options.debug)
return;
- /* display warnings only when running in verbose mode */
+ // display warnings only when running in verbose mode
if (mode & ERR_WARN && !options.verbose)
return;
if (mode & ERR_EXIT)
{
if (mode & ERR_FROM_SERVER)
- exit(1); /* child process: normal exit */
+ exit(1); // child process: normal exit
else
- program.exit_function(1); /* main process: clean up stuff */
+ program.exit_function(1); // main process: clean up stuff
}
}
-/* ------------------------------------------------------------------------- */
-/* checked memory allocation and freeing functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// checked memory allocation and freeing functions
+// ----------------------------------------------------------------------------
void *checked_malloc(unsigned int size)
{
void checked_free(void *ptr)
{
- if (ptr != NULL) /* this check should be done by free() anyway */
+ if (ptr != NULL) // this check should be done by free() anyway
free(ptr);
}
void clear_mem(void *ptr, unsigned int size)
{
#if defined(PLATFORM_WIN32)
- /* for unknown reason, memset() sometimes crashes when compiled with MinGW */
+ // for unknown reason, memset() sometimes crashes when compiled with MinGW
char *cptr = (char *)ptr;
while (size--)
}
-/* ------------------------------------------------------------------------- */
-/* various helper functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// various helper functions
+// ----------------------------------------------------------------------------
void swap_numbers(int *i1, int *i2)
{
if (byte_order == BYTE_ORDER_BIG_ENDIAN)
return ((getByteFromFile(file) << 8) |
(getByteFromFile(file) << 0));
- else /* BYTE_ORDER_LITTLE_ENDIAN */
+ else // BYTE_ORDER_LITTLE_ENDIAN
return ((getByteFromFile(file) << 0) |
(getByteFromFile(file) << 8));
}
fputc((value >> 8) & 0xff, file);
fputc((value >> 0) & 0xff, file);
}
- else /* BYTE_ORDER_LITTLE_ENDIAN */
+ else // BYTE_ORDER_LITTLE_ENDIAN
{
fputc((value >> 0) & 0xff, file);
fputc((value >> 8) & 0xff, file);
(getByteFromFile(file) << 16) |
(getByteFromFile(file) << 8) |
(getByteFromFile(file) << 0));
- else /* BYTE_ORDER_LITTLE_ENDIAN */
+ else // BYTE_ORDER_LITTLE_ENDIAN
return ((getByteFromFile(file) << 0) |
(getByteFromFile(file) << 8) |
(getByteFromFile(file) << 16) |
fputc((value >> 8) & 0xff, file);
fputc((value >> 0) & 0xff, file);
}
- else /* BYTE_ORDER_LITTLE_ENDIAN */
+ else // BYTE_ORDER_LITTLE_ENDIAN
{
fputc((value >> 0) & 0xff, file);
fputc((value >> 8) & 0xff, file);
{
const int chunk_name_length = 4;
- /* read chunk name */
+ // read chunk name
if (getStringFromFile(file, chunk_name, chunk_name_length + 1) == NULL)
return FALSE;
if (chunk_size != NULL)
{
- /* read chunk size */
+ // read chunk size
*chunk_size = getFile32BitInteger(file, byte_order);
}
{
int num_bytes = 0;
- /* write chunk name */
+ // write chunk name
if (file != NULL)
fputs(chunk_name, file);
if (chunk_size >= 0)
{
- /* write chunk size */
+ // write chunk size
if (file != NULL)
putFile32BitInteger(file, chunk_size, byte_order);
}
-/* ------------------------------------------------------------------------- */
-/* functions to translate key identifiers between different format */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions to translate key identifiers between different format
+// ----------------------------------------------------------------------------
#define TRANSLATE_KEYSYM_TO_KEYNAME 0
#define TRANSLATE_KEYSYM_TO_X11KEYNAME 1
char *name;
} translate_key[] =
{
- /* return and escape keys */
+ // return and escape keys
{ KSYM_Return, "XK_Return", "return" },
{ KSYM_Escape, "XK_Escape", "escape" },
- /* normal cursor keys */
+ // normal cursor keys
{ KSYM_Left, "XK_Left", "cursor left" },
{ KSYM_Right, "XK_Right", "cursor right" },
{ KSYM_Up, "XK_Up", "cursor up" },
{ KSYM_Down, "XK_Down", "cursor down" },
- /* keypad cursor keys */
+ // keypad cursor keys
#ifdef KSYM_KP_Left
{ KSYM_KP_Left, "XK_KP_Left", "keypad left" },
{ KSYM_KP_Right, "XK_KP_Right", "keypad right" },
{ KSYM_KP_Down, "XK_KP_Down", "keypad down" },
#endif
- /* other keypad keys */
+ // other keypad keys
#ifdef KSYM_KP_Enter
{ KSYM_KP_Enter, "XK_KP_Enter", "keypad enter" },
{ KSYM_KP_Add, "XK_KP_Add", "keypad +" },
{ KSYM_KP_Separator,"XK_KP_Separator", "keypad ," },
#endif
- /* modifier keys */
+ // modifier keys
{ KSYM_Shift_L, "XK_Shift_L", "left shift" },
{ KSYM_Shift_R, "XK_Shift_R", "right shift" },
{ KSYM_Control_L, "XK_Control_L", "left control" },
{ KSYM_Alt_L, "XK_Alt_L", "left alt" },
{ KSYM_Alt_R, "XK_Alt_R", "right alt" },
#if !defined(TARGET_SDL2)
- { KSYM_Super_L, "XK_Super_L", "left super" }, /* Win-L */
- { KSYM_Super_R, "XK_Super_R", "right super" }, /* Win-R */
+ { KSYM_Super_L, "XK_Super_L", "left super" }, // Win-L
+ { KSYM_Super_R, "XK_Super_R", "right super" }, // Win-R
#endif
- { KSYM_Mode_switch, "XK_Mode_switch", "mode switch" }, /* Alt-R */
- { KSYM_Multi_key, "XK_Multi_key", "multi key" }, /* Ctrl-R */
+ { KSYM_Mode_switch, "XK_Mode_switch", "mode switch" }, // Alt-R
+ { KSYM_Multi_key, "XK_Multi_key", "multi key" }, // Ctrl-R
- /* some special keys */
+ // some special keys
{ KSYM_BackSpace, "XK_BackSpace", "backspace" },
{ KSYM_Delete, "XK_Delete", "delete" },
{ KSYM_Insert, "XK_Insert", "insert" },
#if defined(TARGET_SDL2)
{ KSYM_Select, "XK_Select", "select" },
- { KSYM_Menu, "XK_Menu", "menu" }, /* menu key */
- { KSYM_Back, "XK_Back", "back" }, /* back key */
+ { KSYM_Menu, "XK_Menu", "menu" }, // menu key
+ { KSYM_Back, "XK_Back", "back" }, // back key
{ KSYM_PlayPause, "XK_PlayPause", "play/pause" },
#if defined(PLATFORM_ANDROID)
{ KSYM_Rewind, "XK_Rewind", "rewind" },
#endif
#endif
- /* ASCII 0x20 to 0x40 keys (except numbers) */
+ // ASCII 0x20 to 0x40 keys (except numbers)
{ KSYM_space, "XK_space", "space" },
{ KSYM_exclam, "XK_exclam", "!" },
{ KSYM_quotedbl, "XK_quotedbl", "\"" },
{ KSYM_question, "XK_question", "?" },
{ KSYM_at, "XK_at", "@" },
- /* more ASCII keys */
+ // more ASCII keys
{ KSYM_bracketleft, "XK_bracketleft", "[" },
{ KSYM_backslash, "XK_backslash", "\\" },
{ KSYM_bracketright,"XK_bracketright", "]" },
{ KSYM_braceright, "XK_braceright", "brace right" },
{ KSYM_asciitilde, "XK_asciitilde", "~" },
- /* special (non-ASCII) keys */
+ // special (non-ASCII) keys
{ KSYM_degree, "XK_degree", "degree" },
{ KSYM_Adiaeresis, "XK_Adiaeresis", "A umlaut" },
{ KSYM_Odiaeresis, "XK_Odiaeresis", "O umlaut" },
{ KSYM_ssharp, "XK_ssharp", "sharp s" },
#if defined(TARGET_SDL2)
- /* special (non-ASCII) keys (UTF-8, for reverse mapping only) */
+ // special (non-ASCII) keys (UTF-8, for reverse mapping only)
{ KSYM_degree, "XK_degree", "\xc2\xb0" },
{ KSYM_Adiaeresis, "XK_Adiaeresis", "\xc3\x84" },
{ KSYM_Odiaeresis, "XK_Odiaeresis", "\xc3\x96" },
{ KSYM_udiaeresis, "XK_udiaeresis", "\xc3\xbc" },
{ KSYM_ssharp, "XK_ssharp", "\xc3\x9f" },
- /* other keys (for reverse mapping only) */
+ // other keys (for reverse mapping only)
{ KSYM_space, "XK_space", " " },
#endif
#if defined(TARGET_SDL2)
- /* keypad keys are not in numerical order in SDL2 */
+ // keypad keys are not in numerical order in SDL2
{ KSYM_KP_0, "XK_KP_0", "keypad 0" },
{ KSYM_KP_1, "XK_KP_1", "keypad 1" },
{ KSYM_KP_2, "XK_KP_2", "keypad 2" },
{ KSYM_KP_9, "XK_KP_9", "keypad 9" },
#endif
- /* end-of-array identifier */
+ // end-of-array identifier
{ 0, NULL, NULL }
};
byte key_char;
} translate_key_char[] =
{
- /* special (non-ASCII) keys (ISO-8859-1) */
+ // special (non-ASCII) keys (ISO-8859-1)
{ KSYM_degree, CHAR_BYTE_DEGREE },
{ KSYM_Adiaeresis, CHAR_BYTE_UMLAUT_A },
{ KSYM_Odiaeresis, CHAR_BYTE_UMLAUT_O },
{ KSYM_udiaeresis, CHAR_BYTE_UMLAUT_u },
{ KSYM_ssharp, CHAR_BYTE_SHARP_S },
- /* end-of-array identifier */
+ // end-of-array identifier
{ 0, 0 }
};
char getValidConfigValueChar(char c)
{
- if (c == '#' || /* used to mark comments */
- c == '\\') /* used to mark continued lines */
+ if (c == '#' || // used to mark comments
+ c == '\\') // used to mark continued lines
c = 0;
return c;
}
-/* ------------------------------------------------------------------------- */
-/* functions to translate string identifiers to integer or boolean value */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions to translate string identifiers to integer or boolean value
+// ----------------------------------------------------------------------------
int get_integer_from_string(char *s)
{
}
-/* ------------------------------------------------------------------------- */
-/* functions for generic lists */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for generic lists
+// ----------------------------------------------------------------------------
ListNode *newListNode(void)
{
#endif
-/* ------------------------------------------------------------------------- */
-/* functions for file handling */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for file handling
+// ----------------------------------------------------------------------------
#define MAX_BUFFER_SIZE 4096
}
-/* ------------------------------------------------------------------------- */
-/* functions for directory handling */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for directory handling
+// ----------------------------------------------------------------------------
Directory *openDirectory(char *dir_name)
{
}
-/* ------------------------------------------------------------------------- */
-/* functions for checking files and filenames */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for checking files and filenames
+// ----------------------------------------------------------------------------
boolean directoryExists(char *dir_name)
{
return FALSE;
}
-/* ------------------------------------------------------------------------- */
-/* functions for loading artwork configuration information */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for loading artwork configuration information
+// ----------------------------------------------------------------------------
char *get_mapped_token(char *token)
{
- /* !!! make this dynamically configurable (init.c:InitArtworkConfig) !!! */
+ // !!! make this dynamically configurable (init.c:InitArtworkConfig) !!!
static char *map_token_prefix[][2] =
{
{ "char_procent", "char_percent" },
static char *get_special_base_token(struct ArtworkListInfo *artwork_info,
char *token)
{
- /* !!! make this dynamically configurable (init.c:InitArtworkConfig) !!! */
+ // !!! make this dynamically configurable (init.c:InitArtworkConfig) !!!
static struct ConfigTypeInfo prefix_list[] =
{
{ "global.anim_1" },
int len_suffix = 0;
int i;
- /* search for prefix to check if base token has to be created */
+ // search for prefix to check if base token has to be created
for (i = 0; prefix_list[i].token != NULL; i++)
if (strPrefix(token, prefix_list[i].token))
prefix_found = TRUE;
if (!prefix_found)
return NULL;
- /* search for suffix (parameter) to determine base token length */
+ // search for suffix (parameter) to determine base token length
for (i = 0; suffix_list[i].token != NULL; i++)
if (strSuffix(token, suffix_list[i].token))
len_suffix = strlen(suffix_list[i].token);
{
char next_char = s[strlen(s_contained)];
- /* check if next character is delimiter or whitespace */
+ // check if next character is delimiter or whitespace
return (next_char == ',' || next_char == '\0' ||
next_char == ' ' || next_char == '\t' ? TRUE : FALSE);
}
- /* check if string contains another parameter string after a comma */
+ // check if string contains another parameter string after a comma
substring = strchr(s, ',');
- if (substring == NULL) /* string does not contain a comma */
+ if (substring == NULL) // string does not contain a comma
return FALSE;
- /* advance string pointer to next character after the comma */
+ // advance string pointer to next character after the comma
substring++;
- /* skip potential whitespaces after the comma */
+ // skip potential whitespaces after the comma
while (*substring == ' ' || *substring == '\t')
substring++;
}
}
- /* discard result if next character is neither delimiter nor whitespace */
+ // discard result if next character is neither delimiter nor whitespace
if (!(*s_ptr == ',' || *s_ptr == '\0' ||
*s_ptr == ' ' || *s_ptr == '\t'))
return ANIM_EVENT_NONE;
int get_parameter_value(char *value_raw, char *suffix, int type)
{
char *value = getStringToLower(value_raw);
- int result = 0; /* probably a save default value */
+ int result = 0; // probably a save default value
if (strEqual(suffix, ".direction"))
{
string_has_parameter(value, "curtain") ? FADE_MODE_CURTAIN :
FADE_MODE_DEFAULT);
}
- else if (strPrefix(suffix, ".font")) /* (may also be ".font_xyz") */
+ else if (strPrefix(suffix, ".font")) // (may also be ".font_xyz")
{
result = gfx.get_font_from_token_function(value);
}
- else /* generic parameter of type integer or boolean */
+ else // generic parameter of type integer or boolean
{
result = (strEqual(value, ARG_UNDEFINED) ? ARG_UNDEFINED_VALUE :
type == TYPE_INTEGER ? get_integer_from_string(value) :
int list_pos;
int i, j;
- /* create hash from list of tokens to be ignored (for quick access) */
+ // create hash from list of tokens to be ignored (for quick access)
ignore_tokens_hash = newSetupFileHash();
for (i = 0; ignore_tokens[i] != NULL; i++)
setHashEntry(ignore_tokens_hash, ignore_tokens[i], "");
for (i = 0; suffix_list[i].token != NULL; i++)
num_suffix_list_entries++;
- /* always start with reliable default values */
+ // always start with reliable default values
for (i = 0; i < num_file_list_entries; i++)
{
file_list[i].token = NULL;
}
}
- /* the following tokens are no file definitions, but other config tokens */
+ // the following tokens are no file definitions, but other config tokens
if (getHashEntry(ignore_tokens_hash, config_list[i].token) != NULL)
is_file_entry = FALSE;
int len_token = strlen(token);
int len_suffix = strlen(suffix);
- if (start_pos < 0) /* compare suffix from end of string */
+ if (start_pos < 0) // compare suffix from end of string
start_pos += len_token;
if (start_pos < 0 || start_pos + len_suffix > len_token)
struct ConfigTypeInfo *suffix_list,
struct FileInfo *file_list_entry)
{
- /* check for config token that is the base token without any suffixes */
+ // check for config token that is the base token without any suffixes
char *filename = getHashEntry(setup_file_hash, file_list_entry->token);
char *known_token_value = KNOWN_TOKEN_VALUE;
int i;
{
setString(&file_list_entry->filename, filename);
- /* when file definition found, set all parameters to default values */
+ // when file definition found, set all parameters to default values
for (i = 0; suffix_list[i].token != NULL; i++)
setString(&file_list_entry->parameter[i], suffix_list[i].value);
file_list_entry->redefined = TRUE;
- /* mark config file token as well known from default config */
+ // mark config file token as well known from default config
setHashEntry(setup_file_hash, file_list_entry->token, known_token_value);
}
- /* check for config tokens that can be build by base token and suffixes */
+ // check for config tokens that can be build by base token and suffixes
for (i = 0; suffix_list[i].token != NULL; i++)
{
char *token = getStringCat2(file_list_entry->token, suffix_list[i].token);
{
setString(&file_list_entry->parameter[i], value);
- /* mark config file token as well known from default config */
+ // mark config file token as well known from default config
setHashEntry(setup_file_hash, token, known_token_value);
}
if ((setup_file_hash = loadSetupFileHash(filename)) == NULL)
return;
- /* separate valid (defined) from empty (undefined) config token values */
+ // separate valid (defined) from empty (undefined) config token values
valid_file_hash = newSetupFileHash();
empty_file_hash = newSetupFileHash();
BEGIN_HASH_ITERATION(setup_file_hash, itr)
}
END_HASH_ITERATION(setup_file_hash, itr)
- /* at this point, we do not need the setup file hash anymore -- free it */
+ // at this point, we do not need the setup file hash anymore -- free it
freeSetupFileHash(setup_file_hash);
- /* prevent changing hash while iterating over it by using a temporary copy */
+ // prevent changing hash while iterating over it by using a temporary copy
valid_file_hash_tmp = newSetupFileHash();
BEGIN_HASH_ITERATION(valid_file_hash, itr)
{
}
END_HASH_ITERATION(valid_file_hash, itr)
- /* (iterate over same temporary hash, as modifications are independent) */
+ // (iterate over same temporary hash, as modifications are independent)
- /* map deprecated to current tokens (using prefix match and replace) */
+ // map deprecated to current tokens (using prefix match and replace)
BEGIN_HASH_ITERATION(valid_file_hash_tmp, itr)
{
char *token = HASH_ITERATION_TOKEN(itr);
{
char *value = HASH_ITERATION_VALUE(itr);
- /* add mapped token */
+ // add mapped token
setHashEntry(valid_file_hash, mapped_token, value);
- /* ignore old token (by setting it to "known" keyword) */
+ // ignore old token (by setting it to "known" keyword)
setHashEntry(valid_file_hash, token, known_token_value);
free(mapped_token);
}
END_HASH_ITERATION(valid_file_hash_tmp, itr)
- /* add special base tokens (using prefix match and replace) */
+ // add special base tokens (using prefix match and replace)
BEGIN_HASH_ITERATION(valid_file_hash_tmp, itr)
{
char *token = HASH_ITERATION_TOKEN(itr);
if (base_token != NULL)
{
- /* add base token only if it does not already exist */
+ // add base token only if it does not already exist
if (getHashEntry(valid_file_hash, base_token) == NULL)
setHashEntry(valid_file_hash, base_token, base_token_value);
}
END_HASH_ITERATION(valid_file_hash_tmp, itr)
- /* free temporary hash used for iteration */
+ // free temporary hash used for iteration
freeSetupFileHash(valid_file_hash_tmp);
- /* read parameters for all known config file tokens */
+ // read parameters for all known config file tokens
for (i = 0; i < num_file_list_entries; i++)
read_token_parameters(valid_file_hash, suffix_list, &file_list[i]);
- /* set all tokens that can be ignored here to "known" keyword */
+ // set all tokens that can be ignored here to "known" keyword
for (i = 0; i < num_ignore_tokens; i++)
setHashEntry(valid_file_hash, ignore_tokens[i], known_token_value);
- /* copy all unknown config file tokens to extra config hash */
+ // copy all unknown config file tokens to extra config hash
extra_file_hash = newSetupFileHash();
BEGIN_HASH_ITERATION(valid_file_hash, itr)
{
}
END_HASH_ITERATION(valid_file_hash, itr)
- /* at this point, we do not need the valid file hash anymore -- free it */
+ // at this point, we do not need the valid file hash anymore -- free it
freeSetupFileHash(valid_file_hash);
- /* now try to determine valid, dynamically defined config tokens */
+ // now try to determine valid, dynamically defined config tokens
BEGIN_HASH_ITERATION(extra_file_hash, itr)
{
boolean base_prefix_found = FALSE;
boolean parameter_suffix_found = FALSE;
- /* skip all parameter definitions (handled by read_token_parameters()) */
+ // skip all parameter definitions (handled by read_token_parameters())
for (i = 0; i < num_suffix_list_entries && !parameter_suffix_found; i++)
{
int len_suffix = strlen(suffix_list[i].token);
if (parameter_suffix_found)
continue;
- /* ---------- step 0: search for matching base prefix ---------- */
+ // ---------- step 0: search for matching base prefix ----------
start_pos = 0;
for (i = 0; i < num_base_prefixes && !base_prefix_found; i++)
base_index = i;
- if (start_pos + len_base_prefix == len_token) /* exact match */
+ if (start_pos + len_base_prefix == len_token) // exact match
{
exact_match = TRUE;
continue;
}
- /* ---------- step 1: search for matching first suffix ---------- */
+ // ---------- step 1: search for matching first suffix ----------
start_pos += len_base_prefix;
for (j = 0; j < num_ext1_suffixes && !ext1_suffix_found; j++)
ext1_index = j;
- if (start_pos + len_ext1_suffix == len_token) /* exact match */
+ if (start_pos + len_ext1_suffix == len_token) // exact match
{
exact_match = TRUE;
if (exact_match)
break;
- /* ---------- step 2: search for matching second suffix ---------- */
+ // ---------- step 2: search for matching second suffix ----------
for (k = 0; k < num_ext2_suffixes && !ext2_suffix_found; k++)
{
ext2_index = k;
- if (start_pos + len_ext2_suffix == len_token) /* exact match */
+ if (start_pos + len_ext2_suffix == len_token) // exact match
{
exact_match = TRUE;
if (exact_match)
break;
- /* ---------- step 3: search for matching third suffix ---------- */
+ // ---------- step 3: search for matching third suffix ----------
for (l = 0; l < num_ext3_suffixes && !ext3_suffix_found; l++)
{
ext3_index = l;
- if (start_pos + len_ext3_suffix == len_token) /* exact match */
+ if (start_pos + len_ext3_suffix == len_token) // exact match
{
exact_match = TRUE;
boolean unknown_tokens_found = FALSE;
boolean undefined_values_found = (hashtable_count(empty_file_hash) != 0);
- /* list may be NULL for empty artwork config files */
+ // list may be NULL for empty artwork config files
setup_file_list = loadSetupFileList(filename);
BEGIN_HASH_ITERATION(extra_file_hash, itr)
DrawInitText("Loading artwork config", 120, FC_GREEN);
DrawInitText(ARTWORKINFO_FILENAME(artwork_info->type), 150, FC_YELLOW);
- /* always start with reliable default values */
+ // always start with reliable default values
for (i = 0; i < num_file_list_entries; i++)
{
setString(&file_list[i].filename, file_list[i].default_filename);
file_list[i].fallback_to_default = FALSE;
}
- /* free previous dynamic artwork file array */
+ // free previous dynamic artwork file array
if (artwork_info->dynamic_file_list != NULL)
{
for (i = 0; i < artwork_info->num_dynamic_file_list_entries; i++)
&artwork_info->num_dynamic_file_list_entries);
}
- /* free previous property mapping */
+ // free previous property mapping
if (artwork_info->property_mapping != NULL)
{
free(artwork_info->property_mapping);
if (!GFX_OVERRIDE_ARTWORK(artwork_info->type))
{
- /* first look for special artwork configured in level series config */
+ // first look for special artwork configured in level series config
filename_base = getCustomArtworkLevelConfigFilename(artwork_info->type);
if (fileExists(filename_base))
basename = file_list_entry->default_filename;
- /* fail for cloned default artwork that has no default filename defined */
+ // fail for cloned default artwork that has no default filename defined
if (file_list_entry->default_is_cloned &&
strEqual(basename, UNDEFINED_FILENAME))
{
int error_mode = ERR_WARN;
- /* we can get away without sounds and music, but not without graphics */
+ // we can get away without sounds and music, but not without graphics
if (*listnode == NULL && artwork_info->type == ARTWORK_TYPE_GRAPHICS)
error_mode = ERR_EXIT;
return;
}
- /* dynamic artwork has no default filename / skip empty default artwork */
+ // dynamic artwork has no default filename / skip empty default artwork
if (basename == NULL || strEqual(basename, UNDEFINED_FILENAME))
return;
{
int error_mode = ERR_WARN;
- /* we can get away without sounds and music, but not without graphics */
+ // we can get away without sounds and music, but not without graphics
if (*listnode == NULL && artwork_info->type == ARTWORK_TYPE_GRAPHICS)
error_mode = ERR_EXIT;
}
}
- /* check if the old and the new artwork file are the same */
+ // check if the old and the new artwork file are the same
if (*listnode && strEqual((*listnode)->source_filename, filename))
{
/* The old and new artwork are the same (have the same filename and path).
return;
}
- /* delete existing artwork file entry */
+ // delete existing artwork file entry
deleteArtworkListEntry(artwork_info, listnode);
- /* check if the new artwork file already exists in the list of artwork */
+ // check if the new artwork file already exists in the list of artwork
if ((node = getNodeFromKey(artwork_info->content_list, filename)) != NULL)
{
*listnode = (struct ListNodeInfo *)node->content;
if ((*listnode = artwork_info->load_artwork(filename)) != NULL)
{
- /* add new artwork file entry to the list of artwork files */
+ // add new artwork file entry to the list of artwork files
(*listnode)->num_references = 1;
addNodeToList(&artwork_info->content_list, (*listnode)->source_filename,
*listnode);
{
int error_mode = ERR_WARN;
- /* we can get away without sounds and music, but not without graphics */
+ // we can get away without sounds and music, but not without graphics
if (artwork_info->type == ARTWORK_TYPE_GRAPHICS)
error_mode = ERR_EXIT;
}
-/* ------------------------------------------------------------------------- */
-/* functions only needed for non-Unix (non-command-line) systems */
-/* (MS-DOS only; SDL/Windows creates files "stdout.txt" and "stderr.txt") */
-/* (now also added for Windows, to create files in user data directory) */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions only needed for non-Unix (non-command-line) systems
+// (MS-DOS only; SDL/Windows creates files "stdout.txt" and "stderr.txt")
+// (now also added for Windows, to create files in user data directory)
+// ----------------------------------------------------------------------------
char *getLogFilename(char *basename)
{
program.log_filename[i], strerror(errno));
}
- /* output should be unbuffered so it is not truncated in a crash */
+ // output should be unbuffered so it is not truncated in a crash
setbuf(program.log_file[i], NULL);
}
}
}
-/* ------------------------------------------------------------------------- */
-/* the following is only for debugging purpose and normally not used */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// the following is only for debugging purpose and normally not used
+// ----------------------------------------------------------------------------
#if DEBUG
gettimeofday(¤t_time, NULL);
- /* reset base time in case of wrap-around */
+ // reset base time in case of wrap-around
if (current_time.tv_sec < base_time.tv_sec)
base_time = current_time;
((double)(current_time.tv_sec - base_time.tv_sec)) * 1000000 +
((double)(current_time.tv_usec - base_time.tv_usec));
- return counter; /* return microseconds since last init */
+ return counter; // return microseconds since last init
}
#endif
}
#endif
-#endif /* DEBUG */
+#endif // DEBUG
static void print_timestamp_ext(char *message, char *mode)
{
#include "system.h"
-/* values for InitCounter() and Counter() */
+// values for InitCounter() and Counter()
#define INIT_COUNTER 0
#define READ_COUNTER 1
-/* values for InitRND() */
+// values for InitRND()
#define NEW_RANDOMIZE 0
#define RANDOM_ENGINE 0
#define GetEngineRandom(max) get_random_number(RANDOM_ENGINE, max)
#define GetSimpleRandom(max) get_random_number(RANDOM_SIMPLE, max)
-/* values for Error() */
+// values for Error()
#define ERR_UNKNOWN 0
#define ERR_DEBUG (1 << 0)
#define ERR_INFO (1 << 1)
#define ERR_EXIT_NETWORK_SERVER (ERR_EXIT | ERR_NETWORK_SERVER)
#define ERR_EXIT_NETWORK_CLIENT (ERR_EXIT | ERR_NETWORK_CLIENT)
-/* values for getFile...() and putFile...() */
+// values for getFile...() and putFile...()
#define BYTE_ORDER_BIG_ENDIAN 0
#define BYTE_ORDER_LITTLE_ENDIAN 1
-/* values for cursor bitmap creation */
+// values for cursor bitmap creation
#define BIT_ORDER_MSB 0
#define BIT_ORDER_LSB 1
-/* values for createDirectory() */
+// values for createDirectory()
#define PERMS_PRIVATE 0
#define PERMS_PUBLIC 1
-/* values for general file handling stuff */
+// values for general file handling stuff
#define MAX_FILENAME_LEN 256
#define MAX_LINE_LEN 1024
-/* values for general username handling stuff */
+// values for general username handling stuff
#define MAX_USERNAME_LEN 1024
#if defined(PLATFORM_ANDROID)
-/* values for Android asset handling */
+// values for Android asset handling
#define ASSET_TOC_BASENAME ".toc"
#endif
-/* structure definitions */
+// structure definitions
typedef struct
{
} Directory;
-/* function definitions */
+// function definitions
void fprintf_line(FILE *, char *, int);
void fprintf_line_with_prefix(FILE *, char *, char *, int);
void print_timestamp_done(char *);
-#endif /* MISC_H */
+#endif // MISC_H
#ifndef PLATFORM_H
#define PLATFORM_H
-/* ========================================================================= */
-/* define main platform keywords */
-/* ========================================================================= */
+// ============================================================================
+// define main platform keywords
+// ============================================================================
#if defined(WIN32) || defined(_WIN32)
#define PLATFORM_WIN32
#endif
-/* ========================================================================= */
-/* define additional platform keywords */
-/* ========================================================================= */
+// ============================================================================
+// define additional platform keywords
+// ============================================================================
#if defined(_AIX)
#define PLATFORM_AIX
#endif
-/* ========================================================================= */
-/* define additional target keywords */
-/* ========================================================================= */
+// ============================================================================
+// define additional target keywords
+// ============================================================================
#if defined(TARGET_SDL2)
#ifndef TARGET_SDL
#endif
-#endif /* PLATFORM_H */
+#endif // PLATFORM_H
#include "misc.h"
#include "setup.h"
-#define ENABLE_UNUSED_CODE 0 /* currently unused functions */
+#define ENABLE_UNUSED_CODE 0 // currently unused functions
#define DEBUG_JOYSTICKS 0
-/* ========================================================================= */
-/* video functions */
-/* ========================================================================= */
+// ============================================================================
+// video functions
+// ============================================================================
-/* SDL internal variables */
+// SDL internal variables
#if defined(TARGET_SDL2)
static SDL_Window *sdl_window = NULL;
static SDL_Renderer *sdl_renderer = NULL;
static boolean limit_screen_updates = FALSE;
-/* functions from SGE library */
+// functions from SGE library
void sge_Line(SDL_Surface *, Sint16, Sint16, Sint16, Sint16, Uint32);
#if defined(USE_TOUCH_INPUT_OVERLAY)
-/* functions to draw overlay graphics for touch device input */
+// functions to draw overlay graphics for touch device input
static void DrawTouchInputOverlay();
#endif
static void UpdateScreenExt(SDL_Rect *rect, boolean with_frame_delay)
{
static unsigned int update_screen_delay = 0;
- unsigned int update_screen_delay_value = 50; /* (milliseconds) */
+ unsigned int update_screen_delay_value = 50; // (milliseconds)
SDL_Surface *screen = backbuffer->surface;
if (limit_screen_updates &&
return;
}
- /* set transparent color */
+ // set transparent color
SDL_SetColorKey(surface, SET_TRANSPARENT_PIXEL,
SDL_MapRGB(surface->format, 0x00, 0x00, 0x00));
SDL_putenv("SDL_VIDEO_CENTERED=1");
#endif
- /* initialize SDL video */
+ // initialize SDL video
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
Error(ERR_EXIT, "SDL_InitSubSystem() failed: %s", SDL_GetError());
- /* set default SDL depth */
+ // set default SDL depth
#if !defined(TARGET_SDL2)
video.default_depth = SDL_GetVideoInfo()->vfmt->BitsPerPixel;
#else
video.fullscreen_available = FALSE;
#endif
- /* open SDL video output device (window or fullscreen mode) */
+ // open SDL video output device (window or fullscreen mode)
if (!SDLSetVideoMode(fullscreen))
Error(ERR_EXIT, "setting video mode failed");
- /* !!! SDL2 can only set the window icon if the window already exists !!! */
- /* set window icon */
+ // !!! SDL2 can only set the window icon if the window already exists !!!
+ // set window icon
SDLSetWindowIcon(program.icon_filename);
- /* set window and icon title */
+ // set window and icon title
SDLSetWindowTitle();
}
buffer 'window' at the same size as the SDL backbuffer. Although it
should never be drawn to directly, it would do no harm nevertheless. */
- /* create additional (symbolic) buffer for double-buffering */
+ // create additional (symbolic) buffer for double-buffering
ReCreateBitmap(&window, video.width, video.height);
- /* create dummy drawing buffer for headless mode, if needed */
+ // create dummy drawing buffer for headless mode, if needed
if (program.headless)
ReCreateBitmap(&backbuffer, video.width, video.height);
}
if (fullscreen && !video.fullscreen_enabled && video.fullscreen_available)
{
- /* switch display to fullscreen mode, if available */
+ // switch display to fullscreen mode, if available
success = SDLCreateScreen(TRUE);
if (!success)
{
- /* switching display to fullscreen mode failed -- do not try it again */
+ // switching display to fullscreen mode failed -- do not try it again
video.fullscreen_available = FALSE;
}
else
if ((!fullscreen && video.fullscreen_enabled) || !success)
{
- /* switch display to window mode */
+ // switch display to window mode
success = SDLCreateScreen(FALSE);
if (!success)
{
- /* switching display to window mode failed -- should not happen */
+ // switching display to window mode failed -- should not happen
}
else
{
dst_rect.x = dst_x;
dst_rect.y = dst_y;
- dst_rect.w = width; /* (ignored) */
- dst_rect.h = height; /* (ignored) */
+ dst_rect.w = width; // (ignored)
+ dst_rect.h = height; // (ignored)
dst_rect2 = dst_rect;
if (fade_mode & (FADE_TYPE_FADE_IN | FADE_TYPE_TRANSFORM))
SDL_BlitSurface(surface_screen, &dst_rect, surface_backup, &src_rect);
- /* copy source and target surfaces to temporary surfaces for fading */
+ // copy source and target surfaces to temporary surfaces for fading
if (fade_mode & FADE_TYPE_TRANSFORM)
{
// (source and target fading buffer already prepared)
// (target fading buffer already prepared)
SDL_BlitSurface(surface_black, &src_rect, surface_source, &src_rect);
}
- else /* FADE_TYPE_FADE_OUT */
+ else // FADE_TYPE_FADE_OUT
{
// (source fading buffer already prepared)
SDL_BlitSurface(surface_black, &src_rect, surface_target, &src_rect);
SDL_BlitSurface(surface_source, &src_rect, surface_screen, &dst_rect);
- SDLSetAlpha(surface_target, FALSE, 0); /* disable alpha blending */
+ SDLSetAlpha(surface_target, FALSE, 0); // disable alpha blending
ypos[0] = -GetSimpleRandom(16);
for (i = 1 ; i < melt_columns; i++)
{
- int r = GetSimpleRandom(3) - 1; /* randomly choose from { -1, 0, -1 } */
+ int r = GetSimpleRandom(3) - 1; // randomly choose from { -1, 0, -1 }
ypos[i] = ypos[i - 1] + r;
if (ypos[i] + dy >= height)
dy = height - ypos[i];
- /* copy part of (appearing) target surface to upper area */
+ // copy part of (appearing) target surface to upper area
src_rect.x = src_x + i * melt_pixels;
// src_rect.y = src_y + ypos[i];
src_rect.y = src_y;
ypos[i] += dy;
- /* copy part of (disappearing) source surface to lower area */
+ // copy part of (disappearing) source surface to lower area
src_rect.x = src_x + i * melt_pixels;
src_rect.y = src_y;
src_rect.w = melt_pixels;
SDL_BlitSurface(surface_target, &src_rect, surface_screen, &dst_rect);
- SDLSetAlpha(surface_source, FALSE, 0); /* disable alpha blending */
+ SDLSetAlpha(surface_source, FALSE, 0); // disable alpha blending
for (xx = 0; xx < xx_size;)
{
dst_rect.x = dst_x;
dst_rect.y = dst_y;
- /* draw new (target) image to screen buffer */
+ // draw new (target) image to screen buffer
SDL_BlitSurface(surface_target, &src_rect, surface_screen, &dst_rect);
if (xx_final < xx_size)
src_rect.w = xx_size - xx_final;
src_rect.h = height;
- /* draw old (source) image to screen buffer (left side) */
+ // draw old (source) image to screen buffer (left side)
src_rect.x = src_x + xx_final;
dst_rect.x = dst_x;
SDL_BlitSurface(surface_source, &src_rect, surface_screen, &dst_rect);
- /* draw old (source) image to screen buffer (right side) */
+ // draw old (source) image to screen buffer (right side)
src_rect.x = src_x + xx_size;
dst_rect.x = dst_x + xx_size + xx_final;
if (draw_border_function != NULL)
draw_border_function();
- /* only update the region of the screen that is affected from fading */
+ // only update the region of the screen that is affected from fading
UpdateScreen_WithFrameDelay(&dst_rect2);
}
}
- else /* fading in, fading out or cross-fading */
+ else // fading in, fading out or cross-fading
{
float alpha;
int alpha_final;
alpha += 255 * ((float)(time_current - time_last) / fade_delay);
alpha_final = MIN(MAX(0, alpha), 255);
- /* draw existing (source) image to screen buffer */
+ // draw existing (source) image to screen buffer
SDL_BlitSurface(surface_source, &src_rect, surface_screen, &dst_rect);
- /* draw new (target) image to screen buffer using alpha blending */
+ // draw new (target) image to screen buffer using alpha blending
SDLSetAlpha(surface_target, TRUE, alpha_final);
SDL_BlitSurface(surface_target, &src_rect, surface_screen, &dst_rect);
if (draw_border_function != NULL)
draw_border_function();
- /* only update the region of the screen that is affected from fading */
+ // only update the region of the screen that is affected from fading
UpdateScreen_WithFrameDelay(&dst_rect);
}
}
switch (surface->format->BytesPerPixel)
{
- case 1: /* assuming 8-bpp */
+ case 1: // assuming 8-bpp
{
return *((Uint8 *)surface->pixels + y * surface->pitch + x);
}
break;
- case 2: /* probably 15-bpp or 16-bpp */
+ case 2: // probably 15-bpp or 16-bpp
{
return *((Uint16 *)surface->pixels + y * surface->pitch / 2 + x);
}
break;
- case 3: /* slow 24-bpp mode; usually not used */
+ case 3: // slow 24-bpp mode; usually not used
{
- /* does this work? */
+ // does this work?
Uint8 *pix = (Uint8 *)surface->pixels + y * surface->pitch + x * 3;
Uint32 color = 0;
int shift;
}
break;
- case 4: /* probably 32-bpp */
+ case 4: // probably 32-bpp
{
return *((Uint32 *)surface->pixels + y * surface->pitch / 4 + x);
}
}
-/* ========================================================================= */
-/* The following functions were taken from the SGE library */
-/* (SDL Graphics Extension Library) by Anders Lindström */
-/* http://www.etek.chalmers.se/~e8cal1/sge/index.html */
-/* ========================================================================= */
+// ============================================================================
+// The following functions were taken from the SGE library
+// (SDL Graphics Extension Library) by Anders Lindström
+// http://www.etek.chalmers.se/~e8cal1/sge/index.html
+// ============================================================================
static void _PutPixel(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color)
{
{
case 1:
{
- /* Assuming 8-bpp */
+ // Assuming 8-bpp
*((Uint8 *)surface->pixels + y*surface->pitch + x) = color;
}
break;
case 2:
{
- /* Probably 15-bpp or 16-bpp */
+ // Probably 15-bpp or 16-bpp
*((Uint16 *)surface->pixels + y*surface->pitch/2 + x) = color;
}
break;
case 3:
{
- /* Slow 24-bpp mode, usually not used */
+ // Slow 24-bpp mode, usually not used
Uint8 *pix;
int shift;
- /* Gack - slow, but endian correct */
+ // Gack - slow, but endian correct
pix = (Uint8 *)surface->pixels + y * surface->pitch + x*3;
shift = surface->format->Rshift;
*(pix+shift/8) = color>>shift;
case 4:
{
- /* Probably 32-bpp */
+ // Probably 32-bpp
*((Uint32 *)surface->pixels + y*surface->pitch/4 + x) = color;
}
break;
Uint8 *pix;
int shift;
- /* Gack - slow, but endian correct */
+ // Gack - slow, but endian correct
pix = (Uint8 *)surface->pixels + y * surface->pitch + x*3;
shift = surface->format->Rshift;
*(pix+shift/8) = color>>shift;
{
case 1:
{
- /* Assuming 8-bpp */
+ // Assuming 8-bpp
*((Uint8 *)surface->pixels + ypitch + x) = color;
}
break;
case 2:
{
- /* Probably 15-bpp or 16-bpp */
+ // Probably 15-bpp or 16-bpp
*((Uint16 *)surface->pixels + ypitch + x) = color;
}
break;
case 3:
{
- /* Slow 24-bpp mode, usually not used */
+ // Slow 24-bpp mode, usually not used
Uint8 *pix;
int shift;
- /* Gack - slow, but endian correct */
+ // Gack - slow, but endian correct
pix = (Uint8 *)surface->pixels + ypitch + x*3;
shift = surface->format->Rshift;
*(pix+shift/8) = color>>shift;
case 4:
{
- /* Probably 32-bpp */
+ // Probably 32-bpp
*((Uint32 *)surface->pixels + ypitch + x) = color;
}
break;
x2 = tmp;
}
- /* Do the clipping */
+ // Do the clipping
if (y < 0 || y > Surface->h - 1 || x1 > Surface->w - 1 || x2 < 0)
return;
if (x1 < 0)
x2 = tmp;
}
- /* Do the clipping */
+ // Do the clipping
if (y < 0 || y > Surface->h - 1 || x1 > Surface->w - 1 || x2 < 0)
return;
if (x1 < 0)
y2 = tmp;
}
- /* Do the clipping */
+ // Do the clipping
if (x < 0 || x > Surface->w - 1 || y1 > Surface->h - 1 || y2 < 0)
return;
if (y1 < 0)
y2 = tmp;
}
- /* Do the clipping */
+ // Do the clipping
if (x < 0 || x > Surface->w - 1 || y1 > Surface->h - 1 || y2 < 0)
return;
if (y1 < 0)
return;
}
- /* Draw the line */
+ // Draw the line
sge_DoLine(Surface, x1, y1, x2, y2, Color, _PutPixel);
- /* unlock the display */
+ // unlock the display
if (SDL_MUSTLOCK(Surface))
{
SDL_UnlockSurface(Surface);
}
-/* ========================================================================= */
-/* The following functions were taken from the SDL_gfx library version 2.0.3 */
-/* (Rotozoomer) by Andreas Schiffler */
-/* http://www.ferzkopp.net/Software/SDL_gfx-2.0/index.html */
-/* ========================================================================= */
+// ============================================================================
+// The following functions were taken from the SDL_gfx library version 2.0.3
+// (Rotozoomer) by Andreas Schiffler
+// http://www.ferzkopp.net/Software/SDL_gfx-2.0/index.html
+// ============================================================================
/*
-----------------------------------------------------------------------------
tColorRGBA *sp, *csp, *dp;
int dgap;
- /* pointer setup */
+ // pointer setup
sp = csp = (tColorRGBA *) src->pixels;
dp = (tColorRGBA *) dst->pixels;
dgap = dst->pitch - dst->w * 4;
tColorRGBA *sp11 = &sp1[1];
tColorRGBA new;
- /* create new color pixel from all four source color pixels */
+ // create new color pixel from all four source color pixels
new.r = (sp00->r + sp01->r + sp10->r + sp11->r) / 4;
new.g = (sp00->g + sp01->g + sp10->g + sp11->g) / 4;
new.b = (sp00->b + sp01->b + sp10->b + sp11->b) / 4;
new.a = (sp00->a + sp01->a + sp10->a + sp11->a) / 4;
- /* draw */
+ // draw
*dp = new;
- /* advance source pointers */
+ // advance source pointers
sp += 2;
- /* advance destination pointer */
+ // advance destination pointer
dp++;
}
- /* advance source pointer */
+ // advance source pointer
csp = (tColorRGBA *) ((Uint8 *) csp + 2 * src->pitch);
- /* advance destination pointers */
+ // advance destination pointers
dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
}
tColorRGBA *sp, *csp, *csp0, *dp;
int dgap;
- /* use specialized zoom function when scaling down to exactly half size */
+ // use specialized zoom function when scaling down to exactly half size
if (src->w == 2 * dst->w &&
src->h == 2 * dst->h)
return zoomSurfaceRGBA_scaleDownBy2(src, dst);
- /* variable setup */
+ // variable setup
sx = (float) src->w / (float) dst->w;
sy = (float) src->h / (float) dst->h;
- /* allocate memory for row increments */
+ // allocate memory for row increments
csax = sax = (int *)checked_malloc((dst->w + 1) * sizeof(Uint32));
csay = say = (int *)checked_malloc((dst->h + 1) * sizeof(Uint32));
- /* precalculate row increments */
+ // precalculate row increments
for (x = 0; x <= dst->w; x++)
*csax++ = (int)(sx * x);
for (y = 0; y <= dst->h; y++)
*csay++ = (int)(sy * y);
- /* pointer setup */
+ // pointer setup
sp = csp = csp0 = (tColorRGBA *) src->pixels;
dp = (tColorRGBA *) dst->pixels;
dgap = dst->pitch - dst->w * 4;
for (x = 0; x < dst->w; x++)
{
- /* draw */
+ // draw
*dp = *sp;
- /* advance source pointers */
+ // advance source pointers
csax++;
sp = csp + *csax;
- /* advance destination pointer */
+ // advance destination pointer
dp++;
}
- /* advance source pointer */
+ // advance source pointer
csay++;
csp = (tColorRGBA *) ((Uint8 *) csp0 + *csay * src->pitch);
- /* advance destination pointers */
+ // advance destination pointers
dp = (tColorRGBA *) ((Uint8 *) dp + dgap);
}
Uint8 *sp, *dp, *csp;
int dgap;
- /* variable setup */
+ // variable setup
sx = (Uint32) (65536.0 * (float) src->w / (float) dst->w);
sy = (Uint32) (65536.0 * (float) src->h / (float) dst->h);
- /* allocate memory for row increments */
+ // allocate memory for row increments
sax = (Uint32 *)checked_malloc(dst->w * sizeof(Uint32));
say = (Uint32 *)checked_malloc(dst->h * sizeof(Uint32));
- /* precalculate row increments */
+ // precalculate row increments
csx = 0;
csax = sax;
for (x = 0; x < dst->w; x++)
csay++;
}
- /* pointer setup */
+ // pointer setup
sp = csp = (Uint8 *) src->pixels;
dp = (Uint8 *) dst->pixels;
dgap = dst->pitch - dst->w;
- /* draw */
+ // draw
csay = say;
for (y = 0; y < dst->h; y++)
{
sp = csp;
for (x = 0; x < dst->w; x++)
{
- /* draw */
+ // draw
*dp = *sp;
- /* advance source pointers */
+ // advance source pointers
sp += (*csax);
csax++;
- /* advance destination pointer */
+ // advance destination pointer
dp++;
}
- /* advance source pointer (for row) */
+ // advance source pointer (for row)
csp += ((*csay) * src->pitch);
csay++;
- /* advance destination pointers */
+ // advance destination pointers
dp += dgap;
}
if (src == NULL)
return NULL;
- /* determine if source surface is 32 bit or 8 bit */
+ // determine if source surface is 32 bit or 8 bit
is_32bit = (src->format->BitsPerPixel == 32);
if (is_32bit || src->format->BitsPerPixel == 8)
{
- /* use source surface 'as is' */
+ // use source surface 'as is'
zoom_src = src;
}
else
{
- /* new source surface is 32 bit with a defined RGB ordering */
+ // new source surface is 32 bit with a defined RGB ordering
zoom_src = SDL_CreateRGBSurface(SURFACE_FLAGS, src->w, src->h, 32,
0x000000ff, 0x0000ff00, 0x00ff0000,
(src->format->Amask ? 0xff000000 : 0));
is_converted = TRUE;
}
- /* allocate surface to completely contain the zoomed surface */
+ // allocate surface to completely contain the zoomed surface
if (is_32bit)
{
- /* target surface is 32 bit with source RGBA/ABGR ordering */
+ // target surface is 32 bit with source RGBA/ABGR ordering
zoom_dst = SDL_CreateRGBSurface(SURFACE_FLAGS, dst_width, dst_height, 32,
zoom_src->format->Rmask,
zoom_src->format->Gmask,
}
else
{
- /* target surface is 8 bit */
+ // target surface is 8 bit
zoom_dst = SDL_CreateRGBSurface(SURFACE_FLAGS, dst_width, dst_height, 8,
0, 0, 0, 0);
}
- /* lock source surface */
+ // lock source surface
SDL_LockSurface(zoom_src);
- /* check which kind of surface we have */
+ // check which kind of surface we have
if (is_32bit)
{
- /* call the 32 bit transformation routine to do the zooming */
+ // call the 32 bit transformation routine to do the zooming
zoomSurfaceRGBA(zoom_src, zoom_dst);
}
else
{
- /* copy palette */
+ // copy palette
for (i = 0; i < zoom_src->format->palette->ncolors; i++)
zoom_dst->format->palette->colors[i] =
zoom_src->format->palette->colors[i];
zoom_dst->format->palette->ncolors = zoom_src->format->palette->ncolors;
- /* call the 8 bit transformation routine to do the zooming */
+ // call the 8 bit transformation routine to do the zooming
zoomSurfaceY(zoom_src, zoom_dst);
}
- /* unlock source surface */
+ // unlock source surface
SDL_UnlockSurface(zoom_src);
- /* free temporary surface */
+ // free temporary surface
if (is_converted)
SDL_FreeSurface(zoom_src);
- /* return destination surface */
+ // return destination surface
return zoom_dst;
}
if ((new_surface = SDLGetNativeSurface(surface)) == NULL)
Error(ERR_EXIT, "SDLGetNativeSurface() failed");
- /* remove alpha channel from native non-transparent surface, if defined */
+ // remove alpha channel from native non-transparent surface, if defined
SDLSetAlpha(new_surface, FALSE, 0);
- /* remove transparent color from native non-transparent surface, if defined */
+ // remove transparent color from native non-transparent surface, if defined
SDL_SetColorKey(new_surface, UNSET_TRANSPARENT_PIXEL, 0);
return new_surface;
SDL_Surface *src_surface = src_bitmap->surface_masked;
SDL_Surface *dst_surface;
- dst_width = MAX(1, dst_width); /* prevent zero bitmap width */
- dst_height = MAX(1, dst_height); /* prevent zero bitmap height */
+ dst_width = MAX(1, dst_width); // prevent zero bitmap width
+ dst_height = MAX(1, dst_height); // prevent zero bitmap height
dst_bitmap->width = dst_width;
dst_bitmap->height = dst_height;
- /* create zoomed temporary surface from source surface */
+ // create zoomed temporary surface from source surface
dst_surface = zoomSurface(src_surface, dst_width, dst_height);
- /* create native format destination surface from zoomed temporary surface */
+ // create native format destination surface from zoomed temporary surface
SDLSetNativeSurface(&dst_surface);
- /* set color key for zoomed surface from source surface, if defined */
+ // set color key for zoomed surface from source surface, if defined
if (SDLHasColorKey(src_surface))
SDL_SetColorKey(dst_surface, SET_TRANSPARENT_PIXEL,
SDLGetColorKey(src_surface));
- /* create native non-transparent surface for opaque blitting */
+ // create native non-transparent surface for opaque blitting
dst_bitmap->surface = SDLGetOpaqueSurface(dst_surface);
- /* set native transparent surface for masked blitting */
+ // set native transparent surface for masked blitting
dst_bitmap->surface_masked = dst_surface;
return dst_bitmap;
}
-/* ========================================================================= */
-/* load image to bitmap */
-/* ========================================================================= */
+// ============================================================================
+// load image to bitmap
+// ============================================================================
Bitmap *SDLLoadImage(char *filename)
{
if (program.headless)
{
- /* prevent sanity check warnings at later stage */
+ // prevent sanity check warnings at later stage
new_bitmap->width = new_bitmap->height = 1;
return new_bitmap;
print_timestamp_time(getBaseNamePtr(filename));
- /* load image to temporary surface */
+ // load image to temporary surface
if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError());
UPDATE_BUSY_STATE();
- /* create native non-transparent surface for current image */
+ // create native non-transparent surface for current image
if ((new_bitmap->surface = SDLGetOpaqueSurface(sdl_image_tmp)) == NULL)
Error(ERR_EXIT, "SDLGetOpaqueSurface() failed");
UPDATE_BUSY_STATE();
- /* set black pixel to transparent if no alpha channel / transparent color */
+ // set black pixel to transparent if no alpha channel / transparent color
if (!SDLHasAlpha(sdl_image_tmp) &&
!SDLHasColorKey(sdl_image_tmp))
SDL_SetColorKey(sdl_image_tmp, SET_TRANSPARENT_PIXEL,
SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
- /* create native transparent surface for current image */
+ // create native transparent surface for current image
if ((new_bitmap->surface_masked = SDLGetNativeSurface(sdl_image_tmp)) == NULL)
Error(ERR_EXIT, "SDLGetNativeSurface() failed");
UPDATE_BUSY_STATE();
- /* free temporary surface */
+ // free temporary surface
SDL_FreeSurface(sdl_image_tmp);
new_bitmap->width = new_bitmap->surface->w;
}
-/* ------------------------------------------------------------------------- */
-/* custom cursor fuctions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// custom cursor fuctions
+// ----------------------------------------------------------------------------
static SDL_Cursor *create_cursor(struct MouseCursorInfo *cursor_info)
{
static SDL_Cursor *cursor_default = NULL;
static SDL_Cursor *cursor_current = NULL;
- /* if invoked for the first time, store the SDL default cursor */
+ // if invoked for the first time, store the SDL default cursor
if (cursor_default == NULL)
cursor_default = SDL_GetCursor();
- /* only create new cursor if cursor info (custom only) has changed */
+ // only create new cursor if cursor info (custom only) has changed
if (cursor_info != NULL && cursor_info != last_cursor_info)
{
cursor_current = create_cursor(cursor_info);
last_cursor_info = cursor_info;
}
- /* only set new cursor if cursor info (custom or NULL) has changed */
+ // only set new cursor if cursor info (custom or NULL) has changed
if (cursor_info != last_cursor_info2)
SDL_SetCursor(cursor_info ? cursor_current : cursor_default);
}
-/* ========================================================================= */
-/* audio functions */
-/* ========================================================================= */
+// ============================================================================
+// audio functions
+// ============================================================================
void SDLOpenAudio(void)
{
audio.loops_available = TRUE;
audio.sound_enabled = TRUE;
- /* set number of available mixer channels */
+ // set number of available mixer channels
audio.num_channels = Mix_AllocateChannels(NUM_MIXER_CHANNELS);
audio.music_channel = MUSIC_CHANNEL;
audio.first_sound_channel = FIRST_SOUND_CHANNEL;
}
-/* ========================================================================= */
-/* event functions */
-/* ========================================================================= */
+// ============================================================================
+// event functions
+// ============================================================================
void SDLWaitEvent(Event *event)
{
}
-/* ========================================================================= */
-/* joystick functions */
-/* ========================================================================= */
+// ============================================================================
+// joystick functions
+// ============================================================================
#if defined(TARGET_SDL2)
static void *sdl_joystick[MAX_PLAYERS]; // game controller or joystick
#if defined(TARGET_SDL2)
num_mappings = SDL_GameControllerAddMappingsFromFile(mappings_file_base);
- /* the included game controller base mappings should always be found */
+ // the included game controller base mappings should always be found
if (num_mappings == -1)
Error(ERR_WARN, "no game controller base mappings found");
#if DEBUG_JOYSTICKS
num_mappings = SDL_GameControllerAddMappingsFromFile(mappings_file_user);
#if DEBUG_JOYSTICKS
- /* the personal game controller user mappings may or may not be found */
+ // the personal game controller user mappings may or may not be found
if (num_mappings == -1)
Error(ERR_WARN, "no game controller user mappings found");
else
#endif
}
- /* assign joysticks from configured to connected joystick for all players */
+ // assign joysticks from configured to connected joystick for all players
for (i = 0; i < MAX_PLAYERS; i++)
{
- /* get configured joystick for this player */
+ // get configured joystick for this player
char *device_name = setup.input[i].joy.device_name;
int joystick_nr = getJoystickNrFromDeviceName(device_name);
joystick_nr = -1;
}
- /* store configured joystick number for each player */
+ // store configured joystick number for each player
joystick.nr[i] = joystick_nr;
}
- /* now open all connected joysticks (regardless if configured or not) */
+ // now open all connected joysticks (regardless if configured or not)
for (i = 0; i < SDL_NumJoysticks(); i++)
{
- /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
+ // this allows subsequent calls to 'InitJoysticks' for re-initialization
if (SDLCheckJoystickOpened(i))
SDLCloseJoystick(i);
}
-/* ========================================================================= */
-/* touch input overlay functions */
-/* ========================================================================= */
+// ============================================================================
+// touch input overlay functions
+// ============================================================================
#if defined(USE_TOUCH_INPUT_OVERLAY)
static void DrawTouchInputOverlay_ShowGrid(int alpha)
width = surface->w;
height = surface->h;
- /* set black pixel to transparent if no alpha channel / transparent color */
+ // set black pixel to transparent if no alpha channel / transparent color
if (!SDLHasAlpha(surface) &&
!SDLHasColorKey(surface))
SDL_SetColorKey(surface, SET_TRANSPARENT_PIXEL,
#include <SDL_syswm.h>
#endif
-/* definitions needed for "system.c" */
+// definitions needed for "system.c"
#if defined(TARGET_SDL2)
#define SURFACE_FLAGS (0)
#define UNSET_TRANSPARENT_PIXEL (0)
#endif
-/* system dependent definitions */
+// system dependent definitions
#if defined(TARGET_SDL2)
#define TARGET_STRING "SDL2"
#define CURSOR_MAX_HEIGHT 32
-/* SDL type definitions */
+// SDL type definitions
typedef struct SDLSurfaceInfo Bitmap;
typedef struct SDLSurfaceInfo DrawBuffer;
typedef SDL_Event ClientMessageEvent;
-/* structure definitions */
+// structure definitions
struct SDLSurfaceInfo
{
};
-/* SDL symbol definitions */
+// SDL symbol definitions
#define None 0L
#if defined(TARGET_SDL2)
#define KSYM_percent SDLK_PERCENT
#else
-#define KSYM_percent 37 /* undefined in SDL */
+#define KSYM_percent 37 // undefined in SDL
#endif
#define KSYM_ampersand SDLK_AMPERSAND
#define KSYM_underscore SDLK_UNDERSCORE
#define KSYM_grave SDLK_BACKQUOTE
-#define KSYM_quoteleft KSYM_UNDEFINED /* undefined */
-#define KSYM_braceleft KSYM_UNDEFINED /* undefined */
-#define KSYM_bar KSYM_UNDEFINED /* undefined */
-#define KSYM_braceright KSYM_UNDEFINED /* undefined */
-#define KSYM_asciitilde KSYM_UNDEFINED /* undefined */
+#define KSYM_quoteleft KSYM_UNDEFINED // undefined
+#define KSYM_braceleft KSYM_UNDEFINED // undefined
+#define KSYM_bar KSYM_UNDEFINED // undefined
+#define KSYM_braceright KSYM_UNDEFINED // undefined
+#define KSYM_asciitilde KSYM_UNDEFINED // undefined
#if defined(TARGET_SDL2)
#define KSYM_degree 176
#define KMOD_Meta (KMOD_Meta_L | KMOD_Meta_R)
#define KMOD_Alt (KMOD_Alt_L | KMOD_Alt_R)
-/* this only contains "valid" key modifiers (and ignores keys like "NumLock") */
+// this only contains "valid" key modifiers (and ignores keys like "NumLock")
#define KMOD_Valid (KMOD_Shift | \
KMOD_Control | \
KMOD_Meta | \
#define KMOD_TextInput (KMOD_Shift | KMOD_Alt_R)
#endif
-/* SDL function definitions */
+// SDL function definitions
boolean SDLSetNativeSurface(SDL_Surface **);
SDL_Surface *SDLGetNativeSurface(SDL_Surface *);
void Delay_WithScreenUpdates(unsigned int);
-#endif /* SDL_H */
+#endif // SDL_H
#include "hash.h"
-#define ENABLE_UNUSED_CODE FALSE /* for currently unused functions */
-#define DEBUG_NO_CONFIG_FILE FALSE /* for extra-verbose debug output */
+#define ENABLE_UNUSED_CODE FALSE // for currently unused functions
+#define DEBUG_NO_CONFIG_FILE FALSE // for extra-verbose debug output
#define NUM_LEVELCLASS_DESC 8
static boolean use_artworkinfo_cache = TRUE;
-/* ------------------------------------------------------------------------- */
-/* file functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// file functions
+// ----------------------------------------------------------------------------
static char *getLevelClassDescription(TreeInfo *ti)
{
char *getProgramMainDataPath(char *command_filename, char *base_path)
{
- /* check if the program's main data base directory is configured */
+ // check if the program's main data base directory is configured
if (!strEqual(base_path, "."))
return base_path;
sprintf(basename, "%03d.%s", nr, SCOREFILE_EXTENSION);
- /* used instead of "leveldir_current->subdir" (for network games) */
+ // used instead of "leveldir_current->subdir" (for network games)
filename = getPath2(getScoreDir(levelset.identifier), basename);
return filename;
if (!gfx.override_level_graphics)
{
- /* 1st try: look for special artwork in current level series directory */
+ // 1st try: look for special artwork in current level series directory
filename = getPath3(getCurrentLevelDir(), GRAPHICS_DIRECTORY, basename);
if (fileExists(filename))
return filename;
free(filename);
- /* 2nd try: look for message file in current level set directory */
+ // 2nd try: look for message file in current level set directory
filename = getPath2(getCurrentLevelDir(), basename);
if (fileExists(filename))
return filename;
free(filename);
- /* check if there is special artwork configured in level series config */
+ // check if there is special artwork configured in level series config
if (getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS) != NULL)
{
- /* 3rd try: look for special artwork configured in level series config */
+ // 3rd try: look for special artwork configured in level series config
filename = getPath2(getLevelArtworkDir(ARTWORK_TYPE_GRAPHICS), basename);
if (fileExists(filename))
return filename;
free(filename);
- /* take missing artwork configured in level set config from default */
+ // take missing artwork configured in level set config from default
skip_setup_artwork = TRUE;
}
}
if (!skip_setup_artwork)
{
- /* 4th try: look for special artwork in configured artwork directory */
+ // 4th try: look for special artwork in configured artwork directory
filename = getPath2(getSetupArtworkDir(artwork.gfx_current), basename);
if (fileExists(filename))
return filename;
free(filename);
}
- /* 5th try: look for default artwork in new default artwork directory */
+ // 5th try: look for default artwork in new default artwork directory
filename = getPath2(getDefaultGraphicsDir(GFX_DEFAULT_SUBDIR), basename);
if (fileExists(filename))
return filename;
free(filename);
- /* 6th try: look for default artwork in old default artwork directory */
+ // 6th try: look for default artwork in old default artwork directory
filename = getPath2(options.graphics_directory, basename);
if (fileExists(filename))
return filename;
- return NULL; /* cannot find specified artwork file anywhere */
+ return NULL; // cannot find specified artwork file anywhere
}
static char *getCorrectedArtworkBasename(char *basename)
if (!gfx.override_level_graphics)
{
- /* 1st try: look for special artwork in current level series directory */
+ // 1st try: look for special artwork in current level series directory
filename = getImg3(getCurrentLevelDir(), GRAPHICS_DIRECTORY, basename);
if (fileExists(filename))
return filename;
free(filename);
- /* check if there is special artwork configured in level series config */
+ // check if there is special artwork configured in level series config
if (getLevelArtworkSet(ARTWORK_TYPE_GRAPHICS) != NULL)
{
- /* 2nd try: look for special artwork configured in level series config */
+ // 2nd try: look for special artwork configured in level series config
filename = getImg2(getLevelArtworkDir(ARTWORK_TYPE_GRAPHICS), basename);
if (fileExists(filename))
return filename;
free(filename);
- /* take missing artwork configured in level set config from default */
+ // take missing artwork configured in level set config from default
skip_setup_artwork = TRUE;
}
}
if (!skip_setup_artwork)
{
- /* 3rd try: look for special artwork in configured artwork directory */
+ // 3rd try: look for special artwork in configured artwork directory
filename = getImg2(getSetupArtworkDir(artwork.gfx_current), basename);
if (fileExists(filename))
return filename;
free(filename);
}
- /* 4th try: look for default artwork in new default artwork directory */
+ // 4th try: look for default artwork in new default artwork directory
filename = getImg2(getDefaultGraphicsDir(GFX_DEFAULT_SUBDIR), basename);
if (fileExists(filename))
return filename;
free(filename);
- /* 5th try: look for default artwork in old default artwork directory */
+ // 5th try: look for default artwork in old default artwork directory
filename = getImg2(options.graphics_directory, basename);
if (fileExists(filename))
return filename;
Error(ERR_WARN, "cannot find artwork file '%s' (using fallback)",
basename);
- /* 6th try: look for fallback artwork in old default artwork directory */
- /* (needed to prevent errors when trying to access unused artwork files) */
+ // 6th try: look for fallback artwork in old default artwork directory
+ // (needed to prevent errors when trying to access unused artwork files)
filename = getImg2(options.graphics_directory, GFX_FALLBACK_FILENAME);
if (fileExists(filename))
return filename;
}
- return NULL; /* cannot find specified artwork file anywhere */
+ return NULL; // cannot find specified artwork file anywhere
}
char *getCustomSoundFilename(char *basename)
if (!gfx.override_level_sounds)
{
- /* 1st try: look for special artwork in current level series directory */
+ // 1st try: look for special artwork in current level series directory
filename = getPath3(getCurrentLevelDir(), SOUNDS_DIRECTORY, basename);
if (fileExists(filename))
return filename;
free(filename);
- /* check if there is special artwork configured in level series config */
+ // check if there is special artwork configured in level series config
if (getLevelArtworkSet(ARTWORK_TYPE_SOUNDS) != NULL)
{
- /* 2nd try: look for special artwork configured in level series config */
+ // 2nd try: look for special artwork configured in level series config
filename = getPath2(getLevelArtworkDir(TREE_TYPE_SOUNDS_DIR), basename);
if (fileExists(filename))
return filename;
free(filename);
- /* take missing artwork configured in level set config from default */
+ // take missing artwork configured in level set config from default
skip_setup_artwork = TRUE;
}
}
if (!skip_setup_artwork)
{
- /* 3rd try: look for special artwork in configured artwork directory */
+ // 3rd try: look for special artwork in configured artwork directory
filename = getPath2(getSetupArtworkDir(artwork.snd_current), basename);
if (fileExists(filename))
return filename;
free(filename);
}
- /* 4th try: look for default artwork in new default artwork directory */
+ // 4th try: look for default artwork in new default artwork directory
filename = getPath2(getDefaultSoundsDir(SND_DEFAULT_SUBDIR), basename);
if (fileExists(filename))
return filename;
free(filename);
- /* 5th try: look for default artwork in old default artwork directory */
+ // 5th try: look for default artwork in old default artwork directory
filename = getPath2(options.sounds_directory, basename);
if (fileExists(filename))
return filename;
Error(ERR_WARN, "cannot find artwork file '%s' (using fallback)",
basename);
- /* 6th try: look for fallback artwork in old default artwork directory */
- /* (needed to prevent errors when trying to access unused artwork files) */
+ // 6th try: look for fallback artwork in old default artwork directory
+ // (needed to prevent errors when trying to access unused artwork files)
filename = getPath2(options.sounds_directory, SND_FALLBACK_FILENAME);
if (fileExists(filename))
return filename;
}
- return NULL; /* cannot find specified artwork file anywhere */
+ return NULL; // cannot find specified artwork file anywhere
}
char *getCustomMusicFilename(char *basename)
if (!gfx.override_level_music)
{
- /* 1st try: look for special artwork in current level series directory */
+ // 1st try: look for special artwork in current level series directory
filename = getPath3(getCurrentLevelDir(), MUSIC_DIRECTORY, basename);
if (fileExists(filename))
return filename;
free(filename);
- /* check if there is special artwork configured in level series config */
+ // check if there is special artwork configured in level series config
if (getLevelArtworkSet(ARTWORK_TYPE_MUSIC) != NULL)
{
- /* 2nd try: look for special artwork configured in level series config */
+ // 2nd try: look for special artwork configured in level series config
filename = getPath2(getLevelArtworkDir(TREE_TYPE_MUSIC_DIR), basename);
if (fileExists(filename))
return filename;
free(filename);
- /* take missing artwork configured in level set config from default */
+ // take missing artwork configured in level set config from default
skip_setup_artwork = TRUE;
}
}
if (!skip_setup_artwork)
{
- /* 3rd try: look for special artwork in configured artwork directory */
+ // 3rd try: look for special artwork in configured artwork directory
filename = getPath2(getSetupArtworkDir(artwork.mus_current), basename);
if (fileExists(filename))
return filename;
free(filename);
}
- /* 4th try: look for default artwork in new default artwork directory */
+ // 4th try: look for default artwork in new default artwork directory
filename = getPath2(getDefaultMusicDir(MUS_DEFAULT_SUBDIR), basename);
if (fileExists(filename))
return filename;
free(filename);
- /* 5th try: look for default artwork in old default artwork directory */
+ // 5th try: look for default artwork in old default artwork directory
filename = getPath2(options.music_directory, basename);
if (fileExists(filename))
return filename;
Error(ERR_WARN, "cannot find artwork file '%s' (using fallback)",
basename);
- /* 6th try: look for fallback artwork in old default artwork directory */
- /* (needed to prevent errors when trying to access unused artwork files) */
+ // 6th try: look for fallback artwork in old default artwork directory
+ // (needed to prevent errors when trying to access unused artwork files)
filename = getPath2(options.music_directory, MUS_FALLBACK_FILENAME);
if (fileExists(filename))
return filename;
}
- return NULL; /* cannot find specified artwork file anywhere */
+ return NULL; // cannot find specified artwork file anywhere
}
char *getCustomArtworkFilename(char *basename, int type)
if (!gfx.override_level_music)
{
- /* 1st try: look for special artwork in current level series directory */
+ // 1st try: look for special artwork in current level series directory
directory = getPath2(getCurrentLevelDir(), MUSIC_DIRECTORY);
if (directoryExists(directory))
return directory;
free(directory);
- /* check if there is special artwork configured in level series config */
+ // check if there is special artwork configured in level series config
if (getLevelArtworkSet(ARTWORK_TYPE_MUSIC) != NULL)
{
- /* 2nd try: look for special artwork configured in level series config */
+ // 2nd try: look for special artwork configured in level series config
directory = getStringCopy(getLevelArtworkDir(TREE_TYPE_MUSIC_DIR));
if (directoryExists(directory))
return directory;
free(directory);
- /* take missing artwork configured in level set config from default */
+ // take missing artwork configured in level set config from default
skip_setup_artwork = TRUE;
}
}
if (!skip_setup_artwork)
{
- /* 3rd try: look for special artwork in configured artwork directory */
+ // 3rd try: look for special artwork in configured artwork directory
directory = getStringCopy(getSetupArtworkDir(artwork.mus_current));
if (directoryExists(directory))
return directory;
free(directory);
}
- /* 4th try: look for default artwork in new default artwork directory */
+ // 4th try: look for default artwork in new default artwork directory
directory = getStringCopy(getDefaultMusicDir(MUS_DEFAULT_SUBDIR));
if (directoryExists(directory))
return directory;
free(directory);
- /* 5th try: look for default artwork in old default artwork directory */
+ // 5th try: look for default artwork in old default artwork directory
directory = getStringCopy(options.music_directory);
if (directoryExists(directory))
return directory;
- return NULL; /* cannot find specified artwork file anywhere */
+ return NULL; // cannot find specified artwork file anywhere
}
void InitTapeDirectory(char *level_subdir)
}
-/* ------------------------------------------------------------------------- */
-/* some functions to handle lists of level and artwork directories */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// some functions to handle lists of level and artwork directories
+// ----------------------------------------------------------------------------
TreeInfo *newTreeInfo(void)
{
if (node == NULL)
return NULL;
- if (node->node_group) /* enter level group (step down into tree) */
+ if (node->node_group) // enter level group (step down into tree)
return getFirstValidTreeInfoEntry(node->node_group);
- else if (node->parent_link) /* skip start entry of level group */
+ else if (node->parent_link) // skip start entry of level group
{
- if (node->next) /* get first real level series entry */
+ if (node->next) // get first real level series entry
return getFirstValidTreeInfoEntry(node->next);
- else /* leave empty level group and go on */
+ else // leave empty level group and go on
return getFirstValidTreeInfoEntry(node->node_parent->next);
}
- else /* this seems to be a regular level series */
+ else // this seems to be a regular level series
return node;
}
if (node == NULL)
return NULL;
- if (node->node_parent == NULL) /* top level group */
+ if (node->node_parent == NULL) // top level group
return *node->node_top;
- else /* sub level group */
+ else // sub level group
return node->node_parent->node_group;
}
return cloneTreeNode(node_top, node_parent, node->next,
skip_sets_without_levels);
- node_new = getTreeInfoCopy(node); /* copy complete node */
+ node_new = getTreeInfoCopy(node); // copy complete node
- node_new->node_top = node_top; /* correct top node link */
- node_new->node_parent = node_parent; /* correct parent node link */
+ node_new->node_top = node_top; // correct top node link
+ node_new->node_parent = node_parent; // correct parent node link
if (node->level_group)
node_new->node_group = cloneTreeNode(node_top, node_new, node->node_group,
if (num_nodes == 0)
return;
- /* allocate array for sorting structure pointers */
+ // allocate array for sorting structure pointers
sort_array = checked_calloc(num_nodes * sizeof(TreeInfo *));
- /* writing structure pointers to sorting array */
- while (i < num_nodes && node) /* double boundary check... */
+ // writing structure pointers to sorting array
+ while (i < num_nodes && node) // double boundary check...
{
sort_array[i] = node;
node = node->next;
}
- /* sorting the structure pointers in the sorting array */
+ // sorting the structure pointers in the sorting array
qsort(sort_array, num_nodes, sizeof(TreeInfo *),
compare_function);
- /* update the linkage of list elements with the sorted node array */
+ // update the linkage of list elements with the sorted node array
for (i = 0; i < num_nodes - 1; i++)
sort_array[i]->next = sort_array[i + 1];
sort_array[num_nodes - 1]->next = NULL;
- /* update the linkage of the main list anchor pointer */
+ // update the linkage of the main list anchor pointer
*node_first = sort_array[0];
free(sort_array);
- /* now recursively sort the level group structures */
+ // now recursively sort the level group structures
node = *node_first;
while (node)
{
}
-/* ========================================================================= */
-/* some stuff from "files.c" */
-/* ========================================================================= */
+// ============================================================================
+// some stuff from "files.c"
+// ============================================================================
#if defined(PLATFORM_WIN32)
#ifndef S_IRGRP
#ifndef S_ISGID
#define S_ISGID 0
#endif
-#endif /* PLATFORM_WIN32 */
+#endif // PLATFORM_WIN32
-/* file permissions for newly written files */
+// file permissions for newly written files
#define MODE_R_ALL (S_IRUSR | S_IRGRP | S_IROTH)
#define MODE_W_ALL (S_IWUSR | S_IWGRP | S_IWOTH)
#define MODE_X_ALL (S_IXUSR | S_IXGRP | S_IXOTH)
char *dir = checked_malloc(MAX_PATH + 1);
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_DOCUMENTS, NULL, 0, dir))
- && !strEqual(dir, "")) /* empty for Windows 95/98 */
+ && !strEqual(dir, "")) // empty for Windows 95/98
common_data_dir = getPath2(dir, program.userdata_subdir);
else
common_data_dir = options.rw_base_directory;
if (permission_class == PERMS_PUBLIC)
{
- /* if we're setgid, protect files against "other" */
- /* else keep umask(0) to make the dir world-writable */
+ // if we're setgid, protect files against "other"
+ // else keep umask(0) to make the dir world-writable
if (running_setgid)
posix_umask(last_umask & group_umask);
if (permission_class == PERMS_PUBLIC && !running_setgid)
chmod(dir, dir_mode);
- posix_umask(last_umask); /* restore previous umask */
+ posix_umask(last_umask); // restore previous umask
}
void InitUserDataDirectory(void)
if (strlen(program.cookie_prefix) + 1 +
strlen(file_type) + strlen("_FILE_VERSION_x.x") > MAX_COOKIE_LEN)
- return "[COOKIE ERROR]"; /* should never happen */
+ return "[COOKIE ERROR]"; // should never happen
sprintf(cookie, "%s_%s_FILE_VERSION_%d.%d",
program.cookie_prefix, file_type,
}
-/* ------------------------------------------------------------------------- */
-/* setup file list and hash handling functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// setup file list and hash handling functions
+// ----------------------------------------------------------------------------
char *getFormattedSetupEntry(char *token, char *value)
{
int i;
static char entry[MAX_LINE_LEN];
- /* if value is an empty string, just return token without value */
+ // if value is an empty string, just return token without value
if (*value == '\0')
return token;
- /* start with the token and some spaces to format output line */
+ // start with the token and some spaces to format output line
sprintf(entry, "%s:", token);
for (i = strlen(entry); i < token_value_position; i++)
strcat(entry, " ");
- /* continue with the token's value */
+ // continue with the token's value
strcat(entry, value);
return entry;
int c;
while ((c = *str++))
- hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
+ hash = ((hash << 5) + hash) + c; // hash * 33 + c
return hash;
}
if (hash == NULL)
return;
- hashtable_destroy(hash, 1); /* 1 == also free values stored in hash */
+ hashtable_destroy(hash, 1); // 1 == also free values stored in hash
}
char *getHashEntry(SetupFileHash *hash, char *token)
value_copy = getStringCopy(value);
- /* change value; if it does not exist, insert it as new */
+ // change value; if it does not exist, insert it as new
if (!change_hash_entry(hash, token, value_copy))
if (!insert_hash_entry(hash, getStringCopy(token), value_copy))
Error(ERR_EXIT, "cannot insert into hash -- aborting");
static char line_copy[MAX_LINE_LEN + 1], line_raw_copy[MAX_LINE_LEN + 1];
char *token, *value, *line_ptr;
- /* when externally invoked via ReadTokenValueFromLine(), copy line buffers */
+ // when externally invoked via ReadTokenValueFromLine(), copy line buffers
if (line_raw == NULL)
{
strncpy(line_copy, line, MAX_LINE_LEN);
line_raw = line_raw_copy;
}
- /* cut trailing comment from input line */
+ // cut trailing comment from input line
for (line_ptr = line; *line_ptr; line_ptr++)
{
if (*line_ptr == '#')
}
}
- /* cut trailing whitespaces from input line */
+ // cut trailing whitespaces from input line
for (line_ptr = &line[strlen(line)]; line_ptr >= line; line_ptr--)
if ((*line_ptr == ' ' || *line_ptr == '\t') && *(line_ptr + 1) == '\0')
*line_ptr = '\0';
- /* ignore empty lines */
+ // ignore empty lines
if (*line == '\0')
return FALSE;
- /* cut leading whitespaces from token */
+ // cut leading whitespaces from token
for (token = line; *token; token++)
if (*token != ' ' && *token != '\t')
break;
- /* start with empty value as reliable default */
+ // start with empty value as reliable default
value = "";
token_value_separator_found = FALSE;
- /* find end of token to determine start of value */
+ // find end of token to determine start of value
for (line_ptr = token; *line_ptr; line_ptr++)
{
- /* first look for an explicit token/value separator, like ':' or '=' */
+ // first look for an explicit token/value separator, like ':' or '='
if (*line_ptr == ':' || *line_ptr == '=')
{
- *line_ptr = '\0'; /* terminate token string */
- value = line_ptr + 1; /* set beginning of value */
+ *line_ptr = '\0'; // terminate token string
+ value = line_ptr + 1; // set beginning of value
token_value_separator_found = TRUE;
}
#if ALLOW_TOKEN_VALUE_SEPARATOR_BEING_WHITESPACE
- /* fallback: if no token/value separator found, also allow whitespaces */
+ // fallback: if no token/value separator found, also allow whitespaces
if (!token_value_separator_found && !separator_required)
{
for (line_ptr = token; *line_ptr; line_ptr++)
{
if (*line_ptr == ' ' || *line_ptr == '\t')
{
- *line_ptr = '\0'; /* terminate token string */
- value = line_ptr + 1; /* set beginning of value */
+ *line_ptr = '\0'; // terminate token string
+ value = line_ptr + 1; // set beginning of value
token_value_separator_found = TRUE;
}
#endif
- /* cut trailing whitespaces from token */
+ // cut trailing whitespaces from token
for (line_ptr = &token[strlen(token)]; line_ptr >= token; line_ptr--)
if ((*line_ptr == ' ' || *line_ptr == '\t') && *(line_ptr + 1) == '\0')
*line_ptr = '\0';
- /* cut leading whitespaces from value */
+ // cut leading whitespaces from value
for (; *value; value++)
if (*value != ' ' && *value != '\t')
break;
return FALSE;
}
- /* use "insert pointer" to store list end for constant insertion complexity */
+ // use "insert pointer" to store list end for constant insertion complexity
if (!is_hash)
insert_ptr = setup_file_data;
- /* on top invocation, create hash to mark included files (to prevent loops) */
+ // on top invocation, create hash to mark included files (to prevent loops)
if (top_recursion_level)
include_filename_hash = newSetupFileHash();
- /* mark this file as already included (to prevent including it again) */
+ // mark this file as already included (to prevent including it again)
setHashEntry(include_filename_hash, getBaseNamePtr(filename), "true");
while (!checkEndOfFile(file))
{
- /* read next line of input file */
+ // read next line of input file
if (!getStringFromFile(file, line, MAX_LINE_LEN))
break;
- /* check if line was completely read and is terminated by line break */
+ // check if line was completely read and is terminated by line break
if (strlen(line) > 0 && line[strlen(line) - 1] == '\n')
line_nr++;
- /* cut trailing line break (this can be newline and/or carriage return) */
+ // cut trailing line break (this can be newline and/or carriage return)
for (line_ptr = &line[strlen(line)]; line_ptr >= line; line_ptr--)
if ((*line_ptr == '\n' || *line_ptr == '\r') && *(line_ptr + 1) == '\0')
*line_ptr = '\0';
- /* copy raw input line for later use (mainly debugging output) */
+ // copy raw input line for later use (mainly debugging output)
strcpy(line_raw, line);
if (read_continued_line)
{
- /* append new line to existing line, if there is enough space */
+ // append new line to existing line, if there is enough space
if (strlen(previous_line) + strlen(line_ptr) < MAX_LINE_LEN)
strcat(previous_line, line_ptr);
- strcpy(line, previous_line); /* copy storage buffer to line */
+ strcpy(line, previous_line); // copy storage buffer to line
read_continued_line = FALSE;
}
- /* if the last character is '\', continue at next line */
+ // if the last character is '\', continue at next line
if (strlen(line) > 0 && line[strlen(line) - 1] == '\\')
{
- line[strlen(line) - 1] = '\0'; /* cut off trailing backslash */
- strcpy(previous_line, line); /* copy line to storage buffer */
+ line[strlen(line) - 1] = '\0'; // cut off trailing backslash
+ strcpy(previous_line, line); // copy line to storage buffer
read_continued_line = TRUE;
first_valid_list_entry = setup_file_list->next;
- /* free empty list header */
+ // free empty list header
setup_file_list->next = NULL;
freeSetupFileList(setup_file_list);
}
-/* ========================================================================= */
-/* setup file stuff */
-/* ========================================================================= */
+// ============================================================================
+// setup file stuff
+// ============================================================================
#define TOKEN_STR_LAST_LEVEL_SERIES "last_level_series"
#define TOKEN_STR_LAST_PLAYED_LEVEL "last_played_level"
#define TOKEN_STR_HANDICAP_LEVEL "handicap_level"
-/* level directory info */
+// level directory info
#define LEVELINFO_TOKEN_IDENTIFIER 0
#define LEVELINFO_TOKEN_NAME 1
#define LEVELINFO_TOKEN_NAME_SORTING 2
static struct TokenInfo levelinfo_tokens[] =
{
- /* level directory info */
+ // level directory info
{ TYPE_STRING, &ldi.identifier, "identifier" },
{ TYPE_STRING, &ldi.name, "name" },
{ TYPE_STRING, &ldi.name_sorting, "name_sorting" },
static struct TokenInfo artworkinfo_tokens[] =
{
- /* artwork directory info */
+ // artwork directory info
{ TYPE_STRING, &ldi.identifier, "identifier" },
{ TYPE_STRING, &ldi.subdir, "subdir" },
{ TYPE_STRING, &ldi.name, "name" },
ti->program_copyright = NULL;
ti->program_company = NULL;
- ti->sort_priority = LEVELCLASS_UNDEFINED; /* default: least priority */
- ti->latest_engine = FALSE; /* default: get from level */
+ ti->sort_priority = LEVELCLASS_UNDEFINED; // default: least priority
+ ti->latest_engine = FALSE; // default: get from level
ti->parent_link = FALSE;
ti->in_user_dir = FALSE;
ti->user_defined = FALSE;
return;
}
- /* copy all values from the parent structure */
+ // copy all values from the parent structure
ti->type = parent->type;
{
TreeInfo *ti_copy = newTreeInfo();
- /* copy all values from the original structure */
+ // copy all values from the original structure
ti_copy->type = ti->type;
if (token_value == NULL)
return;
- /* set setup field to corresponding token value */
+ // set setup field to corresponding token value
switch (token_type)
{
case TYPE_BOOLEAN:
}
-/* -------------------------------------------------------------------------- */
-/* functions for handling level and custom artwork info cache */
-/* -------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for handling level and custom artwork info cache
+// ----------------------------------------------------------------------------
static void LoadArtworkInfoCache(void)
{
{
char *filename = getPath2(getCacheDir(), ARTWORKINFO_CACHE_FILE);
- /* try to load artwork info hash from already existing cache file */
+ // try to load artwork info hash from already existing cache file
artworkinfo_cache_old = loadSetupFileHash(filename);
- /* if no artwork info cache file was found, start with empty hash */
+ // if no artwork info cache file was found, start with empty hash
if (artworkinfo_cache_old == NULL)
artworkinfo_cache_old = newSetupFileHash();
return prefix;
}
-/* (identical to above function, but separate string buffer needed -- nasty) */
+// (identical to above function, but separate string buffer needed -- nasty)
static char *getCacheToken(char *prefix, char *suffix)
{
static char *token = NULL;
if (timestamp_string == NULL)
return TRUE;
- if (stat(filename, &file_status) != 0) /* cannot stat file */
+ if (stat(filename, &file_status) != 0) // cannot stat file
return TRUE;
return (file_status.st_mtime != atoi(timestamp_string));
artwork_info = newTreeInfo();
setTreeInfoToDefaults(artwork_info, type);
- /* set all structure fields according to the token/value pairs */
+ // set all structure fields according to the token/value pairs
ldi = *artwork_info;
for (i = 0; artworkinfo_tokens[i].type != -1; i++)
{
char *token = getCacheToken(token_prefix, artworkinfo_tokens[i].text);
char *value = getHashEntry(artworkinfo_cache_old, token);
- /* if defined, use value from cache, else keep default value */
+ // if defined, use value from cache, else keep default value
if (value != NULL)
setSetupInfo(artworkinfo_tokens, i, value);
}
char *filename_artworkinfo = getPath2(getSetupArtworkDir(artwork_info),
ARTWORKINFO_FILENAME(type));
- /* check if corresponding "levelinfo.conf" file has changed */
+ // check if corresponding "levelinfo.conf" file has changed
token_main = getCacheToken(token_prefix, "TIMESTAMP_LEVELINFO");
cache_entry = getHashEntry(artworkinfo_cache_old, token_main);
if (modifiedFileTimestamp(filename_levelinfo, cache_entry))
cached = FALSE;
- /* check if corresponding "<artworkinfo>.conf" file has changed */
+ // check if corresponding "<artworkinfo>.conf" file has changed
token_main = getCacheToken(token_prefix, "TIMESTAMP_ARTWORKINFO");
cache_entry = getHashEntry(artworkinfo_cache_old, token_main);
}
-/* -------------------------------------------------------------------------- */
-/* functions for loading level info and custom artwork info */
-/* -------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// functions for loading level info and custom artwork info
+// ----------------------------------------------------------------------------
-/* forward declaration for recursive call by "LoadLevelInfoFromLevelDir()" */
+// forward declaration for recursive call by "LoadLevelInfoFromLevelDir()"
static void LoadLevelInfoFromLevelDir(TreeInfo **, TreeInfo *, char *);
static boolean LoadLevelInfoFromLevelConf(TreeInfo **node_first,
LevelDirTree *leveldir_new = NULL;
int i;
- /* unless debugging, silently ignore directories without "levelinfo.conf" */
+ // unless debugging, silently ignore directories without "levelinfo.conf"
if (!options.debug && !fileExists(filename))
{
free(directory_path);
leveldir_new->subdir = getStringCopy(directory_name);
- /* set all structure fields according to the token/value pairs */
+ // set all structure fields according to the token/value pairs
ldi = *leveldir_new;
for (i = 0; i < NUM_LEVELINFO_TOKENS; i++)
setSetupInfo(levelinfo_tokens, i,
if (leveldir_new->name_sorting == NULL)
leveldir_new->name_sorting = getStringCopy(leveldir_new->name);
- if (node_parent == NULL) /* top level group */
+ if (node_parent == NULL) // top level group
{
leveldir_new->basepath = getStringCopy(level_directory);
leveldir_new->fullpath = getStringCopy(leveldir_new->subdir);
}
- else /* sub level group */
+ else // sub level group
{
leveldir_new->basepath = getStringCopy(node_parent->basepath);
leveldir_new->fullpath = getPath2(node_parent->fullpath, directory_name);
leveldir_new->in_user_dir =
(!strEqual(leveldir_new->basepath, options.level_directory));
- /* adjust some settings if user's private level directory was detected */
+ // adjust some settings if user's private level directory was detected
if (leveldir_new->sort_priority == LEVELCLASS_UNDEFINED &&
leveldir_new->in_user_dir &&
(strEqual(leveldir_new->subdir, getLoginName()) ||
setString(&leveldir_new->class_desc, getLevelClassDescription(leveldir_new));
- leveldir_new->handicap_level = /* set handicap to default value */
+ leveldir_new->handicap_level = // set handicap to default value
(leveldir_new->user_defined || !leveldir_new->handicap ?
leveldir_new->last_level : leveldir_new->first_level);
if (leveldir_new->level_group)
{
- /* create node to link back to current level directory */
+ // create node to link back to current level directory
createParentTreeInfoNode(leveldir_new);
- /* recursively step into sub-directory and look for more level series */
+ // recursively step into sub-directory and look for more level series
LoadLevelInfoFromLevelDir(&leveldir_new->node_group,
leveldir_new, directory_path);
}
return;
}
- while ((dir_entry = readDirectory(dir)) != NULL) /* loop all entries */
+ while ((dir_entry = readDirectory(dir)) != NULL) // loop all entries
{
char *directory_name = dir_entry->basename;
char *directory_path = getPath2(level_directory, directory_name);
- /* skip entries for current and parent directory */
+ // skip entries for current and parent directory
if (strEqual(directory_name, ".") ||
strEqual(directory_name, ".."))
{
continue;
}
- /* find out if directory entry is itself a directory */
- if (!dir_entry->is_directory) /* not a directory */
+ // find out if directory entry is itself a directory
+ if (!dir_entry->is_directory) // not a directory
{
free(directory_path);
closeDirectory(dir);
- /* special case: top level directory may directly contain "levelinfo.conf" */
+ // special case: top level directory may directly contain "levelinfo.conf"
if (node_parent == NULL && !valid_entry_found)
{
- /* check if this directory directly contains a file "levelinfo.conf" */
+ // check if this directory directly contains a file "levelinfo.conf"
valid_entry_found |= LoadLevelInfoFromLevelConf(node_first, node_parent,
level_directory, ".");
}
AdjustGraphicsForEMC();
- /* before sorting, the first entries will be from the user directory */
+ // before sorting, the first entries will be from the user directory
leveldir_current = getFirstValidTreeInfoEntry(leveldir_first);
if (leveldir_first == NULL)
if (fileExists(filename))
setup_file_hash = loadSetupFileHash(filename);
- if (setup_file_hash == NULL) /* no config file -- look for artwork files */
+ if (setup_file_hash == NULL) // no config file -- look for artwork files
{
Directory *dir;
DirectoryEntry *dir_entry;
artwork_new->subdir = getStringCopy(directory_name);
- if (setup_file_hash) /* (before defining ".color" and ".class_desc") */
+ if (setup_file_hash) // (before defining ".color" and ".class_desc")
{
- /* set all structure fields according to the token/value pairs */
+ // set all structure fields according to the token/value pairs
ldi = *artwork_new;
for (i = 0; i < NUM_LEVELINFO_TOKENS; i++)
setSetupInfo(levelinfo_tokens, i,
artwork_new->name_sorting = getStringCopy(artwork_new->name);
}
- if (node_parent == NULL) /* top level group */
+ if (node_parent == NULL) // top level group
{
artwork_new->basepath = getStringCopy(base_directory);
artwork_new->fullpath = getStringCopy(artwork_new->subdir);
}
- else /* sub level group */
+ else // sub level group
{
artwork_new->basepath = getStringCopy(node_parent->basepath);
artwork_new->fullpath = getPath2(node_parent->fullpath, directory_name);
artwork_new->in_user_dir =
(!strEqual(artwork_new->basepath, OPTIONS_ARTWORK_DIRECTORY(type)));
- /* (may use ".sort_priority" from "setup_file_hash" above) */
+ // (may use ".sort_priority" from "setup_file_hash" above)
artwork_new->color = ARTWORKCOLOR(artwork_new);
setString(&artwork_new->class_desc, getLevelClassDescription(artwork_new));
- if (setup_file_hash == NULL) /* (after determining ".user_defined") */
+ if (setup_file_hash == NULL) // (after determining ".user_defined")
{
if (strEqual(artwork_new->subdir, "."))
{
artwork_new->sort_priority = ARTWORKCLASS_CLASSICS;
}
- /* set to new values after changing ".sort_priority" */
+ // set to new values after changing ".sort_priority"
artwork_new->color = ARTWORKCOLOR(artwork_new);
setString(&artwork_new->class_desc,
if ((dir = openDirectory(base_directory)) == NULL)
{
- /* display error if directory is main "options.graphics_directory" etc. */
+ // display error if directory is main "options.graphics_directory" etc.
if (base_directory == OPTIONS_ARTWORK_DIRECTORY(type))
Error(ERR_WARN, "cannot read directory '%s'", base_directory);
return;
}
- while ((dir_entry = readDirectory(dir)) != NULL) /* loop all entries */
+ while ((dir_entry = readDirectory(dir)) != NULL) // loop all entries
{
char *directory_name = dir_entry->basename;
char *directory_path = getPath2(base_directory, directory_name);
- /* skip directory entries for current and parent directory */
+ // skip directory entries for current and parent directory
if (strEqual(directory_name, ".") ||
strEqual(directory_name, ".."))
{
continue;
}
- /* skip directory entries which are not a directory */
- if (!dir_entry->is_directory) /* not a directory */
+ // skip directory entries which are not a directory
+ if (!dir_entry->is_directory) // not a directory
{
free(directory_path);
free(directory_path);
- /* check if this directory contains artwork with or without config file */
+ // check if this directory contains artwork with or without config file
valid_entry_found |= LoadArtworkInfoFromArtworkConf(node_first, node_parent,
base_directory,
directory_name, type);
closeDirectory(dir);
- /* check if this directory directly contains artwork itself */
+ // check if this directory directly contains artwork itself
valid_entry_found |= LoadArtworkInfoFromArtworkConf(node_first, node_parent,
base_directory, ".",
type);
static TreeInfo *getDummyArtworkInfo(int type)
{
- /* this is only needed when there is completely no artwork available */
+ // this is only needed when there is completely no artwork available
TreeInfo *artwork_new = newTreeInfo();
setTreeInfoToDefaults(artwork_new, type);
if (artwork.mus_first == NULL)
artwork.mus_first = getDummyArtworkInfo(TREE_TYPE_MUSIC_DIR);
- /* before sorting, the first entries will be from the user directory */
+ // before sorting, the first entries will be from the user directory
artwork.gfx_current =
getTreeInfoFromIdentifier(artwork.gfx_first, setup.graphics_set);
if (artwork.gfx_current == NULL)
{
int type = (*artwork_node)->type;
- /* recursively check all level directories for artwork sub-directories */
+ // recursively check all level directories for artwork sub-directories
while (level_node)
{
- /* check all tree entries for artwork, but skip parent link entries */
+ // check all tree entries for artwork, but skip parent link entries
if (!level_node->parent_link)
{
TreeInfo *artwork_new = getArtworkInfoCacheEntry(level_node, type);
LoadArtworkInfoFromArtworkDir(artwork_node, NULL, path, type);
- if (topnode_last != *artwork_node) /* check for newly added node */
+ if (topnode_last != *artwork_node) // check for newly added node
{
artwork_new = *artwork_node;
free(path);
}
- /* insert artwork info (from old cache or filesystem) into new cache */
+ // insert artwork info (from old cache or filesystem) into new cache
if (artwork_new != NULL)
setArtworkInfoCacheEntry(artwork_new, level_node, type);
}
print_timestamp_time("SaveArtworkInfoCache");
- /* needed for reloading level artwork not known at ealier stage */
+ // needed for reloading level artwork not known at ealier stage
if (!strEqual(artwork.gfx_current_identifier, setup.graphics_set))
{
{
char *classic_artwork_set = getClassicArtworkSet(type);
- /* check for custom artwork configured in "levelinfo.conf" */
+ // check for custom artwork configured in "levelinfo.conf"
char *leveldir_artwork_set =
*LEVELDIR_ARTWORK_SET_PTR(leveldir_current, type);
boolean has_leveldir_artwork_set =
(leveldir_artwork_set != NULL && !strEqual(leveldir_artwork_set,
classic_artwork_set));
- /* check for custom artwork in sub-directory "graphics" etc. */
+ // check for custom artwork in sub-directory "graphics" etc.
TreeInfo *artwork_first_node = ARTWORK_FIRST_NODE(artwork, type);
char *leveldir_identifier = leveldir_current->identifier;
boolean has_artwork_subdir =
level_info = newTreeInfo();
- /* always start with reliable default values */
+ // always start with reliable default values
setTreeInfoToDefaults(level_info, TREE_TYPE_LEVEL_DIR);
setString(&level_info->name, level_name);
i == LEVELINFO_TOKEN_MUSIC_SET)))
fprintf(file, "%s\n", getSetupLine(levelinfo_tokens, "", i));
- /* just to make things nicer :) */
+ // just to make things nicer :)
if (i == LEVELINFO_TOKEN_AUTHOR ||
i == LEVELINFO_TOKEN_FIRST_LEVEL ||
(use_artwork_set && i == LEVELINFO_TOKEN_READONLY))
char *token_text = token_info[token_nr].text;
char *value_string = getSetupValue(token_type, setup_value);
- /* build complete token string */
+ // build complete token string
sprintf(token_string, "%s%s", prefix, token_text);
- /* build setup entry line */
+ // build setup entry line
line = getFormattedSetupEntry(token_string, value_string);
if (token_type == TYPE_KEY_X11)
Key key = *(Key *)setup_value;
char *keyname = getKeyNameFromKey(key);
- /* add comment, if useful */
+ // add comment, if useful
if (!strEqual(keyname, "(undefined)") &&
!strEqual(keyname, "(unknown)"))
{
- /* add at least one whitespace */
+ // add at least one whitespace
strcat(line, " ");
for (i = strlen(line); i < token_comment_position; i++)
strcat(line, " ");
void LoadLevelSetup_LastSeries(void)
{
- /* ----------------------------------------------------------------------- */
- /* ~/.<program>/levelsetup.conf */
- /* ----------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
+ // ~/.<program>/levelsetup.conf
+ // --------------------------------------------------------------------------
char *filename = getPath2(getSetupDir(), LEVELSETUP_FILENAME);
SetupFileHash *level_setup_hash = NULL;
- /* always start with reliable default values */
+ // always start with reliable default values
leveldir_current = getFirstValidTreeInfoEntry(leveldir_first);
if (!strEqual(DEFAULT_LEVELSET, UNDEFINED_LEVELSET))
static void SaveLevelSetup_LastSeries_Ext(boolean deactivate_last_level_series)
{
- /* ----------------------------------------------------------------------- */
- /* ~/.<program>/levelsetup.conf */
- /* ----------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
+ // ~/.<program>/levelsetup.conf
+ // --------------------------------------------------------------------------
// check if the current level directory structure is available at this point
if (leveldir_current == NULL)
static char *level_directory = NULL;
Directory *dir;
- /* check for more levels besides the 'levels' field of 'levelinfo.conf' */
+ // check for more levels besides the 'levels' field of 'levelinfo.conf'
level_directory = getPath2((leveldir_current->in_user_dir ?
getUserLevelDir(NULL) :
char *level_subdir = leveldir_current->subdir;
int i;
- /* always start with reliable default values */
+ // always start with reliable default values
level_nr = leveldir_current->first_level;
for (i = 0; i < MAX_LEVELS; i++)
checkSeriesInfo();
- /* ----------------------------------------------------------------------- */
- /* ~/.<program>/levelsetup/<level series>/levelsetup.conf */
- /* ----------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
+ // ~/.<program>/levelsetup/<level series>/levelsetup.conf
+ // --------------------------------------------------------------------------
level_subdir = leveldir_current->subdir;
{
char *token_value;
- /* get last played level in this level set */
+ // get last played level in this level set
token_value = getHashEntry(level_setup_hash, TOKEN_STR_LAST_PLAYED_LEVEL);
level_nr = leveldir_current->last_level;
}
- /* get handicap level in this level set */
+ // get handicap level in this level set
token_value = getHashEntry(level_setup_hash, TOKEN_STR_HANDICAP_LEVEL);
leveldir_current->handicap_level = level_nr;
}
- /* get number of played and solved levels in this level set */
+ // get number of played and solved levels in this level set
BEGIN_HASH_ITERATION(level_setup_hash, itr)
{
int level_nr = atoi(token);
if (value != NULL)
- LevelStats_setPlayed(level_nr, atoi(value)); /* read 1st column */
+ LevelStats_setPlayed(level_nr, atoi(value)); // read 1st column
value = strchr(value, ' ');
if (value != NULL)
- LevelStats_setSolved(level_nr, atoi(value)); /* read 2nd column */
+ LevelStats_setSolved(level_nr, atoi(value)); // read 2nd column
}
}
END_HASH_ITERATION(hash, itr)
FILE *file;
int i;
- /* ----------------------------------------------------------------------- */
- /* ~/.<program>/levelsetup/<level series>/levelsetup.conf */
- /* ----------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
+ // ~/.<program>/levelsetup/<level series>/levelsetup.conf
+ // --------------------------------------------------------------------------
InitLevelSetupDirectory(level_subdir);
#include "hash.h"
-/* values for setup file handling */
+// values for setup file handling
#define TYPE_BOOLEAN (1 << 0)
#define TYPE_SWITCH (1 << 1)
#define TYPE_SWITCH3 (1 << 2)
#define TYPE_ELEMENT (1 << 11)
#define TYPE_GRAPHIC (1 << 12)
-/* additional values for setup screen */
+// additional values for setup screen
#define TYPE_ENTER_SCREEN (1 << 13)
#define TYPE_LEAVE_SCREEN (1 << 14)
#define TYPE_ENTER_MENU (1 << 15)
#define TYPE_GHOSTED (1 << 23)
#define TYPE_QUERY (1 << 24)
-/* additional values for internal purposes */
+// additional values for internal purposes
#define TYPE_BITFIELD (1 << 25)
#define TYPE_CONTENT (1 << 26)
#define TYPE_ELEMENT_LIST (1 << 27)
#define TYPE_CONTENT_LIST (1 << 28)
-/* derived values for setup file handling */
+// derived values for setup file handling
#define TYPE_BOOLEAN_STYLE (TYPE_BOOLEAN | \
TYPE_SWITCH | \
TYPE_YES_NO | \
TYPE_ECS_AGA )
-/* derived values for setup screen */
+// derived values for setup screen
#define TYPE_VALUE (TYPE_BOOLEAN_STYLE | \
TYPE_SWITCH3 | \
TYPE_YES_NO_AUTO | \
char *text;
};
-/* some definitions for list and hash handling */
+// some definitions for list and hash handling
typedef struct SetupFileList SetupFileList;
typedef struct hashtable SetupFileHash;
} \
-/* sort priorities of level series (also used as level series classes) */
+// 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
IS_LEVELCLASS_SB(n) ? LEVELCLASS_SB : \
LEVELCLASS_UNDEFINED)
-/* sort priorities of artwork */
+// sort priorities of artwork
#define ARTWORKCLASS_CLASSICS_START 100
#define ARTWORKCLASS_CLASSICS_END 199
#define ARTWORKCLASS_CONTRIB_START 200
void LevelStats_incPlayed(int);
void LevelStats_incSolved(int);
-#endif /* MISC_H */
+#endif // MISC_H
#define SNAPSHOT_MEMORY_DEFAULT (512 * 1024 * 1024)
-/* needed for comfortably saving engine snapshot buffers */
+// needed for comfortably saving engine snapshot buffers
#define ARGS_ADDRESS_AND_SIZEOF(x) (&(x)), (sizeof(x))
struct SnapshotNodeInfo
void FreeSnapshotSingle(void);
void FreeSnapshotList(void);
-#endif /* SNAPSHOT_H */
+#endif // SNAPSHOT_H
#include "text.h"
-/* expiration time (in milliseconds) for sound loops */
+// expiration time (in milliseconds) for sound loops
#define SOUND_LOOP_EXPIRATION_TIME 200
-/* one second fading interval == 1000 ticks (milliseconds) */
+// one second fading interval == 1000 ticks (milliseconds)
#define SOUND_FADING_INTERVAL 1000
#define SND_TYPE_NONE 0
struct AudioFormatInfo
{
- boolean stereo; /* availability of stereo sound */
- int format; /* size and endianess of sample data */
- int sample_rate; /* sample frequency */
- int fragment_size; /* audio device fragment size in bytes */
+ boolean stereo; // availability of stereo sound
+ int format; // size and endianess of sample data
+ int sample_rate; // sample frequency
+ int fragment_size; // audio device fragment size in bytes
};
struct SampleInfo
int type;
int format;
- void *data_ptr; /* pointer to first sample (8 or 16 bit) */
- int data_len; /* number of samples, NOT number of bytes */
- int num_channels; /* mono: 1 channel, stereo: 2 channels */
+ void *data_ptr; // pointer to first sample (8 or 16 bit)
+ int data_len; // number of samples, NOT number of bytes
+ int num_channels; // mono: 1 channel, stereo: 2 channels
};
typedef struct SampleInfo SoundInfo;
typedef struct SampleInfo MusicInfo;
int type;
int format;
- void *data_ptr; /* pointer to first sample (8 or 16 bit) */
- int data_len; /* number of samples, NOT number of bytes */
- int num_channels; /* mono: 1 channel, stereo: 2 channels */
+ void *data_ptr; // pointer to first sample (8 or 16 bit)
+ int data_len; // number of samples, NOT number of bytes
+ int num_channels; // mono: 1 channel, stereo: 2 channels
};
typedef struct SoundControl SoundControl;
static char *currently_playing_music_filename = NULL;
-/* ========================================================================= */
-/* THE STUFF BELOW IS ONLY USED BY THE SOUND SERVER CHILD PROCESS */
+// ============================================================================
+// THE STUFF BELOW IS ONLY USED BY THE SOUND SERVER CHILD PROCESS
static struct SoundControl mixer[NUM_MIXER_CHANNELS];
static int mixer_active_channels = 0;
static MusicInfo *getMusicInfoEntryFromMusicID(int);
-/* ------------------------------------------------------------------------- */
-/* mixer functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// mixer functions
+// ----------------------------------------------------------------------------
void Mixer_InitChannels(void)
{
static void Mixer_PlayChannel(int channel)
{
- /* start with inactive channel in case something goes wrong */
+ // start with inactive channel in case something goes wrong
mixer[channel].active = FALSE;
if (mixer[channel].type != MUS_TYPE_WAV)
if (snd_info == NULL)
return;
- /* copy sound sample and format information */
+ // copy sound sample and format information
snd_ctrl.type = snd_info->type;
snd_ctrl.format = snd_info->format;
snd_ctrl.data_ptr = snd_info->data_ptr;
snd_ctrl.data_len = snd_info->data_len;
snd_ctrl.num_channels = snd_info->num_channels;
- /* play music samples on a dedicated music channel */
+ // play music samples on a dedicated music channel
if (IS_MUSIC(snd_ctrl))
{
Mixer_StopMusicChannel();
return;
}
- /* check if (and how often) this sound sample is already playing */
+ // check if (and how often) this sound sample is already playing
for (k = 0, i = audio.first_sound_channel; i < audio.num_channels; i++)
if (mixer[i].active && SAME_SOUND_DATA(mixer[i], snd_ctrl))
k++;
- /* reset expiration delay for already playing loop sounds */
+ // reset expiration delay for already playing loop sounds
if (k > 0 && IS_LOOP(snd_ctrl))
{
for (i = audio.first_sound_channel; i < audio.num_channels; i++)
if (IS_FADING(mixer[i]))
Mixer_UnFadeChannel(i);
- /* restore settings like volume and stereo position */
+ // restore settings like volume and stereo position
mixer[i].volume = snd_ctrl.volume;
mixer[i].stereo_position = snd_ctrl.stereo_position;
return;
}
- /* don't play sound more than n times simultaneously (with n == 2 for now) */
+ // don't play sound more than n times simultaneously (with n == 2 for now)
if (k >= 2)
{
unsigned int playing_current = Counter();
int longest = 0, longest_nr = audio.first_sound_channel;
- /* look for oldest equal sound */
+ // look for oldest equal sound
for (i = audio.first_sound_channel; i < audio.num_channels; i++)
{
int playing_time = playing_current - mixer[i].playing_starttime;
library, we use the current playing time (in milliseconds) instead. */
#if DEBUG
- /* channel allocation sanity check -- should not be needed */
+ // channel allocation sanity check -- should not be needed
if (mixer_active_channels ==
audio.num_channels - (mixer[audio.music_channel].active ? 0 : 1))
{
Mixer_StopChannel(longest_nr);
}
- /* add the new sound to the mixer */
+ // add the new sound to the mixer
for (i = audio.first_sound_channel; i < audio.num_channels; i++)
{
if (!mixer[i].active)
{
int i;
- /* deactivate channels that have expired since the last request */
+ // deactivate channels that have expired since the last request
for (i = 0; i < audio.num_channels; i++)
if (mixer[i].active && Mixer_ChannelExpired(i))
Mixer_StopChannel(i);
- if (IS_RELOADING(snd_ctrl)) /* load new sound or music files */
+ if (IS_RELOADING(snd_ctrl)) // load new sound or music files
{
Mixer_StopMusicChannel();
for (i = audio.first_sound_channel; i < audio.num_channels; i++)
else
ReloadCustomMusic();
}
- else if (IS_FADING(snd_ctrl)) /* fade out existing sound or music */
+ else if (IS_FADING(snd_ctrl)) // fade out existing sound or music
{
if (IS_MUSIC(snd_ctrl))
{
if (SAME_SOUND_NR(mixer[i], snd_ctrl) || ALL_SOUNDS(snd_ctrl))
Mixer_FadeChannel(i);
}
- else if (IS_STOPPING(snd_ctrl)) /* stop existing sound or music */
+ else if (IS_STOPPING(snd_ctrl)) // stop existing sound or music
{
if (IS_MUSIC(snd_ctrl))
{
if (SAME_SOUND_NR(mixer[i], snd_ctrl) || ALL_SOUNDS(snd_ctrl))
Mixer_StopChannel(i);
}
- else if (SET_EXPIRE_LOOPS(snd_ctrl)) /* set loop expiration on or off */
+ else if (SET_EXPIRE_LOOPS(snd_ctrl)) // set loop expiration on or off
{
expire_loop_sounds = snd_ctrl.active;
}
- else if (snd_ctrl.active) /* add new sound to mixer */
+ else if (snd_ctrl.active) // add new sound to mixer
{
Mixer_InsertSound(snd_ctrl);
}
if (!audio.sound_available)
return;
- /* initialize stereo position conversion information */
+ // initialize stereo position conversion information
for (i = 0; i <= SOUND_MAX_LEFT2RIGHT; i++)
stereo_volume[i] =
(int)sqrt((float)(SOUND_MAX_LEFT2RIGHT * SOUND_MAX_LEFT2RIGHT - i * i));
}
-/* THE STUFF ABOVE IS ONLY USED BY THE SOUND SERVER CHILD PROCESS */
-/* ========================================================================= */
-/* THE STUFF BELOW IS ONLY USED BY THE MAIN PROCESS */
+// THE STUFF ABOVE IS ONLY USED BY THE SOUND SERVER CHILD PROCESS
+// ============================================================================
+// THE STUFF BELOW IS ONLY USED BY THE MAIN PROCESS
-#define CHUNK_ID_LEN 4 /* IFF style chunk id length */
-#define WAV_HEADER_SIZE 16 /* size of WAV file header */
+#define CHUNK_ID_LEN 4 // IFF style chunk id length
+#define WAV_HEADER_SIZE 16 // size of WAV file header
static void *Load_WAV(char *filename)
{
static void LoadCustomMusic_NoConf(void)
{
- static boolean draw_init_text = TRUE; /* only draw at startup */
+ static boolean draw_init_text = TRUE; // only draw at startup
static char *last_music_directory = NULL;
char *music_directory = getCustomMusicDirectory();
Directory *dir;
if (last_music_directory != NULL &&
strEqual(last_music_directory, music_directory))
- return; /* old and new music directory are the same */
+ return; // old and new music directory are the same
if (last_music_directory != NULL)
free(last_music_directory);
if (draw_init_text)
DrawInitText("Loading music", 120, FC_GREEN);
- while ((dir_entry = readDirectory(dir)) != NULL) /* loop all entries */
+ while ((dir_entry = readDirectory(dir)) != NULL) // loop all entries
{
char *basename = dir_entry->basename;
MusicInfo *mus_info = NULL;
boolean music_already_used = FALSE;
int i;
- /* skip all music files that are configured in music config file */
+ // skip all music files that are configured in music config file
for (i = 0; i < num_music; i++)
{
struct FileInfo *music = getMusicListEntry(i);
int num_list_entries = sound_info->num_file_list_entries;
int list_pos = (pos < num_list_entries ? pos : pos - num_list_entries);
- if (pos < 0 || pos >= num_sounds) /* invalid sound */
+ if (pos < 0 || pos >= num_sounds) // invalid sound
return NULL;
return (pos < num_list_entries ? &sound_info->file_list[list_pos] :
int num_list_entries = music_info->num_file_list_entries;
int list_pos = (pos < num_list_entries ? pos : pos - num_list_entries);
- if (pos < 0 || pos >= num_music) /* invalid music */
+ if (pos < 0 || pos >= num_music) // invalid music
return NULL;
return (pos < num_list_entries ? &music_info->file_list[list_pos] :
(SoundInfo **)(pos < num_list_entries ? sound_info->artwork_list :
sound_info->dynamic_artwork_list);
- if (pos < 0 || pos >= num_sounds) /* invalid sound */
+ if (pos < 0 || pos >= num_sounds) // invalid sound
return NULL;
return snd_info[list_pos];
(MusicInfo **)(pos < num_list_entries ? music_info->artwork_list :
music_info->dynamic_artwork_list);
- if (pos >= num_music) /* invalid music */
+ if (pos >= num_music) // invalid music
return NULL;
- if (pos < 0) /* undefined music */
+ if (pos < 0) // undefined music
{
- if (num_music_noconf == 0) /* no fallback music available */
+ if (num_music_noconf == 0) // no fallback music available
return NULL;
pos = UNMAP_NOCONF_MUSIC(pos) % num_music_noconf;
sound_info = checked_calloc(sizeof(struct ArtworkListInfo));
sound_info->type = ARTWORK_TYPE_SOUNDS;
- /* ---------- initialize file list and suffix lists ---------- */
+ // ---------- initialize file list and suffix lists ----------
sound_info->num_file_list_entries = num_file_list_entries;
sound_info->num_dynamic_file_list_entries = 0;
sound_info->suffix_list = config_suffix_list;
- /* ---------- initialize base prefix and suffixes lists ---------- */
+ // ---------- initialize base prefix and suffixes lists ----------
sound_info->num_base_prefixes = 0;
for (i = 0; base_prefixes[i] != NULL; i++)
sound_info->property_mapping = NULL;
- /* ---------- initialize artwork reference and content lists ---------- */
+ // ---------- initialize artwork reference and content lists ----------
sound_info->sizeof_artwork_list_entry = sizeof(SoundInfo *);
sound_info->content_list = NULL;
- /* ---------- initialize artwork loading/freeing functions ---------- */
+ // ---------- initialize artwork loading/freeing functions ----------
sound_info->load_artwork = Load_WAV;
sound_info->free_artwork = FreeSound;
music_info = checked_calloc(sizeof(struct ArtworkListInfo));
music_info->type = ARTWORK_TYPE_MUSIC;
- /* ---------- initialize file list and suffix lists ---------- */
+ // ---------- initialize file list and suffix lists ----------
music_info->num_file_list_entries = num_file_list_entries;
music_info->num_dynamic_file_list_entries = 0;
music_info->suffix_list = config_suffix_list;
- /* ---------- initialize base prefix and suffixes lists ---------- */
+ // ---------- initialize base prefix and suffixes lists ----------
music_info->num_base_prefixes = 0;
for (i = 0; base_prefixes[i] != NULL; i++)
music_info->property_mapping = NULL;
- /* ---------- initialize artwork reference and content lists ---------- */
+ // ---------- initialize artwork reference and content lists ----------
music_info->sizeof_artwork_list_entry = sizeof(MusicInfo *);
music_info->content_list = NULL;
- /* ---------- initialize artwork loading/freeing functions ---------- */
+ // ---------- initialize artwork loading/freeing functions ----------
music_info->load_artwork = Load_WAV_or_MOD;
music_info->free_artwork = FreeMusic;
else if (stereo_position > SOUND_MAX_RIGHT)
stereo_position = SOUND_MAX_RIGHT;
- clear_mem(&snd_ctrl, sizeof(SoundControl)); /* to make valgrind happy */
+ clear_mem(&snd_ctrl, sizeof(SoundControl)); // to make valgrind happy
snd_ctrl.active = TRUE;
snd_ctrl.nr = nr;
if (!audio.sound_available)
return;
- clear_mem(&snd_ctrl, sizeof(SoundControl)); /* to make valgrind happy */
+ clear_mem(&snd_ctrl, sizeof(SoundControl)); // to make valgrind happy
snd_ctrl.active = FALSE;
snd_ctrl.nr = nr;
if (!audio.sound_available)
return;
- clear_mem(&snd_ctrl, sizeof(SoundControl)); /* to make valgrind happy */
+ clear_mem(&snd_ctrl, sizeof(SoundControl)); // to make valgrind happy
snd_ctrl.active = active;
snd_ctrl.state = SND_CTRL_EXPIRE_LOOPS;
LoadArtworkConfig(music_info);
ReloadCustomArtworkList(music_info);
- /* load all music files from directory not defined in "musicinfo.conf" */
+ // load all music files from directory not defined in "musicinfo.conf"
LoadCustomMusic_NoConf();
}
FreeAllMusic_NoConf();
}
-/* THE STUFF ABOVE IS ONLY USED BY THE MAIN PROCESS */
-/* ========================================================================= */
+// THE STUFF ABOVE IS ONLY USED BY THE MAIN PROCESS
+// ============================================================================
#include "system.h"
-/* values for platform specific sound initialization */
+// values for platform specific sound initialization
#define AUDIO_SAMPLE_RATE_22050 22050
#define AUDIO_FRAGMENT_SIZE_512 512
#define FIRST_SOUND_CHANNEL 1
-/* values for PlaySound(), StopSound() and friends */
+// values for PlaySound(), StopSound() and friends
#define SND_CTRL_NONE (0)
#define SND_CTRL_MUSIC (1 << 0)
#define SND_CTRL_LOOP (1 << 1)
#define SOUND_MIDDLE (SOUND_MAX_LEFT2RIGHT / 2)
-/* general sound functions */
+// general sound functions
void UnixOpenAudio(void);
void UnixCloseAudio(void);
-/* mixer functions */
+// mixer functions
void Mixer_InitChannels(void);
void StartMixer(void);
-/* sound client functions */
+// sound client functions
void PlayMusic(int);
void PlayMusicLoop(int);
void PlaySound(int);
#include "joystick.h"
#include "misc.h"
-#define ENABLE_UNUSED_CODE 0 /* currently unused functions */
+#define ENABLE_UNUSED_CODE 0 // currently unused functions
-/* ========================================================================= */
-/* exported variables */
-/* ========================================================================= */
+// ============================================================================
+// exported variables
+// ============================================================================
struct ProgramInfo program;
struct NetworkInfo network;
int FrameCounter = 0;
-/* ========================================================================= */
-/* init/close functions */
-/* ========================================================================= */
+// ============================================================================
+// init/close functions
+// ============================================================================
void InitProgramInfo(char *argv0, char *config_filename, char *userdata_subdir,
char *program_title, char *icon_title,
{
program.exit_function = exit_function;
- /* set signal handlers to custom exit function */
+ // set signal handlers to custom exit function
// signal(SIGINT, exit_function);
signal(SIGTERM, exit_function);
- /* set exit function to automatically cleanup SDL stuff after exit() */
+ // set exit function to automatically cleanup SDL stuff after exit()
atexit(SDL_Quit);
}
gfx.field_save_buffer = field_save_buffer;
- SetDrawDeactivationMask(REDRAW_NONE); /* do not deactivate drawing */
- SetDrawBackgroundMask(REDRAW_NONE); /* deactivate masked drawing */
+ SetDrawDeactivationMask(REDRAW_NONE); // do not deactivate drawing
+ SetDrawBackgroundMask(REDRAW_NONE); // deactivate masked drawing
}
void InitGfxTileSizeInfo(int game_tile_size, int standard_tile_size)
void InitGfxScrollbufferInfo(int scrollbuffer_width, int scrollbuffer_height)
{
- /* currently only used by MSDOS code to alloc VRAM buffer, if available */
- /* 2009-03-24: also (temporarily?) used for overlapping blit workaround */
+ // currently only used by MSDOS code to alloc VRAM buffer, if available
+ // 2009-03-24: also (temporarily?) used for overlapping blit workaround
gfx.scrollbuffer_width = scrollbuffer_width;
gfx.scrollbuffer_height = scrollbuffer_height;
}
else
gfx.background_bitmap_mask &= ~mask;
- if (background_bitmap_tile == NULL) /* empty background requested */
+ if (background_bitmap_tile == NULL) // empty background requested
return;
if (mask == REDRAW_ALL)
void SetWindowBackgroundBitmap(Bitmap *background_bitmap_tile)
{
- /* remove every mask before setting mask for window */
- /* (!!! TO BE FIXED: The whole REDRAW_* system really sucks! !!!) */
- SetBackgroundBitmap(NULL, 0xffff); /* !!! FIX THIS !!! */
+ // remove every mask before setting mask for window
+ // (!!! TO BE FIXED: The whole REDRAW_* system really sucks! !!!)
+ SetBackgroundBitmap(NULL, 0xffff); // !!! FIX THIS !!!
SetBackgroundBitmap(background_bitmap_tile, REDRAW_ALL);
}
void SetMainBackgroundBitmap(Bitmap *background_bitmap_tile)
{
- /* remove window area mask before setting mask for main area */
- /* (!!! TO BE FIXED: The whole REDRAW_* system really sucks! !!!) */
- SetBackgroundBitmap(NULL, REDRAW_ALL); /* !!! FIX THIS !!! */
+ // remove window area mask before setting mask for main area
+ // (!!! TO BE FIXED: The whole REDRAW_* system really sucks! !!!)
+ SetBackgroundBitmap(NULL, REDRAW_ALL); // !!! FIX THIS !!!
SetBackgroundBitmap(background_bitmap_tile, REDRAW_FIELD);
}
void SetDoorBackgroundBitmap(Bitmap *background_bitmap_tile)
{
- /* remove window area mask before setting mask for door area */
- /* (!!! TO BE FIXED: The whole REDRAW_* system really sucks! !!!) */
- SetBackgroundBitmap(NULL, REDRAW_ALL); /* !!! FIX THIS !!! */
+ // remove window area mask before setting mask for door area
+ // (!!! TO BE FIXED: The whole REDRAW_* system really sucks! !!!)
+ SetBackgroundBitmap(NULL, REDRAW_ALL); // !!! FIX THIS !!!
SetBackgroundBitmap(background_bitmap_tile, REDRAW_DOOR_1);
}
-/* ========================================================================= */
-/* video functions */
-/* ========================================================================= */
+// ============================================================================
+// video functions
+// ============================================================================
static int GetRealDepth(int depth)
{
Bitmap *CreateBitmap(int width, int height, int depth)
{
Bitmap *new_bitmap = CreateBitmapStruct();
- int real_width = MAX(1, width); /* prevent zero bitmap width */
- int real_height = MAX(1, height); /* prevent zero bitmap height */
+ int real_width = MAX(1, width); // prevent zero bitmap width
+ int real_height = MAX(1, height); // prevent zero bitmap height
int real_depth = GetRealDepth(depth);
SDLCreateBitmapContent(new_bitmap, real_width, real_height, real_depth);
{
if (*bitmap != NULL)
{
- /* if new bitmap size fits into old one, no need to re-create it */
+ // if new bitmap size fits into old one, no need to re-create it
if (width <= (*bitmap)->width &&
height <= (*bitmap)->height)
return;
- /* else adjust size so that old and new bitmap size fit into it */
+ // else adjust size so that old and new bitmap size fit into it
width = MAX(width, (*bitmap)->width);
height = MAX(height, (*bitmap)->height);
}
{
int clip_x, clip_y, clip_width, clip_height;
- if (gfx.clipping_enabled && is_dest) /* only clip destination bitmap */
+ if (gfx.clipping_enabled && is_dest) // only clip destination bitmap
{
clip_x = MIN(MAX(0, gfx.clip_x), bitmap->width);
clip_y = MIN(MAX(0, gfx.clip_y), bitmap->height);
clip_height = bitmap->height;
}
- /* skip if rectangle completely outside bitmap */
+ // skip if rectangle completely outside bitmap
if (*x + *width <= clip_x ||
*y + *height <= clip_y ||
*y >= clip_y + clip_height)
return FALSE;
- /* clip if rectangle overlaps bitmap */
+ // clip if rectangle overlaps bitmap
if (*x < clip_x)
{
!InClippedRectangle(dst_bitmap, &dst_x, &dst_y, &width, &height, TRUE))
return;
- /* source x/y might need adjustment if destination x/y was clipped top/left */
+ // source x/y might need adjustment if destination x/y was clipped top/left
src_x += dst_x - dst_x_unclipped;
src_y += dst_y - dst_y_unclipped;
#if defined(TARGET_SDL2)
- /* !!! 2013-12-11: An "old friend" is back. Same bug in SDL2 2.0.1 !!! */
- /* !!! 2009-03-30: Fixed by using self-compiled, patched SDL.dll !!! */
+ // !!! 2013-12-11: An "old friend" is back. Same bug in SDL2 2.0.1 !!!
+ // !!! 2009-03-30: Fixed by using self-compiled, patched SDL.dll !!!
/* (This bug still exists in the actual (as of 2009-06-15) version 1.2.13,
but is already fixed in SVN and should therefore finally be fixed with
the next official SDL release, which is probably version 1.2.14.) */
- /* !!! 2009-03-24: It seems that this problem still exists in 1.2.12 !!! */
+ // !!! 2009-03-24: It seems that this problem still exists in 1.2.12 !!!
if (src_bitmap == dst_bitmap)
{
static int tmp_bitmap_xsize = 0;
static int tmp_bitmap_ysize = 0;
- /* start with largest static bitmaps for initial bitmap size ... */
+ // start with largest static bitmaps for initial bitmap size ...
if (tmp_bitmap_xsize == 0 && tmp_bitmap_ysize == 0)
{
tmp_bitmap_xsize = MAX(gfx.win_xsize, gfx.scrollbuffer_width);
tmp_bitmap_ysize = MAX(gfx.win_ysize, gfx.scrollbuffer_height);
}
- /* ... and allow for later re-adjustments due to custom artwork bitmaps */
+ // ... and allow for later re-adjustments due to custom artwork bitmaps
if (src_bitmap->width > tmp_bitmap_xsize ||
src_bitmap->height > tmp_bitmap_ysize)
{
int fade_mode, int fade_delay, int post_delay,
void (*draw_border_function)(void))
{
- /* (use destination bitmap "backbuffer" -- "bitmap_cross" may be undefined) */
+ // (use destination bitmap "backbuffer" -- "bitmap_cross" may be undefined)
if (!InClippedRectangle(backbuffer, &x, &y, &width, &height, TRUE))
return;
{
if (DrawingOnBackground(dst_x, dst_y))
{
- /* draw background */
+ // draw background
BlitBitmap(gfx.background_bitmap, dst_bitmap, dst_x, dst_y, width, height,
dst_x, dst_y);
- /* draw foreground */
+ // draw foreground
BlitBitmapMasked(src_bitmap, dst_bitmap, src_x, src_y, width, height,
dst_x, dst_y);
}
char *filename = getCustomImageFilename(basename);
Bitmap *new_bitmap;
- if (filename == NULL) /* (should never happen) */
+ if (filename == NULL) // (should never happen)
{
Error(ERR_WARN, "ReloadCustomImage(): cannot find file '%s'", basename);
return;
old_width = old_bitmap->width;
old_height = old_bitmap->height;
- /* calculate new image dimensions for final image size */
+ // calculate new image dimensions for final image size
width_final = old_width * zoom_factor;
height_final = old_height * zoom_factor;
- /* get image with final size (this might require scaling up) */
- /* ("final" size may result in non-standard tile size image) */
+ // get image with final size (this might require scaling up)
+ // ("final" size may result in non-standard tile size image)
if (zoom_factor != 1)
tmp_bitmap_final = ZoomBitmap(old_bitmap, width_final, height_final);
else
if (create_small_bitmaps)
{
- /* check if we have a non-gameplay tile size image */
+ // check if we have a non-gameplay tile size image
if (tile_size != gfx.game_tile_size)
{
- /* get image with gameplay tile size */
+ // get image with gameplay tile size
width_0 = width_final * gfx.game_tile_size / tile_size;
height_0 = height_final * gfx.game_tile_size / tile_size;
UPDATE_BUSY_STATE();
}
- /* check if we have a non-standard tile size image */
+ // check if we have a non-standard tile size image
if (tile_size != gfx.standard_tile_size)
{
- /* get image with standard tile size */
+ // get image with standard tile size
width_1 = width_final * gfx.standard_tile_size / tile_size;
height_1 = height_final * gfx.standard_tile_size / tile_size;
UPDATE_BUSY_STATE();
}
- /* calculate new image dimensions for small images */
+ // calculate new image dimensions for small images
width_2 = width_1 / 2;
height_2 = height_1 / 2;
width_4 = width_1 / 4;
width_32 = width_1 / 32;
height_32 = height_1 / 32;
- /* get image with 1/2 of normal size (for use in the level editor) */
+ // get image with 1/2 of normal size (for use in the level editor)
if (width_2 == old_width)
tmp_bitmap_2 = old_bitmap;
else
UPDATE_BUSY_STATE();
- /* get image with 1/4 of normal size (for use in the level editor) */
+ // get image with 1/4 of normal size (for use in the level editor)
if (width_4 == old_width)
tmp_bitmap_4 = old_bitmap;
else
UPDATE_BUSY_STATE();
- /* get image with 1/8 of normal size (for use on the preview screen) */
+ // get image with 1/8 of normal size (for use on the preview screen)
if (width_8 == old_width)
tmp_bitmap_8 = old_bitmap;
else
UPDATE_BUSY_STATE();
- /* get image with 1/16 of normal size (for use on the preview screen) */
+ // get image with 1/16 of normal size (for use on the preview screen)
if (width_16 == old_width)
tmp_bitmap_16 = old_bitmap;
else
UPDATE_BUSY_STATE();
- /* get image with 1/32 of normal size (for use on the preview screen) */
+ // get image with 1/32 of normal size (for use on the preview screen)
if (width_32 == old_width)
tmp_bitmap_32 = old_bitmap;
else
if (free_old_bitmap)
{
- /* copy image filename from old to new standard sized bitmap */
+ // copy image filename from old to new standard sized bitmap
bitmaps[IMG_BITMAP_STANDARD]->source_filename =
getStringCopy(old_bitmap->source_filename);
}
-/* ------------------------------------------------------------------------- */
-/* mouse pointer functions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// mouse pointer functions
+// ----------------------------------------------------------------------------
#define USE_ONE_PIXEL_PLAYFIELD_MOUSEPOINTER 0
-/* XPM image definitions */
+// XPM image definitions
static const char *cursor_image_none[] =
{
- /* width height num_colors chars_per_pixel */
+ // width height num_colors chars_per_pixel
" 16 16 3 1",
- /* colors */
+ // colors
"X c #000000",
". c #ffffff",
" c None",
- /* pixels */
+ // pixels
" ",
" ",
" ",
" ",
" ",
- /* hot spot */
+ // hot spot
"0,0"
};
#if USE_ONE_PIXEL_PLAYFIELD_MOUSEPOINTER
static const char *cursor_image_dot[] =
{
- /* width height num_colors chars_per_pixel */
+ // width height num_colors chars_per_pixel
" 16 16 3 1",
- /* colors */
+ // colors
"X c #000000",
". c #ffffff",
" c None",
- /* pixels */
+ // pixels
" X ",
"X.X ",
" X ",
" ",
" ",
- /* hot spot */
+ // hot spot
"1,1"
};
static const char **cursor_image_playfield = cursor_image_dot;
}
-/* ========================================================================= */
-/* audio functions */
-/* ========================================================================= */
+// ============================================================================
+// audio functions
+// ============================================================================
void OpenAudio(void)
{
- /* always start with reliable default values */
+ // always start with reliable default values
audio.sound_available = FALSE;
audio.music_available = FALSE;
audio.loops_available = FALSE;
}
-/* ========================================================================= */
-/* event functions */
-/* ========================================================================= */
+// ============================================================================
+// event functions
+// ============================================================================
boolean PendingEvent(void)
{
Key GetEventKey(KeyEvent *event, boolean with_modifiers)
{
#if defined(TARGET_SDL2)
- /* key up/down events in SDL2 do not return text characters anymore */
+ // key up/down events in SDL2 do not return text characters anymore
return event->keysym.sym;
#else
{
static KeyMod current_modifiers = KMOD_None;
- if (key != KSYM_UNDEFINED) /* new key => check for modifier key change */
+ if (key != KSYM_UNDEFINED) // new key => check for modifier key change
{
KeyMod new_modifier = KMOD_None;
if (event->type != EVENT_CLIENTMESSAGE)
return FALSE;
- return TRUE; /* the only possible message here is SDL_QUIT */
+ return TRUE; // the only possible message here is SDL_QUIT
}
-/* ========================================================================= */
-/* joystick functions */
-/* ========================================================================= */
+// ============================================================================
+// joystick functions
+// ============================================================================
void InitJoysticks(void)
{
int i;
#if defined(NO_JOYSTICK)
- return; /* joysticks generally deactivated by compile-time directive */
+ return; // joysticks generally deactivated by compile-time directive
#endif
- /* always start with reliable default values */
+ // always start with reliable default values
joystick.status = JOYSTICK_NOT_AVAILABLE;
for (i = 0; i < MAX_PLAYERS; i++)
- joystick.nr[i] = -1; /* no joystick configured */
+ joystick.nr[i] = -1; // no joystick configured
SDLInitJoysticks();
}
#include "sdl.h"
-/* the additional 'b' is needed for Win32 to open files in binary mode */
+// the additional 'b' is needed for Win32 to open files in binary mode
#define MODE_READ "rb"
#define MODE_WRITE "wb"
#define MODE_APPEND "ab"
#define BLIT_INVERSE 2
#define BLIT_ON_BACKGROUND 3
-/* values for fullscreen status */
+// values for fullscreen status
#define FULLSCREEN_NOT_AVAILABLE FALSE
#define FULLSCREEN_AVAILABLE TRUE
-/* values for window scaling */
+// values for window scaling
#define WINDOW_SCALING_NOT_AVAILABLE FALSE
#define WINDOW_SCALING_AVAILABLE TRUE
#define MAX_WINDOW_SCALING_PERCENT 400
#define STEP_WINDOW_SCALING_PERCENT 10
-/* values for window scaling quality */
+// values for window scaling quality
#define SCALING_QUALITY_NEAREST "nearest"
#define SCALING_QUALITY_LINEAR "linear"
#define SCALING_QUALITY_BEST "best"
#define SCALING_QUALITY_DEFAULT SCALING_QUALITY_LINEAR
-/* values for screen rendering mode */
+// values for screen rendering mode
#define STR_SPECIAL_RENDERING_OFF "stream_texture_only"
#define STR_SPECIAL_RENDERING_BITMAP "bitmap_and_stream_texture"
#define STR_SPECIAL_RENDERING_TARGET "target_texture_only"
#define SPECIAL_RENDERING_DEFAULT SPECIAL_RENDERING_BITMAP
#endif
-/* values for vertical screen retrace synchronization (vsync) */
+// values for vertical screen retrace synchronization (vsync)
#define STR_VSYNC_MODE_OFF "off"
#define STR_VSYNC_MODE_NORMAL "normal"
#define STR_VSYNC_MODE_ADAPTIVE "adaptive"
#define VSYNC_MODE_DEFAULT VSYNC_MODE_OFF
-/* values for network server settings */
+// values for network server settings
#define STR_NETWORK_AUTO_DETECT "auto_detect_network_server"
#define STR_NETWORK_AUTO_DETECT_SETUP "(auto detect network server)"
-/* values for touch control */
+// values for touch control
#define TOUCH_CONTROL_OFF "off"
#define TOUCH_CONTROL_VIRTUAL_BUTTONS "virtual_buttons"
#define TOUCH_CONTROL_WIPE_GESTURES "wipe_gestures"
#define ALPHA_FROM_TRANSPARENCY(x) ((100 - x) * SDL_ALPHA_OPAQUE / 100)
#define ALPHA_FADING_STEPSIZE(x) ((x) / 25)
-/* values for special settings for mobile devices */
+// values for special settings for mobile devices
#if defined(PLATFORM_ANDROID)
#define USE_TOUCH_INPUT_OVERLAY
#define USE_COMPLETE_DISPLAY
#define SCREEN_KEYBOARD_POS(h) ((h) / 2)
#endif
-/* default input keys */
+// default input keys
#define DEFAULT_KEY_LEFT KSYM_Left
#define DEFAULT_KEY_RIGHT KSYM_Right
#define DEFAULT_KEY_UP KSYM_Up
#define DEFAULT_KEY_OKAY KSYM_Return
#define DEFAULT_KEY_CANCEL KSYM_Escape
-/* default shortcut keys */
+// default shortcut keys
#define DEFAULT_KEY_SAVE_GAME KSYM_F1
#define DEFAULT_KEY_LOAD_GAME KSYM_F2
#define DEFAULT_KEY_TOGGLE_PAUSE KSYM_space
#define DEFAULT_KEY_SNAP_UP KSYM_UNDEFINED
#define DEFAULT_KEY_SNAP_DOWN KSYM_UNDEFINED
-/* default debug setup keys and values */
+// default debug setup keys and values
#define DEFAULT_FRAME_DELAY_0 20 // 100 % speed
#define DEFAULT_FRAME_DELAY_1 500 // 4 % speed
#define DEFAULT_FRAME_DELAY_2 250 // 8 % speed
#define DEFAULT_FRAME_DELAY_USE_MOD_KEY FALSE
#define DEFAULT_FRAME_DELAY_GAME_ONLY TRUE
-/* values for key_status */
+// values for key_status
#define KEY_NOT_PRESSED FALSE
#define KEY_RELEASED FALSE
#define KEY_PRESSED TRUE
-/* values for button status */
+// values for button status
#define MB_NOT_PRESSED FALSE
#define MB_NOT_RELEASED TRUE
#define MB_RELEASED FALSE
(b) == MB_MIDDLEBUTTON ? 5 : \
(b) == MB_RIGHTBUTTON ? 10 : 1)
-/* values for move directions */
+// values for move directions
#define MV_BIT_LEFT 0
#define MV_BIT_RIGHT 1
#define MV_BIT_UP 2
#define NUM_DIRECTIONS 4
-/* diagonal movement directions are used in a different contect than buttons */
+// diagonal movement directions are used in a different contect than buttons
#define MV_BIT_UPLEFT 4
#define MV_BIT_UPRIGHT 5
#define MV_BIT_DOWNLEFT 6
#define NUM_DIRECTIONS_FULL 8
-/* values for special "button" bitmasks */
+// values for special "button" bitmasks
#define BUTTON_1 4
#define BUTTON_2 5
#define NUM_PLAYER_ACTIONS 6
-/* values for special "focus player" bitmasks */
+// values for special "focus player" bitmasks
#define BIT_SET_FOCUS 6
-/* values for drawing stages for global animations */
+// values for drawing stages for global animations
#define DRAW_GLOBAL_ANIM_STAGE_1 1
#define DRAW_GLOBAL_ANIM_STAGE_2 2
-/* values for drawing target (various functions) */
+// values for drawing target (various functions)
#define DRAW_TO_BACKBUFFER 0
#define DRAW_TO_FIELDBUFFER 1
#define DRAW_TO_SCREEN 2
#define DRAW_TO_FADE_SOURCE 3
#define DRAW_TO_FADE_TARGET 4
-/* values for move directions and special "button" key bitmasks */
+// values for move directions and special "button" key bitmasks
#define MV_NONE 0
#define MV_LEFT (1 << MV_BIT_LEFT)
#define MV_RIGHT (1 << MV_BIT_RIGHT)
(x) == MV_DOWNRIGHT ? MV_UPLEFT : \
MV_NONE)
-/* values for animation mode (frame order and direction) */
-/* (stored in level files -- never change existing values) */
+// values for animation mode (frame order and direction)
+// (stored in level files -- never change existing values)
#define ANIM_NONE 0
#define ANIM_LOOP (1 << 0)
#define ANIM_LINEAR (1 << 1)
#define ANIM_REVERSE (1 << 8)
#define ANIM_OPAQUE_PLAYER (1 << 9)
-/* values for special (non game element) animation modes */
-/* (not stored in level files -- can be changed, if needed) */
+// values for special (non game element) animation modes
+// (not stored in level files -- can be changed, if needed)
#define ANIM_HORIZONTAL (1 << 10)
#define ANIM_VERTICAL (1 << 11)
#define ANIM_CENTERED (1 << 12)
#define ANIM_DEFAULT ANIM_LOOP
-/* values for special drawing styles (currently only for crumbled graphics) */
+// values for special drawing styles (currently only for crumbled graphics)
#define STYLE_NONE 0
#define STYLE_ACCURATE_BORDERS (1 << 0)
#define STYLE_INNER_CORNERS (1 << 1)
#define STYLE_REVERSE (1 << 2)
-/* values for special event handling style (used for global animation) */
+// values for special event handling style (used for global animation)
#define STYLE_PASSTHROUGH (1 << 3)
#define STYLE_MULTIPLE_ACTIONS (1 << 4)
#define STYLE_DEFAULT STYLE_NONE
-/* values for special global animation events */
+// values for special global animation events
#define ANIM_EVENT_NONE 0
#define ANIM_EVENT_SELF (1 << 16)
#define ANIM_EVENT_ANY (1 << 17)
#define ANIM_EVENT_DEFAULT ANIM_EVENT_NONE
-/* values for special global animation event actions */
+// values for special global animation event actions
#define ANIM_EVENT_ACTION_NONE -1
-/* values for fade mode */
+// values for fade mode
#define FADE_TYPE_NONE 0
#define FADE_TYPE_FADE_IN (1 << 0)
#define FADE_TYPE_FADE_OUT (1 << 1)
#define FADE_MODE_DEFAULT FADE_MODE_FADE
-/* values for toon positions */
+// values for toon positions
#define POS_UNDEFINED -1
#define POS_LEFT 0
#define POS_RIGHT 1
#define POS_ANY 7
#define POS_LAST 8
-/* values for text alignment */
+// values for text alignment
#define ALIGN_LEFT (1 << 0)
#define ALIGN_RIGHT (1 << 1)
#define ALIGN_CENTER (1 << 2)
#define ALIGNED_TEXT_XPOS(p) ALIGNED_XPOS((p)->x, (p)->width, (p)->align)
#define ALIGNED_TEXT_YPOS(p) ALIGNED_YPOS((p)->y, (p)->height, (p)->valign)
-/* values for redraw_mask */
+// values for redraw_mask
#define REDRAW_NONE (0)
#define REDRAW_ALL (1 << 0)
#define REDRAW_FIELD (1 << 1)
#define IN_GFX_DOOR_3(x, y) (x >= gfx.ex && x < gfx.ex + gfx.exsize && \
y >= gfx.ey && y < gfx.ey + gfx.eysize)
-/* values for mouse cursor */
+// values for mouse cursor
#define CURSOR_DEFAULT 0
#define CURSOR_NONE 1
#define CURSOR_PLAYFIELD 2
-/* fundamental game speed values */
-#define ONE_SECOND_DELAY 1000 /* delay value for one second */
-#define MENU_FRAME_DELAY 20 /* frame delay in milliseconds */
-#define GAME_FRAME_DELAY 20 /* frame delay in milliseconds */
-#define FFWD_FRAME_DELAY 10 /* 200% speed for fast forward */
-#define MIN_VSYNC_FRAME_DELAY 15 /* minimum value for vsync to keep */
-#define MAX_VSYNC_FRAME_DELAY 16 /* maximum value for vsync to work */
+// fundamental game speed values
+#define ONE_SECOND_DELAY 1000 // delay value for one second
+#define MENU_FRAME_DELAY 20 // frame delay in milliseconds
+#define GAME_FRAME_DELAY 20 // frame delay in milliseconds
+#define FFWD_FRAME_DELAY 10 // 200% speed for fast forward
+#define MIN_VSYNC_FRAME_DELAY 15 // minimum value for vsync to keep
+#define MAX_VSYNC_FRAME_DELAY 16 // maximum value for vsync to work
#define FRAMES_PER_SECOND (ONE_SECOND_DELAY / GAME_FRAME_DELAY)
#define FRAMES_PER_SECOND_SP 35
-/* maximum playfield size supported by libgame functions */
+// maximum playfield size supported by libgame functions
#define MAX_PLAYFIELD_WIDTH 128
#define MAX_PLAYFIELD_HEIGHT 128
-/* maximum number of parallel players supported by libgame functions */
+// maximum number of parallel players supported by libgame functions
#define MAX_PLAYERS 4
-/* maximum allowed length of player name */
+// maximum allowed length of player name
#define MAX_PLAYER_NAME_LEN 10
-/* maximum number of levels in a level set */
+// maximum number of levels in a level set
#define MAX_LEVELS 1000
-/* maximum number of global animation and parts */
+// maximum number of global animation and parts
#define MAX_GLOBAL_ANIMS 32
#define MAX_GLOBAL_ANIM_PARTS 32
-/* minimum/maximum/default x/y grid size for virtual buttons */
+// minimum/maximum/default x/y grid size for virtual buttons
#define MIN_GRID_XSIZE 3
#define MIN_GRID_YSIZE 3
#define MAX_GRID_XSIZE 32
#define GRID_ACTIVE_NR() (video.screen_width > \
video.screen_height ? 0 : 1)
-/* values for grid button characters for virtual buttons */
+// values for grid button characters for virtual buttons
#define CHAR_GRID_BUTTON_NONE ' '
#define CHAR_GRID_BUTTON_LEFT '<'
#define CHAR_GRID_BUTTON_RIGHT '>'
JOY_BUTTON_2 : \
JOY_NO_ACTION)
-/* default name for empty highscore entry */
+// default name for empty highscore entry
#define EMPTY_PLAYER_NAME "no name"
-/* default name for unknown player names */
+// default name for unknown player names
#define ANONYMOUS_NAME "anonymous"
-/* default for other unknown names */
+// default for other unknown names
#define UNKNOWN_NAME "unknown"
-/* default name for new levels */
+// default name for new levels
#define NAMELESS_LEVEL_NAME "nameless level"
-/* default text for non-existant artwork */
+// default text for non-existant artwork
#define NOT_AVAILABLE "(not available)"
-/* default value for undefined filename */
+// default value for undefined filename
#define UNDEFINED_FILENAME "[NONE]"
-/* default value for undefined levelset */
+// default value for undefined levelset
#define UNDEFINED_LEVELSET "[NONE]"
-/* default value for undefined parameter */
+// default value for undefined parameter
#define ARG_DEFAULT "[DEFAULT]"
-/* default values for undefined configuration file parameters */
+// default values for undefined configuration file parameters
#define ARG_UNDEFINED "-1000000"
#define ARG_UNDEFINED_VALUE (-1000000)
-/* default value for off-screen positions */
+// default value for off-screen positions
#define POS_OFFSCREEN (-1000000)
-/* definitions for game sub-directories */
+// definitions for game sub-directories
#ifndef RO_GAME_DIR
#define RO_GAME_DIR "."
#endif
#define RO_BASE_PATH RO_GAME_DIR
#define RW_BASE_PATH RW_GAME_DIR
-/* directory names */
+// directory names
#define GRAPHICS_DIRECTORY "graphics"
#define SOUNDS_DIRECTORY "sounds"
#define MUSIC_DIRECTORY "music"
#define DEFAULT_LEVELSET (setup.internal.default_level_series)
-/* file names and filename extensions */
+// file names and filename extensions
#define LEVELSETUP_DIRECTORY "levelsetup"
#define SETUP_FILENAME "setup.conf"
#define AUTOSETUP_FILENAME "autosetup.conf"
#endif
-/* areas in bitmap PIX_DOOR */
+// areas in bitmap PIX_DOOR
/* meaning in PIX_DB_DOOR: (3 PAGEs)
PAGEX1: 1. buffer for DOOR_1
PAGEX2: 2. buffer for DOOR_1
PAGEX3: buffer for animations
*/
-/* these values are hard-coded to be able to use them in initialization */
-#define DOOR_GFX_PAGE_WIDTH 100 /* should be set to "gfx.dxsize" */
-#define DOOR_GFX_PAGE_HEIGHT 280 /* should be set to "gfx.dysize" */
+// these values are hard-coded to be able to use them in initialization
+#define DOOR_GFX_PAGE_WIDTH 100 // should be set to "gfx.dxsize"
+#define DOOR_GFX_PAGE_HEIGHT 280 // should be set to "gfx.dysize"
#define DOOR_GFX_PAGESIZE (DOOR_GFX_PAGE_WIDTH)
#define DOOR_GFX_PAGEX1 (0 * DOOR_GFX_PAGESIZE)
#define DOOR_GFX_PAGEY2 (DOOR_GFX_PAGE_HEIGHT)
-/* macros for version handling */
+// macros for version handling
#define VERSION_PART_1(x) ((x) / 1000000)
#define VERSION_PART_2(x) (((x) % 1000000) / 10000)
#define VERSION_PART_3(x) (((x) % 10000) / 100)
#define VERSION_IDENT(a,b,c,d) ((a) * 1000000 + (b) * 10000 + (c) * 100 + (d))
-/* macros for parent/child process identification */
+// macros for parent/child process identification
#if defined(PLATFORM_UNIX)
#define IS_PARENT_PROCESS() (audio.mixer_pid != getpid())
#define IS_CHILD_PROCESS() (audio.mixer_pid == getpid())
#endif
-/* values for artwork type */
+// values for artwork type
#define ARTWORK_TYPE_GRAPHICS 0
#define ARTWORK_TYPE_SOUNDS 1
#define ARTWORK_TYPE_MUSIC 2
#define NUM_ARTWORK_TYPES 3
-/* values for tree type (chosen to match artwork type) */
+// values for tree type (chosen to match artwork type)
#define TREE_TYPE_UNDEFINED -1
#define TREE_TYPE_GRAPHICS_DIR ARTWORK_TYPE_GRAPHICS
#define TREE_TYPE_SOUNDS_DIR ARTWORK_TYPE_SOUNDS
INFOTEXT_MUSIC_DIR : \
INFOTEXT_UNDEFINED)
-/* values for artwork handling */
+// values for artwork handling
#define LEVELDIR_ARTWORK_SET_PTR(leveldir, type) \
((type) == ARTWORK_TYPE_GRAPHICS ? \
&(leveldir)->graphics_set : \
}
-/* structure definitions */
+// structure definitions
struct ProgramInfo
{
- char *command_basepath; /* path to the program binary */
- char *command_basename; /* base filename of the program binary */
+ char *command_basepath; // path to the program binary
+ char *command_basename; // base filename of the program binary
- char *config_filename; /* optional global program config filename */
+ char *config_filename; // optional global program config filename
- char *maindata_path; /* main game data (installation) directory */
+ char *maindata_path; // main game data (installation) directory
- char *userdata_subdir; /* personal user game data directory */
- char *userdata_path; /* resulting full path to game data directory */
+ char *userdata_subdir; // personal user game data directory
+ char *userdata_path; // resulting full path to game data directory
char *program_title;
char *window_title;
char *cookie_prefix;
- char *log_filename[NUM_LOGS]; /* log filenames for out/err messages */
- FILE *log_file[NUM_LOGS]; /* log file handles for out/err files */
- FILE *log_file_default[NUM_LOGS]; /* default log file handles (out/err) */
+ char *log_filename[NUM_LOGS]; // log filenames for out/err messages
+ FILE *log_file[NUM_LOGS]; // log file handles for out/err files
+ FILE *log_file_default[NUM_LOGS]; // default log file handles (out/err)
int version_super;
int version_major;
boolean music_available;
boolean sound_enabled;
- boolean sound_deactivated; /* for temporarily disabling sound */
+ boolean sound_deactivated; // for temporarily disabling sound
int mixer_pipe[2];
int mixer_pid;
{
Bitmap *bitmap;
- int src_x, src_y; /* start position of font characters */
- int width, height; /* width / height of font characters */
+ int src_x, src_y; // start position of font characters
+ int width, height; // width / height of font characters
- int offset_x; /* offset to next font character */
- int offset_y; /* offset to next font character */
+ int offset_x; // offset to next font character
+ int offset_y; // offset to next font character
- int draw_xoffset; /* offset for drawing font characters */
- int draw_yoffset; /* offset for drawing font characters */
+ int draw_xoffset; // offset for drawing font characters
+ int draw_yoffset; // offset for drawing font characters
int num_chars;
int num_chars_per_line;
struct TileCursorInfo
{
- boolean enabled; /* tile cursor generally enabled or disabled */
- boolean active; /* tile cursor activated (depending on game) */
- boolean moving; /* tile cursor moving to target position */
+ boolean enabled; // tile cursor generally enabled or disabled
+ boolean active; // tile cursor activated (depending on game)
+ boolean moving; // tile cursor moving to target position
- int xpos, ypos; /* tile cursor level playfield position */
- int x, y; /* tile cursor current screen position */
- int target_x, target_y; /* tile cursor target screen position */
+ int xpos, ypos; // tile cursor level playfield position
+ int x, y; // tile cursor current screen position
+ int target_x, target_y; // tile cursor target screen position
- int sx, sy; /* tile cursor screen start position */
+ int sx, sy; // tile cursor screen start position
};
struct OverlayInfo
{
- boolean enabled; /* overlay generally enabled or disabled */
- boolean active; /* overlay activated (depending on game mode) */
+ boolean enabled; // overlay generally enabled or disabled
+ boolean active; // overlay activated (depending on game mode)
boolean show_grid;
struct JoystickInfo
{
int status;
- int nr[MAX_PLAYERS]; /* joystick number for each player */
+ int nr[MAX_PLAYERS]; // joystick number for each player
};
struct SetupJoystickInfo
{
- char *device_name; /* device name of player's joystick */
+ char *device_name; // device name of player's joystick
int xleft, xmiddle, xright;
int yupper, ymiddle, ylower;
char grid_button[2][MAX_GRID_XSIZE][MAX_GRID_YSIZE];
- int transparency; /* in percent (0 == opaque, 100 == invisible) */
+ int transparency; // in percent (0 == opaque, 100 == invisible)
boolean draw_outlined;
boolean draw_pressed;
char *graphics_set;
char *sounds_set;
char *music_set;
- int override_level_graphics; /* not boolean -- can also be "AUTO" */
- int override_level_sounds; /* not boolean -- can also be "AUTO" */
- int override_level_music; /* not boolean -- can also be "AUTO" */
+ int override_level_graphics; // not boolean -- can also be "AUTO"
+ int override_level_sounds; // not boolean -- can also be "AUTO"
+ int override_level_music; // not boolean -- can also be "AUTO"
int volume_simple;
int volume_loops;
struct TreeInfo
{
- struct TreeInfo **node_top; /* topmost node in tree */
- struct TreeInfo *node_parent; /* parent level directory info */
- struct TreeInfo *node_group; /* level group sub-directory info */
- struct TreeInfo *next; /* next level series structure node */
-
- int cl_first; /* internal control field for setup screen */
- int cl_cursor; /* internal control field for setup screen */
-
- int type; /* type of tree content */
-
- /* fields for "type == TREE_TYPE_LEVEL_DIR" */
-
- char *subdir; /* tree info sub-directory basename (may be ".") */
- char *fullpath; /* complete path relative to tree base directory */
- char *basepath; /* absolute base path of tree base directory */
- char *identifier; /* identifier string for configuration files */
- char *name; /* tree info name, as displayed in selection menues */
- char *name_sorting; /* optional sorting name for correct name sorting */
- char *author; /* level or artwork author name */
- char *year; /* optional year of creation for levels or artwork */
-
- char *program_title; /* optional alternative text for program title */
- char *program_copyright; /* optional alternative text for program copyright */
- char *program_company; /* optional alternative text for program company */
-
- char *imported_from; /* optional comment for imported levels or artwork */
- char *imported_by; /* optional comment for imported levels or artwork */
- char *tested_by; /* optional comment to name people who tested a set */
-
- char *graphics_set_ecs; /* special EMC custom graphics set (ECS graphics) */
- char *graphics_set_aga; /* special EMC custom graphics set (AGA graphics) */
- char *graphics_set; /* optional custom graphics set (level tree only) */
- char *sounds_set; /* optional custom sounds set (level tree only) */
- char *music_set; /* optional custom music set (level tree only) */
- char *graphics_path; /* path to optional custom graphics set (level only) */
- char *sounds_path; /* path to optional custom sounds set (level only) */
- char *music_path; /* path to optional custom music set (level only) */
-
- char *level_filename; /* filename of level file (for packed level file) */
- char *level_filetype; /* type of levels in level directory or level file */
-
- char *special_flags; /* flags for special actions performed on level file */
-
- int levels; /* number of levels in level series */
- int first_level; /* first level number (to allow start with 0 or 1) */
- int last_level; /* last level number (automatically calculated) */
- int sort_priority; /* sort levels by 'sort_priority' and then by name */
-
- boolean latest_engine;/* force level set to use the latest game engine */
-
- boolean level_group; /* directory contains more level series directories */
- boolean parent_link; /* entry links back to parent directory */
- boolean in_user_dir; /* user defined levels are stored in home directory */
- boolean user_defined; /* levels in user directory and marked as "private" */
- boolean readonly; /* readonly levels can not be changed with editor */
- boolean handicap; /* level set has no handicap when set to "false" */
- boolean skip_levels; /* levels can be skipped when set to "true" */
-
- int color; /* color to use on selection screen for this level */
- char *class_desc; /* description of level series class */
- int handicap_level; /* number of the lowest unsolved level */
-
- char *infotext; /* optional text to describe the tree type (headline) */
+ struct TreeInfo **node_top; // topmost node in tree
+ struct TreeInfo *node_parent; // parent level directory info
+ struct TreeInfo *node_group; // level group sub-directory info
+ struct TreeInfo *next; // next level series structure node
+
+ int cl_first; // internal control field for setup screen
+ int cl_cursor; // internal control field for setup screen
+
+ int type; // type of tree content
+
+ // fields for "type == TREE_TYPE_LEVEL_DIR"
+
+ char *subdir; // tree info sub-directory basename (may be ".")
+ char *fullpath; // complete path relative to tree base directory
+ char *basepath; // absolute base path of tree base directory
+ char *identifier; // identifier string for configuration files
+ char *name; // tree info name, as displayed in selection menues
+ char *name_sorting; // optional sorting name for correct name sorting
+ char *author; // level or artwork author name
+ char *year; // optional year of creation for levels or artwork
+
+ char *program_title; // optional alternative text for program title
+ char *program_copyright; // optional alternative text for program copyright
+ char *program_company; // optional alternative text for program company
+
+ char *imported_from; // optional comment for imported levels or artwork
+ char *imported_by; // optional comment for imported levels or artwork
+ char *tested_by; // optional comment to name people who tested a set
+
+ char *graphics_set_ecs; // special EMC custom graphics set (ECS graphics)
+ char *graphics_set_aga; // special EMC custom graphics set (AGA graphics)
+ char *graphics_set; // optional custom graphics set (level tree only)
+ char *sounds_set; // optional custom sounds set (level tree only)
+ char *music_set; // optional custom music set (level tree only)
+ char *graphics_path; // path to optional custom graphics set (level only)
+ char *sounds_path; // path to optional custom sounds set (level only)
+ char *music_path; // path to optional custom music set (level only)
+
+ char *level_filename; // filename of level file (for packed level file)
+ char *level_filetype; // type of levels in level directory or level file
+
+ char *special_flags; // flags for special actions performed on level file
+
+ int levels; // number of levels in level series
+ int first_level; // first level number (to allow start with 0 or 1)
+ int last_level; // last level number (automatically calculated)
+ int sort_priority; // sort levels by 'sort_priority' and then by name
+
+ boolean latest_engine;// force level set to use the latest game engine
+
+ boolean level_group; // directory contains more level series directories
+ boolean parent_link; // entry links back to parent directory
+ boolean in_user_dir; // user defined levels are stored in home directory
+ boolean user_defined; // levels in user directory and marked as "private"
+ boolean readonly; // readonly levels can not be changed with editor
+ boolean handicap; // level set has no handicap when set to "false"
+ boolean skip_levels; // levels can be skipped when set to "true"
+
+ int color; // color to use on selection screen for this level
+ char *class_desc; // description of level series class
+ int handicap_level; // number of the lowest unsolved level
+
+ char *infotext; // optional text to describe the tree type (headline)
};
typedef struct TreeInfo TreeInfo;
char *default_filename;
char *filename;
- char **default_parameter; /* array of file parameters */
- char **parameter; /* array of file parameters */
+ char **default_parameter; // array of file parameters
+ char **parameter; // array of file parameters
boolean redefined;
boolean fallback_to_default;
struct ListNodeInfo
{
- char *source_filename; /* primary key for node list */
+ char *source_filename; // primary key for node list
int num_references;
};
struct ArtworkListInfo
{
- int type; /* type of artwork */
+ int type; // type of artwork
int num_file_list_entries;
int num_dynamic_file_list_entries;
- struct FileInfo *file_list; /* static artwork file array */
- struct FileInfo *dynamic_file_list; /* dynamic artwrk file array */
+ struct FileInfo *file_list; // static artwork file array
+ struct FileInfo *dynamic_file_list; // dynamic artwrk file array
int num_suffix_list_entries;
- struct ConfigTypeInfo *suffix_list; /* parameter suffixes array */
+ struct ConfigTypeInfo *suffix_list; // parameter suffixes array
int num_base_prefixes;
int num_ext1_suffixes;
int num_ext2_suffixes;
int num_ext3_suffixes;
- char **base_prefixes; /* base token prefixes array */
- char **ext1_suffixes; /* property suffixes array 1 */
- char **ext2_suffixes; /* property suffixes array 2 */
- char **ext3_suffixes; /* property suffixes array 3 */
+ char **base_prefixes; // base token prefixes array
+ char **ext1_suffixes; // property suffixes array 1
+ char **ext2_suffixes; // property suffixes array 2
+ char **ext3_suffixes; // property suffixes array 3
int num_ignore_tokens;
- char **ignore_tokens; /* file tokens to be ignored */
+ char **ignore_tokens; // file tokens to be ignored
int num_property_mapping_entries;
- struct PropertyMapping *property_mapping; /* mapping token -> artwork */
+ struct PropertyMapping *property_mapping; // mapping token -> artwork
int sizeof_artwork_list_entry;
- struct ListNodeInfo **artwork_list; /* static artwork node array */
- struct ListNodeInfo **dynamic_artwork_list; /* dynamic artwrk node array */
- struct ListNode *content_list; /* dynamic artwork node list */
+ struct ListNodeInfo **artwork_list; // static artwork node array
+ struct ListNodeInfo **dynamic_artwork_list; // dynamic artwrk node array
+ struct ListNode *content_list; // dynamic artwork node list
- void *(*load_artwork)(char *); /* constructor function */
- void (*free_artwork)(void *); /* destructor function */
+ void *(*load_artwork)(char *); // constructor function
+ void (*free_artwork)(void *); // destructor function
};
struct XY
struct TextPosInfo
{
int x, y;
- int xoffset; /* special case for tape date and time */
- int xoffset2; /* special case for tape date */
- int yoffset; /* special case for list of preview players */
+ int xoffset; // special case for tape date and time
+ int xoffset2; // special case for tape date
+ int yoffset; // special case for list of preview players
int width, height;
int align, valign;
- int size; /* also used for suffix ".digits" */
+ int size; // also used for suffix ".digits"
int font, font_alt;
boolean draw_masked;
- boolean draw_player; /* special case for network player buttons */
- int sort_priority; /* also used for suffix ".draw_order" */
+ boolean draw_player; // special case for network player buttons
+ int sort_priority; // also used for suffix ".draw_order"
int id;
- int direction; /* needed for panel time/health graphics */
- int class; /* needed for panel time/health graphics */
- int style; /* needed for panel time/health graphics */
+ int direction; // needed for panel time/health graphics
+ int class; // needed for panel time/health graphics
+ int style; // needed for panel time/health graphics
- int tile_size; /* special case for list of network players */
- int border_size; /* special case for list of preview players */
- int vertical; /* special case for list of preview players */
+ int tile_size; // special case for list of network players
+ int border_size; // special case for list of preview players
+ int vertical; // special case for list of preview players
};
struct MouseActionInfo
};
-/* ========================================================================= */
-/* exported variables */
-/* ========================================================================= */
+// ============================================================================
+// exported variables
+// ============================================================================
extern struct ProgramInfo program;
extern struct NetworkInfo network;
extern int FrameCounter;
-/* function definitions */
+// function definitions
void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *,
char *, int);
boolean CheckJoystickOpened(int);
void ClearJoystickState(void);
-#endif /* SYSTEM_H */
+#endif // SYSTEM_H
#include "misc.h"
-/* ========================================================================= */
-/* font functions */
-/* ========================================================================= */
+// ============================================================================
+// font functions
+// ============================================================================
void InitFontInfo(struct FontBitmapInfo *font_bitmap_info, int num_fonts,
int (*select_font_function)(int),
boolean default_font = (font->num_chars == DEFAULT_NUM_CHARS_PER_FONT);
int font_pos = (unsigned char)c - 32;
- /* map some special characters to their ascii values in default font */
+ // map some special characters to their ascii values in default font
if (default_font)
font_pos = MAP_FONT_ASCII(c) - 32;
- /* this allows dynamic special characters together with special font */
+ // this allows dynamic special characters together with special font
if (font_pos < 0 || font_pos >= font->num_chars)
font_pos = 0;
}
-/* ========================================================================= */
-/* text string helper functions */
-/* ========================================================================= */
+// ============================================================================
+// text string helper functions
+// ============================================================================
int maxWordLengthInRequestString(char *text)
{
}
-/* ========================================================================= */
-/* simple text drawing functions */
-/* ========================================================================= */
+// ============================================================================
+// simple text drawing functions
+// ============================================================================
void DrawInitText(char *text, int ypos, int font_nr)
{
if (font->bitmap == NULL)
return;
- /* skip text to be printed outside the window (left/right will be clipped) */
+ // skip text to be printed outside the window (left/right will be clipped)
if (dst_y < 0 || dst_y + font_height > video.height)
return;
- /* add offset for drawing font characters */
+ // add offset for drawing font characters
dst_x += font->draw_xoffset;
dst_y += font->draw_yoffset;
char c = *text_ptr++;
if (c == '\n')
- c = ' '; /* print space instead of newline */
+ c = ' '; // print space instead of newline
getFontCharSource(font_nr, c, &src_bitmap, &src_x, &src_y);
- /* clip text at the left side of the window */
+ // clip text at the left side of the window
if (dst_x < 0)
{
dst_x += font_width;
continue;
}
- /* clip text at the right side of the window */
+ // clip text at the right side of the window
if (dst_x + font_width > video.width)
break;
- if (mask_mode == BLIT_INVERSE) /* special mode for text gadgets */
+ if (mask_mode == BLIT_INVERSE) // special mode for text gadgets
{
- /* first step: draw solid colored rectangle (use "cursor" character) */
- if (strlen(text) == 1) /* only one char inverted => draw cursor */
+ // first step: draw solid colored rectangle (use "cursor" character)
+ if (strlen(text) == 1) // only one char inverted => draw cursor
{
Bitmap *cursor_bitmap;
int cursor_x, cursor_y;
font_width, font_height, dst_x, dst_y);
}
- /* second step: draw masked inverted character */
+ // second step: draw masked inverted character
SDLCopyInverseMasked(src_bitmap, dst_bitmap, src_x, src_y,
font_width, font_height, dst_x, dst_y);
}
{
if (mask_mode == BLIT_ON_BACKGROUND)
{
- /* clear font character background */
+ // clear font character background
ClearRectangleOnBackground(dst_bitmap, dst_x, dst_y,
font_width, font_height);
}
BlitBitmapMasked(src_bitmap, dst_bitmap, src_x, src_y,
font_width, font_height, dst_x, dst_y);
}
- else /* normal, non-masked font blitting */
+ else // normal, non-masked font blitting
{
BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y,
font_width, font_height, dst_x, dst_y);
}
-/* ========================================================================= */
-/* text buffer drawing functions */
-/* ========================================================================= */
+// ============================================================================
+// text buffer drawing functions
+// ============================================================================
#define MAX_LINES_FROM_FILE 1024
if (!(file = openFile(filename, MODE_READ)))
return NULL;
- buffer = checked_calloc(1); /* start with valid, but empty text buffer */
+ buffer = checked_calloc(1); // start with valid, but empty text buffer
while (!checkEndOfFile(file) && num_lines < max_lines)
{
char line[MAX_LINE_LEN];
- /* read next line of input file */
+ // read next line of input file
if (!getStringFromFile(file, line, MAX_LINE_LEN))
break;
char *word_ptr;
int word_len;
- /* skip leading whitespaces */
+ // skip leading whitespaces
while (*text_ptr == ' ' || *text_ptr == '\t')
text_ptr++;
word_ptr = text_ptr;
word_len = 0;
- /* look for end of next word */
+ // look for end of next word
while (*word_ptr != ' ' && *word_ptr != '\t' && *word_ptr != '\0')
{
word_ptr++;
{
continue;
}
- else if (*text_ptr == '\n') /* special case: force empty line */
+ else if (*text_ptr == '\n') // special case: force empty line
{
if (buffer_len == 0)
text_ptr++;
- /* prevent printing of multiple empty lines */
+ // prevent printing of multiple empty lines
if (buffer_len > 0 || !last_line_was_empty)
buffer_filled = TRUE;
}
else if (word_len < line_length - buffer_len)
{
- /* word fits into text buffer -- add word */
+ // word fits into text buffer -- add word
if (buffer_len > 0)
buffer[buffer_len++] = ' ';
}
else if (buffer_len > 0)
{
- /* not enough space left for word in text buffer -- print buffer */
+ // not enough space left for word in text buffer -- print buffer
buffer_filled = TRUE;
}
else
{
- /* word does not fit at all into empty text buffer -- cut word */
+ // word does not fit at all into empty text buffer -- cut word
strncpy(buffer, text_ptr, line_length);
buffer[line_length] = '\0';
if (!getTokenValueFromString(string, token, value))
return FALSE;
- if (**token != '.') /* token should begin with dot */
+ if (**token != '.') // token should begin with dot
return FALSE;
- for (ptr = *token; *ptr; ptr++) /* token should contain no whitespace */
+ for (ptr = *token; *ptr; ptr++) // token should contain no whitespace
if (*ptr == ' ' || *ptr == '\t')
return FALSE;
- for (ptr = *value; *ptr; ptr++) /* value should contain no whitespace */
+ for (ptr = *value; *ptr; ptr++) // value should contain no whitespace
if (*ptr == ' ' || *ptr == '\t')
return FALSE;
int num_line_chars = MAX_LINE_LEN;
int i;
- /* copy next line from text buffer to line buffer (nearly fgets() style) */
+ // copy next line from text buffer to line buffer (nearly fgets() style)
for (i = 0; i < num_line_chars && *text_buffer; i++)
if ((line[i] = *text_buffer++) == '\n')
break;
line[i] = '\0';
- /* prevent 'num_line_chars' sized lines to cause additional empty line */
+ // prevent 'num_line_chars' sized lines to cause additional empty line
if (i == num_line_chars && *text_buffer == '\n')
text_buffer++;
- /* skip comments (lines directly beginning with '#') */
+ // skip comments (lines directly beginning with '#')
if (line[0] == '#' && parse_comments)
{
char *token, *value;
- /* try to read generic token/value pair definition after comment sign */
+ // try to read generic token/value pair definition after comment sign
if (getCheckedTokenValueFromString(line + 1, &token, &value))
{
- /* if found, flush the current buffer, if non-empty */
+ // if found, flush the current buffer, if non-empty
if (buffer_len > 0 && current_ypos < max_ysize)
{
DrawTextBuffer_Flush(x, y, buffer, font_nr, line_length, cut_length,
continue;
}
- /* cut trailing newline and carriage return from input line */
+ // cut trailing newline and carriage return from input line
for (line_ptr = line; *line_ptr; line_ptr++)
{
if (*line_ptr == '\n' || *line_ptr == '\r')
}
}
- if (strlen(line) == 0) /* special case: force empty line */
+ if (strlen(line) == 0) // special case: force empty line
strcpy(line, "\n");
line_ptr = line;
#include "system.h"
-/* default fonts */
+// default fonts
#define FONT_INITIAL_1 0
#define FONT_INITIAL_2 1
#define FONT_INITIAL_3 2
#define FONT_INITIAL_4 3
-/* font colors */
+// font colors
#define FC_RED FONT_INITIAL_1
#define FC_BLUE FONT_INITIAL_2
#define FC_GREEN FONT_INITIAL_3
#define FC_YELLOW FONT_INITIAL_4
-/* text output definitions */
+// text output definitions
#define MAX_OUTPUT_LINESIZE 1024
-/* special constants for old ISO-8859-1 character byte values */
+// special constants for old ISO-8859-1 character byte values
#define CHAR_BYTE_UMLAUT_A ((char)0xc4)
#define CHAR_BYTE_UMLAUT_O ((char)0xd6)
#define CHAR_BYTE_UMLAUT_U ((char)0xdc)
#define CHAR_BYTE_DEGREE ((char)0xb0)
#define CHAR_BYTE_CURSOR ((char)0xa0)
-/* special character mapping for default fonts */
+// special character mapping for default fonts
#define FONT_ASCII_CURSOR ((char)160)
#define FONT_ASCII_BUTTON ((char)128)
#define FONT_ASCII_UP ((char)129)
(c) == FONT_ASCII_DOWN ? 111 : \
(c))
-/* 64 regular ordered ASCII characters, 6 special characters, 1 cursor char. */
+// 64 regular ordered ASCII characters, 6 special characters, 1 cursor char.
#define MIN_NUM_CHARS_PER_FONT 64
#define DEFAULT_NUM_CHARS_PER_FONT (MIN_NUM_CHARS_PER_FONT + 6 +1)
#define DEFAULT_NUM_CHARS_PER_LINE 16
-/* font structure definitions */
+// font structure definitions
void InitFontInfo(struct FontBitmapInfo *, int,
int (*function1)(int), int (*function2)(char *));
int DrawTextFile(int, int, char *, int, int, int, int, int, int,
boolean, boolean, boolean);
-#endif /* TEXT_H */
+#endif // TEXT_H
};
typedef struct ListNode ListNode;
-#endif /* TYPES_H */
+#endif // TYPES_H
#ifndef WINDOWS_H
#define WINDOWS_H
-/* prevent including lots of conflicting macros */
+// prevent including lots of conflicting macros
#define WIN32_LEAN_AND_MEAN
#include <shlobj.h>
-/* some symbols are already defined on Windows */
+// some symbols are already defined on Windows
typedef int boolean_internal;
#define boolean boolean_internal
#define DrawText DrawText_internal
#endif
-#endif /* WINDOWS_H */
+#endif // WINDOWS_H
SetupFileHash *hide_setup_hash = NULL;
-/* ------------------------------------------------------------------------- */
-/* element definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// element definitions
+// ----------------------------------------------------------------------------
struct ElementInfo element_info[MAX_NUM_ELEMENTS + 1];
-/* this contains predefined structure elements to initialize "element_info" */
+// this contains predefined structure elements to initialize "element_info"
struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
{
- /* keyword to start parser: "ELEMENT_INFO_START" <-- do not change! */
+ // keyword to start parser: "ELEMENT_INFO_START" <-- do not change!
- /* ----------------------------------------------------------------------- */
- /* "real" level file elements */
- /* ----------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
+ // "real" level file elements
+ // --------------------------------------------------------------------------
{
"empty_space",
"wooden wall (DF style)",
},
- /* ----------------------------------------------------------------------- */
- /* "real" (and therefore drawable) runtime elements */
- /* ----------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
+ // "real" (and therefore drawable) runtime elements
+ // --------------------------------------------------------------------------
{
"dynabomb_player_1.active",
"pac man (eating down)"
},
- /* ----------------------------------------------------------------------- */
- /* "unreal" (and therefore not drawable) runtime elements */
- /* ----------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
+ // "unreal" (and therefore not drawable) runtime elements
+ // --------------------------------------------------------------------------
{
"blocked",
"-"
},
- /* ----------------------------------------------------------------------- */
- /* dummy elements (never used as game elements, only used as graphics) */
- /* ----------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
+ // dummy elements (never used as game elements, only used as graphics)
+ // --------------------------------------------------------------------------
{
"steelwall_topleft",
"hide elements used in this level"
},
- /* keyword to stop parser: "ELEMENT_INFO_END" <-- do not change! */
+ // keyword to stop parser: "ELEMENT_INFO_END" <-- do not change!
{
NULL,
};
-/* ------------------------------------------------------------------------- */
-/* element action and direction definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// element action and direction definitions
+// ----------------------------------------------------------------------------
struct ElementActionInfo element_action_info[NUM_ACTIONS + 1 + 1] =
{
{ ".part_32", ACTION_PART_32, FALSE },
{ ".other", ACTION_OTHER, FALSE },
- /* empty suffix always matches -- check as last entry in InitSoundInfo() */
+ // empty suffix always matches -- check as last entry in InitSoundInfo()
{ "", ACTION_DEFAULT, TRUE },
{ NULL, 0, 0 }
{ ".FADING", GFX_SPECIAL_ARG_FADING, },
{ ".QUIT", GFX_SPECIAL_ARG_QUIT, },
- /* empty suffix always matches -- check as last entry in InitMusicInfo() */
+ // empty suffix always matches -- check as last entry in InitMusicInfo()
{ "", GFX_SPECIAL_ARG_DEFAULT, },
{ NULL, 0, }
};
-#include "conf_var.c" /* include auto-generated data structure definitions */
+#include "conf_var.c" // include auto-generated data structure definitions
-/* ------------------------------------------------------------------------- */
-/* font definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// font definitions
+// ----------------------------------------------------------------------------
/* Important: When one entry is a prefix of another entry, the longer entry
must come first, because the dynamic configuration does prefix matching!
struct GlobalAnimInfo global_anim_info[NUM_GLOBAL_ANIM_TOKENS + 1];
-/* this contains predefined structure elements to init "global_anim_info" */
+// this contains predefined structure elements to init "global_anim_info"
struct GlobalAnimNameInfo global_anim_name_info[NUM_GLOBAL_ANIM_TOKENS + 1] =
{
- /* (real) graphic definitions used to define animation graphics */
+ // (real) graphic definitions used to define animation graphics
{ "gfx.global.anim_1", },
{ "gfx.global.anim_2", },
{ "gfx.global.anim_3", },
{ "gfx.global.anim_31", },
{ "gfx.global.anim_32", },
- /* (dummy) graphic definitions used to define animation controls */
+ // (dummy) graphic definitions used to define animation controls
{ "global.anim_1", },
{ "global.anim_2", },
{ "global.anim_3", },
};
-/* ------------------------------------------------------------------------- */
-/* music token prefix definitions */
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
+// music token prefix definitions
+// ----------------------------------------------------------------------------
struct MusicPrefixInfo music_prefix_info[NUM_MUSIC_PREFIXES + 1] =
{
};
-/* ========================================================================= */
-/* main() */
-/* ========================================================================= */
+// ============================================================================
+// main()
+// ============================================================================
static void print_usage(void)
{
EventLoop();
CloseAllAndExit(0);
- return 0; /* to keep compilers happy */
+ return 0; // to keep compilers happy
}
#include "game_mm/game_mm.h"
#include "engines.h"
-#include "conf_gfx.h" /* include auto-generated data structure definitions */
-#include "conf_snd.h" /* include auto-generated data structure definitions */
-#include "conf_mus.h" /* include auto-generated data structure definitions */
+#include "conf_gfx.h" // include auto-generated data structure definitions
+#include "conf_snd.h" // include auto-generated data structure definitions
+#include "conf_mus.h" // include auto-generated data structure definitions
#define IMG_UNDEFINED (-1)
#define IN_LEV_FIELD(x, y) IN_FIELD(x, y, lev_fieldx, lev_fieldy)
#define IN_SCR_FIELD(x, y) IN_FIELD_MINMAX(x,y, BX1,BY1, BX2,BY2)
-/* values for configurable properties (custom elem's only, else pre-defined) */
-/* (never change these values, as they are stored in level files!) */
+// values for configurable properties (custom elem's only, else pre-defined)
+// (never change these values, as they are stored in level files!)
#define EP_DIGGABLE 0
#define EP_COLLECTIBLE_ONLY 1
#define EP_DONT_RUN_INTO 2
#define EP_GRAVITY_REACHABLE 30
#define EP_DONT_GET_HIT_BY 31
-/* values for pre-defined properties */
-/* (from here on, values can be changed by inserting new values) */
+// values for pre-defined properties
+// (from here on, values can be changed by inserting new values)
#define EP_PLAYER 32
#define EP_CAN_PASS_MAGIC_WALL 33
#define EP_CAN_PASS_DC_MAGIC_WALL 34
#define EP_ACTIVE_BOMB 57
#define EP_INACTIVE 58
-/* values for special configurable properties (depending on level settings) */
+// values for special configurable properties (depending on level settings)
#define EP_EM_SLIPPERY_WALL 59
-/* values for special graphics properties (no effect on game engine) */
+// values for special graphics properties (no effect on game engine)
#define EP_GFX_CRUMBLED 60
-/* values for derived properties (determined from properties above) */
+// values for derived properties (determined from properties above)
#define EP_ACCESSIBLE_OVER 61
#define EP_ACCESSIBLE_INSIDE 62
#define EP_ACCESSIBLE_UNDER 63
#define EP_MAYBE_DONT_COLLIDE_WITH 82
#define EP_CAN_BE_CLONED_BY_ANDROID 83
-/* values for internal purpose only (level editor) */
+// values for internal purpose only (level editor)
#define EP_WALK_TO_OBJECT 84
#define EP_DEADLY 85
#define EP_EDITOR_CASCADE 86
#define EP_EDITOR_CASCADE_ACTIVE 87
#define EP_EDITOR_CASCADE_INACTIVE 88
-/* values for internal purpose only (game engine) */
+// values for internal purpose only (game engine)
#define EP_HAS_ACTION 89
#define EP_CAN_CHANGE_OR_HAS_ACTION 90
-/* values for internal purpose only (other) */
+// values for internal purpose only (other)
#define EP_OBSOLETE 91
#define NUM_ELEMENT_PROPERTIES 92
(PROPERTY_VAR(e,p) &= ~PROPERTY_BIT(p)))
-/* values for change events for custom elements (stored in level file) */
+// values for change events for custom elements (stored in level file)
#define CE_DELAY 0
#define CE_TOUCHED_BY_PLAYER 1
#define CE_PRESSED_BY_PLAYER 2
#define SET_ANY_CHANGE_EVENT(e,c,v) (IS_CUSTOM_ELEMENT(e) ? \
CH_ANY_EVENT_VAR(e,c) = (v) : 0)
-/* values for player bitmasks */
+// values for player bitmasks
#define PLAYER_BITS_NONE 0
#define PLAYER_BITS_1 (1 << 0)
#define PLAYER_BITS_2 (1 << 1)
#define PLAYER_BITS_TRIGGER (1 << 4)
#define PLAYER_BITS_ACTION (1 << 5)
-/* values for move directions (bits 0 - 3: basic move directions) */
+// values for move directions (bits 0 - 3: basic move directions)
#define MV_BIT_PREVIOUS 4
#define MV_BIT_TRIGGER 5
#define MV_BIT_TRIGGER_BACK 6
#define MV_NORMAL (1 << MV_BIT_NORMAL)
#define MV_REVERSE (1 << MV_BIT_REVERSE)
-/* values for move stepsize */
+// values for move stepsize
#define STEPSIZE_NOT_MOVING 0
#define STEPSIZE_VERY_SLOW 1
#define STEPSIZE_SLOW 2
#define STEPSIZE_FAST 8
#define STEPSIZE_VERY_FAST 16
#define STEPSIZE_EVEN_FASTER 32
-#define STEPSIZE_SLOWER 50 /* (symbolic value only) */
-#define STEPSIZE_FASTER 200 /* (symbolic value only) */
-#define STEPSIZE_RESET 100 /* (symbolic value only) */
+#define STEPSIZE_SLOWER 50 // (symbolic value only)
+#define STEPSIZE_FASTER 200 // (symbolic value only)
+#define STEPSIZE_RESET 100 // (symbolic value only)
-/* values for change side for custom elements */
+// values for change side for custom elements
#define CH_SIDE_NONE MV_NONE
#define CH_SIDE_LEFT MV_LEFT
#define CH_SIDE_RIGHT MV_RIGHT
#define CH_SIDE_TOP_BOTTOM MV_VERTICAL
#define CH_SIDE_ANY MV_ANY_DIRECTION
-/* values for change player for custom elements */
+// values for change player for custom elements
#define CH_PLAYER_NONE PLAYER_BITS_NONE
#define CH_PLAYER_1 PLAYER_BITS_1
#define CH_PLAYER_2 PLAYER_BITS_2
#define CH_PLAYER_4 PLAYER_BITS_4
#define CH_PLAYER_ANY PLAYER_BITS_ANY
-/* values for change page for custom elements */
+// values for change page for custom elements
#define CH_PAGE_ANY_FILE (0xff)
#define CH_PAGE_ANY (0xffffffff)
-/* values for change power for custom elements */
+// values for change power for custom elements
#define CP_WHEN_EMPTY 0
#define CP_WHEN_DIGGABLE 1
#define CP_WHEN_DESTRUCTIBLE 2
#define CP_WHEN_REMOVABLE 4
#define CP_WHEN_WALKABLE 5
-/* values for change actions for custom elements (stored in level file) */
+// values for change actions for custom elements (stored in level file)
#define CA_NO_ACTION 0
#define CA_EXIT_PLAYER 1
#define CA_KILL_PLAYER 2
#define CA_HEADLINE_ENGINE_ACTIONS 253
#define CA_UNDEFINED 255
-/* values for change action mode for custom elements */
+// values for change action mode for custom elements
#define CA_MODE_UNDEFINED 0
#define CA_MODE_SET 1
#define CA_MODE_ADD 2
#define CA_MODE_DIVIDE 5
#define CA_MODE_MODULO 6
-/* values for change action parameters for custom elements */
+// values for change action parameters for custom elements
#define CA_ARG_MIN 0
#define CA_ARG_0 0
#define CA_ARG_1 1
#define CA_ARG_INVENTORY_RM_HEADLINE (CA_ARG_INVENTORY + 999)
#define CA_ARG_UNDEFINED 65535
-/* values for custom move patterns (bits 0 - 3: basic move directions) */
+// values for custom move patterns (bits 0 - 3: basic move directions)
#define MV_BIT_TOWARDS_PLAYER 4
#define MV_BIT_AWAY_FROM_PLAYER 5
#define MV_BIT_ALONG_LEFT_SIDE 6
#define MV_BIT_TURNING_RANDOM 16
#define MV_BIT_WIND_DIRECTION 17
-/* values for custom move patterns */
+// values for custom move patterns
#define MV_TOWARDS_PLAYER (1 << MV_BIT_TOWARDS_PLAYER)
#define MV_AWAY_FROM_PLAYER (1 << MV_BIT_AWAY_FROM_PLAYER)
#define MV_ALONG_LEFT_SIDE (1 << MV_BIT_ALONG_LEFT_SIDE)
#define MV_TURNING_RANDOM (1 << MV_BIT_TURNING_RANDOM)
#define MV_WIND_DIRECTION (1 << MV_BIT_WIND_DIRECTION)
-/* values for initial move direction */
+// values for initial move direction
#define MV_START_NONE (MV_NONE)
#define MV_START_AUTOMATIC (MV_NONE)
#define MV_START_LEFT (MV_LEFT)
#define MV_START_RANDOM (MV_ALL_DIRECTIONS)
#define MV_START_PREVIOUS (MV_PREVIOUS)
-/* values for elements left behind by custom elements */
+// values for elements left behind by custom elements
#define LEAVE_TYPE_UNLIMITED 0
#define LEAVE_TYPE_LIMITED 1
-/* values for slippery property for custom elements */
+// values for slippery property for custom elements
#define SLIPPERY_ANY_RANDOM 0
#define SLIPPERY_ANY_LEFT_RIGHT 1
#define SLIPPERY_ANY_RIGHT_LEFT 2
#define SLIPPERY_ONLY_LEFT 3
#define SLIPPERY_ONLY_RIGHT 4
-/* values for explosion type for custom elements */
+// values for explosion type for custom elements
#define EXPLODES_3X3 0
#define EXPLODES_1X1 1
#define EXPLODES_CROSS 2
-/* macros for configurable properties */
+// macros for configurable properties
#define IS_DIGGABLE(e) HAS_PROPERTY(e, EP_DIGGABLE)
#define IS_COLLECTIBLE_ONLY(e) HAS_PROPERTY(e, EP_COLLECTIBLE_ONLY)
#define DONT_RUN_INTO(e) HAS_PROPERTY(e, EP_DONT_RUN_INTO)
#define IS_GRAVITY_REACHABLE(e) HAS_PROPERTY(e, EP_GRAVITY_REACHABLE)
#define DONT_GET_HIT_BY(e) HAS_PROPERTY(e, EP_DONT_GET_HIT_BY)
-/* macros for special configurable properties */
+// macros for special configurable properties
#define IS_EM_SLIPPERY_WALL(e) HAS_PROPERTY(e, EP_EM_SLIPPERY_WALL)
-/* macros for special graphics properties */
+// macros for special graphics properties
#define GFX_CRUMBLED(e) HAS_PROPERTY(GFX_ELEMENT(e), EP_GFX_CRUMBLED)
-/* macros for pre-defined properties */
+// macros for pre-defined properties
#define ELEM_IS_PLAYER(e) HAS_PROPERTY(e, EP_PLAYER)
#define CAN_PASS_MAGIC_WALL(e) HAS_PROPERTY(e, EP_CAN_PASS_MAGIC_WALL)
#define CAN_PASS_DC_MAGIC_WALL(e) HAS_PROPERTY(e, EP_CAN_PASS_DC_MAGIC_WALL)
#define IS_ACTIVE_BOMB(e) HAS_PROPERTY(e, EP_ACTIVE_BOMB)
#define IS_INACTIVE(e) HAS_PROPERTY(e, EP_INACTIVE)
-/* macros for derived properties */
+// macros for derived properties
#define IS_ACCESSIBLE_OVER(e) HAS_PROPERTY(e, EP_ACCESSIBLE_OVER)
#define IS_ACCESSIBLE_INSIDE(e) HAS_PROPERTY(e, EP_ACCESSIBLE_INSIDE)
#define IS_ACCESSIBLE_UNDER(e) HAS_PROPERTY(e, EP_ACCESSIBLE_UNDER)
#define IS_OBSOLETE(e) HAS_PROPERTY(e, EP_OBSOLETE)
-/* special macros used in game engine */
+// special macros used in game engine
#define IS_FILE_ELEMENT(e) ((e) >= 0 && \
(e) <= NUM_FILE_ELEMENTS)
#define GFX_ELEMENT(e) (element_info[e].gfx_element)
-/* !!! CHECK THIS !!! */
+// !!! CHECK THIS !!!
#if 1
#define TILE_GFX_ELEMENT(x, y) \
(GfxElement[x][y] != EL_UNDEFINED && \
GfxElement[x][y] : Feld[x][y])
#endif
-/* !!! "use sound" deactivated due to problems with level "bug machine" !!! */
-/* (solution: add separate "use sound of element" to level file and editor) */
+// !!! "use sound" deactivated due to problems with level "bug machine" !!!
+// (solution: add separate "use sound of element" to level file and editor)
#if 0
#define SND_ELEMENT(e) GFX_ELEMENT(e)
#else
#define BUTTON_ACTIVE(b) (ActiveButton[b])
#define FONT_ACTIVE(f) (ActiveFont[f])
-/* fundamental game speed values */
-#define MICROLEVEL_SCROLL_DELAY 50 /* delay for scrolling micro level */
-#define MICROLEVEL_LABEL_DELAY 250 /* delay for micro level label */
+// fundamental game speed values
+#define MICROLEVEL_SCROLL_DELAY 50 // delay for scrolling micro level
+#define MICROLEVEL_LABEL_DELAY 250 // delay for micro level label
-/* boundaries of arrays etc. */
+// boundaries of arrays etc.
#define MAX_LEVEL_NAME_LEN 32
#define MAX_LEVEL_AUTHOR_LEN 32
#define MAX_ELEMENT_NAME_LEN 32
#define MIN_ANDROID_ELEMENTS 1
#define MAX_ANDROID_ELEMENTS 16
-/* values for elements with content */
+// values for elements with content
#define MIN_ELEMENT_CONTENTS 1
#define STD_ELEMENT_CONTENTS 4
#define MAX_ELEMENT_CONTENTS 8
-/* values for initial player inventory */
+// values for initial player inventory
#define MIN_INITIAL_INVENTORY_SIZE 1
#define MAX_INITIAL_INVENTORY_SIZE 8
-/* often used screen positions */
+// often used screen positions
#define TILESIZE 32
#define TILEX TILESIZE
#define TILEY TILESIZE
#define MICROLABEL1_YPOS (MICROLEVEL_YPOS - 36)
#define MICROLABEL2_YPOS (MICROLEVEL_YPOS + MICROLEVEL_YSIZE + 7)
-/* values for GfxRedraw */
+// values for GfxRedraw
#define GFX_REDRAW_NONE (0)
#define GFX_REDRAW_TILE (1 << 0)
#define GFX_REDRAW_TILE_CRUMBLED (1 << 1)
#define GFX_REDRAW_TILE_CRUMBLED_NEIGHBOURS (1 << 2)
#define GFX_REDRAW_TILE_TWINKLED (1 << 3)
-/* score for elements */
+// score for elements
#define SC_EMERALD 0
#define SC_DIAMOND 1
#define SC_BUG 2
#define SC_ELEM_BONUS 14
#define SC_UNKNOWN_15 15
-#define LEVEL_SCORE_ELEMENTS 16 /* level elements with score */
+#define LEVEL_SCORE_ELEMENTS 16 // level elements with score
-/* "real" level file elements */
+// "real" level file elements
#define EL_UNDEFINED -1
#define EL_EMPTY_SPACE 0
#define EL_WALL 2
#define EL_WALL_SLIPPERY 3
#define EL_ROCK 4
-#define EL_KEY_OBSOLETE 5 /* obsolete; now EL_KEY_1 */
+#define EL_KEY_OBSOLETE 5 // obsolete; now EL_KEY_1
#define EL_EMERALD 6
#define EL_EXIT_CLOSED 7
-#define EL_PLAYER_OBSOLETE 8 /* obsolete; now EL_PLAYER_1 */
+#define EL_PLAYER_OBSOLETE 8 // obsolete; now EL_PLAYER_1
#define EL_BUG 9
#define EL_SPACESHIP 10
#define EL_YAMYAM 11
#define EL_PIG 117
#define EL_DRAGON 118
-#define EL_EM_KEY_1_FILE_OBSOLETE 119 /* obsolete; now EL_EM_KEY_1 */
+#define EL_EM_KEY_1_FILE_OBSOLETE 119 // obsolete; now EL_EM_KEY_1
#define EL_CHAR_START 120
#define EL_CHAR_ASCII0 (EL_CHAR_START - 32)
#define EL_CHAR_ASCII0_START (EL_CHAR_ASCII0 + 32)
-#include "conf_chr.h" /* include auto-generated data structure definitions */
+#include "conf_chr.h" // include auto-generated data structure definitions
#define EL_CHAR_ASCII0_END (EL_CHAR_ASCII0 + 111)
#define EL_CHAR_END (EL_CHAR_START + 79)
#define EL_EM_GATE_3 205
#define EL_EM_GATE_4 206
-#define EL_EM_KEY_2_FILE_OBSOLETE 207 /* obsolete; now EL_EM_KEY_2 */
-#define EL_EM_KEY_3_FILE_OBSOLETE 208 /* obsolete; now EL_EM_KEY_3 */
-#define EL_EM_KEY_4_FILE_OBSOLETE 209 /* obsolete; now EL_EM_KEY_4 */
+#define EL_EM_KEY_2_FILE_OBSOLETE 207 // obsolete; now EL_EM_KEY_2
+#define EL_EM_KEY_3_FILE_OBSOLETE 208 // obsolete; now EL_EM_KEY_3
+#define EL_EM_KEY_4_FILE_OBSOLETE 209 // obsolete; now EL_EM_KEY_4
#define EL_SP_START 210
#define EL_SP_EMPTY_SPACE (EL_SP_START + 0)
#define EL_CONVEYOR_BELT_4_SWITCH_MIDDLE 293
#define EL_CONVEYOR_BELT_4_SWITCH_RIGHT 294
#define EL_LANDMINE 295
-#define EL_ENVELOPE_OBSOLETE 296 /* obsolete; now EL_ENVELOPE_1 */
+#define EL_ENVELOPE_OBSOLETE 296 // obsolete; now EL_ENVELOPE_1
#define EL_LIGHT_SWITCH 297
#define EL_LIGHT_SWITCH_ACTIVE 298
#define EL_SIGN_EXCLAMATION 299
#define EL_UNUSED_358 358
#define EL_UNUSED_359 359
-/* ---------- begin of custom elements section ----------------------------- */
+// ---------- begin of custom elements section --------------------------------
#define EL_CUSTOM_START 360
-#include "conf_cus.h" /* include auto-generated data structure definitions */
+#include "conf_cus.h" // include auto-generated data structure definitions
#define NUM_CUSTOM_ELEMENTS 256
#define EL_CUSTOM_END 615
-/* ---------- end of custom elements section ------------------------------- */
+// ---------- end of custom elements section ----------------------------------
#define EL_EM_KEY_1 616
#define EL_EM_KEY_2 617
#define EL_ENVELOPE_3 622
#define EL_ENVELOPE_4 623
-/* ---------- begin of group elements section ------------------------------ */
+// ---------- begin of group elements section ---------------------------------
#define EL_GROUP_START 624
-#include "conf_grp.h" /* include auto-generated data structure definitions */
+#include "conf_grp.h" // include auto-generated data structure definitions
#define NUM_GROUP_ELEMENTS 32
#define EL_GROUP_END 655
-/* ---------- end of custom elements section ------------------------------- */
+// ---------- end of custom elements section ----------------------------------
#define EL_UNKNOWN 656
#define EL_TRIGGER_ELEMENT 657
#define EL_TRIGGER_PLAYER 658
-/* SP style elements */
+// SP style elements
#define EL_SP_GRAVITY_ON_PORT_RIGHT 659
#define EL_SP_GRAVITY_ON_PORT_DOWN 660
#define EL_SP_GRAVITY_ON_PORT_LEFT 661
#define EL_SP_GRAVITY_OFF_PORT_LEFT 665
#define EL_SP_GRAVITY_OFF_PORT_UP 666
-/* EMC style elements */
+// EMC style elements
#define EL_BALLOON_SWITCH_NONE 667
#define EL_EMC_GATE_5 668
#define EL_EMC_GATE_6 669
#define EL_STEEL_CHAR_ASCII0 (EL_STEEL_CHAR_START - 32)
#define EL_STEEL_CHAR_ASCII0_START (EL_STEEL_CHAR_ASCII0 + 32)
-/* (auto-generated data structure definitions included with normal chars) */
+// (auto-generated data structure definitions included with normal chars)
#define EL_STEEL_CHAR_ASCII0_END (EL_STEEL_CHAR_ASCII0 + 111)
#define EL_STEEL_CHAR_END (EL_STEEL_CHAR_START + 79)
#define NUM_FILE_ELEMENTS 1215
-/* "real" (and therefore drawable) runtime elements */
+// "real" (and therefore drawable) runtime elements
#define EL_FIRST_RUNTIME_REAL NUM_FILE_ELEMENTS
#define EL_DYNABOMB_PLAYER_1_ACTIVE (EL_FIRST_RUNTIME_REAL + 0)
#define EL_MM_RUNTIME_START EL_MM_EXIT_OPENING
#define EL_MM_RUNTIME_END EL_MM_AMOEBA_WALL_GROWING
-/* "unreal" (and therefore not drawable) runtime elements */
+// "unreal" (and therefore not drawable) runtime elements
#define EL_FIRST_RUNTIME_UNREAL (NUM_DRAWABLE_ELEMENTS)
#define EL_BLOCKED (EL_FIRST_RUNTIME_UNREAL + 0)
#define NUM_RUNTIME_ELEMENTS (EL_FIRST_RUNTIME_UNREAL + 24)
-/* dummy elements (never used as game elements, only used as graphics) */
+// dummy elements (never used as game elements, only used as graphics)
#define EL_FIRST_DUMMY NUM_RUNTIME_ELEMENTS
#define EL_STEELWALL_TOPLEFT (EL_FIRST_DUMMY + 0)
#define EL_MM_DUMMY_START EL_MM_MASK_MCDUFFIN_RIGHT
#define EL_MM_DUMMY_END EL_MM_MASK_CIRCLE
-/* internal elements (only used for internal purposes like copying) */
+// internal elements (only used for internal purposes like copying)
#define EL_FIRST_INTERNAL (EL_FIRST_DUMMY + 47)
#define EL_INTERNAL_CLIPBOARD_CUSTOM (EL_FIRST_INTERNAL + 0)
#define MAX_NUM_ELEMENTS (EL_FIRST_INTERNAL + 38)
-/* values for graphics/sounds action types */
+// values for graphics/sounds action types
#define ACTION_DEFAULT 0
#define ACTION_WAITING 1
#define ACTION_FALLING 2
#define ACTION_SLEEPING_LAST ACTION_SLEEPING_3
-/* values for special image configuration suffixes (must match game mode) */
+// values for special image configuration suffixes (must match game mode)
#define GFX_SPECIAL_ARG_DEFAULT 0
#define GFX_SPECIAL_ARG_LOADING 1
#define GFX_SPECIAL_ARG_TITLE_INITIAL 2
#define NUM_SPECIAL_GFX_ARGS 36
-/* these additional definitions are currently only used for draw offsets */
+// these additional definitions are currently only used for draw offsets
#define GFX_SPECIAL_ARG_INFO_MAIN 0
#define GFX_SPECIAL_ARG_INFO_TITLE 1
#define GFX_SPECIAL_ARG_INFO_ELEMENTS 2
#define NUM_SPECIAL_GFX_INFO_ARGS 8
-/* these additional definitions are currently only used for draw offsets */
-/* (must match SETUP_MODE_* values as defined in src/screens.c) */
-/* (should also match corresponding entries in src/conf_gfx.c) */
+// these additional definitions are currently only used for draw offsets
+// (must match SETUP_MODE_* values as defined in src/screens.c)
+// (should also match corresponding entries in src/conf_gfx.c)
#define GFX_SPECIAL_ARG_SETUP_MAIN 0
#define GFX_SPECIAL_ARG_SETUP_GAME 1
#define GFX_SPECIAL_ARG_SETUP_EDITOR 2
#define NUM_SPECIAL_GFX_SETUP_ARGS 16
-/* values for image configuration suffixes */
+// values for image configuration suffixes
#define GFX_ARG_X 0
#define GFX_ARG_Y 1
#define GFX_ARG_XPOS 2
#define NUM_GFX_ARGS 62
-/* values for sound configuration suffixes */
+// values for sound configuration suffixes
#define SND_ARG_MODE_LOOP 0
#define SND_ARG_VOLUME 1
#define SND_ARG_PRIORITY 2
#define NUM_SND_ARGS 3
-/* values for music configuration suffixes */
+// values for music configuration suffixes
#define MUS_ARG_MODE_LOOP 0
#define NUM_MUS_ARGS 1
-/* values for font configuration (definitions must match those from main.c) */
+// values for font configuration (definitions must match those from main.c)
#define FONT_INITIAL_1 0
#define FONT_INITIAL_2 1
#define FONT_INITIAL_3 2
#define NUM_FONTS 43
#define NUM_INITIAL_FONTS 4
-/* values for toon animation configuration */
+// values for toon animation configuration
#define MAX_NUM_TOONS 20
-/* values for global animation configuration (must match those from main.c) */
+// values for global animation configuration (must match those from main.c)
#define NUM_GLOBAL_ANIMS MAX_GLOBAL_ANIMS
#define NUM_GLOBAL_ANIM_PARTS MAX_GLOBAL_ANIM_PARTS
#define NUM_GLOBAL_ANIM_PARTS_ALL (NUM_GLOBAL_ANIM_PARTS + 1)
#define GLOBAL_ANIM_ID_PART_LAST (NUM_GLOBAL_ANIM_PARTS - 1)
#define GLOBAL_ANIM_ID_PART_BASE (NUM_GLOBAL_ANIM_PARTS)
-/* values for global border graphics */
+// values for global border graphics
#define IMG_GLOBAL_BORDER_FIRST IMG_GLOBAL_BORDER
#define IMG_GLOBAL_BORDER_LAST IMG_GLOBAL_BORDER_PLAYING
-/* values for game_status (must match special image configuration suffixes) */
+// values for game_status (must match special image configuration suffixes)
#define GAME_MODE_DEFAULT 0
#define GAME_MODE_LOADING 1
#define GAME_MODE_TITLE_INITIAL 2
#define NUM_GAME_MODES 36
-/* special definitions currently only used for custom artwork configuration */
+// special definitions currently only used for custom artwork configuration
#define MUSIC_PREFIX_BACKGROUND 0
#define NUM_MUSIC_PREFIXES 1
-/* definitions for demo animation lists */
+// definitions for demo animation lists
#define HELPANIM_LIST_NEXT -1
#define HELPANIM_LIST_END -999
-/* program information and versioning definitions */
+// program information and versioning definitions
#define PROGRAM_VERSION_SUPER 4
#define PROGRAM_VERSION_MAJOR 1
#define PROGRAM_VERSION_MINOR 1
PROGRAM_VERSION_MINOR, \
PROGRAM_VERSION_PATCH)
-/* values for game_emulation */
+// values for game_emulation
#define EMU_NONE 0
#define EMU_BOULDERDASH 1
#define EMU_SOKOBAN 2
#define EMU_SUPAPLEX 3
-/* values for level file type identifier */
+// values for level file type identifier
#define LEVEL_FILE_TYPE_UNKNOWN 0
#define LEVEL_FILE_TYPE_RND 1
#define LEVEL_FILE_TYPE_BD 2
#define NUM_LEVEL_FILE_TYPES 9
-/* values for game engine type identifier */
+// values for game engine type identifier
#define GAME_ENGINE_TYPE_UNKNOWN LEVEL_FILE_TYPE_UNKNOWN
#define GAME_ENGINE_TYPE_RND LEVEL_FILE_TYPE_RND
#define GAME_ENGINE_TYPE_EM LEVEL_FILE_TYPE_EM
#define NUM_ENGINE_TYPES 4
-/* values for automatically playing tapes */
+// values for automatically playing tapes
#define AUTOPLAY_NONE 0
#define AUTOPLAY_PLAY (1 << 0)
#define AUTOPLAY_FFWD (1 << 1)
int game_engine_type;
- /* level stored in native format for the alternative native game engines */
+ // level stored in native format for the alternative native game engines
struct LevelInfo_EM *native_em_level;
struct LevelInfo_SP *native_sp_level;
struct LevelInfo_MM *native_mm_level;
- int file_version; /* file format version the level is stored with */
- int game_version; /* game release version the level was created with */
+ int file_version; // file format version the level is stored with
+ int game_version; // game release version the level was created with
struct DateInfo creation_date;
- boolean encoding_16bit_field; /* level contains 16-bit elements */
- boolean encoding_16bit_yamyam; /* yamyam contains 16-bit elements */
- boolean encoding_16bit_amoeba; /* amoeba contains 16-bit elements */
+ boolean encoding_16bit_field; // level contains 16-bit elements
+ boolean encoding_16bit_yamyam; // yamyam contains 16-bit elements
+ boolean encoding_16bit_amoeba; // amoeba contains 16-bit elements
int fieldx, fieldy;
- int time; /* available time (seconds) */
+ int time; // available time (seconds)
int gems_needed;
boolean auto_count_gems;
int explosion_element[MAX_PLAYERS];
boolean use_explosion_element[MAX_PLAYERS];
- /* values for the new EMC elements */
+ // values for the new EMC elements
int android_move_time;
int android_clone_time;
boolean ball_random;
int num_android_clone_elements;
int android_clone_element[MAX_ANDROID_ELEMENTS];
- int can_move_into_acid_bits; /* bitfield to store property for elements */
- int dont_collide_with_bits; /* bitfield to store property for elements */
+ int can_move_into_acid_bits; // bitfield to store property for elements
+ int dont_collide_with_bits; // bitfield to store property for elements
- int initial_player_stepsize[MAX_PLAYERS]; /* initial player speed */
+ int initial_player_stepsize[MAX_PLAYERS]; // initial player speed
boolean initial_player_gravity[MAX_PLAYERS];
boolean use_initial_inventory[MAX_PLAYERS];
int initial_inventory_size[MAX_PLAYERS];
int initial_inventory_content[MAX_PLAYERS][MAX_INITIAL_INVENTORY_SIZE];
- boolean em_slippery_gems; /* EM style "gems slip from wall" behaviour */
- boolean em_explodes_by_fire; /* EM style chain explosion behaviour */
- boolean use_spring_bug; /* for compatibility with old levels */
- boolean use_time_orb_bug; /* for compatibility with old levels */
- boolean use_life_bugs; /* for compatibility with old levels */
- boolean instant_relocation; /* no visual delay when relocating player */
- boolean shifted_relocation; /* no level centering when relocating player */
- boolean lazy_relocation; /* only redraw off-screen player relocation */
- boolean can_pass_to_walkable; /* player can pass to empty or walkable tile */
- boolean grow_into_diggable; /* amoeba can grow into anything diggable */
- boolean auto_exit_sokoban; /* automatically finish solved Sokoban levels */
- boolean solved_by_one_player; /* level is solved if one player enters exit */
-
- boolean continuous_snapping; /* repeated snapping without releasing key */
- boolean block_snap_field; /* snapping blocks field to show animation */
- boolean block_last_field; /* player blocks previous field while moving */
- boolean sp_block_last_field; /* player blocks previous field while moving */
-
- /* values for MM/DF elements */
+ boolean em_slippery_gems; // EM style "gems slip from wall" behaviour
+ boolean em_explodes_by_fire; // EM style chain explosion behaviour
+ boolean use_spring_bug; // for compatibility with old levels
+ boolean use_time_orb_bug; // for compatibility with old levels
+ boolean use_life_bugs; // for compatibility with old levels
+ boolean instant_relocation; // no visual delay when relocating player
+ boolean shifted_relocation; // no level centering when relocating player
+ boolean lazy_relocation; // only redraw off-screen player relocation
+ boolean can_pass_to_walkable; // player can pass to empty or walkable tile
+ boolean grow_into_diggable; // amoeba can grow into anything diggable
+ boolean auto_exit_sokoban; // automatically finish solved Sokoban levels
+ boolean solved_by_one_player; // level is solved if one player enters exit
+
+ boolean continuous_snapping; // repeated snapping without releasing key
+ boolean block_snap_field; // snapping blocks field to show animation
+ boolean block_last_field; // player blocks previous field while moving
+ boolean sp_block_last_field; // player blocks previous field while moving
+
+ // values for MM/DF elements
boolean mm_laser_red, mm_laser_green, mm_laser_blue;
boolean df_laser_red, df_laser_green, df_laser_blue;
int mm_time_fuse;
int mm_time_ball;
int mm_time_block;
- /* ('int' instead of 'boolean' because used as selectbox value in editor) */
- int use_step_counter; /* count steps instead of seconds for level */
+ // ('int' instead of 'boolean' because used as selectbox value in editor)
+ int use_step_counter; // count steps instead of seconds for level
short field[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
- boolean use_custom_template; /* use custom properties from template file */
+ boolean use_custom_template; // use custom properties from template file
- boolean file_has_custom_elements; /* set when level file contains CEs */
+ boolean file_has_custom_elements; // set when level file contains CEs
- boolean no_valid_file; /* set when level file missing or invalid */
- boolean no_level_file; /* set when falling back to level template */
+ boolean no_valid_file; // set when level file missing or invalid
+ boolean no_level_file; // set when falling back to level template
- boolean changed; /* set when level was changed in the editor */
+ boolean changed; // set when level was changed in the editor
- /* runtime flags to handle bugs in old levels (not stored in level file) */
+ // runtime flags to handle bugs in old levels (not stored in level file)
boolean use_action_after_change_bug;
};
struct NetworkLevelInfo
{
- char *leveldir_identifier; /* network levelset identifier */
+ char *leveldir_identifier; // network levelset identifier
- struct LevelFileInfo file_info; /* file info for level file */
- struct LevelFileInfo tmpl_info; /* file info for level template */
+ struct LevelFileInfo file_info; // file info for level file
+ struct LevelFileInfo tmpl_info; // file info for level template
- boolean use_network_level_files; /* use levels from network server */
- boolean use_custom_template; /* use CEs from level template */
+ boolean use_network_level_files; // use levels from network server
+ boolean use_custom_template; // use CEs from level template
};
struct GlobalInfo
float frames_per_second;
boolean show_frames_per_second;
- /* global values for fading screens and masking borders */
+ // global values for fading screens and masking borders
int border_status;
- /* values for global animations */
+ // values for global animations
int anim_status;
int anim_status_next;
struct ElementChangeInfo
{
- boolean can_change; /* use or ignore this change info */
+ boolean can_change; // use or ignore this change info
- boolean has_event[NUM_CHANGE_EVENTS]; /* change events */
+ boolean has_event[NUM_CHANGE_EVENTS]; // change events
- int trigger_player; /* player triggering change */
- int trigger_side; /* side triggering change */
- int trigger_page; /* page triggering change */
+ int trigger_player; // player triggering change
+ int trigger_side; // side triggering change
+ int trigger_page; // page triggering change
- int target_element; /* target element after change */
+ int target_element; // target element after change
- int delay_fixed; /* added frame delay before changed (fixed) */
- int delay_random; /* added frame delay before changed (random) */
- int delay_frames; /* either 1 (frames) or 50 (seconds; 50 fps) */
+ int delay_fixed; // added frame delay before changed (fixed)
+ int delay_random; // added frame delay before changed (random)
+ int delay_frames; // either 1 (frames) or 50 (seconds; 50 fps)
- int initial_trigger_element; /* initial element triggering change */
+ int initial_trigger_element; // initial element triggering change
- struct Content target_content;/* elements for extended change target */
- boolean use_target_content; /* use extended change target */
- boolean only_if_complete; /* only use complete target content */
- boolean use_random_replace; /* use random value for replacing elements */
- int random_percentage; /* random value for replacing elements */
- int replace_when; /* type of elements that can be replaced */
+ struct Content target_content;// elements for extended change target
+ boolean use_target_content; // use extended change target
+ boolean only_if_complete; // only use complete target content
+ boolean use_random_replace; // use random value for replacing elements
+ int random_percentage; // random value for replacing elements
+ int replace_when; // type of elements that can be replaced
- boolean explode; /* explode instead of change */
+ boolean explode; // explode instead of change
- boolean has_action; /* execute action on specified condition */
- int action_type; /* type of action */
- int action_mode; /* mode of action */
- int action_arg; /* parameter of action */
- int action_element; /* element related to action */
+ boolean has_action; // execute action on specified condition
+ int action_type; // type of action
+ int action_mode; // mode of action
+ int action_arg; // parameter of action
+ int action_element; // element related to action
- /* ---------- internal values used at runtime when playing ---------- */
+ // ---------- internal values used at runtime when playing ----------
- int trigger_element; /* element triggering change */
+ int trigger_element; // element triggering change
/* functions that are called before, while and after the change of an
element -- currently only used for non-custom elements */
void (*change_function)(int x, int y);
void (*post_change_function)(int x, int y);
- short actual_trigger_element; /* element that actually triggered change */
- int actual_trigger_side; /* element side that triggered the change */
- int actual_trigger_player; /* player which actually triggered change */
- int actual_trigger_player_bits; /* player bits of triggering players */
- int actual_trigger_ce_value; /* CE value of element that triggered change */
- int actual_trigger_ce_score; /* CE score of element that triggered change */
+ short actual_trigger_element; // element that actually triggered change
+ int actual_trigger_side; // element side that triggered the change
+ int actual_trigger_player; // player which actually triggered change
+ int actual_trigger_player_bits; // player bits of triggering players
+ int actual_trigger_ce_value; // CE value of element that triggered change
+ int actual_trigger_ce_score; // CE score of element that triggered change
- boolean can_change_or_has_action; /* can_change | has_action */
+ boolean can_change_or_has_action; // can_change | has_action
- /* ---------- internal values used in level editor ---------- */
+ // ---------- internal values used in level editor ----------
- int direct_action; /* change triggered by actions on element */
- int other_action; /* change triggered by other element actions */
+ int direct_action; // change triggered by actions on element
+ int other_action; // change triggered by other element actions
};
struct ElementGroupInfo
{
- int num_elements; /* number of elements in this group */
- int element[MAX_ELEMENTS_IN_GROUP]; /* list of elements in this group */
+ int num_elements; // number of elements in this group
+ int element[MAX_ELEMENTS_IN_GROUP]; // list of elements in this group
- int choice_mode; /* how to choose element from group */
+ int choice_mode; // how to choose element from group
- /* ---------- internal values used at runtime when playing ---------- */
+ // ---------- internal values used at runtime when playing ----------
/* the following is the same as above, but with recursively resolved group
elements (group elements may also contain further group elements!) */
int num_elements_resolved;
short element_resolved[NUM_FILE_ELEMENTS];
- int choice_pos; /* current element choice position */
+ int choice_pos; // current element choice position
};
struct ElementNameInfo
{
- /* ---------- token and description strings ---------- */
+ // ---------- token and description strings ----------
- char *token_name; /* element token used in config files */
- char *class_name; /* element class used in config files */
- char *editor_description; /* pre-defined description for level editor */
+ char *token_name; // element token used in config files
+ char *class_name; // element class used in config files
+ char *editor_description; // pre-defined description for level editor
};
struct ElementInfo
{
- /* ---------- token and description strings ---------- */
+ // ---------- token and description strings ----------
- char *token_name; /* element token used in config files */
- char *class_name; /* element class used in config files */
- char *editor_description; /* pre-defined description for level editor */
- char *custom_description; /* alternative description from config file */
- char description[MAX_ELEMENT_NAME_LEN + 1]; /* for custom/group elements */
+ char *token_name; // element token used in config files
+ char *class_name; // element class used in config files
+ char *editor_description; // pre-defined description for level editor
+ char *custom_description; // alternative description from config file
+ char description[MAX_ELEMENT_NAME_LEN + 1]; // for custom/group elements
- /* ---------- graphic and sound definitions ---------- */
+ // ---------- graphic and sound definitions ----------
- int graphic[NUM_ACTIONS]; /* default graphics for several actions */
+ int graphic[NUM_ACTIONS]; // default graphics for several actions
int direction_graphic[NUM_ACTIONS][NUM_DIRECTIONS_FULL];
- /* special graphics for left/right/up/down */
+ // special graphics for left/right/up/down
- int crumbled[NUM_ACTIONS]; /* crumbled graphics for several actions */
+ int crumbled[NUM_ACTIONS]; // crumbled graphics for several actions
int direction_crumbled[NUM_ACTIONS][NUM_DIRECTIONS_FULL];
- /* crumbled graphics for left/right/up/down */
+ // crumbled graphics for left/right/up/down
int special_graphic[NUM_SPECIAL_GFX_ARGS];
- /* special graphics for certain screens */
+ // special graphics for certain screens
- int sound[NUM_ACTIONS]; /* default sounds for several actions */
+ int sound[NUM_ACTIONS]; // default sounds for several actions
- /* ---------- special element property values ---------- */
+ // ---------- special element property values ----------
- unsigned int properties[NUM_EP_BITFIELDS]; /* element base properties */
+ unsigned int properties[NUM_EP_BITFIELDS]; // element base properties
- boolean use_gfx_element; /* use custom graphic element */
- int gfx_element_initial; /* initial optional custom graphic element */
+ boolean use_gfx_element; // use custom graphic element
+ int gfx_element_initial; // initial optional custom graphic element
- int access_direction; /* accessible from which direction */
+ int access_direction; // accessible from which direction
- int collect_score_initial; /* initial score value for collecting */
- int collect_count_initial; /* initial count value for collecting */
+ int collect_score_initial; // initial score value for collecting
+ int collect_count_initial; // initial count value for collecting
- int ce_value_fixed_initial; /* initial value for custom variable (fix) */
- int ce_value_random_initial; /* initial value for custom variable (rnd) */
- boolean use_last_ce_value; /* use value from element before change */
+ int ce_value_fixed_initial; // initial value for custom variable (fix)
+ int ce_value_random_initial; // initial value for custom variable (rnd)
+ boolean use_last_ce_value; // use value from element before change
- int push_delay_fixed; /* constant delay before pushing */
- int push_delay_random; /* additional random delay before pushing */
- int drop_delay_fixed; /* constant delay after dropping */
- int drop_delay_random; /* additional random delay after dropping */
- int move_delay_fixed; /* constant delay after moving */
- int move_delay_random; /* additional random delay after moving */
+ int push_delay_fixed; // constant delay before pushing
+ int push_delay_random; // additional random delay before pushing
+ int drop_delay_fixed; // constant delay after dropping
+ int drop_delay_random; // additional random delay after dropping
+ int move_delay_fixed; // constant delay after moving
+ int move_delay_random; // additional random delay after moving
- int move_pattern; /* direction movable element moves to */
- int move_direction_initial; /* initial direction element moves to */
- int move_stepsize; /* step size element moves with */
+ int move_pattern; // direction movable element moves to
+ int move_direction_initial; // initial direction element moves to
+ int move_stepsize; // step size element moves with
- int move_enter_element; /* element that can be entered (and removed) */
- int move_leave_element; /* element that can be left behind */
- int move_leave_type; /* change (limited) or leave (unlimited) */
+ int move_enter_element; // element that can be entered (and removed)
+ int move_leave_element; // element that can be left behind
+ int move_leave_type; // change (limited) or leave (unlimited)
- int slippery_type; /* how/where other elements slip away */
+ int slippery_type; // how/where other elements slip away
- struct Content content; /* new elements after explosion */
+ struct Content content; // new elements after explosion
- int explosion_type; /* type of explosion, like 3x3, 3+3 or 1x1 */
- int explosion_delay; /* duration of explosion of this element */
- int ignition_delay; /* delay for explosion by other explosion */
+ int explosion_type; // type of explosion, like 3x3, 3+3 or 1x1
+ int explosion_delay; // duration of explosion of this element
+ int ignition_delay; // delay for explosion by other explosion
- struct ElementChangeInfo *change_page; /* actual list of change pages */
- struct ElementChangeInfo *change; /* pointer to current change page */
+ struct ElementChangeInfo *change_page; // actual list of change pages
+ struct ElementChangeInfo *change; // pointer to current change page
- int num_change_pages; /* actual number of change pages */
- int current_change_page; /* currently edited change page */
+ int num_change_pages; // actual number of change pages
+ int current_change_page; // currently edited change page
- struct ElementGroupInfo *group; /* pointer to element group info */
+ struct ElementGroupInfo *group; // pointer to element group info
- /* ---------- internal values used at runtime when playing ---------- */
+ // ---------- internal values used at runtime when playing ----------
boolean has_change_event[NUM_CHANGE_EVENTS];
- int event_page_nr[NUM_CHANGE_EVENTS]; /* page number for each event */
- struct ElementChangeInfo *event_page[NUM_CHANGE_EVENTS]; /* page for event */
+ int event_page_nr[NUM_CHANGE_EVENTS]; // page number for each event
+ struct ElementChangeInfo *event_page[NUM_CHANGE_EVENTS]; // page for event
boolean in_group[NUM_GROUP_ELEMENTS];
- int gfx_element; /* runtime optional custom graphic element */
+ int gfx_element; // runtime optional custom graphic element
- int collect_score; /* runtime score value for collecting */
+ int collect_score; // runtime score value for collecting
- /* count of this element on playfield, calculated after each frame */
+ // count of this element on playfield, calculated after each frame
int element_count;
- /* ---------- internal values used in level editor ---------- */
+ // ---------- internal values used in level editor ----------
- int access_type; /* walkable or passable */
- int access_layer; /* accessible over/inside/under */
- int access_protected; /* protection against deadly elements */
- int walk_to_action; /* diggable/collectible/pushable */
- int smash_targets; /* can smash player/enemies/everything */
- int deadliness; /* deadly when running/colliding/touching */
+ int access_type; // walkable or passable
+ int access_layer; // accessible over/inside/under
+ int access_protected; // protection against deadly elements
+ int walk_to_action; // diggable/collectible/pushable
+ int smash_targets; // can smash player/enemies/everything
+ int deadliness; // deadly when running/colliding/touching
- boolean can_explode_by_fire; /* element explodes by fire */
- boolean can_explode_smashed; /* element explodes when smashed */
- boolean can_explode_impact; /* element explodes on impact */
+ boolean can_explode_by_fire; // element explodes by fire
+ boolean can_explode_smashed; // element explodes when smashed
+ boolean can_explode_impact; // element explodes on impact
- boolean modified_settings; /* set for all modified custom elements */
+ boolean modified_settings; // set for all modified custom elements
};
struct FontInfo
{
- char *token_name; /* font token used in config files */
+ char *token_name; // font token used in config files
- int graphic; /* default graphic for this font */
+ int graphic; // default graphic for this font
int special_graphic[NUM_SPECIAL_GFX_ARGS];
- /* special graphics for certain screens */
+ // special graphics for certain screens
int special_bitmap_id[NUM_SPECIAL_GFX_ARGS];
- /* internal bitmap ID for special graphics */
+ // internal bitmap ID for special graphics
};
struct GlobalAnimNameInfo
{
- char *token_name; /* global animation token in config files */
+ char *token_name; // global animation token in config files
};
struct GlobalAnimInfo
{
- char *token_name; /* global animation token in config files */
+ char *token_name; // global animation token in config files
- /* global animation graphic and control definitions */
+ // global animation graphic and control definitions
int graphic[NUM_GLOBAL_ANIM_PARTS_ALL][NUM_SPECIAL_GFX_ARGS];
- /* global animation sound and music definitions */
+ // global animation sound and music definitions
int sound[NUM_GLOBAL_ANIM_PARTS_ALL][NUM_SPECIAL_GFX_ARGS];
int music[NUM_GLOBAL_ANIM_PARTS_ALL][NUM_SPECIAL_GFX_ARGS];
};
struct GraphicInfo
{
- Bitmap **bitmaps; /* bitmaps in all required sizes */
- Bitmap *bitmap; /* bitmap in default size */
+ Bitmap **bitmaps; // bitmaps in all required sizes
+ Bitmap *bitmap; // bitmap in default size
- int src_image_width; /* scaled bitmap size, but w/o small images */
- int src_image_height; /* scaled bitmap size, but w/o small images */
+ int src_image_width; // scaled bitmap size, but w/o small images
+ int src_image_height; // scaled bitmap size, but w/o small images
- int src_x, src_y; /* start position of animation frames */
- int width, height; /* width/height of each animation frame */
+ int src_x, src_y; // start position of animation frames
+ int width, height; // width/height of each animation frame
- int offset_x, offset_y; /* x/y offset to next animation frame */
- int offset2_x, offset2_y; /* x/y offset to second movement tile */
+ int offset_x, offset_y; // x/y offset to next animation frame
+ int offset2_x, offset2_y; // x/y offset to second movement tile
- boolean double_movement; /* animation has second movement tile */
- int swap_double_tiles; /* explicitely force or forbid tile swapping */
+ boolean double_movement; // animation has second movement tile
+ int swap_double_tiles; // explicitely force or forbid tile swapping
int anim_frames;
int anim_frames_per_line;
int anim_start_frame;
- int anim_delay; /* important: delay of 1 means "no delay"! */
+ int anim_delay; // important: delay of 1 means "no delay"!
int anim_mode;
boolean anim_global_sync;
- int crumbled_like; /* element for cloning crumble graphics */
- int diggable_like; /* element for cloning digging graphics */
+ int crumbled_like; // element for cloning crumble graphics
+ int diggable_like; // element for cloning digging graphics
- int border_size; /* border size for "crumbled" graphics */
+ int border_size; // border size for "crumbled" graphics
- int scale_up_factor; /* optional factor for scaling image up */
- int tile_size; /* optional explicitly defined tile size */
+ int scale_up_factor; // optional factor for scaling image up
+ int tile_size; // optional explicitly defined tile size
- int clone_from; /* graphic for cloning *all* settings */
+ int clone_from; // graphic for cloning *all* settings
- int init_delay_fixed; /* optional initial delay values for global */
- int init_delay_random; /* animations (pause interval before start) */
- int anim_delay_fixed; /* optional delay values for bored/sleeping */
- int anim_delay_random; /* and global animations (animation length) */
- int post_delay_fixed; /* optional delay values after bored/global */
- int post_delay_random; /* animations (pause before next animation) */
+ int init_delay_fixed; // optional initial delay values for global
+ int init_delay_random; // animations (pause interval before start)
+ int anim_delay_fixed; // optional delay values for bored/sleeping
+ int anim_delay_random; // and global animations (animation length)
+ int post_delay_fixed; // optional delay values after bored/global
+ int post_delay_random; // animations (pause before next animation)
- int init_event; /* optional event triggering animation start */
- int init_event_action; /* optional action called on animation start */
- int anim_event; /* optional event triggering animation end */
- int anim_event_action; /* optional action called on animation end */
+ int init_event; // optional event triggering animation start
+ int init_event_action; // optional action called on animation start
+ int anim_event; // optional event triggering animation end
+ int anim_event_action; // optional action called on animation end
- int step_offset; /* optional step offset of toon animations */
- int step_xoffset; /* optional step offset of toon animations */
- int step_yoffset; /* optional step offset of toon animations */
- int step_delay; /* optional step delay of toon animations */
- int direction; /* optional move direction of toon animations */
- int position; /* optional draw position of toon animations */
- int x; /* optional draw position of toon animations */
- int y; /* optional draw position of toon animations */
+ int step_offset; // optional step offset of toon animations
+ int step_xoffset; // optional step offset of toon animations
+ int step_yoffset; // optional step offset of toon animations
+ int step_delay; // optional step delay of toon animations
+ int direction; // optional move direction of toon animations
+ int position; // optional draw position of toon animations
+ int x; // optional draw position of toon animations
+ int y; // optional draw position of toon animations
- int draw_xoffset; /* optional offset for drawing font chars */
- int draw_yoffset; /* optional offset for drawing font chars */
+ int draw_xoffset; // optional offset for drawing font chars
+ int draw_yoffset; // optional offset for drawing font chars
- int draw_masked; /* optional setting for drawing envelope gfx */
- int draw_order; /* optional draw order for global animations */
+ int draw_masked; // optional setting for drawing envelope gfx
+ int draw_order; // optional draw order for global animations
- int fade_mode; /* optional setting for drawing title screens */
- int fade_delay; /* optional setting for drawing title screens */
- int post_delay; /* optional setting for drawing title screens */
- int auto_delay; /* optional setting for drawing title screens */
- int align, valign; /* optional setting for drawing title screens */
- int sort_priority; /* optional setting for drawing title screens */
+ int fade_mode; // optional setting for drawing title screens
+ int fade_delay; // optional setting for drawing title screens
+ int post_delay; // optional setting for drawing title screens
+ int auto_delay; // optional setting for drawing title screens
+ int align, valign; // optional setting for drawing title screens
+ int sort_priority; // optional setting for drawing title screens
int class;
int style;
int pressed_xoffset;
int pressed_yoffset;
- boolean use_image_size; /* use image size as default width and height */
+ boolean use_image_size; // use image size as default width and height
};
struct SoundInfo
extern struct ConfigInfo helpanim_config[];
extern struct ConfigInfo helptext_config[];
-#endif /* MAIN_H */
+#endif // MAIN_H
#define NEXT(player) ((player)->next ? (player)->next : first_player)
-/* TODO: peer address */
-static TCPsocket lfd; /* listening TCP socket */
-static UDPsocket udp; /* listening UDP socket */
-static SDLNet_SocketSet fds; /* socket set */
+// TODO: peer address
+static TCPsocket lfd; // listening TCP socket
+static UDPsocket udp; // listening UDP socket
+static SDLNet_SocketSet fds; // socket set
static struct NetworkBuffer *read_buffer = NULL;
static struct NetworkBuffer *write_buffer = NULL;
{
resetNetworkBufferForReading(nb);
- /* skip message length header */
+ // skip message length header
getNetworkBuffer32BitInteger(nb);
}
{
resetNetworkBufferForWriting(nb);
- /* will be replaced with message length before sending */
+ // will be replaced with message length before sending
putNetworkBuffer32BitInteger(nb, 0);
putNetworkBuffer8BitInteger(nb, message_type);
int message_type = getNetworkBuffer8BitInteger(nb_from);
- /* skip player number */
+ // skip player number
getNetworkBuffer8BitInteger(nb_from);
initNetworkBufferForWriting(nb_to, message_type, player_nr);
static void increaseNetworkBuffer(struct NetworkBuffer *nb, int additional_size)
{
- /* add some more buffer size than is really required this time */
+ // add some more buffer size than is really required this time
nb->max_size += additional_size + MAX_BUFFER_SIZE;
nb->buffer = checked_realloc(nb->buffer, nb->max_size);
}
int filesize_pos = nb->pos;
int num_bytes = 0;
- /* will be replaced with file size */
+ // will be replaced with file size
putNetworkBuffer32BitInteger(nb, 0);
if (!(file = openFile(filename, MODE_READ)))
closeFile(file);
- /* set file size */
+ // set file size
putNetwork32BitInteger(&nb->buffer[filesize_pos], num_bytes);
return num_bytes;
{
struct NetworkServerPlayerInfo *player;
- /* set message length header */
+ // set message length header
putNetwork32BitInteger(nb->buffer, nb->size - 4);
for (player = first_player; player != NULL; player = player->next)
{
if (player != except && player->introduced)
{
- /* directly send the buffer to the network client */
+ // directly send the buffer to the network client
SDLNet_TCP_Send(player->fd, nb->buffer, nb->size);
}
}
static void SendNetworkBufferToClient(struct NetworkBuffer *nb,
struct NetworkServerPlayerInfo *player)
{
- /* set message length header */
+ // set message length header
putNetwork32BitInteger(nb->buffer, nb->size - 4);
- /* directly send the buffer to the network client */
+ // directly send the buffer to the network client
SDLNet_TCP_Send(player->fd, nb->buffer, nb->size);
}
free(player);
num_clients--;
-#if 0 /* do not terminate network server if last player disconnected */
+#if 0 // do not terminate network server if last player disconnected
if (run_server_only_once && num_clients == 0)
{
if (options.verbose)
struct NetworkServerPlayerInfo *p;
- /* reset frame counter */
+ // reset frame counter
ServerFrameCounter = 0;
Error(ERR_NETWORK_SERVER, "resetting ServerFrameCounter to 0");
- /* reset player actions */
+ // reset player actions
for (p = first_player; p != NULL; p = p->next)
{
p->action = 0;
struct NetworkServerPlayerInfo *p;
int i;
- /* store player action */
+ // store player action
for (p = first_player; p != NULL; p = p->next)
{
if (p->number == player->number)
}
}
- /* check if server received action from each player */
+ // check if server received action from each player
for (p = first_player; p != NULL; p = p->next)
{
if (!p->action_received)
int player_action_all[last_client_nr];
- /* initialize all player actions to zero */
+ // initialize all player actions to zero
for (i = 0; i < last_client_nr; i++)
player_action_all[i] = 0;
- /* broadcast actions of all players to all players */
+ // broadcast actions of all players to all players
for (p = first_player; p != NULL; p = p->next)
{
player_action_all[p->number - 1] = p->action;
{
NetworkServer(*((int *) ptr), 0);
- /* should never be reached */
+ // should never be reached
return 0;
}
if (SDLNet_CheckSockets(fds, 100) < 1)
continue;
- /* accept incoming TCP connections */
+ // accept incoming TCP connections
if (SDLNet_SocketReady(lfd))
{
Error(ERR_DEBUG, "got TCP packet");
AddPlayer(newsock);
}
- /* accept incoming UDP packets */
+ // accept incoming UDP packets
if (SDLNet_SocketReady(udp))
{
Error(ERR_DEBUG, "got UDP packet");
int message_type = getNetworkBuffer8BitInteger(read_buffer);
- /* skip player number */
+ // skip player number
getNetworkBuffer8BitInteger(read_buffer);
if (!player->introduced &&
NULL
};
-/* server stuff */
+// server stuff
-static TCPsocket sfd; /* TCP server socket */
-static UDPsocket udp; /* UDP server socket */
-static SDLNet_SocketSet rfds; /* socket set */
+static TCPsocket sfd; // TCP server socket
+static UDPsocket udp; // UDP server socket
+static SDLNet_SocketSet rfds; // socket set
static struct NetworkBuffer *read_buffer = NULL;
static struct NetworkBuffer *write_buffer = NULL;
DrawTextSCentered(ypos_1, font_nr, message);
- /* calculate offset to x position caused by rounding */
+ // calculate offset to x position caused by rounding
int max_chars_per_line = max_line_width / font_width;
int xoffset = (max_line_width - max_chars_per_line * font_width) / 2;
if (!network.enabled)
return;
- /* set message length header */
+ // set message length header
putNetwork32BitInteger(nb->buffer, nb->size - 4);
- /* directly send the buffer to the network server */
+ // directly send the buffer to the network server
SDLNet_TCP_Send(sfd, nb->buffer, nb->size);
}
if (player->nr == player_nr)
break;
- if (player == NULL) /* should not happen */
+ if (player == NULL) // should not happen
Error(ERR_EXIT, "protocol error: reference to non-existing player %d",
player_nr);
int data_len = strlen(data_ptr) + 1;
IPaddress ip_address;
- SDLNet_Write32(0xffffffff, &ip_address.host); /* 255.255.255.255 */
+ SDLNet_Write32(0xffffffff, &ip_address.host); // 255.255.255.255
SDLNet_Write16(port, &ip_address.port);
UDPpacket packet =
DrawNetworkText("Looking for nearby network server ...");
- /* wait for any nearby network server to answer UDP broadcast */
+ // wait for any nearby network server to answer UDP broadcast
for (i = 0; i < 5; i++)
{
if (SDLNet_CheckSockets(udp_socket_set, 0) == 1)
// local network, try to connect to a network server at the local host
if (server_host == 0)
{
- server_host = 0x7f000001; /* 127.0.0.1 */
+ server_host = 0x7f000001; // 127.0.0.1
DrawNetworkText("Looking for local network server ...");
}
printf("SDLNet_TCP_Open(): %s\n", SDLNet_GetError());
}
- if (hostname) /* connect to specified server failed */
+ if (hostname) // connect to specified server failed
return FALSE;
DrawNetworkText("Starting new local network server ...");
StartNetworkServer(port);
- /* wait for server to start up and try connecting several times */
+ // wait for server to start up and try connecting several times
for (i = 0; i < 30; i++)
{
- if ((sfd = SDLNet_TCP_Open(&ip))) /* connected */
+ if ((sfd = SDLNet_TCP_Open(&ip))) // connected
{
DrawNetworkText_Success("Successfully connected to newly started network server!");
DrawNetworkText_Failed("Failed to connect to newly started network server!");
- /* when reaching this point, connect to newly started server has failed */
+ // when reaching this point, connect to newly started server has failed
return FALSE;
}
setString(&network_level.leveldir_identifier, leveldir_current->identifier);
- /* the sending client does not use network level files (but the real ones) */
+ // the sending client does not use network level files (but the real ones)
network_level.use_network_level_files = FALSE;
#if 0
if (old_local_player != new_local_player)
{
- /* set relevant player settings and change to new player */
+ // set relevant player settings and change to new player
local_player = new_local_player;
printf("OP_NUMBER_WANTED: %d\n", old_client_nr);
- if (new_client_nr == client_nr_wanted) /* switching succeeded */
+ if (new_client_nr == client_nr_wanted) // switching succeeded
{
struct NetworkClientPlayerInfo *player;
- if (old_client_nr != client_nr_wanted) /* client's nr has changed */
+ if (old_client_nr != client_nr_wanted) // client's nr has changed
Error(ERR_NETWORK_CLIENT, "client %d switches to # %d",
old_client_nr, new_client_nr);
- else if (old_client_nr == first_player.nr) /* local player keeps his nr */
+ else if (old_client_nr == first_player.nr) // local player keeps his nr
Error(ERR_NETWORK_CLIENT, "keeping client # %d", new_client_nr);
if (old_client_nr != new_client_nr)
{
- /* set relevant player settings and change to new player */
+ // set relevant player settings and change to new player
old_player->connected_network = FALSE;
new_player->connected_network = TRUE;
player = getNetworkPlayer(old_client_nr);
player->nr = new_client_nr;
- if (old_player == local_player) /* local player switched */
+ if (old_player == local_player) // local player switched
{
local_player = new_player;
new_player->connected_locally = TRUE;
}
}
- else if (old_client_nr == first_player.nr) /* failed -- local player? */
+ else if (old_client_nr == first_player.nr) // failed -- local player?
{
char request[100];
level_nr = new_level_nr;
}
- /* needed if level set of network game changed graphics, sounds or music */
+ // needed if level set of network game changed graphics, sounds or music
ReloadCustomArtwork(0);
TapeErase();
return;
}
- /* copy valid player actions (will be set to 0 for not connected players) */
+ // copy valid player actions (will be set to 0 for not connected players)
for (i = 0; i < MAX_PLAYERS; i++)
stored_player[i].effective_action =
getNetworkBuffer8BitInteger(read_buffer);
network_level.leveldir_identifier = leveldir_identifier;
network_level.use_custom_template = use_custom_template;
- /* the receiving client(s) use(s) the transferred network level files */
+ // the receiving client(s) use(s) the transferred network level files
network_level.use_network_level_files = TRUE;
#if 0
fflush(stdout);
- /* in case of internal error, stop network game */
+ // in case of internal error, stop network game
if (stop_network_game)
SendToServer_StopPlaying(NETWORK_STOP_BY_ERROR);
}
{
while (1)
{
- /* ---------- check network server for activity ---------- */
+ // ---------- check network server for activity ----------
int num_active_sockets = SDLNet_CheckSockets(rfds, 0);
if (num_active_sockets == 0)
break; // no active sockets, stop here
- /* ---------- read packets from network server ---------- */
+ // ---------- read packets from network server ----------
initNetworkBufferForReceiving(read_buffer);
void HandleNetworking(void)
{
- /* do not handle any networking packets if request dialog is active */
+ // do not handle any networking packets if request dialog is active
if (game.request_active)
return;
#define DEBUG_JOYSTICKS 0
-/* screens on the info screen */
+// screens on the info screen
#define INFO_MODE_MAIN 0
#define INFO_MODE_TITLE 1
#define INFO_MODE_ELEMENTS 2
#define MAX_INFO_MODES 8
-/* screens on the setup screen */
-/* (must match GFX_SPECIAL_ARG_SETUP_* values as defined in src/main.h) */
-/* (should also match corresponding entries in src/conf_gfx.c) */
+// screens on the setup screen
+// (must match GFX_SPECIAL_ARG_SETUP_* values as defined in src/main.h)
+// (should also match corresponding entries in src/conf_gfx.c)
#define SETUP_MODE_MAIN 0
#define SETUP_MODE_GAME 1
#define SETUP_MODE_EDITOR 2
#define SETUP_MODE_SHORTCUTS_4 12
#define SETUP_MODE_SHORTCUTS_5 13
-/* sub-screens on the setup screen (generic) */
+// sub-screens on the setup screen (generic)
#define SETUP_MODE_CHOOSE_ARTWORK 14
#define SETUP_MODE_CHOOSE_OTHER 15
-/* sub-screens on the setup screen (specific) */
+// sub-screens on the setup screen (specific)
#define SETUP_MODE_CHOOSE_GAME_SPEED 16
#define SETUP_MODE_CHOOSE_SCROLL_DELAY 17
#define SETUP_MODE_CHOOSE_SNAPSHOT_MODE 18
#define MAX_MENU_MODES MAX(MAX_INFO_MODES, MAX_SETUP_MODES)
-/* setup screen titles */
+// setup screen titles
#define STR_SETUP_MAIN "Setup"
#define STR_SETUP_GAME "Game & Menu"
#define STR_SETUP_EDITOR "Editor"
#define STR_SETUP_CHOOSE_GRID_XSIZE_1 "Horiz. Buttons"
#define STR_SETUP_CHOOSE_GRID_YSIZE_1 "Vert. Buttons"
-/* for input setup functions */
+// for input setup functions
#define SETUPINPUT_SCREEN_POS_START 0
#define SETUPINPUT_SCREEN_POS_EMPTY1 3
#define SETUPINPUT_SCREEN_POS_EMPTY2 12
#define MAX_SETUP_TEXT_INPUT_LEN 28
-/* for various menu stuff */
+// for various menu stuff
#define MENU_SCREEN_START_XPOS 1
#define MENU_SCREEN_START_YPOS 2
#define MENU_SCREEN_VALUE_XPOS (SCR_FIELDX - 3)
#define MAX_MENU_TEXT_LENGTH_BIG 13
#define MAX_MENU_TEXT_LENGTH_MEDIUM (MAX_MENU_TEXT_LENGTH_BIG * 2)
-/* screen gadget identifiers */
+// screen gadget identifiers
#define SCREEN_CTRL_ID_PREV_LEVEL 0
#define SCREEN_CTRL_ID_NEXT_LEVEL 1
#define SCREEN_CTRL_ID_PREV_PLAYER 2
#define SCREEN_MASK_MAIN_HAS_SOLUTION (1 << 1)
#define SCREEN_MASK_INPUT (1 << 2)
-/* graphic position and size values for buttons and scrollbars */
+// graphic position and size values for buttons and scrollbars
#define SC_MENUBUTTON_XSIZE TILEX
#define SC_MENUBUTTON_YSIZE TILEY
#define SC_BORDER_SIZE 14
-/* forward declarations of internal functions */
+// forward declarations of internal functions
static void HandleScreenGadgets(struct GadgetInfo *);
static void HandleSetupScreen_Generic(int, int, int, int, int);
static void HandleSetupScreen_Input(int, int, int, int, int);
(s) == GAME_MODE_PSEUDO_TYPENAME ? \
GAME_MODE_MAIN : GAME_MODE_DEFAULT)
-/* (there are no draw offset definitions needed for INFO_MODE_TITLE) */
+// (there are no draw offset definitions needed for INFO_MODE_TITLE)
#define DRAW_MODE_INFO(i) ((i) >= INFO_MODE_TITLE && \
(i) <= INFO_MODE_LEVELSET ? (i) : \
INFO_MODE_MAIN)
NUM_MENU_ENTRIES_ON_SCREEN)
-/* title display and control definitions */
+// title display and control definitions
#define MAX_NUM_TITLE_SCREENS (2 * MAX_NUM_TITLE_IMAGES + \
2 * MAX_NUM_TITLE_MESSAGES)
struct TitleControlInfo title_controls[MAX_NUM_TITLE_SCREENS];
-/* main menu display and control definitions */
+// main menu display and control definitions
#define MAIN_CONTROL_NAME 0
#define MAIN_CONTROL_LEVELS 1
NULL, NULL,
},
#if 0
- /* (these two buttons are real gadgets) */
+ // (these two buttons are real gadgets)
{
MAIN_CONTROL_PREV_LEVEL,
&menu.main.button.prev_level, IMG_MENU_BUTTON_PREV_LEVEL,
title_controls[num_title_screens].local_nr = nr;
title_controls[num_title_screens].sort_priority = sort_priority;
- title_controls[num_title_screens].first = FALSE; /* will be set later */
+ title_controls[num_title_screens].first = FALSE; // will be set later
num_title_screens++;
}
{
num_title_screens = 0;
- /* 1st step: initialize title screens for game start (only when starting) */
+ // 1st step: initialize title screens for game start (only when starting)
if (show_title_initial)
InitializeTitleControls_CheckTitleInfo(TRUE);
- /* 2nd step: initialize title screens for current level set */
+ // 2nd step: initialize title screens for current level set
InitializeTitleControls_CheckTitleInfo(FALSE);
- /* sort title screens according to sort_priority and title number */
+ // sort title screens according to sort_priority and title number
qsort(title_controls, num_title_screens, sizeof(struct TitleControlInfo),
compareTitleControlInfo);
- /* mark first title screen */
+ // mark first title screen
title_controls[0].first = TRUE;
}
boolean local_team_mode = (!network.enabled && setup.team_mode);
int i;
- /* set main control text values to dynamically determined values */
+ // set main control text values to dynamically determined values
sprintf(main_text_name, "%s", local_team_mode ? "Team:" : "Name:");
strcpy(main_text_first_level, int2str(leveldir_current->first_level,
main_text_title_2 = getConfigProgramCopyrightString();
main_text_title_3 = getConfigProgramCompanyString();
- /* set main control screen positions to dynamically determined values */
+ // set main control screen positions to dynamically determined values
for (i = 0; main_controls[i].nr != -1; i++)
{
struct MainControlInfo *mci = &main_controls[i];
menu.main.input.name.height = input_height;
}
- if (pos_button != NULL) /* (x/y may be -1/-1 here) */
+ if (pos_button != NULL) // (x/y may be -1/-1 here)
{
pos_button->width = button_width;
pos_button->height = button_height;
}
- if (pos_text != NULL) /* (x/y may be -1/-1 here) */
+ if (pos_text != NULL) // (x/y may be -1/-1 here)
{
- /* calculate text size -- needed for text alignment */
+ // calculate text size -- needed for text alignment
boolean calculate_text_size = (text != NULL);
if (pos_text->width == -1 || calculate_text_size)
}
}
- if (pos_input != NULL) /* (x/y may be -1/-1 here) */
+ if (pos_input != NULL) // (x/y may be -1/-1 here)
{
if (visibleTextPos(pos_text))
{
int y = mSY + ALIGNED_TEXT_YPOS(pos);
#if 1
- /* (check why/if this is needed) */
+ // (check why/if this is needed)
DrawBackgroundForFont(x, y, pos->width, pos->height, font_text);
#endif
DrawText(x, y, text, font_text);
int y = mSY + ALIGNED_TEXT_YPOS(pos);
#if 1
- /* (check why/if this is needed) */
+ // (check why/if this is needed)
DrawBackgroundForFont(x, y, pos->width, pos->height, font_input);
#endif
DrawText(x, y, input, font_input);
{
int scrollbar_xpos = mSX + SC_SCROLLBAR_XPOS + menu.scrollbar_xoffset;
- /* correct scrollbar position if placed outside menu (playfield) area */
+ // correct scrollbar position if placed outside menu (playfield) area
if (scrollbar_xpos > SX + SC_SCROLLBAR_XPOS)
scrollbar_xpos = SX + SC_SCROLLBAR_XPOS;
- /* clear menu list area, but not title or scrollbar */
+ // clear menu list area, but not title or scrollbar
DrawBackground(mSX, mSY + MENU_SCREEN_START_YPOS * 32,
scrollbar_xpos - mSX, NUM_MENU_ENTRIES_ON_SCREEN * 32);
}
if (width > WIN_XSIZE)
{
- /* image width too large for window => center image horizontally */
+ // image width too large for window => center image horizontally
src_x = (width - WIN_XSIZE) / 2;
width = WIN_XSIZE;
}
if (height > WIN_YSIZE)
{
- /* image height too large for window => center image vertically */
+ // image height too large for window => center image vertically
src_y = (height - WIN_YSIZE) / 2;
height = WIN_YSIZE;
}
- /* always display title screens centered */
+ // always display title screens centered
dst_x = (WIN_XSIZE - width) / 2;
dst_y = (WIN_YSIZE - height) / 2;
if (filename == NULL)
return;
- /* force TITLE font on title message screen */
+ // force TITLE font on title message screen
SetFontStatus(getTitleMessageGameMode(initial));
- /* if chars *and* width set to "-1", automatically determine width */
+ // if chars *and* width set to "-1", automatically determine width
if (tmi->chars == -1 && tmi->width == -1)
tmi->width = viewport.window[game_status].width;
- /* if lines *and* height set to "-1", automatically determine height */
+ // if lines *and* height set to "-1", automatically determine height
if (tmi->lines == -1 && tmi->height == -1)
tmi->height = viewport.window[game_status].height;
- /* if chars set to "-1", automatically determine by text and font width */
+ // if chars set to "-1", automatically determine by text and font width
if (tmi->chars == -1)
tmi->chars = tmi->width / getFontWidth(tmi->font);
else
tmi->width = tmi->chars * getFontWidth(tmi->font);
- /* if lines set to "-1", automatically determine by text and font height */
+ // if lines set to "-1", automatically determine by text and font height
if (tmi->lines == -1)
tmi->lines = tmi->height / getFontHeight(tmi->font);
else
tmi->height = tmi->lines * getFontHeight(tmi->font);
- /* if x set to "-1", automatically determine by width and alignment */
+ // if x set to "-1", automatically determine by width and alignment
if (tmi->x == -1)
tmi->x = -1 * ALIGNED_XPOS(0, tmi->width, tmi->align);
- /* if y set to "-1", automatically determine by height and alignment */
+ // if y set to "-1", automatically determine by height and alignment
if (tmi->y == -1)
tmi->y = -1 * ALIGNED_YPOS(0, tmi->height, tmi->valign);
static boolean show_title_initial = TRUE;
boolean show_titlescreen = FALSE;
- /* needed to be able to skip title screen, if no image or message defined */
+ // needed to be able to skip title screen, if no image or message defined
InitializeTitleControls(show_title_initial);
if (setup.show_titlescreen && (show_title_initial || levelset_has_changed))
show_titlescreen = TRUE;
- /* show initial title images and messages only once at program start */
+ // show initial title images and messages only once at program start
show_title_initial = FALSE;
return (show_titlescreen && num_title_screens > 0);
FadeSetLeaveScreen();
- /* do not fade out here -- function may continue and fade on editor screen */
+ // do not fade out here -- function may continue and fade on editor screen
UnmapAllGadgets();
FadeMenuSoundsAndMusic();
GetPlayerConfig();
- /* needed if last screen was the playing screen, invoked from level editor */
+ // needed if last screen was the playing screen, invoked from level editor
if (level_editor_test_game)
{
CloseDoor(DOOR_CLOSE_ALL);
return;
}
- /* needed if last screen was the setup screen and fullscreen state changed */
+ // needed if last screen was the setup screen and fullscreen state changed
// (moved to "execSetupGraphics()" to change fullscreen state directly)
// ToggleFullscreenOrChangeWindowScalingIfNeeded();
- /* leveldir_current may be invalid (level group, parent link) */
+ // leveldir_current may be invalid (level group, parent link)
if (!validLevelSeries(leveldir_current))
leveldir_current = getFirstValidTreeInfoEntry(leveldir_last_valid);
if (leveldir_current != leveldir_last_valid)
levelset_has_changed = TRUE;
- /* store valid level series information */
+ // store valid level series information
leveldir_last_valid = leveldir_current;
- init_last = init; /* switch to new busy animation */
+ init_last = init; // switch to new busy animation
- /* needed if last screen (level choice) changed graphics, sounds or music */
+ // needed if last screen (level choice) changed graphics, sounds or music
ReloadCustomArtwork(0);
if (CheckTitleScreen(levelset_has_changed))
FadeOut(fade_mask);
- /* needed if different viewport properties defined for menues */
+ // needed if different viewport properties defined for menues
ChangeViewportPropertiesIfNeeded();
SetDrawtoField(DRAW_TO_BACKBUFFER);
- /* level_nr may have been set to value over handicap with level editor */
+ // level_nr may have been set to value over handicap with level editor
if (setup.handicap && level_nr > leveldir_current->handicap_level)
level_nr = leveldir_current->handicap_level;
PlayMenuSoundsAndMusic();
- /* create gadgets for main menu screen */
+ // create gadgets for main menu screen
FreeScreenGadgets();
CreateScreenGadgets();
- /* may be required if audio buttons shown on tape and changed in setup menu */
+ // may be required if audio buttons shown on tape and changed in setup menu
FreeGameButtons();
CreateGameButtons();
- /* map gadgets for main menu screen */
+ // map gadgets for main menu screen
MapTapeButtons();
MapScreenMenuGadgets(SCREEN_MASK_MAIN);
UpdateScreenMenuGadgets(SCREEN_MASK_MAIN_HAS_SOLUTION, hasSolutionTape());
- /* copy actual game door content to door double buffer for OpenDoor() */
+ // copy actual game door content to door double buffer for OpenDoor()
BlitBitmap(drawto, bitmap_db_door_1, DX, DY, DXSIZE, DYSIZE, 0, 0);
BlitBitmap(drawto, bitmap_db_door_2, VX, VY, VXSIZE, VYSIZE, 0, 0);
FadeIn(fade_mask);
FadeSetEnterMenu();
- /* update screen area with special editor door */
+ // update screen area with special editor door
redraw_mask |= REDRAW_ALL;
BackToFront();
static void gotoTopLevelDir(void)
{
- /* move upwards until inside (but not above) top level directory */
+ // move upwards until inside (but not above) top level directory
while (leveldir_current->node_parent &&
!strEqual(leveldir_current->node_parent->subdir, STRING_TOP_DIRECTORY))
{
- /* write a "path" into level tree for easy navigation to last level */
+ // write a "path" into level tree for easy navigation to last level
if (leveldir_current->node_parent->node_group->cl_first == -1)
{
int num_leveldirs = numTreeInfoInGroup(leveldir_current);
{
FadeSetEnterScreen();
- /* use individual title fading instead of global "enter screen" fading */
+ // use individual title fading instead of global "enter screen" fading
fading = getTitleFading(tci);
}
{
if (num_title_screens == 0)
{
- /* switch game mode from title screen mode back to info screen mode */
+ // switch game mode from title screen mode back to info screen mode
SetGameStatus(GAME_MODE_INFO);
- /* store that last screen was info screen, not main menu screen */
+ // store that last screen was info screen, not main menu screen
game_status_last_screen = GAME_MODE_INFO;
DrawInfoScreen_NotAvailable("Title screen information:",
FadeOut(REDRAW_ALL);
- /* title screens may have different window size */
+ // title screens may have different window size
ChangeViewportPropertiesIfNeeded();
- /* only required to update logic for redrawing global border */
+ // only required to update logic for redrawing global border
ClearField();
if (tci->is_image)
FadeIn(REDRAW_ALL);
- DelayReached(&title_delay, 0); /* reset delay counter */
+ DelayReached(&title_delay, 0); // reset delay counter
return;
}
FadeIn(REDRAW_ALL);
- DelayReached(&title_delay, 0); /* reset delay counter */
+ DelayReached(&title_delay, 0); // reset delay counter
}
else
{
{
SetMouseCursor(CURSOR_DEFAULT);
- /* force full menu screen redraw after displaying title screens */
+ // force full menu screen redraw after displaying title screens
redraw_mask = REDRAW_ALL;
if (game_status_last_screen == GAME_MODE_INFO)
DrawInfoScreen();
}
- else /* default: return to main menu */
+ else // default: return to main menu
{
SetGameStatus(GAME_MODE_MAIN);
if (setup.handicap && new_level_nr > leveldir_current->handicap_level)
{
- /* skipping levels is only allowed when trying to skip single level */
+ // skipping levels is only allowed when trying to skip single level
if (setup.skip_levels && new_level_nr == old_level_nr + 1 &&
Request("Level still unsolved! Skip despite handicap?", REQ_ASK))
{
UpdateScreenMenuGadgets(SCREEN_MASK_MAIN_HAS_SOLUTION, hasSolutionTape());
- /* needed because DrawPreviewLevelInitial() takes some time */
+ // needed because DrawPreviewLevelInitial() takes some time
BackToFront();
- /* SyncDisplay(); */
+ // SyncDisplay();
}
}
return;
}
- if (mx || my) /* mouse input */
+ if (mx || my) // mouse input
{
pos = -1;
}
}
- /* check if level preview was clicked */
+ // check if level preview was clicked
if (insidePreviewRect(&preview, mx - SX, my - SY))
pos = MAIN_CONTROL_GAME;
PlaySound(SND_MENU_BUTTON_RELEASING);
}
}
- else if (dx || dy) /* keyboard input */
+ else if (dx || dy) // keyboard input
{
if (dx > 0 && (choice == MAIN_CONTROL_INFO ||
choice == MAIN_CONTROL_SETUP))
}
-/* ========================================================================= */
-/* info screen functions */
-/* ========================================================================= */
+// ============================================================================
+// info screen functions
+// ============================================================================
static struct TokenInfo *info_info;
-static int num_info_info; /* number of info entries shown on screen */
-static int max_info_info; /* total number of info entries in list */
+static int num_info_info; // number of info entries shown on screen
+static int max_info_info; // total number of info entries in list
static void execInfoTitleScreen(void)
{
struct TokenInfo *si = &menu_info[menu_info_pos];
void *value_ptr = si->value;
- /* set some entries to "unchangeable" according to other variables */
+ // set some entries to "unchangeable" according to other variables
if ((value_ptr == &setup.sound_simple && !audio.sound_available) ||
(value_ptr == &setup.sound_loops && !audio.loops_available) ||
(value_ptr == &setup.sound_music && !audio.music_available) ||
FreeScreenGadgets();
CreateScreenGadgets();
- /* (needed after displaying title screens which disable auto repeat) */
+ // (needed after displaying title screens which disable auto repeat)
KeyboardAutoRepeatOn();
FadeSetLeaveScreen();
FadeOut(fade_mask);
- /* needed if different viewport properties defined for info screen */
+ // needed if different viewport properties defined for info screen
ChangeViewportPropertiesIfNeeded();
SetMainBackgroundImage(IMG_BACKGROUND_INFO);
int *num_page_entries_last = num_page_entries_all_last[game_status];
int *choice_store = choice_stores[game_status];
int *first_entry_store = first_entry_stores[game_status];
- int choice = choice_store[mode]; /* starts with 0 */
- int first_entry = first_entry_store[mode]; /* starts with 0 */
+ int choice = choice_store[mode]; // starts with 0
+ int first_entry = first_entry_store[mode]; // starts with 0
int x = 0;
int y = choice - first_entry;
int y_old = y;
num_page_entries_last[mode] = num_page_entries;
}
- /* advance to first valid menu entry */
+ // advance to first valid menu entry
while (choice < num_page_entries &&
menu_info[choice].type & TYPE_SKIP_ENTRY)
choice++;
menu_callback_function();
- break; /* absolutely needed because function changes 'menu_info'! */
+ break; // absolutely needed because function changes 'menu_info'!
}
}
return;
}
- if (mx || my) /* mouse input */
+ if (mx || my) // mouse input
{
x = (mx - mSX) / 32;
y = (my - mSY) / 32 - MENU_SCREEN_START_YPOS;
}
- else if (dx || dy) /* keyboard or scrollbar/scrollbutton input */
+ else if (dx || dy) // keyboard or scrollbar/scrollbutton input
{
- /* move cursor instead of scrolling when already at start/end of list */
+ // move cursor instead of scrolling when already at start/end of list
if (dy == -1 * SCROLL_LINE && first_entry == 0)
dy = -1;
else if (dy == +1 * SCROLL_LINE &&
first_entry + num_page_entries == max_page_entries)
dy = 1;
- /* handle scrolling screen one line or page */
+ // handle scrolling screen one line or page
if (y + dy < 0 ||
y + dy > num_page_entries - 1)
{
if (dy < 0 && first_entry > 0)
{
- /* scroll page/line up */
+ // scroll page/line up
first_entry -= step;
if (first_entry < 0)
}
else if (dy > 0 && first_entry + num_page_entries < max_page_entries)
{
- /* scroll page/line down */
+ // scroll page/line down
first_entry += step;
if (first_entry + num_page_entries > max_page_entries)
else if (dy)
y += dy;
- /* jump to next non-empty menu entry (up or down) */
+ // jump to next non-empty menu entry (up or down)
while (first_entry + y > 0 &&
first_entry + y < max_page_entries - 1 &&
menu_info[first_entry + y].type & TYPE_SKIP_ENTRY)
menu_callback_function();
- /* absolutely needed because function changes 'menu_info'! */
+ // absolutely needed because function changes 'menu_info'!
break;
}
}
{
PlaySound(SND_MENU_ITEM_SELECTING);
- /* when selecting key headline, execute function for key value change */
+ // when selecting key headline, execute function for key value change
if (menu_info[first_entry + y].type & TYPE_KEYTEXT &&
menu_info[first_entry + y + 1].type & TYPE_KEY)
y++;
- /* when selecting string value, execute function for list selection */
+ // when selecting string value, execute function for list selection
if (menu_info[first_entry + y].type & TYPE_STRING && y > 0 &&
menu_info[first_entry + y - 1].type & TYPE_ENTER_LIST)
y--;
- /* when selecting string value, execute function for text input gadget */
+ // when selecting string value, execute function for text input gadget
if (menu_info[first_entry + y].type & TYPE_STRING && y > 0 &&
menu_info[first_entry + y - 1].type & TYPE_TEXT_INPUT)
y--;
int max_lines_per_text = 2;
char *text = NULL;
- if (action != -1 && direction != -1) /* element.action.direction */
+ if (action != -1 && direction != -1) // element.action.direction
text = getHelpText(element, action, direction);
- if (text == NULL && action != -1) /* element.action */
+ if (text == NULL && action != -1) // element.action
text = getHelpText(element, action, -1);
- if (text == NULL && direction != -1) /* element.direction */
+ if (text == NULL && direction != -1) // element.direction
text = getHelpText(element, -1, direction);
- if (text == NULL) /* base element */
+ if (text == NULL) // base element
text = getHelpText(element, -1, -1);
- if (text == NULL) /* not found */
+ if (text == NULL) // not found
text = "No description available";
- if (strlen(text) <= max_chars_per_line) /* only one line of text */
+ if (strlen(text) <= max_chars_per_line) // only one line of text
ystart += getFontHeight(font_nr) / 2;
DrawTextBuffer(xstart, ystart + ypos * ystep, text, font_nr,
DrawTextSCentered(ystart, FONT_TEXT_1, title);
- /* if x position set to "-1", automatically determine by playfield width */
+ // if x position set to "-1", automatically determine by playfield width
if (tmi->x == -1)
tmi->x = SXSIZE / 2;
- /* if y position set to "-1", use static default value */
+ // if y position set to "-1", use static default value
if (tmi->y == -1)
tmi->y = 150;
- /* if width set to "-1", automatically determine by playfield width */
+ // if width set to "-1", automatically determine by playfield width
if (tmi->width == -1)
tmi->width = SXSIZE - 2 * TILEX;
- /* if height set to "-1", automatically determine by playfield height */
+ // if height set to "-1", automatically determine by playfield height
if (tmi->height == -1)
tmi->height = MENU_SCREEN_INFO_YBOTTOM - tmi->y - 10;
- /* if chars set to "-1", automatically determine by text and font width */
+ // if chars set to "-1", automatically determine by text and font width
if (tmi->chars == -1)
tmi->chars = tmi->width / getFontWidth(tmi->font);
else
tmi->width = tmi->chars * getFontWidth(tmi->font);
- /* if lines set to "-1", automatically determine by text and font height */
+ // if lines set to "-1", automatically determine by text and font height
if (tmi->lines == -1)
tmi->lines = tmi->height / getFontHeight(tmi->font);
else
}
-/* ========================================================================= */
-/* type name functions */
-/* ========================================================================= */
+// ============================================================================
+// type name functions
+// ============================================================================
void HandleTypeName(int newxpos, Key key)
{
}
-/* ========================================================================= */
-/* tree menu functions */
-/* ========================================================================= */
+// ============================================================================
+// tree menu functions
+// ============================================================================
static void DrawChooseTree(TreeInfo **ti_ptr)
{
FadeOut(fade_mask);
- /* needed if different viewport properties defined for choosing level (set) */
+ // needed if different viewport properties defined for choosing level (set)
ChangeViewportPropertiesIfNeeded();
if (game_status == GAME_MODE_LEVELNR)
node->levels, (node->levels > 1 ? "levels" : "level"),
node->class_desc);
- /* let BackToFront() redraw only what is needed */
+ // let BackToFront() redraw only what is needed
redraw_mask = last_redraw_mask;
for (x = 0; x < SCR_FIELDX; x++)
MarkTileDirty(x, 1);
if (ti->cl_first == -1)
{
- /* only on initialization */
+ // only on initialization
ti->cl_first = MAX(0, entry_pos - num_page_entries + 1);
ti->cl_cursor = entry_pos - ti->cl_first;
}
(num_entries > num_page_entries &&
num_entries - ti->cl_first < num_page_entries))
{
- /* only after change of list size (by custom graphic configuration) */
+ // only after change of list size (by custom graphic configuration)
ti->cl_first = MAX(0, entry_pos - num_page_entries + 1);
ti->cl_cursor = entry_pos - ti->cl_first;
}
return;
}
- if (mx || my) /* mouse input */
+ if (mx || my) // mouse input
{
x = (mx - mSX) / 32;
y = (my - mSY) / 32 - MENU_SCREEN_START_YPOS;
}
- else if (dx || dy) /* keyboard or scrollbar/scrollbutton input */
+ else if (dx || dy) // keyboard or scrollbar/scrollbutton input
{
- /* move cursor instead of scrolling when already at start/end of list */
+ // move cursor instead of scrolling when already at start/end of list
if (dy == -1 * SCROLL_LINE && ti->cl_first == 0)
dy = -1;
else if (dy == +1 * SCROLL_LINE &&
ti->cl_first + num_page_entries == num_entries)
dy = 1;
- /* handle scrolling screen one line or page */
+ // handle scrolling screen one line or page
if (ti->cl_cursor + dy < 0 ||
ti->cl_cursor + dy > num_page_entries - 1)
{
if (dy < 0 && ti->cl_first > 0)
{
- /* scroll page/line up */
+ // scroll page/line up
ti->cl_first -= step;
if (ti->cl_first < 0)
}
else if (dy > 0 && ti->cl_first + num_page_entries < num_entries)
{
- /* scroll page/line down */
+ // scroll page/line down
ti->cl_first += step;
if (ti->cl_first + num_page_entries > num_entries)
return;
}
- /* handle moving cursor one line */
+ // handle moving cursor one line
y = ti->cl_cursor + dy;
}
char identifier[32], name[32];
int value = i;
- /* temporarily load level info to get level name */
+ // temporarily load level info to get level name
LoadLevelInfoOnly(i);
ti->node_top = &level_number;
pushTreeInfo(&level_number, ti);
}
- /* sort level number values to start with lowest level number */
+ // sort level number values to start with lowest level number
sortTreeInfo(&level_number);
- /* set current level number to current level number */
+ // set current level number to current level number
level_number_current =
getTreeInfoFromIdentifier(level_number, i_to_a(level_nr));
- /* if that also fails, set current level number to first available level */
+ // if that also fails, set current level number to first available level
if (level_number_current == NULL)
level_number_current = level_number;
UnmapAllGadgets();
FadeMenuSoundsAndMusic();
- /* (this is needed when called from GameEnd() after winning a game) */
+ // (this is needed when called from GameEnd() after winning a game)
KeyboardAutoRepeatOn();
- /* (this is needed when called from GameEnd() after winning a game) */
+ // (this is needed when called from GameEnd() after winning a game)
SetDrawDeactivationMask(REDRAW_NONE);
SetDrawBackgroundMask(REDRAW_FIELD);
FadeOut(fade_mask);
- /* needed if different viewport properties defined for scores */
+ // needed if different viewport properties defined for scores
ChangeViewportPropertiesIfNeeded();
PlayMenuSoundsAndMusic();
return;
}
- if (ABS(dy) == SCROLL_PAGE) /* handle scrolling one page */
+ if (ABS(dy) == SCROLL_PAGE) // handle scrolling one page
step = NUM_MENU_ENTRIES_ON_SCREEN - 1;
if (dy < 0)
}
-/* ========================================================================= */
-/* setup screen functions */
-/* ========================================================================= */
+// ============================================================================
+// setup screen functions
+// ============================================================================
static struct TokenInfo *setup_info;
-static int num_setup_info; /* number of setup entries shown on screen */
-static int max_setup_info; /* total number of setup entries in list */
+static int num_setup_info; // number of setup entries shown on screen
+static int max_setup_info; // total number of setup entries in list
static char *window_size_text;
static char *scaling_type_text;
pushTreeInfo(&game_speeds, ti);
}
- /* sort game speed values to start with slowest game speed */
+ // sort game speed values to start with slowest game speed
sortTreeInfo(&game_speeds);
update_value = TRUE;
if (update_value)
{
- /* set current game speed to configured game speed value */
+ // set current game speed to configured game speed value
game_speed_current =
getTreeInfoFromIdentifier(game_speeds, i_to_a(setup.game_frame_delay));
- /* if that fails, set current game speed to reliable default value */
+ // if that fails, set current game speed to reliable default value
if (game_speed_current == NULL)
game_speed_current =
getTreeInfoFromIdentifier(game_speeds, i_to_a(GAME_FRAME_DELAY));
- /* if that also fails, set current game speed to first available speed */
+ // if that also fails, set current game speed to first available speed
if (game_speed_current == NULL)
game_speed_current = game_speeds;
setup.game_frame_delay = atoi(game_speed_current->identifier);
- /* needed for displaying game speed text instead of identifier */
+ // needed for displaying game speed text instead of identifier
game_speed_text = game_speed_current->name;
}
pushTreeInfo(&scroll_delays, ti);
}
- /* sort scroll delay values to start with lowest scroll delay value */
+ // sort scroll delay values to start with lowest scroll delay value
sortTreeInfo(&scroll_delays);
- /* set current scroll delay value to configured scroll delay value */
+ // set current scroll delay value to configured scroll delay value
scroll_delay_current =
getTreeInfoFromIdentifier(scroll_delays,i_to_a(setup.scroll_delay_value));
- /* if that fails, set current scroll delay to reliable default value */
+ // if that fails, set current scroll delay to reliable default value
if (scroll_delay_current == NULL)
scroll_delay_current =
getTreeInfoFromIdentifier(scroll_delays, i_to_a(STD_SCROLL_DELAY));
- /* if that also fails, set current scroll delay to first available value */
+ // if that also fails, set current scroll delay to first available value
if (scroll_delay_current == NULL)
scroll_delay_current = scroll_delays;
}
setup.scroll_delay_value = atoi(scroll_delay_current->identifier);
- /* needed for displaying scroll delay text instead of identifier */
+ // needed for displaying scroll delay text instead of identifier
scroll_delay_text = scroll_delay_current->name;
}
pushTreeInfo(&snapshot_modes, ti);
}
- /* sort snapshot mode values to start with lowest snapshot mode value */
+ // sort snapshot mode values to start with lowest snapshot mode value
sortTreeInfo(&snapshot_modes);
- /* set current snapshot mode value to configured snapshot mode value */
+ // set current snapshot mode value to configured snapshot mode value
snapshot_mode_current =
getTreeInfoFromIdentifier(snapshot_modes, setup.engine_snapshot_mode);
- /* if that fails, set current snapshot mode to reliable default value */
+ // if that fails, set current snapshot mode to reliable default value
if (snapshot_mode_current == NULL)
snapshot_mode_current =
getTreeInfoFromIdentifier(snapshot_modes, STR_SNAPSHOT_MODE_DEFAULT);
- /* if that also fails, set current snapshot mode to first available value */
+ // if that also fails, set current snapshot mode to first available value
if (snapshot_mode_current == NULL)
snapshot_mode_current = snapshot_modes;
}
setup.engine_snapshot_mode = snapshot_mode_current->identifier;
- /* needed for displaying snapshot mode text instead of identifier */
+ // needed for displaying snapshot mode text instead of identifier
snapshot_mode_text = snapshot_mode_current->name;
}
network_server_hostname[MAX_SETUP_TEXT_INPUT_LEN] = '\0';
}
- /* needed for displaying network server text instead of identifier */
+ // needed for displaying network server text instead of identifier
network_server_text = network_server_hostname;
}
pushTreeInfo(&window_sizes, ti);
}
- /* sort window size values to start with lowest window size value */
+ // sort window size values to start with lowest window size value
sortTreeInfo(&window_sizes);
- /* set current window size value to configured window size value */
+ // set current window size value to configured window size value
window_size_current =
getTreeInfoFromIdentifier(window_sizes,
i_to_a(setup.window_scaling_percent));
- /* if that fails, set current window size to reliable default value */
+ // if that fails, set current window size to reliable default value
if (window_size_current == NULL)
window_size_current =
getTreeInfoFromIdentifier(window_sizes,
i_to_a(STD_WINDOW_SCALING_PERCENT));
- /* if that also fails, set current window size to first available value */
+ // if that also fails, set current window size to first available value
if (window_size_current == NULL)
window_size_current = window_sizes;
}
setup.window_scaling_percent = atoi(window_size_current->identifier);
- /* needed for displaying window size text instead of identifier */
+ // needed for displaying window size text instead of identifier
window_size_text = window_size_current->name;
}
pushTreeInfo(&scaling_types, ti);
}
- /* sort scaling type values to start with lowest scaling type value */
+ // sort scaling type values to start with lowest scaling type value
sortTreeInfo(&scaling_types);
- /* set current scaling type value to configured scaling type value */
+ // set current scaling type value to configured scaling type value
scaling_type_current =
getTreeInfoFromIdentifier(scaling_types, setup.window_scaling_quality);
- /* if that fails, set current scaling type to reliable default value */
+ // if that fails, set current scaling type to reliable default value
if (scaling_type_current == NULL)
scaling_type_current =
getTreeInfoFromIdentifier(scaling_types, SCALING_QUALITY_DEFAULT);
- /* if that also fails, set current scaling type to first available value */
+ // if that also fails, set current scaling type to first available value
if (scaling_type_current == NULL)
scaling_type_current = scaling_types;
}
setup.window_scaling_quality = scaling_type_current->identifier;
- /* needed for displaying scaling type text instead of identifier */
+ // needed for displaying scaling type text instead of identifier
scaling_type_text = scaling_type_current->name;
}
pushTreeInfo(&rendering_modes, ti);
}
- /* sort rendering mode values to start with lowest rendering mode value */
+ // sort rendering mode values to start with lowest rendering mode value
sortTreeInfo(&rendering_modes);
- /* set current rendering mode value to configured rendering mode value */
+ // set current rendering mode value to configured rendering mode value
rendering_mode_current =
getTreeInfoFromIdentifier(rendering_modes, setup.screen_rendering_mode);
- /* if that fails, set current rendering mode to reliable default value */
+ // if that fails, set current rendering mode to reliable default value
if (rendering_mode_current == NULL)
rendering_mode_current =
getTreeInfoFromIdentifier(rendering_modes,
STR_SPECIAL_RENDERING_DEFAULT);
- /* if that also fails, set current rendering mode to first available one */
+ // if that also fails, set current rendering mode to first available one
if (rendering_mode_current == NULL)
rendering_mode_current = rendering_modes;
}
setup.screen_rendering_mode = rendering_mode_current->identifier;
- /* needed for displaying rendering mode text instead of identifier */
+ // needed for displaying rendering mode text instead of identifier
rendering_mode_text = rendering_mode_current->name;
}
pushTreeInfo(&vsync_modes, ti);
}
- /* sort vsync mode values to start with lowest vsync mode value */
+ // sort vsync mode values to start with lowest vsync mode value
sortTreeInfo(&vsync_modes);
update_value = TRUE;
if (update_value)
{
- /* set current vsync mode value to configured vsync mode value */
+ // set current vsync mode value to configured vsync mode value
vsync_mode_current =
getTreeInfoFromIdentifier(vsync_modes, setup.vsync_mode);
- /* if that fails, set current vsync mode to reliable default value */
+ // if that fails, set current vsync mode to reliable default value
if (vsync_mode_current == NULL)
vsync_mode_current =
getTreeInfoFromIdentifier(vsync_modes, STR_VSYNC_MODE_DEFAULT);
- /* if that also fails, set current vsync mode to first available one */
+ // if that also fails, set current vsync mode to first available one
if (vsync_mode_current == NULL)
vsync_mode_current = vsync_modes;
}
setup.vsync_mode = vsync_mode_current->identifier;
- /* needed for displaying vsync mode text instead of identifier */
+ // needed for displaying vsync mode text instead of identifier
vsync_mode_text = vsync_mode_current->name;
}
pushTreeInfo(&volumes_simple, ti);
}
- /* sort volume values to start with lowest volume value */
+ // sort volume values to start with lowest volume value
sortTreeInfo(&volumes_simple);
- /* set current volume value to configured volume value */
+ // set current volume value to configured volume value
volume_simple_current =
getTreeInfoFromIdentifier(volumes_simple,i_to_a(setup.volume_simple));
- /* if that fails, set current volume to reliable default value */
+ // if that fails, set current volume to reliable default value
if (volume_simple_current == NULL)
volume_simple_current =
getTreeInfoFromIdentifier(volumes_simple, i_to_a(100));
- /* if that also fails, set current volume to first available value */
+ // if that also fails, set current volume to first available value
if (volume_simple_current == NULL)
volume_simple_current = volumes_simple;
}
pushTreeInfo(&volumes_loops, ti);
}
- /* sort volume values to start with lowest volume value */
+ // sort volume values to start with lowest volume value
sortTreeInfo(&volumes_loops);
- /* set current volume value to configured volume value */
+ // set current volume value to configured volume value
volume_loops_current =
getTreeInfoFromIdentifier(volumes_loops,i_to_a(setup.volume_loops));
- /* if that fails, set current volume to reliable default value */
+ // if that fails, set current volume to reliable default value
if (volume_loops_current == NULL)
volume_loops_current =
getTreeInfoFromIdentifier(volumes_loops, i_to_a(100));
- /* if that also fails, set current volume to first available value */
+ // if that also fails, set current volume to first available value
if (volume_loops_current == NULL)
volume_loops_current = volumes_loops;
}
pushTreeInfo(&volumes_music, ti);
}
- /* sort volume values to start with lowest volume value */
+ // sort volume values to start with lowest volume value
sortTreeInfo(&volumes_music);
- /* set current volume value to configured volume value */
+ // set current volume value to configured volume value
volume_music_current =
getTreeInfoFromIdentifier(volumes_music,i_to_a(setup.volume_music));
- /* if that fails, set current volume to reliable default value */
+ // if that fails, set current volume to reliable default value
if (volume_music_current == NULL)
volume_music_current =
getTreeInfoFromIdentifier(volumes_music, i_to_a(100));
- /* if that also fails, set current volume to first available value */
+ // if that also fails, set current volume to first available value
if (volume_music_current == NULL)
volume_music_current = volumes_music;
}
setup.volume_loops = atoi(volume_loops_current->identifier);
setup.volume_music = atoi(volume_music_current->identifier);
- /* needed for displaying volume text instead of identifier */
+ // needed for displaying volume text instead of identifier
volume_simple_text = volume_simple_current->name;
volume_loops_text = volume_loops_current->name;
volume_music_text = volume_music_current->name;
pushTreeInfo(&touch_controls, ti);
}
- /* sort touch control values to start with lowest touch control value */
+ // sort touch control values to start with lowest touch control value
sortTreeInfo(&touch_controls);
- /* set current touch control value to configured touch control value */
+ // set current touch control value to configured touch control value
touch_control_current =
getTreeInfoFromIdentifier(touch_controls, setup.touch.control_type);
- /* if that fails, set current touch control to reliable default value */
+ // if that fails, set current touch control to reliable default value
if (touch_control_current == NULL)
touch_control_current =
getTreeInfoFromIdentifier(touch_controls, TOUCH_CONTROL_DEFAULT);
- /* if that also fails, set current touch control to first available value */
+ // if that also fails, set current touch control to first available value
if (touch_control_current == NULL)
touch_control_current = touch_controls;
}
pushTreeInfo(&move_distances, ti);
}
- /* sort distance values to start with lowest distance value */
+ // sort distance values to start with lowest distance value
sortTreeInfo(&move_distances);
- /* set current distance value to configured distance value */
+ // set current distance value to configured distance value
move_distance_current =
getTreeInfoFromIdentifier(move_distances,
i_to_a(setup.touch.move_distance));
- /* if that fails, set current distance to reliable default value */
+ // if that fails, set current distance to reliable default value
if (move_distance_current == NULL)
move_distance_current =
getTreeInfoFromIdentifier(move_distances,
i_to_a(TOUCH_MOVE_DISTANCE_DEFAULT));
- /* if that also fails, set current distance to first available value */
+ // if that also fails, set current distance to first available value
if (move_distance_current == NULL)
move_distance_current = move_distances;
}
pushTreeInfo(&drop_distances, ti);
}
- /* sort distance values to start with lowest distance value */
+ // sort distance values to start with lowest distance value
sortTreeInfo(&drop_distances);
- /* set current distance value to configured distance value */
+ // set current distance value to configured distance value
drop_distance_current =
getTreeInfoFromIdentifier(drop_distances,
i_to_a(setup.touch.drop_distance));
- /* if that fails, set current distance to reliable default value */
+ // if that fails, set current distance to reliable default value
if (drop_distance_current == NULL)
drop_distance_current =
getTreeInfoFromIdentifier(drop_distances,
i_to_a(TOUCH_DROP_DISTANCE_DEFAULT));
- /* if that also fails, set current distance to first available value */
+ // if that also fails, set current distance to first available value
if (drop_distance_current == NULL)
drop_distance_current = drop_distances;
}
pushTreeInfo(&transparencies, ti);
}
- /* sort transparency values to start with lowest transparency value */
+ // sort transparency values to start with lowest transparency value
sortTreeInfo(&transparencies);
- /* set current transparency value to configured transparency value */
+ // set current transparency value to configured transparency value
transparency_current =
getTreeInfoFromIdentifier(transparencies,
i_to_a(setup.touch.transparency));
- /* if that fails, set current transparency to reliable default value */
+ // if that fails, set current transparency to reliable default value
if (transparency_current == NULL)
transparency_current =
getTreeInfoFromIdentifier(transparencies,
i_to_a(TOUCH_TRANSPARENCY_DEFAULT));
- /* if that also fails, set current transparency to first available value */
+ // if that also fails, set current transparency to first available value
if (transparency_current == NULL)
transparency_current = transparencies;
}
pushTreeInfo(&grid_sizes[i][j], ti);
}
- /* sort grid size values to start with lowest grid size value */
+ // sort grid size values to start with lowest grid size value
sortTreeInfo(&grid_sizes[i][j]);
- /* set current grid size value to configured grid size value */
+ // set current grid size value to configured grid size value
grid_size_current[i][j] =
getTreeInfoFromIdentifier(grid_sizes[i][j],
i_to_a(j == 0 ?
setup.touch.grid_xsize[i] :
setup.touch.grid_ysize[i]));
- /* if that fails, set current grid size to reliable default value */
+ // if that fails, set current grid size to reliable default value
if (grid_size_current[i][j] == NULL)
grid_size_current[i][j] =
getTreeInfoFromIdentifier(grid_sizes[i][j],
DEFAULT_GRID_XSIZE(i) :
DEFAULT_GRID_YSIZE(i)));
- /* if that also fails, set current grid size to first available value */
+ // if that also fails, set current grid size to first available value
if (grid_size_current[i][j] == NULL)
grid_size_current[i][j] = grid_sizes[i][j];
}
}
}
- /* needed for displaying value text instead of identifier */
+ // needed for displaying value text instead of identifier
touch_controls_text = touch_control_current->name;
move_distance_text = move_distance_current->name;
drop_distance_text = drop_distance_current->name;
setup.sounds_set = artwork.snd_current->identifier;
setup.music_set = artwork.mus_current->identifier;
- /* needed if last screen (setup choice) changed graphics, sounds or music */
+ // needed if last screen (setup choice) changed graphics, sounds or music
ReloadCustomArtwork(0);
- /* needed for displaying artwork name instead of artwork identifier */
+ // needed for displaying artwork name instead of artwork identifier
graphics_set_name = artwork.gfx_current->name;
sounds_set_name = artwork.snd_current->name;
music_set_name = artwork.mus_current->name;
if (setup.game_speed_extended == using_game_speeds_extended)
return;
- /* try to match similar values when changing game speeds list */
+ // try to match similar values when changing game speeds list
if (setup.game_speed_extended)
setup.game_frame_delay = (setup.game_frame_delay == 15 ? 16 :
setup.game_frame_delay == 30 ? 29 :
sprintf(message, "Game speed set to %s for VSync to work!", game_speed_text);
- /* set game speed to existing list value that is fast enough for vsync */
+ // set game speed to existing list value that is fast enough for vsync
setup.game_frame_delay = game_speed_value;
execSetupGame_setGameSpeeds(TRUE);
setup.game_frame_delay <= MAX_VSYNC_FRAME_DELAY))
return;
- /* disable vsync for the selected game speed to work */
+ // disable vsync for the selected game speed to work
setup.vsync_mode = STR_VSYNC_MODE_OFF;
execSetupGraphics_setVsyncModes(TRUE);
{
key = GetEventKey((KeyEvent *)&event, TRUE);
- /* press 'Escape' or 'Enter' to keep the existing key binding */
+ // press 'Escape' or 'Enter' to keep the existing key binding
if (key == KSYM_Escape || key == KSYM_Return)
- key = KSYM_UNDEFINED; /* keep old value */
+ key = KSYM_UNDEFINED; // keep old value
got_key_event = TRUE;
}
}
}
- /* downward compatibility correction for Juergen Bonhagen's menu settings */
+ // downward compatibility correction for Juergen Bonhagen's menu settings
if (setup_mode != SETUP_MODE_INPUT)
{
int max_menu_text_length_big = (menu_screen_value_xpos -
MENU_SCREEN_START_XPOS);
int max_menu_text_length_medium = max_menu_text_length_big * 2;
- int check_font_nr = FONT_OPTION_ON; /* known font that needs correction */
+ int check_font_nr = FONT_OPTION_ON; // known font that needs correction
int font1_xoffset = getFontBitmapInfo(font_nr)->draw_xoffset;
int font2_xoffset = getFontBitmapInfo(check_font_nr)->draw_xoffset;
int text_startx = mSX + MENU_SCREEN_START_XPOS * 32;
startx + font2_xoffset < text_startx + text_width + text_font_xoffset)
correct_font_draw_xoffset = TRUE;
- /* check if setup value would overlap with setup text when printed */
- /* (this can happen for extreme/wrong values for font draw offset) */
+ // check if setup value would overlap with setup text when printed
+ // (this can happen for extreme/wrong values for font draw offset)
if (correct_font_draw_xoffset)
{
font_draw_xoffset_old = getFontBitmapInfo(font_nr)->draw_xoffset;
int list_pos = 0;
int i;
- /* determine maximum list size of target list */
+ // determine maximum list size of target list
while (setup_info_orig[list_size++].type != 0);
- /* free, allocate and clear memory for target list */
+ // free, allocate and clear memory for target list
checked_free(setup_info_final);
setup_info_final = checked_calloc(list_size * sizeof(struct TokenInfo));
- /* copy setup info list without setup entries marked as hidden */
+ // copy setup info list without setup entries marked as hidden
for (i = 0; setup_info_orig[i].type != 0; i++)
{
- /* skip setup entries configured to be hidden */
+ // skip setup entries configured to be hidden
if (hideSetupEntry(setup_info_orig[i].value))
continue;
- /* skip skippable setup entries if screen is lower than usual */
+ // skip skippable setup entries if screen is lower than usual
if (SCR_FIELDY < SCR_FIELDY_DEFAULT &&
setup_info_orig[i].type == TYPE_SKIPPABLE)
continue;
FadeOut(fade_mask);
- /* needed if different viewport properties defined for setup screen */
+ // needed if different viewport properties defined for setup screen
ChangeViewportPropertiesIfNeeded();
SetMainBackgroundImage(IMG_BACKGROUND_SETUP);
title_string = STR_SETUP_SHORTCUTS;
}
- /* use modified setup info without setup entries marked as hidden */
+ // use modified setup info without setup entries marked as hidden
setup_info = getSetupInfoFinal(setup_info);
DrawTextSCentered(mSY - SY + 16, FONT_TITLE_1, title_string);
DrawCursorAndText_Setup(i, -1, FALSE);
}
- /* create gadgets for setup input menu screen */
+ // create gadgets for setup input menu screen
FreeScreenGadgets();
CreateScreenGadgets();
- /* map gadgets for setup input menu screen */
+ // map gadgets for setup input menu screen
MapScreenMenuGadgets(SCREEN_MASK_INPUT);
HandleSetupScreen_Input(0, 0, 0, 0, MB_MENU_INITIALIZE);
for (i = 0; setup_info_input[i].type != 0; i++)
{
- /* adjust menu structure according to skipped setup entries */
+ // adjust menu structure according to skipped setup entries
if (setup_info_input[i].type == TYPE_SKIPPABLE)
{
pos_empty2--;
if (button == MB_MENU_INITIALIZE)
{
- /* input setup menu may have changed size due to graphics configuration */
+ // input setup menu may have changed size due to graphics configuration
if (choice >= pos_empty1)
choice = pos_end;
return;
}
- if (mx || my) /* mouse input */
+ if (mx || my) // mouse input
{
x = (mx - mSX) / 32;
y = (my - mSY) / 32 - MENU_SCREEN_START_YPOS;
}
- else if (dx || dy) /* keyboard input */
+ else if (dx || dy) // keyboard input
{
if (dx && choice == 0)
x = (dx < 0 ? 10 : 12);
font_nr_new = FONT_VALUE_NARROW;
}
- /* read existing key bindings from player setup */
+ // read existing key bindings from player setup
custom_key = setup.input[player_nr].key;
FadeSetEnterMenu();
{
Key key = GetEventKey((KeyEvent *)&event, FALSE);
- /* press 'Escape' to abort and keep the old key bindings */
+ // press 'Escape' to abort and keep the old key bindings
if (key == KSYM_Escape)
{
FadeSkipNextFadeIn();
break;
}
- /* press 'Enter' to keep the existing key binding */
+ // press 'Enter' to keep the existing key binding
if (key == KSYM_Return)
key = *customize_step[step_nr].key;
- /* check if key already used */
+ // check if key already used
for (i = 0; i < step_nr; i++)
if (*customize_step[i].key == key)
break;
if (i < step_nr)
break;
- /* got new key binding */
+ // got new key binding
*customize_step[step_nr].key = key;
DrawText(mSX + 4 * 32, mSY + (2 + 2 * step_nr + 1) * 32,
" ", font_nr_new);
getKeyNameFromKey(key), font_nr_new);
step_nr++;
- /* un-highlight last query */
+ // un-highlight last query
DrawText(mSX, mSY + (2 + 2 * (step_nr - 1)) * 32,
customize_step[step_nr - 1].text, FONT_MENU_1);
DrawText(mSX, mSY + (2 + 2 * (step_nr - 1) + 1) * 32,
"Key:", FONT_MENU_1);
- /* all keys configured */
+ // all keys configured
if (step_nr == 6)
{
finished = TRUE;
break;
}
- /* query next key binding */
+ // query next key binding
DrawText(mSX, mSY + (2 + 2 * step_nr) * 32,
customize_step[step_nr].text, FONT_INPUT_1_ACTIVE);
DrawText(mSX, mSY + (2 + 2 * step_nr + 1) * 32,
BackToFront();
}
- /* write new key bindings back to player setup, if successfully finished */
+ // write new key bindings back to player setup, if successfully finished
if (success)
setup.input[player_nr].key = custom_key;
DrawSetupScreen_Input();
}
-/* game controller mapping generator by Gabriel Jacobo <gabomdq@gmail.com> */
+// game controller mapping generator by Gabriel Jacobo <gabomdq@gmail.com>
#define MARKER_BUTTON 1
#define MARKER_AXIS_X 2
name = getFormattedJoystickName(SDL_JoystickName(joystick));
#if DEBUG_JOYSTICKS
- /* print info about the joystick we are watching */
+ // print info about the joystick we are watching
Error(ERR_DEBUG, "watching joystick %d: (%s)\n",
SDL_JoystickInstanceID(joystick), name);
Error(ERR_DEBUG, "joystick has %d axes, %d hats, %d balls, and %d buttons\n",
SDL_JoystickNumBalls(joystick), SDL_JoystickNumButtons(joystick));
#endif
- /* initialize mapping with GUID and name */
+ // initialize mapping with GUID and name
SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), temp, sizeof(temp));
snprintf(mapping, sizeof(mapping), "%s,%s,platform:%s,",
temp, name, SDL_GetPlatform());
- /* loop through all steps (buttons and axes), getting joystick events */
+ // loop through all steps (buttons and axes), getting joystick events
for (i = 0; i < SDL_arraysize(steps) && !done;)
{
- Bitmap *marker = button; /* initialize with reliable default value */
+ Bitmap *marker = button; // initialize with reliable default value
step = &steps[i];
strcpy(step->mapping, mapping);
case SDL_FINGERDOWN:
case SDL_MOUSEBUTTONDOWN:
- /* skip this step */
+ // skip this step
i++;
next = TRUE;
{
if (i == 0)
{
- /* leave screen */
+ // leave screen
success = FALSE;
done = TRUE;
break;
}
- /* undo this step */
+ // undo this step
prev_step = &steps[i - 1];
strcpy(mapping, prev_step->mapping);
i--;
event.key.keysym.sym == KSYM_Return ||
event.key.keysym.sym == KSYM_Menu)
{
- /* skip this step */
+ // skip this step
i++;
next = TRUE;
if (event.key.keysym.sym == KSYM_Escape)
{
- /* leave screen */
+ // leave screen
success = FALSE;
done = TRUE;
}
SaveSetup_AddGameControllerMapping(mapping);
}
- /* wait until the last pending event was removed from event queue */
+ // wait until the last pending event was removed from event queue
while (NextValidEvent(&event));
return success;
{
Key key = GetEventKey((KeyEvent *)&event, FALSE);
- /* press 'Escape' to abort and keep the old key bindings */
+ // press 'Escape' to abort and keep the old key bindings
if (key == KSYM_Escape)
{
for (x = 0; x < MAX_GRID_XSIZE; x++)
break;
}
- /* press 'Enter' to keep the existing key binding */
+ // press 'Enter' to keep the existing key binding
if (key == KSYM_Return ||
#if defined(TARGET_SDL2)
key == KSYM_Menu ||
break;
}
- /* all virtual buttons configured */
+ // all virtual buttons configured
if (step_nr == 6)
{
finished = TRUE;
overlay.grid_button_highlight = grid_button[step_nr];
- /* query next virtual button */
+ // query next virtual button
ClearField();
if (game_status != GAME_MODE_PLAYING)
return;
- GameActions(); /* main game loop */
+ GameActions(); // main game loop
if (tape.auto_play && !tape.playing)
- AutoPlayTape(); /* continue automatically playing next tape */
+ AutoPlayTape(); // continue automatically playing next tape
}
-/* ---------- new screen button stuff -------------------------------------- */
+// ---------- new screen button stuff --------------------------------------
static void getScreenMenuButtonPos(int *x, int *y, int gadget_id)
{
{
{
IMG_MENU_BUTTON_UP, IMG_MENU_BUTTON_UP_ACTIVE,
- -1, -1, /* these values are not constant, but can change at runtime */
+ -1, -1, // these values are not constant, but can change at runtime
SCREEN_CTRL_ID_SCROLL_UP,
"scroll up"
},
{
IMG_MENU_BUTTON_DOWN, IMG_MENU_BUTTON_DOWN_ACTIVE,
- -1, -1, /* these values are not constant, but can change at runtime */
+ -1, -1, // these values are not constant, but can change at runtime
SCREEN_CTRL_ID_SCROLL_DOWN,
"scroll down"
}
{
{
IMG_MENU_SCROLLBAR, IMG_MENU_SCROLLBAR_ACTIVE,
- -1, -1, /* these values are not constant, but can change at runtime */
- -1, -1, /* these values are not constant, but can change at runtime */
+ -1, -1, // these values are not constant, but can change at runtime
+ -1, -1, // these values are not constant, but can change at runtime
GD_TYPE_SCROLLBAR_VERTICAL,
SCREEN_CTRL_ID_SCROLL_VERTICAL,
"scroll level series vertically"
{
IMG_SETUP_INPUT_TEXT,
SCREEN_CTRL_ID_NETWORK_SERVER,
- -1, -1, /* these values are not constant, but can change at runtime */
+ -1, -1, // these values are not constant, but can change at runtime
MAX_SETUP_TEXT_INPUT_LEN,
network_server_hostname,
"Network Server Hostname / IP"
unsigned int event_mask;
int i;
- /* these values are not constant, but can change at runtime */
+ // these values are not constant, but can change at runtime
scrollbutton_info[0].x = SC_SCROLL_UP_XPOS;
scrollbutton_info[0].y = SC_SCROLL_UP_YPOS;
scrollbutton_info[1].x = SC_SCROLL_DOWN_XPOS;
width = SC_SCROLLBUTTON_XSIZE;
height = SC_SCROLLBUTTON_YSIZE;
- /* correct scrollbar position if placed outside menu (playfield) area */
+ // correct scrollbar position if placed outside menu (playfield) area
if (x > SX + SC_SCROLL_UP_XPOS)
x = SX + SC_SCROLL_UP_XPOS;
{
int i;
- /* these values are not constant, but can change at runtime */
+ // these values are not constant, but can change at runtime
scrollbar_info[0].x = SC_SCROLL_VERTICAL_XPOS;
scrollbar_info[0].y = SC_SCROLL_VERTICAL_YPOS;
scrollbar_info[0].width = SC_SCROLL_VERTICAL_XSIZE;
width = scrollbar_info[i].width;
height = scrollbar_info[i].height;
- /* correct scrollbar position if placed outside menu (playfield) area */
+ // correct scrollbar position if placed outside menu (playfield) area
if (x > SX + SC_SCROLL_VERTICAL_XPOS)
x = SX + SC_SCROLL_VERTICAL_XPOS;
#include "main.h"
-/* (arbitrary, but unique) values for HandleChooseTree() */
+// (arbitrary, but unique) values for HandleChooseTree()
#define SCROLL_LINE (1 * SCR_FIELDY)
#define SCROLL_PAGE (2 * SCR_FIELDY)
void DumpScreenIdentifiers(void);
boolean DoScreenAction(int);
-#endif /* SCREENS_H */
+#endif // SCREENS_H
#define DEBUG_TAPE_WHEN_PLAYING FALSE
-/* tape button identifiers */
+// tape button identifiers
#define TAPE_CTRL_ID_EJECT 0
#define TAPE_CTRL_ID_EXTRA 1
#define TAPE_CTRL_ID_STOP 2
#define NUM_TAPE_BUTTONS 8
-/* values for tape handling */
+// values for tape handling
#define TAPE_PAUSE_SECONDS_BEFORE_DEATH 5
-/* forward declaration for internal use */
+// forward declaration for internal use
static void HandleTapeButtons(struct GadgetInfo *);
static void TapeStopWarpForward(void);
static float GetTapeLengthSecondsFloat(void);
static struct GadgetInfo *tape_gadget[NUM_TAPE_BUTTONS];
-/* ========================================================================= */
-/* video tape definitions */
-/* ========================================================================= */
+// ============================================================================
+// video tape definitions
+// ============================================================================
#define VIDEO_INFO_OFF (VIDEO_STATE_DATE_OFF | \
VIDEO_STATE_TIME_OFF | \
#define NUM_TAPE_FUNCTION_STATES 2
-/* ========================================================================= */
-/* video display functions */
-/* ========================================================================= */
+// ============================================================================
+// video display functions
+// ============================================================================
static void DrawVideoDisplay_Graphics(unsigned int state, unsigned int value)
{
{ -1, NULL },
},
{
- /* (no label for displaying optional frame) */
+ // (no label for displaying optional frame)
{ -1, NULL },
{ -1, NULL },
},
},
};
- for (k = 0; k < NUM_TAPE_FUNCTION_STATES; k++) /* on or off states */
+ for (k = 0; k < NUM_TAPE_FUNCTION_STATES; k++) // on or off states
{
- for (i = 0; i < NUM_TAPE_FUNCTIONS; i++) /* record, play, ... */
+ for (i = 0; i < NUM_TAPE_FUNCTIONS; i++) // record, play, ...
{
- for (j = 0; j < NUM_TAPE_FUNCTION_PARTS; j++) /* label or symbol */
+ for (j = 0; j < NUM_TAPE_FUNCTION_PARTS; j++) // label or symbol
{
int graphic = video_pos[i][j].graphic;
struct XY *pos = video_pos[i][j].pos;
if (value == skip_value)
continue;
- if (k == 1) /* on */
+ if (k == 1) // on
{
gd_bitmap = gfx->bitmap;
gd_x = gfx->src_x;
gd_y = gfx->src_y;
}
- else /* off */
+ else // off
{
gd_bitmap = gfx_bg->bitmap;
gd_x = gfx_bg->src_x + pos->x;
gd_y = gfx_bg->src_y + pos->y;
}
- /* some tape graphics may be undefined -- only draw if defined */
+ // some tape graphics may be undefined -- only draw if defined
if (gd_bitmap != NULL)
BlitBitmap(gd_bitmap, drawto, gd_x, gd_y, gfx->width, gfx->height,
VX + pos->x, VY + pos->y);
{
struct GraphicInfo *g_tape = &graphic_info[IMG_BACKGROUND_TAPE];
- /* draw tape background */
+ // draw tape background
BlitBitmap(g_tape->bitmap, drawto, g_tape->src_x, g_tape->src_y,
gfx.vxsize, gfx.vysize, gfx.vx, gfx.vy);
- /* draw tape buttons (forced) */
+ // draw tape buttons (forced)
RedrawOrRemapTapeButtons();
DrawVideoDisplay(VIDEO_ALL_OFF, 0);
}
-/* ========================================================================= */
-/* tape logging functions */
-/* ========================================================================= */
+// ============================================================================
+// tape logging functions
+// ============================================================================
static void PrintTapeReplayProgress(boolean replay_finished)
{
}
-/* ========================================================================= */
-/* tape control functions */
-/* ========================================================================= */
+// ============================================================================
+// tape control functions
+// ============================================================================
void TapeSetDateFromEpochSeconds(time_t epoch_seconds)
{
{
int i;
- if (tape.pos[tape.counter].delay > 0) /* already stored action */
+ if (tape.pos[tape.counter].delay > 0) // already stored action
{
boolean changed_events = FALSE;
tape.pos[tape.counter].delay++;
}
- if (tape.pos[tape.counter].delay == 0) /* store new action */
+ if (tape.pos[tape.counter].delay == 0) // store new action
{
for (i = 0; i < MAX_PLAYERS; i++)
tape.pos[tape.counter].action[i] = action[i];
byte action[MAX_PLAYERS];
int i;
- if (!tape.recording) /* (record action even when tape is paused) */
+ if (!tape.recording) // (record action even when tape is paused)
return;
for (i = 0; i < MAX_PLAYERS; i++)
}
}
- if (tape.counter >= tape.length) /* end of tape reached */
+ if (tape.counter >= tape.length) // end of tape reached
{
if (tape.warp_forward && !tape.auto_play)
{
return;
if (tape.recording)
- TapeHaltRecording(); /* prepare tape for saving on-the-fly */
+ TapeHaltRecording(); // prepare tape for saving on-the-fly
if (TAPE_IS_EMPTY(tape))
{
tape.quick_resume = TRUE;
}
- else /* this should not happen (basically checked above) */
+ else // this should not happen (basically checked above)
{
int reopen_door = (game_status == GAME_MODE_PLAYING ? REQ_REOPEN : 0);
if (autoplay_initialized)
{
- /* just finished auto-playing tape */
+ // just finished auto-playing tape
PrintTapeReplayProgress(TRUE);
num_levels_played++;
}
#if 0
- /* ACTIVATE THIS FOR LOADING/TESTING OF LEVELS ONLY */
+ // ACTIVATE THIS FOR LOADING/TESTING OF LEVELS ONLY
Print("Level %03d: (only testing level)\n", level_nr);
continue;
#endif
}
-/* ---------- new tape button stuff ---------------------------------------- */
+// ---------- new tape button stuff -------------------------------------------
static struct
{
TAPE_CTRL_ID_EJECT, "eject tape"
},
{
- /* (same position as "eject" button) */
+ // (same position as "eject" button)
IMG_GFX_TAPE_BUTTON_EXTRA, &tape.button.eject,
TAPE_CTRL_ID_EXTRA, "extra functions"
},
}
else if (tape.pausing)
{
- if (tape.playing) /* PLAY -> PAUSE -> RECORD */
+ if (tape.playing) // PLAY -> PAUSE -> RECORD
TapeAppendRecording();
else
TapeTogglePause(TAPE_TOGGLE_MANUAL);
break;
case TAPE_CTRL_ID_PLAY:
- if (tape.recording && tape.pausing) /* PAUSE -> RECORD */
+ if (tape.recording && tape.pausing) // PAUSE -> RECORD
{
// ("TAPE_IS_EMPTY(tape)" is TRUE here -- probably fix this)
}
else if (tape.playing)
{
- if (tape.pausing) /* PAUSE -> PLAY */
+ if (tape.pausing) // PAUSE -> PLAY
{
TapeTogglePause(TAPE_TOGGLE_MANUAL | TAPE_TOGGLE_PLAY_PAUSE);
}
- else if (!tape.fast_forward) /* PLAY -> FFWD */
+ else if (!tape.fast_forward) // PLAY -> FFWD
{
tape.fast_forward = TRUE;
}
- else if (!tape.warp_forward) /* FFWD -> WARP */
+ else if (!tape.warp_forward) // FFWD -> WARP
{
tape.warp_forward = TRUE;
}
- else if (!tape.deactivate_display) /* WARP -> WARP BLIND */
+ else if (!tape.deactivate_display) // WARP -> WARP BLIND
{
tape.deactivate_display = TRUE;
TapeDeactivateDisplayOn();
}
- else /* WARP BLIND -> PLAY */
+ else // WARP BLIND -> PLAY
{
tape.fast_forward = FALSE;
tape.warp_forward = FALSE;
#define TAPE_H
-/* values for TapeTogglePause() */
+// values for TapeTogglePause()
#define TAPE_TOGGLE_AUTOMATIC 0
#define TAPE_TOGGLE_MANUAL (1 << 0)
#define TAPE_TOGGLE_PLAY_PAUSE (1 << 1)
-/* values for tape properties */
-#define MAX_TAPE_LEN (1000 * FRAMES_PER_SECOND) /* max.time x fps */
+// values for tape properties
+#define MAX_TAPE_LEN (1000 * FRAMES_PER_SECOND) // max.time x fps
-/* values for tape mouse actions */
+// values for tape mouse actions
#define TAPE_ACTION_LX 0
#define TAPE_ACTION_LY 1
#define TAPE_ACTION_BUTTON 2
#define TAPE_ACTION_UNUSED 3
-/* some positions in the video tape control window */
+// some positions in the video tape control window
#define VIDEO_DISPLAY1_XPOS 5
#define VIDEO_DISPLAY1_YPOS 5
#define VIDEO_DISPLAY2_XPOS 5
#define VIDEO_CONTROL_XSIZE VIDEO_DISPLAY_XSIZE
#define VIDEO_CONTROL_YSIZE VIDEO_BUTTON_YSIZE
-/* values for video tape control */
+// values for video tape control
#define VIDEO_STATE_PLAY_OFF (1 << 0)
#define VIDEO_STATE_PLAY_ON (1 << 1)
#define VIDEO_STATE_REC_OFF (1 << 2)
#define VIDEO_PRESS_STOP(x) ((x) ? VIDEO_PRESS_STOP_ON : VIDEO_PRESS_STOP_OFF)
#define VIDEO_PRESS_EJECT(x) ((x) ? VIDEO_PRESS_EJECT_ON: VIDEO_PRESS_EJECT_OFF)
-/* tags to draw video display labels or symbols only */
+// tags to draw video display labels or symbols only
/* (negative values to prevent misinterpretation in DrawVideoDisplay(), where
the variable "value" is also used for tape length -- better fix this) */
#define VIDEO_DISPLAY_DEFAULT 0
struct TapeInfo
{
- int file_version; /* file format version the tape is stored with */
- int game_version; /* game release version the tape was created with */
- int engine_version; /* game engine version the tape was recorded with */
+ int file_version; // file format version the tape is stored with
+ int game_version; // game release version the tape was created with
+ int engine_version; // game engine version the tape was recorded with
char *level_identifier;
int level_nr;
struct TapeLabelInfo label;
struct TapeTextInfo text;
- boolean show_game_buttons; /* show game buttons in tape viewport */
+ boolean show_game_buttons; // show game buttons in tape viewport
- boolean no_valid_file; /* set when tape file missing or invalid */
+ boolean no_valid_file; // set when tape file missing or invalid
};
#include "screens.h"
-/* select level set with EMC X11 graphics before activating EM GFX debugging */
+// select level set with EMC X11 graphics before activating EM GFX debugging
#define DEBUG_EM_GFX FALSE
#define DEBUG_FRAME_TIME FALSE
-/* tool button identifiers */
+// tool button identifiers
#define TOOL_CTRL_ID_YES 0
#define TOOL_CTRL_ID_NO 1
#define TOOL_CTRL_ID_CONFIRM 2
#define NUM_TOOL_BUTTONS 7
-/* constants for number of doors and door parts */
+// constants for number of doors and door parts
#define NUM_DOORS 2
#define NUM_PANELS NUM_DOORS
// #define NUM_PANELS 0
};
-/* forward declaration for internal use */
+// forward declaration for internal use
static void UnmapToolButtons(void);
static void HandleToolButtons(struct GadgetInfo *);
static int el_act_dir2crm(int, int, int);
drawto_field = fieldbuffer;
}
- else /* DRAW_TO_BACKBUFFER */
+ else // DRAW_TO_BACKBUFFER
{
FX = SX;
FY = SY;
static void DrawMaskedBorderExt_DOOR_3(int draw_target)
{
- /* currently not available */
+ // currently not available
}
static void DrawMaskedBorderExt_ALL(int draw_target)
static void DrawMaskedBorderExt(int redraw_mask, int draw_target)
{
- /* never draw masked screen borders on borderless screens */
+ // never draw masked screen borders on borderless screens
if (global.border_status == GAME_MODE_LOADING ||
global.border_status == GAME_MODE_TITLE)
return;
int draw_deactivation_mask = GetDrawDeactivationMask();
boolean draw_masked = (draw_deactivation_mask == REDRAW_NONE);
- /* draw FPS with leading space (needed if field buffer deactivated) */
+ // draw FPS with leading space (needed if field buffer deactivated)
sprintf(text, " %04.1f fps", global.frames_per_second);
- /* override draw deactivation mask (required for invisible warp mode) */
+ // override draw deactivation mask (required for invisible warp mode)
SetDrawDeactivationMask(REDRAW_NONE);
- /* draw opaque FPS if field buffer deactivated, else draw masked FPS */
+ // draw opaque FPS if field buffer deactivated, else draw masked FPS
DrawTextExt(backbuffer, SX + SXSIZE - font_width * strlen(text), SY, text,
font_nr, (draw_masked ? BLIT_MASKED : BLIT_OPAQUE));
- /* set draw deactivation mask to previous value */
+ // set draw deactivation mask to previous value
SetDrawDeactivationMask(draw_deactivation_mask);
- /* force full-screen redraw in this frame */
+ // force full-screen redraw in this frame
redraw_mask = REDRAW_ALL;
}
{
if (fade_type_skip != FADE_TYPE_NONE)
{
- /* skip all fade operations until specified fade operation */
+ // skip all fade operations until specified fade operation
if (fade_type & fade_type_skip)
fade_type_skip = FADE_TYPE_NONE;
if (fade_type_skip != FADE_TYPE_NONE)
{
- /* skip all fade operations until specified fade operation */
+ // skip all fade operations until specified fade operation
if (fade_type & fade_type_skip)
fade_type_skip = FADE_TYPE_NONE;
height = FADE_SYSIZE;
if (border.draw_masked_when_fading)
- draw_border_function = DrawMaskedBorder_FIELD; /* update when fading */
+ draw_border_function = DrawMaskedBorder_FIELD; // update when fading
else
- DrawMaskedBorder_FIELD(); /* draw once */
+ DrawMaskedBorder_FIELD(); // draw once
}
- else /* REDRAW_ALL */
+ else // REDRAW_ALL
{
x = 0;
y = 0;
{
fading = menu.enter_menu;
- FadeSetLeaveNext(fading, TRUE); /* (keep same fade mode) */
+ FadeSetLeaveNext(fading, TRUE); // (keep same fade mode)
}
void FadeSetLeaveMenu(void)
{
fading = menu.leave_menu;
- FadeSetLeaveNext(fading, TRUE); /* (keep same fade mode) */
+ FadeSetLeaveNext(fading, TRUE); // (keep same fade mode)
}
void FadeSetEnterScreen(void)
{
fading = menu.enter_screen[game_status];
- FadeSetLeaveNext(menu.leave_screen[game_status], TRUE); /* store */
+ FadeSetLeaveNext(menu.leave_screen[game_status], TRUE); // store
}
void FadeSetNextScreen(void)
fading = menu.next_screen[game_status];
// (do not overwrite fade mode set by FadeSetEnterScreen)
- // FadeSetLeaveNext(fading, TRUE); /* (keep same fade mode) */
+ // FadeSetLeaveNext(fading, TRUE); // (keep same fade mode)
}
void FadeSetLeaveScreen(void)
{
- FadeSetLeaveNext(menu.leave_screen[game_status], FALSE); /* recall */
+ FadeSetLeaveNext(menu.leave_screen[game_status], FALSE); // recall
}
void FadeSetFromType(int type)
void DrawBackground(int x, int y, int width, int height)
{
- /* "drawto" might still point to playfield buffer here (hall of fame) */
+ // "drawto" might still point to playfield buffer here (hall of fame)
ClearRectangleOnBackground(backbuffer, x, y, width, height);
if (IN_GFX_FIELD_FULL(x, y))
{
RedrawGlobalBorderIfNeeded();
- /* !!! "drawto" might still point to playfield buffer here (see above) !!! */
- /* (when entering hall of fame after playing) */
+ // !!! "drawto" might still point to playfield buffer here (see above) !!!
+ // (when entering hall of fame after playing)
DrawBackground(REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
- /* !!! maybe this should be done before clearing the background !!! */
+ // !!! maybe this should be done before clearing the background !!!
if (game_status == GAME_MODE_PLAYING)
{
ClearRectangle(fieldbuffer, 0, 0, FXSIZE, FYSIZE);
BorderElement = EL_EMPTY;
- /* the MM game engine does not use a visible border element */
+ // the MM game engine does not use a visible border element
if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
return;
static int check[4][2] = { { -1, 0 }, { 0, -1 }, { 1, 0 }, { 0, 1 } };
static int safety = 0;
- /* check if starting field still has the desired content */
+ // check if starting field still has the desired content
if (field[from_x][from_y] == fill_element)
return;
int getGraphicAnimationFrame(int graphic, int sync_frame)
{
- /* animation synchronized with global frame counter, not move position */
+ // animation synchronized with global frame counter, not move position
if (graphic_info[graphic].anim_global_sync || sync_frame < 0)
sync_frame = FrameCounter;
int src_x = g->src_x + (get_backside ? g->offset2_x : 0);
int src_y = g->src_y + (get_backside ? g->offset2_y : 0);
- if (g->offset_y == 0) /* frames are ordered horizontally */
+ if (g->offset_y == 0) // frames are ordered horizontally
{
int max_width = g->anim_frames_per_line * g->width;
int pos = (src_y / g->height) * max_width + src_x + frame * g->offset_x;
*x = pos % max_width;
*y = src_y % g->height + pos / max_width * g->height;
}
- else if (g->offset_x == 0) /* frames are ordered vertically */
+ else if (g->offset_x == 0) // frames are ordered vertically
{
int max_height = g->anim_frames_per_line * g->height;
int pos = (src_x / g->width) * max_height + src_y + frame * g->offset_y;
*x = src_x % g->width + pos / max_height * g->width;
*y = pos % max_height;
}
- else /* frames are ordered diagonally */
+ else // frames are ordered diagonally
{
*x = src_x + frame * g->offset_x;
*y = src_y + frame * g->offset_y;
int width = TILEX, height = TILEY;
int cx = 0, cy = 0;
- if (dx || dy) /* shifted graphic */
+ if (dx || dy) // shifted graphic
{
- if (x < BX1) /* object enters playfield from the left */
+ if (x < BX1) // object enters playfield from the left
{
x = BX1;
width = dx;
cx = TILEX - dx;
dx = 0;
}
- else if (x > BX2) /* object enters playfield from the right */
+ else if (x > BX2) // object enters playfield from the right
{
x = BX2;
width = -dx;
dx = TILEX + dx;
}
- else if (x == BX1 && dx < 0) /* object leaves playfield to the left */
+ else if (x == BX1 && dx < 0) // object leaves playfield to the left
{
width += dx;
cx = -dx;
dx = 0;
}
- else if (x == BX2 && dx > 0) /* object leaves playfield to the right */
+ else if (x == BX2 && dx > 0) // object leaves playfield to the right
width -= dx;
- else if (dx) /* general horizontal movement */
+ else if (dx) // general horizontal movement
MarkTileDirty(x + SIGN(dx), y);
- if (y < BY1) /* object enters playfield from the top */
+ if (y < BY1) // object enters playfield from the top
{
- if (cut_mode == CUT_BELOW) /* object completely above top border */
+ if (cut_mode == CUT_BELOW) // object completely above top border
return;
y = BY1;
cy = TILEY - dy;
dy = 0;
}
- else if (y > BY2) /* object enters playfield from the bottom */
+ else if (y > BY2) // object enters playfield from the bottom
{
y = BY2;
height = -dy;
dy = TILEY + dy;
}
- else if (y == BY1 && dy < 0) /* object leaves playfield to the top */
+ else if (y == BY1 && dy < 0) // object leaves playfield to the top
{
height += dy;
cy = -dy;
}
else if (dy > 0 && cut_mode == CUT_ABOVE)
{
- if (y == BY2) /* object completely above bottom border */
+ if (y == BY2) // object completely above bottom border
return;
height = dy;
cy = TILEY - dy;
dy = TILEY;
MarkTileDirty(x, y + 1);
- } /* object leaves playfield to the bottom */
+ } // object leaves playfield to the bottom
else if (dy > 0 && (y == BY2 || cut_mode == CUT_BELOW))
height -= dy;
- else if (dy) /* general vertical movement */
+ else if (dy) // general vertical movement
MarkTileDirty(x, y + SIGN(dy));
}
int anim_pos = (dx ? ABS(dx) : ABS(dy));
int anim_frames = graphic_info[graphic].anim_frames;
- /* (we also need anim_delay here for movement animations with less frames) */
+ // (we also need anim_delay here for movement animations with less frames)
int anim_delay = graphic_info[graphic].anim_delay;
int sync_frame = anim_pos * anim_frames * anim_delay / TILESIZE;
- boolean draw_start_tile = (cut_mode != CUT_ABOVE); /* only for falling! */
- boolean draw_end_tile = (cut_mode != CUT_BELOW); /* only for falling! */
+ boolean draw_start_tile = (cut_mode != CUT_ABOVE); // only for falling!
+ boolean draw_end_tile = (cut_mode != CUT_BELOW); // only for falling!
- /* re-calculate animation frame for two-tile movement animation */
+ // re-calculate animation frame for two-tile movement animation
frame = getGraphicAnimationFrame(graphic, sync_frame);
- /* check if movement start graphic inside screen area and should be drawn */
+ // check if movement start graphic inside screen area and should be drawn
if (draw_start_tile && IN_SCR_FIELD(x1, y1))
{
getGraphicSourceExt(graphic, frame, &src_bitmap, &src_x, &src_y, TRUE);
MarkTileDirty(x1, y1);
}
- /* check if movement end graphic inside screen area and should be drawn */
+ // check if movement end graphic inside screen area and should be drawn
if (draw_end_tile && IN_SCR_FIELD(x2, y2))
{
getGraphicSourceExt(graphic, frame, &src_bitmap, &src_x, &src_y, FALSE);
return;
}
- if (graphic_info[graphic].double_movement) /* EM style movement images */
+ if (graphic_info[graphic].double_movement) // EM style movement images
DrawGraphicShiftedDouble(x, y, dx, dy, graphic, frame, cut_mode,mask_mode);
else
DrawGraphicShiftedNormal(x, y, dx, dy, graphic, frame, cut_mode,mask_mode);
graphic = el_act_dir2img(element, GfxAction[lx][ly], GfxDir[lx][ly]);
frame = getGraphicAnimationFrame(graphic, GfxFrame[lx][ly]);
- /* do not use double (EM style) movement graphic when not moving */
+ // do not use double (EM style) movement graphic when not moving
if (graphic_info[graphic].double_movement && !dx && !dy)
{
graphic = el_act_dir2img(element, ACTION_DEFAULT, GfxDir[lx][ly]);
frame = getGraphicAnimationFrame(graphic, GfxFrame[lx][ly]);
}
}
- else /* border element */
+ else // border element
{
graphic = el2img(element);
frame = getGraphicAnimationFrame(graphic, -1);
DrawLevelElementExt(x, y, 0, 0, Feld[x][y], NO_CUTTING, USE_MASKING);
}
-/* !!! implementation of quicksand is totally broken !!! */
+// !!! implementation of quicksand is totally broken !!!
#define IS_CRUMBLED_TILE(x, y, e) \
(GFX_CRUMBLED(e) && (!IN_LEV_FIELD(x, y) || \
!IS_MOVING(x, y) || \
int element = (IN_LEV_FIELD(xx, yy) ? TILE_GFX_ELEMENT(xx, yy) :
BorderElement);
- /* check if neighbour field is of same crumble type */
+ // check if neighbour field is of same crumble type
boolean same = (IS_CRUMBLED_TILE(xx, yy, element) &&
graphic_info[graphic].class ==
graphic_info[el_act2crm(element, ACTION_DEFAULT)].class);
- /* return if check prevents inner corner */
+ // return if check prevents inner corner
if (same == (dxx == dx && dyy == dy))
return;
}
- /* if we reach this point, we have an inner corner */
+ // if we reach this point, we have an inner corner
getGraphicSource(graphic, 1, &src_bitmap, &src_x, &src_y);
getGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
- /* draw simple, sloppy, non-corner-accurate crumbled border */
+ // draw simple, sloppy, non-corner-accurate crumbled border
width = (dir == 1 || dir == 2 ? crumbled_border_size_var : TILESIZE_VAR);
height = (dir == 0 || dir == 3 ? crumbled_border_size_var : TILESIZE_VAR);
FX + sx * TILEX_VAR + cx,
FY + sy * TILEY_VAR + cy);
- /* (remaining middle border part must be at least as big as corner part) */
+ // (remaining middle border part must be at least as big as corner part)
if (!(graphic_info[graphic].style & STYLE_ACCURATE_BORDERS) ||
crumbled_border_size_var >= TILESIZE_VAR / 3)
return;
- /* correct corners of crumbled border, if needed */
+ // correct corners of crumbled border, if needed
for (i = -1; i <= 1; i += 2)
{
int element = (IN_LEV_FIELD(xx, yy) ? TILE_GFX_ELEMENT(xx, yy) :
BorderElement);
- /* check if neighbour field is of same crumble type */
+ // check if neighbour field is of same crumble type
if (IS_CRUMBLED_TILE(xx, yy, element) &&
graphic_info[graphic].class ==
graphic_info[el_act2crm(element, ACTION_DEFAULT)].class)
{
- /* no crumbled corner, but continued crumbled border */
+ // no crumbled corner, but continued crumbled border
int c1 = (dir == 2 || dir == 3 ? crumbled_border_pos_var : 0);
int c2 = (i == 1 ? crumbled_border_pos_var : 0);
element = TILE_GFX_ELEMENT(x, y);
- if (IS_CRUMBLED_TILE(x, y, element)) /* crumble field itself */
+ if (IS_CRUMBLED_TILE(x, y, element)) // crumble field itself
{
if (!IN_SCR_FIELD(sx, sy))
return;
- /* crumble field borders towards direct neighbour fields */
+ // crumble field borders towards direct neighbour fields
for (i = 0; i < 4; i++)
{
int xx = x + xy[i][0];
element = (IN_LEV_FIELD(xx, yy) ? TILE_GFX_ELEMENT(xx, yy) :
BorderElement);
- /* check if neighbour field is of same crumble type */
+ // check if neighbour field is of same crumble type
if (IS_CRUMBLED_TILE(xx, yy, element) &&
graphic_info[graphic].class ==
graphic_info[el_act2crm(element, ACTION_DEFAULT)].class)
DrawLevelFieldCrumbledBorders(x, y, graphic, frame, i);
}
- /* crumble inner field corners towards corner neighbour fields */
+ // crumble inner field corners towards corner neighbour fields
if ((graphic_info[graphic].style & STYLE_INNER_CORNERS) &&
graphic_info[graphic].anim_frames == 2)
{
MarkTileDirty(sx, sy);
}
- else /* center field is not crumbled -- crumble neighbour fields */
+ else // center field is not crumbled -- crumble neighbour fields
{
- /* crumble field borders of direct neighbour fields */
+ // crumble field borders of direct neighbour fields
for (i = 0; i < 4; i++)
{
int xx = x + xy[i][0];
MarkTileDirty(sxx, syy);
}
- /* crumble inner field corners of corner neighbour fields */
+ // crumble inner field corners of corner neighbour fields
for (i = 0; i < 4; i++)
{
int dx = (i & 1 ? +1 : -1);
};
int i;
- /* crumble direct neighbour fields (required for field borders) */
+ // crumble direct neighbour fields (required for field borders)
for (i = 0; i < 4; i++)
{
int xx = x + xy[i][0];
DrawLevelField(xx, yy);
}
- /* crumble corner neighbour fields (required for inner field corners) */
+ // crumble corner neighbour fields (required for inner field corners)
for (i = 0; i < 4; i++)
{
int dx = (i & 1 ? +1 : -1);
int main_anim_mode = (anim_mode == ANIM_NONE ? ANIM_VERTICAL|ANIM_HORIZONTAL:
anim_mode == ANIM_DEFAULT ? ANIM_VERTICAL : anim_mode);
- game.envelope_active = TRUE; /* needed for RedrawPlayfield() events */
+ game.envelope_active = TRUE; // needed for RedrawPlayfield() events
PlayMenuSoundStereo(sound_opening, SOUND_MIDDLE);
x, y, x_steps, y_steps,
tile_size, tile_size);
- /* force DOOR font inside door area */
+ // force DOOR font inside door area
SetFontStatus(GAME_MODE_PSEUDO_DOOR);
DrawTextBuffer(sx + sx_offset, sy + sy_offset, text_final, font_nr,
int graphic = IMG_BACKGROUND_REQUEST;
int sound_opening = SND_REQUEST_OPENING;
int sound_closing = SND_REQUEST_CLOSING;
- int anim_mode_1 = request.anim_mode; /* (higher priority) */
- int anim_mode_2 = graphic_info[graphic].anim_mode; /* (lower priority) */
+ int anim_mode_1 = request.anim_mode; // (higher priority)
+ int anim_mode_2 = graphic_info[graphic].anim_mode; // (lower priority)
int anim_mode = (anim_mode_1 != ANIM_DEFAULT ? anim_mode_1 : anim_mode_2);
int main_anim_mode = (anim_mode == ANIM_NONE ? ANIM_VERTICAL|ANIM_HORIZONTAL:
anim_mode == ANIM_DEFAULT ? ANIM_VERTICAL : anim_mode);
DrawEnvelopeRequest(text);
}
- game.envelope_active = TRUE; /* needed for RedrawPlayfield() events */
+ game.envelope_active = TRUE; // needed for RedrawPlayfield() events
if (action == ACTION_OPENING)
{
DrawPreviewLevelInfo(MICROLABEL_LEVEL_NAME);
DrawPreviewLevelInfo(MICROLABEL_LEVEL_AUTHOR);
- /* initialize delay counters */
+ // initialize delay counters
DelayReached(&scroll_delay, 0);
DelayReached(&label_delay, 0);
return;
}
- /* scroll preview level, if needed */
+ // scroll preview level, if needed
if (preview.anim_mode != ANIM_NONE &&
(level_xsize > preview.xsize || level_ysize > preview.ysize) &&
DelayReached(&scroll_delay, scroll_delay_value))
DrawPreviewLevelPlayfield(from_x, from_y);
}
- /* !!! THIS ALL SUCKS -- SHOULD BE CLEANLY REWRITTEN !!! */
- /* redraw micro level label, if needed */
+ // !!! THIS ALL SUCKS -- SHOULD BE CLEANLY REWRITTEN !!!
+ // redraw micro level label, if needed
if (!strEqual(level.name, NAMELESS_LEVEL_NAME) &&
!strEqual(level.author, ANONYMOUS_NAME) &&
!strEqual(level.author, leveldir_current->name) &&
for (i = 0; i < MAX_PLAYERS; i++)
player_found[i] = FALSE;
- /* check which players can be found in the level (simple approach) */
+ // check which players can be found in the level (simple approach)
for (x = 0; x < lev_fieldx; x++)
{
for (y = 0; y < lev_fieldy; y++)
int xpos = SX + ALIGNED_XPOS(pos->x, all_players_width, pos->align);
int ypos = SY + ALIGNED_YPOS(pos->y, all_players_height, pos->valign);
- /* clear area in which the players will be drawn */
+ // clear area in which the players will be drawn
ClearRectangleOnBackground(drawto, max_xpos, max_ypos,
max_players_width, max_players_height);
- /* only draw players if level is suited for team mode */
+ // only draw players if level is suited for team mode
if (num_players < 2)
return;
- /* draw all players that were found in the level */
+ // draw all players that were found in the level
for (i = 0; i < MAX_PLAYERS; i++)
{
if (player_found[i])
ClearRectangleOnBackground(drawto, max_xpos, max_ypos,
max_players_width, max_players_height);
- /* first draw local network player ... */
+ // first draw local network player ...
for (i = 0; i < MAX_PLAYERS; i++)
{
if (stored_player[i].connected_network &&
}
}
- /* ... then draw all other network players */
+ // ... then draw all other network players
for (i = 0; i < MAX_PLAYERS; i++)
{
if (stored_player[i].connected_network &&
{
if (player->use_murphy)
{
- /* this works only because currently only one player can be "murphy" ... */
+ // this works only because currently only one player can be "murphy" ...
static int last_horizontal_dir = MV_LEFT;
int graphic = el_act_dir2img(EL_SP_MURPHY, player->GfxAction, move_dir);
if (move_dir == MV_LEFT || move_dir == MV_RIGHT)
last_horizontal_dir = move_dir;
- if (graphic == IMG_SP_MURPHY) /* undefined => use special graphic */
+ if (graphic == IMG_SP_MURPHY) // undefined => use special graphic
{
int direction = (player->is_snapping ? move_dir : last_horizontal_dir);
InitPlayerGfxAnimation(player, action, move_dir);
- /* ----------------------------------------------------------------------- */
- /* draw things in the field the player is leaving, if needed */
- /* ----------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
+ // draw things in the field the player is leaving, if needed
+ // --------------------------------------------------------------------------
if (player->is_moving)
{
if (!IN_SCR_FIELD(sx, sy))
return;
- /* ----------------------------------------------------------------------- */
- /* draw things behind the player, if needed */
- /* ----------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
+ // draw things behind the player, if needed
+ // --------------------------------------------------------------------------
if (Back[jx][jy])
DrawLevelElement(jx, jy, Back[jx][jy]);
{
GfxElement[jx][jy] = EL_UNDEFINED;
- /* make sure that pushed elements are drawn with correct frame rate */
+ // make sure that pushed elements are drawn with correct frame rate
graphic = el_act_dir2img(element, ACTION_PUSHING, move_dir);
if (player->is_pushing && player->is_moving && !IS_ANIM_MODE_CE(graphic))
}
#if !DRAW_PLAYER_OVER_PUSHED_ELEMENT
- /* ----------------------------------------------------------------------- */
- /* draw player himself */
- /* ----------------------------------------------------------------------- */
+ // -----------------------------------------------------------------------
+ // draw player himself
+ // -----------------------------------------------------------------------
graphic = getPlayerGraphic(player, move_dir);
}
#endif
- /* ----------------------------------------------------------------------- */
- /* draw things the player is pushing, if needed */
- /* ----------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
+ // draw things the player is pushing, if needed
+ // --------------------------------------------------------------------------
if (player->is_pushing && player->is_moving)
{
int sync_frame;
int frame;
- if (!IS_MOVING(jx, jy)) /* push movement already finished */
+ if (!IS_MOVING(jx, jy)) // push movement already finished
{
element = Feld[next_jx][next_jy];
gfx_frame = GfxFrame[next_jx][next_jy];
sync_frame = (IS_ANIM_MODE_CE(graphic) ? gfx_frame : player->StepFrame);
frame = getGraphicAnimationFrame(graphic, sync_frame);
- /* draw background element under pushed element (like the Sokoban field) */
+ // draw background element under pushed element (like the Sokoban field)
if (game.use_masked_pushing && IS_MOVING(jx, jy))
{
- /* this allows transparent pushing animation over non-black background */
+ // this allows transparent pushing animation over non-black background
if (Back[jx][jy])
DrawLevelElement(jx, jy, Back[jx][jy]);
DrawLevelElement(next_jx, next_jy, Back[next_jx][next_jy]);
#if 1
- /* do not draw (EM style) pushing animation when pushing is finished */
- /* (two-tile animations usually do not contain start and end frame) */
+ // do not draw (EM style) pushing animation when pushing is finished
+ // (two-tile animations usually do not contain start and end frame)
if (graphic_info[graphic].double_movement && !IS_MOVING(jx, jy))
DrawLevelElement(next_jx, next_jy, Feld[next_jx][next_jy]);
else
DrawGraphicShiftedThruMask(px, py, pxx, pyy, graphic, frame, NO_CUTTING);
#else
- /* masked drawing is needed for EMC style (double) movement graphics */
- /* !!! (ONLY WHEN DRAWING PUSHED ELEMENT OVER THE PLAYER) !!! */
+ // masked drawing is needed for EMC style (double) movement graphics
+ // !!! (ONLY WHEN DRAWING PUSHED ELEMENT OVER THE PLAYER) !!!
DrawGraphicShiftedThruMask(px, py, pxx, pyy, graphic, frame, NO_CUTTING);
#endif
}
#if DRAW_PLAYER_OVER_PUSHED_ELEMENT
- /* ----------------------------------------------------------------------- */
- /* draw player himself */
- /* ----------------------------------------------------------------------- */
+ // -----------------------------------------------------------------------
+ // draw player himself
+ // -----------------------------------------------------------------------
graphic = getPlayerGraphic(player, move_dir);
}
#endif
- /* ----------------------------------------------------------------------- */
- /* draw things in front of player (active dynamite or dynabombs) */
- /* ----------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
+ // draw things in front of player (active dynamite or dynabombs)
+ // --------------------------------------------------------------------------
if (IS_ACTIVE_BOMB(element))
{
DrawGraphicThruMask(SCREENX(last_jx), SCREENY(last_jy), graphic, frame);
}
- /* ----------------------------------------------------------------------- */
- /* draw elements the player is just walking/passing through/under */
- /* ----------------------------------------------------------------------- */
+ // --------------------------------------------------------------------------
+ // draw elements the player is just walking/passing through/under
+ // --------------------------------------------------------------------------
if (player_is_moving)
{
- /* handle the field the player is leaving ... */
+ // handle the field the player is leaving ...
if (IS_ACCESSIBLE_INSIDE(last_element))
DrawLevelField(last_jx, last_jy);
else if (IS_ACCESSIBLE_UNDER(last_element))
DrawLevelFieldThruMask(last_jx, last_jy);
}
- /* do not redraw accessible elements if the player is just pushing them */
+ // do not redraw accessible elements if the player is just pushing them
if (!player_is_moving || !player->is_pushing)
{
- /* ... and the field the player is entering */
+ // ... and the field the player is entering
if (IS_ACCESSIBLE_INSIDE(element))
DrawLevelField(jx, jy);
else if (IS_ACCESSIBLE_UNDER(element))
MarkTileDirty(sx, sy);
}
-/* ------------------------------------------------------------------------- */
+// ----------------------------------------------------------------------------
void WaitForEventToContinue(void)
{
if (program.headless)
return;
- /* simulate releasing mouse button over last gadget, if still pressed */
+ // simulate releasing mouse button over last gadget, if still pressed
if (button_status)
HandleGadgets(-1, -1, 0);
int sx, sy;
int result;
- /* when showing request dialog after game ended, deactivate game panel */
+ // when showing request dialog after game ended, deactivate game panel
if (game_just_ended)
game.panel.active = FALSE;
{
if (game_just_ended)
{
- /* the MM game engine does not use a special (scrollable) field buffer */
+ // the MM game engine does not use a special (scrollable) field buffer
if (level.game_engine_type != GAME_ENGINE_TYPE_MM)
SetDrawtoField(DRAW_TO_FIELDBUFFER);
if (global.use_envelope_request)
{
- /* copy current state of request area to middle of playfield area */
+ // copy current state of request area to middle of playfield area
BlitBitmap(bitmap_db_store_2, drawto, sx, sy, width, height, sx, sy);
}
}
button_status = MB_RELEASED;
}
- /* this sets 'request_gadget_id' */
+ // this sets 'request_gadget_id'
HandleGadgets(mx, my, button_status);
switch (request_gadget_id)
case KSYM_Select:
case KSYM_Menu:
#if defined(KSYM_Rewind)
- case KSYM_Rewind: /* for Amazon Fire TV remote */
+ case KSYM_Rewind: // for Amazon Fire TV remote
#endif
#endif
result = 1;
case KSYM_N:
case KSYM_Back:
#if defined(KSYM_FastForward)
- case KSYM_FastForward: /* for Amazon Fire TV remote */
+ case KSYM_FastForward: // for Amazon Fire TV remote
#endif
#endif
result = 0;
{
if (global.use_envelope_request)
{
- /* copy back current state of pressed buttons inside request area */
+ // copy back current state of pressed buttons inside request area
BlitBitmap(drawto, bitmap_db_store_2, sx, sy, width, height, sx, sy);
}
}
if (game_status == GAME_MODE_PLAYING)
BlitScreenToBitmap(backbuffer);
- /* disable deactivated drawing when quick-loading level tape recording */
+ // disable deactivated drawing when quick-loading level tape recording
if (tape.playing && tape.deactivate_display)
TapeDeactivateDisplayOff(TRUE);
SetMouseCursor(CURSOR_DEFAULT);
- /* pause network game while waiting for request to answer */
+ // pause network game while waiting for request to answer
if (network.enabled &&
game_status == GAME_MODE_PLAYING &&
!AllPlayersGone &&
old_door_state = GetDoorState();
- /* simulate releasing mouse button over last gadget, if still pressed */
+ // simulate releasing mouse button over last gadget, if still pressed
if (button_status)
HandleGadgets(-1, -1, 0);
UnmapAllGadgets();
- /* draw released gadget before proceeding */
+ // draw released gadget before proceeding
// BackToFront();
if (old_door_state & DOOR_OPEN_1)
{
CloseDoor(DOOR_CLOSE_1);
- /* save old door content */
+ // save old door content
BlitBitmap(bitmap_db_door_1, bitmap_db_door_1,
0 * DXSIZE, 0, DXSIZE, DYSIZE, 1 * DXSIZE, 0);
}
SetDoorBackgroundImage(IMG_BACKGROUND_DOOR);
SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1);
- /* clear door drawing field */
+ // clear door drawing field
DrawBackground(DX, DY, DXSIZE, DYSIZE);
- /* force DOOR font inside door area */
+ // force DOOR font inside door area
SetFontStatus(GAME_MODE_PSEUDO_DOOR);
- /* write text for request */
+ // write text for request
for (text_ptr = text, ty = 0; ty < MAX_REQUEST_LINES; ty++)
{
char text_line[max_request_line_len + 1];
MapGadget(tool_gadget[TOOL_CTRL_ID_PLAYER_4]);
}
- /* copy request gadgets to door backbuffer */
+ // copy request gadgets to door backbuffer
BlitBitmap(drawto, bitmap_db_door_1, DX, DY, DXSIZE, DYSIZE, 0, 0);
OpenDoor(DOOR_OPEN_1);
SetDrawBackgroundMask(REDRAW_FIELD);
}
- /* continue network game after request */
+ // continue network game after request
if (network.enabled &&
game_status == GAME_MODE_PLAYING &&
!AllPlayersGone &&
req_state & REQUEST_WAIT_FOR_INPUT)
SendToServer_ContinuePlaying();
- /* restore deactivated drawing when quick-loading level tape recording */
+ // restore deactivated drawing when quick-loading level tape recording
if (tape.playing && tape.deactivate_display)
TapeDeactivateDisplayOn();
if (game_status == GAME_MODE_PLAYING)
BlitScreenToBitmap(backbuffer);
- /* disable deactivated drawing when quick-loading level tape recording */
+ // disable deactivated drawing when quick-loading level tape recording
if (tape.playing && tape.deactivate_display)
TapeDeactivateDisplayOff(TRUE);
SetMouseCursor(CURSOR_DEFAULT);
- /* pause network game while waiting for request to answer */
+ // pause network game while waiting for request to answer
if (network.enabled &&
game_status == GAME_MODE_PLAYING &&
!AllPlayersGone &&
req_state & REQUEST_WAIT_FOR_INPUT)
SendToServer_PausePlaying();
- /* simulate releasing mouse button over last gadget, if still pressed */
+ // simulate releasing mouse button over last gadget, if still pressed
if (button_status)
HandleGadgets(-1, -1, 0);
// SetDoorBackgroundImage(IMG_BACKGROUND_DOOR);
// SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1);
- /* clear door drawing field */
+ // clear door drawing field
// DrawBackground(DX, DY, DXSIZE, DYSIZE);
ShowEnvelopeRequest(text, req_state, ACTION_OPENING);
SetDrawBackgroundMask(REDRAW_FIELD);
}
- /* continue network game after request */
+ // continue network game after request
if (network.enabled &&
game_status == GAME_MODE_PLAYING &&
!AllPlayersGone &&
req_state & REQUEST_WAIT_FOR_INPUT)
SendToServer_ContinuePlaying();
- /* restore deactivated drawing when quick-loading level tape recording */
+ // restore deactivated drawing when quick-loading level tape recording
if (tape.playing && tape.deactivate_display)
TapeDeactivateDisplayOn();
struct Rect *door_rect = &door_rect_list[door_index];
boolean door_gfx_redefined = FALSE;
- /* check if any door part graphic definitions have been redefined */
+ // check if any door part graphic definitions have been redefined
for (j = 0; door_part_controls[j].door_token != -1; j++)
{
door_gfx_redefined = TRUE;
}
- /* check for old-style door graphic/animation modifications */
+ // check for old-style door graphic/animation modifications
if (!door_gfx_redefined)
{
struct GraphicInfo *g_part_2 = &graphic_info[part_2];
int num_door_steps, num_panel_steps;
- /* remove door part graphics other than the two default wings */
+ // remove door part graphics other than the two default wings
for (j = 0; door_part_controls[j].door_token != -1; j++)
{
g->bitmap = NULL;
}
- /* set graphics and screen positions of the default wings */
+ // set graphics and screen positions of the default wings
g_part_1->width = door_rect->width;
g_part_1->height = door_rect->height;
door->part_2.y += door_rect->height - door->height;
}
- /* set animation delays for the default wings and panels */
+ // set animation delays for the default wings and panels
door->part_1.step_delay = door->step_delay;
door->part_2.step_delay = door->step_delay;
door->panel.step_delay = door->step_delay;
- /* set animation draw order for the default wings */
+ // set animation draw order for the default wings
- door->part_1.sort_priority = 2; /* draw left wing over ... */
- door->part_2.sort_priority = 1; /* ... right wing */
+ door->part_1.sort_priority = 2; // draw left wing over ...
+ door->part_2.sort_priority = 1; // ... right wing
- /* set animation draw offset for the default wings */
+ // set animation draw offset for the default wings
if (door->anim_mode & ANIM_HORIZONTAL)
{
num_door_steps = g_part_1->height / door->step_offset;
}
- /* set animation draw offset for the default panels */
+ // set animation draw offset for the default panels
if (door->step_offset > 1)
{
struct DoorPartControlInfo *dpc = &door_part_controls[i];
struct DoorPartOrderInfo *dpo = &door_part_order[i];
- /* initialize "start_step_opening" and "start_step_closing", if needed */
+ // initialize "start_step_opening" and "start_step_closing", if needed
if (dpc->pos->start_step_opening == 0 &&
dpc->pos->start_step_closing == 0)
{
dpc->pos->start_step_closing = dpc->pos->start_step;
}
- /* fill structure for door part draw order (sorted below) */
+ // fill structure for door part draw order (sorted below)
dpo->nr = i;
dpo->sort_priority = dpc->pos->sort_priority;
}
- /* sort door part controls according to sort_priority and graphic number */
+ // sort door part controls according to sort_priority and graphic number
qsort(door_part_order, MAX_DOOR_PARTS,
sizeof(struct DoorPartOrderInfo), compareDoorPartOrderInfo);
}
}
else
{
- /* opening door sound has priority over simultaneously closing door */
+ // opening door sound has priority over simultaneously closing door
if (door_state & (DOOR_OPEN_1 | DOOR_OPEN_2))
{
PlayMenuSoundStereo(SND_DOOR_OPENING, SOUND_MIDDLE);
current_move_delay += max_step_delay;
- /* prevent OS (Windows) from complaining about program not responding */
+ // prevent OS (Windows) from complaining about program not responding
CheckQuitEvent();
}
if (!(door_state & DOOR_NO_DELAY))
{
- /* wait for specified door action post delay */
+ // wait for specified door action post delay
if (door_state & DOOR_ACTION_1 && door_state & DOOR_ACTION_2)
door_delay_value = MAX(door_1.post_delay, door_2.post_delay);
else if (door_state & DOOR_ACTION_1)
if (!useSpecialEditorDoor())
return;
- /* draw bigger level editor toolbox window */
+ // draw bigger level editor toolbox window
BlitBitmap(gfx1->bitmap, drawto, gfx1->src_x, gfx1->src_y,
top_border_width, top_border_height, ex, ey - top_border_height);
BlitBitmap(graphic_info[IMG_GLOBAL_BORDER].bitmap, drawto, ex, vy,
if (!useSpecialEditorDoor())
return;
- /* draw normal tape recorder window */
+ // draw normal tape recorder window
if (graphic_info[IMG_GLOBAL_BORDER].bitmap)
{
BlitBitmap(graphic_info[IMG_GLOBAL_BORDER].bitmap, drawto,
}
-/* ---------- new tool button stuff ---------------------------------------- */
+// ---------- new tool button stuff -------------------------------------------
static struct
{
static struct Mapping_EM_to_RND_object
{
int element_em;
- boolean is_rnd_to_em_mapping; /* unique mapping EM <-> RND */
- boolean is_backside; /* backside of moving element */
+ boolean is_rnd_to_em_mapping; // unique mapping EM <-> RND
+ boolean is_backside; // backside of moving element
int element_rnd;
int action;
Xbomb_force_w, FALSE, FALSE,
EL_BOMB, -1, MV_BIT_LEFT
},
-#endif /* EM_ENGINE_BAD_ROLL */
+#endif // EM_ENGINE_BAD_ROLL
{
Xstone, TRUE, FALSE,
{
int i;
- /* return "Xalpha_quest" for all undefined elements in mapping array */
+ // return "Xalpha_quest" for all undefined elements in mapping array
for (i = 0; i < NUM_FILE_ELEMENTS; i++)
mapping_RND_to_EM[i] = Xalpha_quest;
{
int i;
- /* return "EL_UNKNOWN" for all undefined elements in mapping array */
+ // return "EL_UNKNOWN" for all undefined elements in mapping array
for (i = 0; i < TILE_MAX; i++)
mapping_EM_to_RND[i] = EL_UNKNOWN;
int map_element_RND_to_SP(int element_rnd)
{
- int element_sp = 0x20; /* map unknown elements to yellow "hardware" */
+ int element_sp = 0x20; // map unknown elements to yellow "hardware"
if (element_rnd >= EL_SP_START &&
element_rnd <= EL_SP_END)
int map_action_MM_to_RND(int action_mm)
{
- /* all MM actions are defined to exactly match their RND counterparts */
+ // all MM actions are defined to exactly match their RND counterparts
return action_mm;
}
int el_act_dir2img(int element, int action, int direction)
{
element = GFX_ELEMENT(element);
- direction = MV_DIR_TO_BIT(direction); /* default: MV_NONE => MV_DOWN */
+ direction = MV_DIR_TO_BIT(direction); // default: MV_NONE => MV_DOWN
- /* direction_graphic[][] == graphic[] for undefined direction graphics */
+ // direction_graphic[][] == graphic[] for undefined direction graphics
return element_info[element].direction_graphic[action][direction];
}
static int el_act_dir2crm(int element, int action, int direction)
{
element = GFX_ELEMENT(element);
- direction = MV_DIR_TO_BIT(direction); /* default: MV_NONE => MV_DOWN */
+ direction = MV_DIR_TO_BIT(direction); // default: MV_NONE => MV_DOWN
- /* direction_graphic[][] == graphic[] for undefined direction graphics */
+ // direction_graphic[][] == graphic[] for undefined direction graphics
return element_info[element].direction_crumbled[action][direction];
}
return element;
}
}
- else /* frame_em == 7 */
+ else // frame_em == 7
{
switch (tile)
{
for last (8th) frame which ends the movement animation */
if (g->double_movement && g->anim_frames < 8 && frame_em == 7)
{
- action = ACTION_DEFAULT; /* (keep action_* unchanged for now) */
+ action = ACTION_DEFAULT; // (keep action_* unchanged for now)
graphic = (direction == MV_NONE ?
el_act2img(effective_element, action) :
el_act_dir2img(effective_element, action, direction));
GfxFrame[x][y]++;
#if 1
- /* !!! TEST !!! NEW !!! DOES NOT WORK RIGHT YET !!! */
+ // !!! TEST !!! NEW !!! DOES NOT WORK RIGHT YET !!!
if (g->double_movement && frame_em == 0)
GfxFrame[x][y] = 0;
#endif
{
GfxFrame[x][y]++;
- /* special case: animation for Xsand_stonesand_quickout_1/2 twice as fast */
+ // special case: animation for Xsand_stonesand_quickout_1/2 twice as fast
if (tile == Xsand_stonesand_quickout_1 ||
tile == Xsand_stonesand_quickout_2)
GfxFrame[x][y]++;
else if (IN_FIELD(x, y, MAX_LEV_FIELDX, MAX_LEV_FIELDY))
sync_frame = GfxFrame[x][y];
else
- sync_frame = 0; /* playfield border (pseudo steel) */
+ sync_frame = 0; // playfield border (pseudo steel)
SetRandomAnimationValue(x, y);
else if (IN_FIELD(x, y, MAX_LEV_FIELDX, MAX_LEV_FIELDY))
sync_frame = GfxFrame[x][y];
else
- sync_frame = 0; /* playfield border (pseudo steel) */
+ sync_frame = 0; // playfield border (pseudo steel)
SetRandomAnimationValue(x, y);
if (graphic_info_em_object[0][0].bitmap == NULL)
{
- /* EM graphics not yet initialized in em_open_all() */
+ // EM graphics not yet initialized in em_open_all()
return;
}
printf("::: [4 errors can be ignored (1 x 'bomb', 3 x 'em_dynamite']\n");
#endif
- /* always start with reliable default values */
+ // always start with reliable default values
for (i = 0; i < TILE_MAX; i++)
{
object_mapping[i].element_rnd = EL_UNKNOWN;
object_mapping[i].direction = MV_NONE;
}
- /* always start with reliable default values */
+ // always start with reliable default values
for (p = 0; p < MAX_PLAYERS; p++)
{
for (i = 0; i < SPR_MAX; i++)
struct GraphicInfo_EM *g_em = &graphic_info_em_object[i][7 - j];
Bitmap *src_bitmap;
int src_x, src_y;
- /* ensure to get symmetric 3-frame, 2-delay animations as used in EM */
+ // ensure to get symmetric 3-frame, 2-delay animations as used in EM
boolean special_animation = (action != ACTION_DEFAULT &&
g->anim_frames == 3 &&
g->anim_delay == 2 &&
i == Xsand_stoneout_2 ? j + 8 : j) + 1;
int step = (is_backside ? step_frame : num_steps - step_frame);
- if (is_backside) /* tile where movement starts */
+ if (is_backside) // tile where movement starts
{
if (dx < 0 || dy < 0)
{
g_em->dst_offset_y = cy * step;
}
}
- else /* tile where movement ends */
+ else // tile where movement ends
{
if (dx < 0 || dy < 0)
{
g_em->height = TILEY - cy * step;
}
- /* create unique graphic identifier to decide if tile must be redrawn */
+ // create unique graphic identifier to decide if tile must be redrawn
/* bit 31 - 16 (16 bit): EM style graphic
bit 15 - 12 ( 4 bit): EM style frame
bit 11 - 6 ( 6 bit): graphic width
#if DEBUG_EM_GFX
- /* skip check for EMC elements not contained in original EMC artwork */
+ // skip check for EMC elements not contained in original EMC artwork
if (element == EL_EMC_FAKE_ACID)
continue;
direction == MV_RIGHT ? (is_backside? Yspring_eB: Yspring_e) :
Xspring);
- /* no separate animation for "smashed by rock" -- use rock instead */
+ // no separate animation for "smashed by rock" -- use rock instead
struct GraphicInfo_EM *g_em = &graphic_info_em_object[i][7 - j];
struct GraphicInfo_EM *g_xx = &graphic_info_em_object[e][7 - j];
#if DEBUG_EM_GFX
- /* skip check for EMC elements not contained in original EMC artwork */
+ // skip check for EMC elements not contained in original EMC artwork
if (element == EL_PLAYER_3 ||
element == EL_PLAYER_4)
continue;
{
SDLSetWindowFullscreen(setup.fullscreen);
- /* set setup value according to successfully changed fullscreen mode */
+ // set setup value according to successfully changed fullscreen mode
setup.fullscreen = video.fullscreen_enabled;
return;
{
Bitmap *tmp_backbuffer = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH);
- /* save backbuffer content which gets lost when toggling fullscreen mode */
+ // save backbuffer content which gets lost when toggling fullscreen mode
BlitBitmap(backbuffer, tmp_backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
if (change_window_scaling_percent)
{
- /* keep window mode, but change window scaling */
- video.fullscreen_enabled = TRUE; /* force new window scaling */
+ // keep window mode, but change window scaling
+ video.fullscreen_enabled = TRUE; // force new window scaling
}
- /* toggle fullscreen */
+ // toggle fullscreen
ChangeVideoModeIfNeeded(setup.fullscreen);
- /* set setup value according to successfully changed fullscreen mode */
+ // set setup value according to successfully changed fullscreen mode
setup.fullscreen = video.fullscreen_enabled;
- /* restore backbuffer content from temporary backbuffer backup bitmap */
+ // restore backbuffer content from temporary backbuffer backup bitmap
BlitBitmap(tmp_backbuffer, backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
FreeBitmap(tmp_backbuffer);
- /* update visible window/screen */
+ // update visible window/screen
BlitBitmap(backbuffer, window, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
}
}
if (new_scr_fieldx != SCR_FIELDX ||
new_scr_fieldy != SCR_FIELDY)
{
- /* this always toggles between MAIN and GAME when using small tile size */
+ // this always toggles between MAIN and GAME when using small tile size
SCR_FIELDX = new_scr_fieldx;
SCR_FIELDY = new_scr_fieldy;
#include "game.h"
-/* for DrawElementShifted */
+// for DrawElementShifted
#define NO_CUTTING 0
#define CUT_ABOVE (1 << 0)
#define CUT_BELOW (1 << 1)
#define CUT_LEFT (1 << 2)
#define CUT_RIGHT (1 << 3)
-/* for masking functions */
+// for masking functions
#define NO_MASKING 0
#define USE_MASKING 1
-/* for MoveDoor */
+// for MoveDoor
#define DOOR_OPEN_1 (1 << 0)
#define DOOR_OPEN_2 (1 << 1)
#define DOOR_CLOSE_1 (1 << 2)
#define REDRAW_DOOR_FROM_TOKEN(x) ((x) == DOOR_1 ? REDRAW_DOOR_1 : \
REDRAW_DOOR_2)
-/* for Request */
+// for Request
#define REQ_ASK (1 << 0)
#define REQ_CONFIRM (1 << 1)
#define REQ_PLAYER (1 << 2)
boolean CheckIfPlayfieldViewportHasChanged(void);
boolean CheckIfGlobalBorderOrPlayfieldViewportHasChanged(void);
-#endif /* TOOLS_H */
+#endif // TOOLS_H