From: Holger Schemel Date: Tue, 23 Oct 2018 19:01:23 +0000 (+0200) Subject: changed comments from old to new style (one-line comments only) X-Git-Tag: 4.1.2.0~126 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=64e7c54dce6ea8c063f04198c64c5057d751c928;p=rocksndiamonds.git changed comments from old to new style (one-line comments only) --- diff --git a/src/anim.c b/src/anim.c index cdde4236..1215f1ca 100644 --- a/src/anim.c +++ b/src/anim.c @@ -18,11 +18,11 @@ #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, \ @@ -58,13 +58,13 @@ 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 @@ -195,7 +195,7 @@ struct AnimClassGameMode { -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); @@ -215,9 +215,9 @@ static int anim_classes_last = ANIM_CLASS_NONE; 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) @@ -226,34 +226,34 @@ int getAnimationFrame(int num_frames, int delay, int mode, int start_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); @@ -265,16 +265,16 @@ int getAnimationFrame(int num_frames, int delay, int mode, int start_frame, 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) { @@ -530,12 +530,12 @@ static void InitGlobalAnimControls(void) 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); @@ -544,7 +544,7 @@ static void InitGlobalAnimControls(void) { 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); @@ -1662,7 +1662,7 @@ boolean HandleGlobalAnimClicks(int mx, int my, int button) 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; diff --git a/src/conf_gfx.c b/src/conf_gfx.c index c5359b80..dc4613a6 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -91,7 +91,7 @@ struct ConfigInfo image_config[] = // 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" }, @@ -293,7 +293,7 @@ struct ConfigInfo image_config[] = { "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" }, @@ -831,7 +831,7 @@ struct ConfigInfo image_config[] = { "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" }, @@ -859,7 +859,7 @@ struct ConfigInfo image_config[] = { "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" }, @@ -1724,7 +1724,7 @@ struct ConfigInfo image_config[] = { "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" }, @@ -1822,7 +1822,7 @@ struct ConfigInfo image_config[] = { "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" }, @@ -2461,7 +2461,7 @@ struct ConfigInfo image_config[] = { "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" }, @@ -2537,7 +2537,7 @@ struct ConfigInfo image_config[] = { "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" }, @@ -3249,7 +3249,7 @@ struct ConfigInfo image_config[] = { "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" }, @@ -5671,7 +5671,7 @@ struct ConfigInfo image_config[] = { "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 }, @@ -5681,27 +5681,27 @@ struct ConfigInfo image_config[] = { "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" }, @@ -7366,7 +7366,7 @@ struct ConfigInfo image_config[] = /* 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" }, diff --git a/src/conf_snd.c b/src/conf_snd.c index ec7dd8cc..745fdffc 100644 --- a/src/conf_snd.c +++ b/src/conf_snd.c @@ -28,7 +28,7 @@ struct ConfigTypeInfo sound_config_suffix[] = struct ConfigInfo sound_config[] = { - /* some default sounds */ + // some default sounds { "[default].digging", "schlurf.wav" }, { "[default].collecting", "pong.wav" }, { "[default].snapping", "pong.wav" }, @@ -42,7 +42,7 @@ struct ConfigInfo sound_config[] = { "[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" }, @@ -59,7 +59,7 @@ struct ConfigInfo sound_config[] = { "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" }, @@ -81,12 +81,12 @@ struct ConfigInfo sound_config[] = { "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" }, @@ -144,7 +144,7 @@ struct ConfigInfo sound_config[] = { "[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" }, @@ -159,7 +159,7 @@ struct ConfigInfo sound_config[] = { "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" }, @@ -194,13 +194,13 @@ struct ConfigInfo sound_config[] = { "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" }, @@ -237,7 +237,7 @@ struct ConfigInfo sound_config[] = { "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" }, @@ -280,10 +280,10 @@ struct ConfigInfo sound_config[] = { "[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" }, @@ -294,7 +294,7 @@ struct ConfigInfo sound_config[] = { "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 }, @@ -305,7 +305,7 @@ struct ConfigInfo sound_config[] = { "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" }, diff --git a/src/config.h b/src/config.h index 6c7396fc..2387c5b7 100644 --- a/src/config.h +++ b/src/config.h @@ -24,4 +24,4 @@ char *getConfigProgramCopyrightString(void); char *getConfigProgramCompanyString(void); char *getWindowTitleString(void); -#endif /* CONFIG_H */ +#endif // CONFIG_H diff --git a/src/editor.c b/src/editor.c index fe006ee6..6a0e6be2 100644 --- a/src/editor.c +++ b/src/editor.c @@ -31,20 +31,20 @@ ----------------------------------------------------------------------------- */ -/* 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) @@ -62,7 +62,7 @@ #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) @@ -72,7 +72,7 @@ #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) @@ -83,14 +83,14 @@ 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) @@ -249,7 +249,7 @@ 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) @@ -265,11 +265,11 @@ #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) @@ -283,7 +283,7 @@ 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) @@ -297,7 +297,7 @@ 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) @@ -320,7 +320,7 @@ #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) @@ -341,7 +341,7 @@ 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) @@ -364,7 +364,7 @@ enum { GADGET_ID_NONE = -1, - /* drawing toolbox buttons */ + // drawing toolbox buttons GADGET_ID_SINGLE_ITEMS, GADGET_ID_CONNECTED_ITEMS, @@ -402,7 +402,7 @@ enum GADGET_ID_ELEMENT_RIGHT, GADGET_ID_PALETTE, - /* counter gadget identifiers */ + // counter gadget identifiers GADGET_ID_SELECT_LEVEL_DOWN, GADGET_ID_SELECT_LEVEL_TEXT, @@ -510,7 +510,7 @@ enum 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, @@ -546,7 +546,7 @@ enum GADGET_ID_GROUP_CONTENT, GADGET_ID_RANDOM_BACKGROUND, - /* text input identifiers */ + // text input identifiers GADGET_ID_LEVEL_NAME, GADGET_ID_LEVEL_AUTHOR, @@ -554,11 +554,11 @@ enum 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, @@ -591,7 +591,7 @@ enum GADGET_ID_SELECT_CHANGE_PAGE, GADGET_ID_GROUP_CHOICE_MODE, - /* textbutton identifiers */ + // textbutton identifiers GADGET_ID_LEVELINFO_LEVEL, GADGET_ID_LEVELINFO_LEVELSET, @@ -607,14 +607,14 @@ enum 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, @@ -623,13 +623,13 @@ enum 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, @@ -703,14 +703,14 @@ enum 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, @@ -718,7 +718,7 @@ enum RADIO_NR_RANDOM_ELEMENTS }; -/* values for counter gadgets */ +// values for counter gadgets enum { ED_COUNTER_ID_SELECT_LEVEL, @@ -777,7 +777,7 @@ enum #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, @@ -793,7 +793,7 @@ enum #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, @@ -806,7 +806,7 @@ enum #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, @@ -824,7 +824,7 @@ enum #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, @@ -835,7 +835,7 @@ enum #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, @@ -888,7 +888,7 @@ enum #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, @@ -917,7 +917,7 @@ enum #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, @@ -931,7 +931,7 @@ enum #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, @@ -1023,7 +1023,7 @@ enum #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, @@ -1035,7 +1035,7 @@ enum #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, @@ -1085,55 +1085,55 @@ enum ----------------------------------------------------------------------------- */ -/* 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 @@ -1157,7 +1157,7 @@ static struct /* 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, @@ -1240,7 +1240,7 @@ static struct "pick drawing element", ',' }, - /* ---------- level control buttons -------------------------------------- */ + // ---------- level control buttons ----------------------------------------- { IMG_GFX_EDITOR_BUTTON_UNDO, GADGET_ID_UNDO, @@ -1273,7 +1273,7 @@ static struct "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, @@ -1301,7 +1301,7 @@ static struct "paste settings to this element", 0 }, - /* ---------- palette control buttons ------------------------------------ */ + // ---------- palette control buttons --------------------------------------- { IMG_GFX_EDITOR_BUTTON_PROPERTIES, GADGET_ID_PROPERTIES, @@ -1359,10 +1359,10 @@ static struct 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, @@ -1370,7 +1370,7 @@ static struct NULL, NULL, NULL }, - /* ---------- level and editor settings ---------------------------------- */ + // ---------- level and editor settings ------------------------------------- { ED_LEVEL_SETTINGS_XPOS(0), ED_LEVEL_SETTINGS_YPOS(4), @@ -1437,14 +1437,14 @@ static struct "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 }, { @@ -1452,7 +1452,7 @@ static struct 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 }, { @@ -1460,7 +1460,7 @@ static struct 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 }, { @@ -1468,7 +1468,7 @@ static struct 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 }, { @@ -1500,7 +1500,7 @@ static struct 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", }, { @@ -1508,7 +1508,7 @@ static struct 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", }, { @@ -1520,7 +1520,7 @@ static struct 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), @@ -1587,7 +1587,7 @@ static struct 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), @@ -1622,7 +1622,7 @@ static struct 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), @@ -1633,7 +1633,7 @@ static struct 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), @@ -1699,9 +1699,9 @@ static struct "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" } @@ -2441,13 +2441,13 @@ static struct 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), @@ -2474,7 +2474,7 @@ static struct "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), @@ -2493,7 +2493,7 @@ static struct 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), @@ -2536,7 +2536,7 @@ static struct 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), @@ -2606,7 +2606,7 @@ static struct 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), @@ -2697,7 +2697,7 @@ static struct 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), @@ -2719,7 +2719,7 @@ static struct 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), @@ -2740,7 +2740,7 @@ static struct NULL, NULL, NULL, "Configure editor properties" }, - /* ---------- element settings (tabs) ------------------------------------ */ + // ---------- element settings (tabs) --------------------------------------- { ED_ELEMENT_TABS_XPOS(0), ED_ELEMENT_TABS_YPOS(0), @@ -2773,7 +2773,7 @@ static struct 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), @@ -2789,7 +2789,7 @@ static struct "Save current settings as new template" }, - /* ---------- element settings (buttons) --------------------------------- */ + // ---------- element settings (buttons) ------------------------------------ { -1, -1, @@ -2964,7 +2964,7 @@ static struct 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), @@ -3009,7 +3009,7 @@ static struct "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), @@ -3257,7 +3257,7 @@ static struct "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), @@ -3309,7 +3309,7 @@ static struct "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), @@ -3375,7 +3375,7 @@ static struct "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), @@ -3453,18 +3453,18 @@ static struct 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, @@ -3523,7 +3523,7 @@ static struct NULL, NULL, "8", NULL }, - /* ---------- magic ball content ----------------------------------------- */ + // ---------- magic ball content -------------------------------------------- { ED_AREA_MAGIC_BALL_CONTENT_XPOS, ED_AREA_MAGIC_BALL_CONTENT_YPOS, @@ -3582,7 +3582,7 @@ static struct NULL, NULL, "8", NULL }, - /* ---------- android content -------------------------------------------- */ + // ---------- android content ----------------------------------------------- { ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(5), @@ -3592,7 +3592,7 @@ static struct "elements:", NULL, NULL, "elements android can clone" }, - /* ---------- amoeba content --------------------------------------------- */ + // ---------- amoeba content ------------------------------------------------ { ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(3), @@ -3602,7 +3602,7 @@ static struct "content:", NULL, NULL, "amoeba content" }, - /* ---------- level start element ---------------------------------------- */ + // ---------- level start element ------------------------------------------- { -1, ED_AREA_1X1_SETTINGS_YPOS(10), @@ -3612,7 +3612,7 @@ static struct NULL, NULL, NULL, "level start element" }, - /* ---------- player artwork element ------------------------------------- */ + // ---------- player artwork element ---------------------------------------- { -1, ED_AREA_1X1_SETTINGS_YPOS(11), @@ -3622,7 +3622,7 @@ static struct NULL, NULL, NULL, "element for player artwork" }, - /* ---------- player explosion element ----------------------------------- */ + // ---------- player explosion element -------------------------------------- { -1, ED_AREA_1X1_SETTINGS_YPOS(12), @@ -3632,7 +3632,7 @@ static struct NULL, NULL, NULL, "element for player explosion" }, - /* ---------- player initial inventory ----------------------------------- */ + // ---------- player initial inventory -------------------------------------- { -1, ED_AREA_1X1_SETTINGS_YPOS(1), @@ -3642,9 +3642,9 @@ static struct 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), @@ -3654,19 +3654,19 @@ static struct 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), @@ -3683,9 +3683,9 @@ static struct 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), @@ -3695,17 +3695,17 @@ static struct 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), @@ -3715,7 +3715,7 @@ static struct 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), @@ -3725,7 +3725,7 @@ static struct 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), @@ -3735,7 +3735,7 @@ static struct "content:", NULL, NULL, NULL }, - /* ---------- random background (for random painting) -------------------- */ + // ---------- random background (for random painting) ----------------------- { -1, ED_AREA_1X1_LSETTINGS_YPOS(1), @@ -3753,22 +3753,22 @@ static struct ----------------------------------------------------------------------------- */ -/* 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; @@ -3787,7 +3787,7 @@ static int use_permanent_palette = TRUE; #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); @@ -3824,7 +3824,7 @@ static int getTabulatorBarWidth(void); 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; @@ -4072,8 +4072,8 @@ static int editor_hl_rnd[] = static int editor_el_rnd[] = { - EL_DYNAMITE, /* RND */ - EL_DYNAMITE_ACTIVE, /* RND */ + EL_DYNAMITE, // RND + EL_DYNAMITE_ACTIVE, // RND EL_EMPTY, EL_EMPTY, @@ -4120,7 +4120,7 @@ static int editor_el_rnd[] = EL_PACMAN_LEFT, EL_DARK_YAMYAM, EL_PACMAN_RIGHT, - EL_YAMYAM, /* RND */ + EL_YAMYAM, // RND EL_BLACK_ORB, EL_PACMAN_DOWN, @@ -4267,10 +4267,10 @@ static int editor_hl_diamond_caves[] = 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, @@ -5246,17 +5246,17 @@ static int num_editor_hl_dynamic = ARRAY_SIZE(editor_hl_dynamic); 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; @@ -5482,14 +5482,14 @@ static char *getElementDescriptionFilenameExt(char *basename) 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; @@ -5502,13 +5502,13 @@ static char *getElementDescriptionFilename(int element) 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) @@ -5529,51 +5529,51 @@ static void InitDynamicEditorElementList(int **elements, int *num_elements) 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; @@ -5593,7 +5593,7 @@ static void ReinitializeElementList_EnableSections(void) 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) { @@ -5690,9 +5690,9 @@ static void ReinitializeElementList(void) 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]; @@ -5709,19 +5709,19 @@ static void ReinitializeElementList(void) 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++) @@ -5739,7 +5739,7 @@ static void ReinitializeElementList(void) 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; @@ -5776,7 +5776,7 @@ static void ReinitializeElementList(void) 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; @@ -5789,7 +5789,7 @@ static void ReinitializeElementList(void) 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; @@ -5835,7 +5835,7 @@ static void ReinitializeElementList(void) } } - /* (this function is also called before editor gadgets are initialized!) */ + // (this function is also called before editor gadgets are initialized!) AdjustElementListScrollbar(); } @@ -5889,7 +5889,7 @@ static void ReinitializeElementListButtons(void) 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; @@ -5906,7 +5906,7 @@ static void ReinitializeElementListButtons(void) 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 = @@ -5976,7 +5976,7 @@ static void DrawEditorLevelBorderLine(int x, int y, int xsize, int ysize) 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); @@ -5993,7 +5993,7 @@ static void DrawEditorLevelBorderLinesIfNeeded(void) 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); @@ -6086,7 +6086,7 @@ static void CreateControlButtons(void) 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; @@ -6203,7 +6203,7 @@ static void CreateControlButtons(void) 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; @@ -6217,7 +6217,7 @@ static void CreateControlButtons(void) 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; @@ -6269,7 +6269,7 @@ static void CreateControlButtons(void) 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; @@ -6331,15 +6331,15 @@ static void CreateCounterButtons(void) 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); @@ -6417,7 +6417,7 @@ static void CreateCounterButtons(void) 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) { @@ -6460,7 +6460,7 @@ static void CreateCounterButtons(void) 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, @@ -6479,7 +6479,7 @@ static void CreateCounterButtons(void) 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 } } } @@ -6489,7 +6489,7 @@ static void CreateDrawingAreas(void) { 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; @@ -6509,12 +6509,12 @@ static void CreateDrawingAreas(void) 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); @@ -6680,7 +6680,7 @@ static void CreateSelectboxGadgets(void) 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 @@ -6691,18 +6691,18 @@ static void CreateSelectboxGadgets(void) 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); @@ -6770,7 +6770,7 @@ static void CreateTextbuttonGadgets(void) 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; @@ -6778,7 +6778,7 @@ static void CreateTextbuttonGadgets(void) 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; @@ -6789,7 +6789,7 @@ static void CreateTextbuttonGadgets(void) 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); @@ -6830,7 +6830,7 @@ static void CreateGraphicbuttonGadgets(void) 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; @@ -6845,12 +6845,12 @@ static void CreateGraphicbuttonGadgets(void) 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); @@ -6884,7 +6884,7 @@ static void CreateScrollbarGadgets(void) { 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 = @@ -6943,7 +6943,7 @@ static void CreateScrollbarGadgets(void) 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) { @@ -7018,12 +7018,12 @@ static void CreateCheckbuttonGadgets(void) 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); @@ -7082,12 +7082,12 @@ static void CreateRadiobuttonGadgets(void) 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); @@ -7122,10 +7122,10 @@ static void CreateRadiobuttonGadgets(void) 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; @@ -7148,7 +7148,7 @@ void CreateLevelEditorGadgets(void) 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(); @@ -7196,21 +7196,21 @@ static void MapCounterButtons(int id) 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) { @@ -7222,7 +7222,7 @@ static void MapCounterButtons(int id) 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) @@ -7244,17 +7244,17 @@ static void MapControlButtons(void) 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]); @@ -7262,7 +7262,7 @@ static void MapControlButtons(void) 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; @@ -7383,7 +7383,7 @@ static void MapTextbuttonGadget(int id) 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; @@ -7457,10 +7457,10 @@ static void MapCheckbuttonGadget(int id) 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); @@ -7638,7 +7638,7 @@ static void DrawEditModeWindowExt(boolean remap_toolbox_gadgets) 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); } @@ -7818,19 +7818,19 @@ static void setSelectboxSpecialActionVariablesIfNeeded(void) { 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; @@ -7844,7 +7844,7 @@ static void setSelectboxSpecialActionOptions(void) { 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) @@ -7906,7 +7906,7 @@ static void replace_custom_element_in_settings(int element_from, 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; @@ -7960,7 +7960,7 @@ static boolean CopyCustomElement(int element_old, int element_new, 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()) @@ -8001,7 +8001,7 @@ static void CopyCustomElementPropertiesToEditor(int element) 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); @@ -8013,7 +8013,7 @@ static void CopyCustomElementPropertiesToEditor(int element) 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 = @@ -8022,10 +8022,10 @@ static void CopyCustomElementPropertiesToEditor(int element) 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); @@ -8035,9 +8035,9 @@ static void CopyCustomElementPropertiesToEditor(int element) 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 : @@ -8054,7 +8054,7 @@ static void CopyCustomElementPropertiesToEditor(int element) 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 : @@ -8069,7 +8069,7 @@ static void CopyCustomElementPropertiesToEditor(int element) 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 : @@ -8080,7 +8080,7 @@ static void CopyCustomElementPropertiesToEditor(int element) 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 : @@ -8093,9 +8093,9 @@ static void CopyCustomElementPropertiesToEditor(int element) 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 : @@ -8117,7 +8117,7 @@ static void CopyCustomElementPropertiesToEditor(int element) 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 : @@ -8148,7 +8148,7 @@ static void CopyCustomElementPropertiesToEditor(int element) 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) @@ -8187,9 +8187,9 @@ static boolean AskToCopyAndModifyLevelTemplate(void) } 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; } @@ -8200,7 +8200,7 @@ static void CopyCustomElementPropertiesToGame(int element) 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; @@ -8210,9 +8210,9 @@ static void CopyCustomElementPropertiesToGame(int element) 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; @@ -8228,7 +8228,7 @@ static void CopyCustomElementPropertiesToGame(int element) (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; @@ -8237,14 +8237,14 @@ static void CopyCustomElementPropertiesToGame(int element) 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; @@ -8252,9 +8252,9 @@ static void CopyCustomElementPropertiesToGame(int element) 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; @@ -8276,7 +8276,7 @@ static void CopyCustomElementPropertiesToGame(int element) 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; @@ -8309,14 +8309,14 @@ static void CopyCustomElementPropertiesToGame(int element) 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; @@ -8492,10 +8492,10 @@ static boolean useEditorDoorAnimation(void) 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, @@ -8503,10 +8503,10 @@ static void DrawEditorDoorContent(void) 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, @@ -8514,14 +8514,14 @@ static void DrawEditorDoorContent(void) 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); } @@ -8536,7 +8536,7 @@ void DrawLevelEd(void) FadeOut(fade_mask); - /* needed if different viewport properties defined for editor */ + // needed if different viewport properties defined for editor ChangeViewportPropertiesIfNeeded(); ClearField(); @@ -8573,8 +8573,8 @@ void DrawLevelEd(void) 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(); @@ -8619,19 +8619,19 @@ static void AdjustDrawingAreaGadgets(void) 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); @@ -8644,13 +8644,13 @@ static void AdjustDrawingAreaGadgets(void) 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); @@ -8664,7 +8664,7 @@ static void AdjustDrawingAreaGadgets(void) 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); @@ -8732,7 +8732,7 @@ static void AdjustElementListScrollbar(void) 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) @@ -8795,7 +8795,7 @@ static void ModifyEditorSelectboxOptions(int selectbox_id, 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); } @@ -8964,11 +8964,11 @@ static void DrawLevelInfoTabulatorGadgets(void) 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); @@ -8976,8 +8976,8 @@ static void DrawLevelInfoTabulatorGadgets(void) 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); @@ -8994,11 +8994,11 @@ static void DrawPropertiesTabulatorGadgets(void) 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; @@ -9008,17 +9008,17 @@ static void DrawPropertiesTabulatorGadgets(void) 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); @@ -9026,8 +9026,8 @@ static void DrawPropertiesTabulatorGadgets(void) 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); @@ -9055,19 +9055,19 @@ static void DrawLevelInfoLevel(void) { 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); } @@ -9101,11 +9101,11 @@ static void DrawLevelInfoLevelSet(void) 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 || @@ -9116,18 +9116,18 @@ static void DrawLevelInfoLevelSet(void) 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(); } @@ -9135,22 +9135,22 @@ static void DrawLevelInfoEditor(void) { 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); } @@ -9192,7 +9192,7 @@ static void DrawCustomContentArea(void) 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); @@ -9235,7 +9235,7 @@ static void DrawYamYamContentAreas(void) 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++) @@ -9250,7 +9250,7 @@ static void DrawYamYamContentAreas(void) { 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); } } @@ -9270,7 +9270,7 @@ static void DrawMagicBallContentAreas(void) 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++) @@ -9285,7 +9285,7 @@ static void DrawMagicBallContentAreas(void) { 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); } } @@ -9305,7 +9305,7 @@ static void DrawAndroidElementArea(int element) 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) @@ -9315,7 +9315,7 @@ static void DrawAndroidElementArea(int element) 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); @@ -9340,7 +9340,7 @@ static void DrawGroupElementArea(int element) 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); @@ -9359,12 +9359,12 @@ static void DrawPlayerInitialInventoryArea(int element) 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); @@ -9372,7 +9372,7 @@ static void DrawPlayerInitialInventoryArea(int element) 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); @@ -9408,7 +9408,7 @@ static void DrawPropertiesInfo(void) } properties[] = { - /* configurable properties */ + // configurable properties { EP_WALKABLE_OVER, "- player can walk over it" }, { EP_WALKABLE_INSIDE, "- player can walk inside it" }, @@ -9449,7 +9449,7 @@ static void DrawPropertiesInfo(void) { 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" }, @@ -9492,7 +9492,7 @@ static void DrawPropertiesInfo(void) 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++) @@ -9512,7 +9512,7 @@ static void DrawPropertiesInfo(void) 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); @@ -9540,7 +9540,7 @@ static void DrawPropertiesInfo(void) 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); @@ -9765,7 +9765,7 @@ static void DrawPropertiesConfig(void) 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) @@ -9787,12 +9787,12 @@ static void DrawPropertiesConfig(void) 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; } @@ -9807,7 +9807,7 @@ static void DrawPropertiesConfig(void) if (HAS_EDITOR_CONTENT(properties_element)) { - /* draw stickybutton gadget */ + // draw stickybutton gadget MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT); if (IS_AMOEBOID(properties_element)) @@ -9833,7 +9833,7 @@ static void DrawPropertiesConfig(void) { 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) { @@ -9889,13 +9889,13 @@ static void DrawPropertiesConfig(void) 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); } } @@ -9911,7 +9911,7 @@ static void DrawPropertiesConfig(void) (!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 = @@ -9965,11 +9965,11 @@ static void DrawPropertiesConfig(void) 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); @@ -9992,55 +9992,55 @@ static void DrawPropertiesConfig(void) 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(); @@ -10048,35 +10048,35 @@ static void DrawPropertiesConfig(void) } 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]; @@ -10085,7 +10085,7 @@ static void DrawPropertiesConfig(void) 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 - @@ -10112,38 +10112,38 @@ static void DrawPropertiesChange(void) { 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(); } @@ -10225,7 +10225,7 @@ static void DrawPropertiesWindow(void) 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; @@ -10255,7 +10255,7 @@ static void DrawPropertiesWindow(void) 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); @@ -10267,7 +10267,7 @@ static void DrawPropertiesWindow(void) 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(); } @@ -10280,7 +10280,7 @@ static void DrawPaletteWindow(void) 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]); @@ -10297,7 +10297,7 @@ static void UpdateCustomElementGraphicGadgets(void) 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]; @@ -10343,7 +10343,7 @@ static int getTubeFromOpenDirection(int direction) 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; @@ -10791,15 +10791,15 @@ static void MergeAndCloseNeighbourElements(int x1, int y1, int *element1, 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); } @@ -10832,7 +10832,7 @@ static void SetElementIntelliDraw(int x, int y, int new_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_TUBE(old_element)) direction |= getOpenDirectionFromTube(old_element); @@ -10870,7 +10870,7 @@ static void SetElementIntelliDraw(int x, int y, int new_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); @@ -10908,7 +10908,7 @@ static void SetElementIntelliDraw(int x, int y, int new_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); @@ -10932,7 +10932,7 @@ static void SetElementIntelliDraw(int x, int y, int new_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) @@ -10951,7 +10951,7 @@ static void SetElementIntelliDraw(int x, int y, int new_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_EMC_PILLAR(old_element)) direction |= getOpenDirectionFromPillar(old_element); @@ -10988,7 +10988,7 @@ static void SetElementIntelliDraw(int x, int y, int new_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); @@ -11025,7 +11025,7 @@ static void SetElementIntelliDraw(int x, int y, int new_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++) { @@ -11698,19 +11698,19 @@ static void DrawLine(int from_x, int from_y, int to_x, int to_y, 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; @@ -11722,7 +11722,7 @@ static void DrawLine(int from_x, int from_y, int to_x, int to_y, DrawLineElement(from_x + x, from_y + y, element, change_level); } } - else /* a >= 1 */ + else // a >= 1 { float a = (float)xsize / (float)ysize; @@ -11876,7 +11876,7 @@ static void SelectArea(int from_x, int from_y, int to_x, int to_y, 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 @@ -12086,7 +12086,7 @@ static void FloodFillWall_MM(int from_sx2, int from_sy2, int fill_element) 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 @@ -12104,7 +12104,7 @@ static int DrawLevelText(int sx, int sy, char letter, int mode) 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) @@ -12255,21 +12255,21 @@ static void CopyLevelToUndoBuffer(int mode) 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; @@ -12284,7 +12284,7 @@ static void RandomPlacement(int new_element) 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] = @@ -12296,12 +12296,12 @@ static void RandomPlacement(int new_element) 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++) @@ -12316,7 +12316,7 @@ static void RandomPlacement(int new_element) 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; @@ -12392,29 +12392,29 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) 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); @@ -12435,7 +12435,7 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) } 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)) @@ -12459,15 +12459,15 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) 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; @@ -12480,7 +12480,7 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) ResetIntelliDraw(); } - SetDrawModeHiRes(-1); /* reset to normal draw mode */ + SetDrawModeHiRes(-1); // reset to normal draw mode switch (actual_drawing_function) { @@ -12509,7 +12509,7 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) 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) @@ -12545,7 +12545,7 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) { UpdateCustomElementGraphicGadgets(); - FrameCounter = 0; /* restart animation frame counter */ + FrameCounter = 0; // restart animation frame counter } } break; @@ -12588,7 +12588,7 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) sx = sx2; sy = sy2; } - /* FALLTHROUGH */ + // FALLTHROUGH case GADGET_ID_GRAB_BRUSH: case GADGET_ID_TEXT: { @@ -12608,7 +12608,7 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) 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) @@ -12639,7 +12639,7 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) 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; @@ -12678,7 +12678,7 @@ static void HandleDrawingAreas(struct GadgetInfo *gi) 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 || @@ -12737,7 +12737,7 @@ static void HandleCounterButtons(struct GadgetInfo *gi) if (level.game_engine_type != last_game_engine_type) { - /* update element selection list */ + // update element selection list ReinitializeElementList(); ModifyEditorElementList(); } @@ -12778,7 +12778,7 @@ static void HandleCounterButtons(struct GadgetInfo *gi) 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; @@ -12793,7 +12793,7 @@ static void HandleCounterButtons(struct GadgetInfo *gi) 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 && @@ -12813,10 +12813,10 @@ static void HandleTextInputGadgets(struct GadgetInfo *gi) { 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; @@ -12861,7 +12861,7 @@ static void HandleSelectboxGadgets(struct GadgetInfo *gi) { 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(); @@ -12872,12 +12872,12 @@ static void HandleSelectboxGadgets(struct GadgetInfo *gi) } 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; @@ -12909,10 +12909,10 @@ static void HandleTextbuttonGadgets(struct GadgetInfo *gi) { 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 || @@ -12922,7 +12922,7 @@ static void HandleTextbuttonGadgets(struct GadgetInfo *gi) 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) @@ -12996,13 +12996,13 @@ static void HandleTextbuttonGadgets(struct GadgetInfo *gi) { 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]; @@ -13017,11 +13017,11 @@ static void HandleTextbuttonGadgets(struct GadgetInfo *gi) { 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]; @@ -13066,7 +13066,7 @@ static void HandleGraphicbuttonGadgets(struct GadgetInfo *gi) } 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; @@ -13087,7 +13087,7 @@ static void HandleRadiobuttons(struct GadgetInfo *gi) *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; @@ -13123,7 +13123,7 @@ static void HandleCheckbuttons(struct GadgetInfo *gi) 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) @@ -13199,7 +13199,7 @@ static void HandleCheckbuttons(struct GadgetInfo *gi) 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 && @@ -13235,11 +13235,11 @@ static void HandleControlButtons(struct GadgetInfo *gi) !(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) { @@ -13464,11 +13464,11 @@ static void HandleControlButtons(struct GadgetInfo *gi) { 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; @@ -13514,7 +13514,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) if (button == 1) { - /* undo */ + // undo undo_buffer_position = (undo_buffer_position - 1 + NUM_UNDO_STEPS) % NUM_UNDO_STEPS; @@ -13524,7 +13524,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) } else { - /* redo */ + // redo undo_buffer_position = (undo_buffer_position + 1) % NUM_UNDO_STEPS; @@ -13536,7 +13536,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) 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); @@ -13613,7 +13613,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) } } - /* "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; @@ -13634,7 +13634,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) 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; @@ -13646,7 +13646,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) 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: @@ -13670,14 +13670,14 @@ static void HandleControlButtons(struct GadgetInfo *gi) *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; @@ -13701,7 +13701,7 @@ static void HandleControlButtons(struct GadgetInfo *gi) 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; @@ -13810,18 +13810,18 @@ void HandleLevelEditorKeyInput(Key key) 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; } @@ -13857,7 +13857,7 @@ void HandleLevelEditorKeyInput(Key key) { HandleControlButtons(level_editor_gadget[GADGET_ID_PALETTE]); } - else /* should never happen */ + else // should never happen { ChangeEditModeWindow(ED_MODE_DRAWING); } @@ -13926,7 +13926,7 @@ void HandleLevelEditorIdle(void) redraw_mask |= REDRAW_FIELD; - FrameCounter++; /* increase animation frame counter */ + FrameCounter++; // increase animation frame counter } static void ClearEditorGadgetInfoText(void) @@ -13986,7 +13986,7 @@ void HandleEditorGadgetInfoText(void *ptr) 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(); @@ -14010,9 +14010,9 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi) 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; @@ -14021,7 +14021,7 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi) 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); @@ -14032,22 +14032,22 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi) 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) { @@ -14105,7 +14105,7 @@ static void HandleDrawingAreaInfo(struct GadgetInfo *gi) 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)) @@ -14158,7 +14158,7 @@ void RequestExitLevelEditor(boolean ask_if_level_has_changed, 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 diff --git a/src/engines.h b/src/engines.h index 1120dd88..b04dbe05 100644 --- a/src/engines.h +++ b/src/engines.h @@ -21,9 +21,9 @@ #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); @@ -40,9 +40,9 @@ void getGraphicSourceObjectExt_EM(struct GraphicInfo_EM *, 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); @@ -51,9 +51,9 @@ int getGraphicInfo_Delay(int); 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); @@ -66,4 +66,4 @@ void getMiniGraphicSource(int, Bitmap **, int *, int *); void getSizedGraphicSource(int, int, int, Bitmap **, int *, int *); -#endif /* ENGINES_H */ +#endif // ENGINES_H diff --git a/src/events.c b/src/events.c index 37d7c0d7..5a0d5775 100644 --- a/src/events.c +++ b/src/events.c @@ -40,7 +40,7 @@ static unsigned int special_cursor_delay = 0; 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); @@ -57,7 +57,7 @@ static int FilterEvents(const Event *event) 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) @@ -76,7 +76,7 @@ static int FilterEvents(const Event *event) ((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; @@ -84,7 +84,7 @@ static int FilterEvents(const Event *event) 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) || @@ -98,7 +98,7 @@ static int FilterEvents(const Event *event) 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; @@ -112,11 +112,11 @@ static int FilterEvents(const Event *event) 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; @@ -126,7 +126,7 @@ static boolean SkipPressedMouseMotionEvent(const Event *event) 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; } @@ -262,7 +262,7 @@ void HandleOtherEvents(Event *event) HandleSpecialGameControllerButtons(event); - /* FALL THROUGH */ + // FALL THROUGH case SDL_CONTROLLERDEVICEADDED: case SDL_CONTROLLERDEVICEREMOVED: case SDL_CONTROLLERAXISMOTION: @@ -287,7 +287,7 @@ static void HandleMouseCursor(void) { 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)) @@ -298,7 +298,7 @@ static void HandleMouseCursor(void) 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 && @@ -314,7 +314,7 @@ static void HandleMouseCursor(void) 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; } @@ -327,7 +327,7 @@ void EventLoop(void) 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 @@ -336,10 +336,10 @@ void EventLoop(void) 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) @@ -356,7 +356,7 @@ void ClearAutoRepeatKeyEvents(void) 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); @@ -407,7 +407,7 @@ void ClearPlayerAction(void) { 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; @@ -436,7 +436,7 @@ static void SetPlayerMouseAction(int mx, int my, int button) 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); } @@ -1390,7 +1390,7 @@ static void HandleButtonOrFinger(int mx, int my, int button) 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 { @@ -1577,20 +1577,20 @@ void HandleButton(int mx, int my, int button, int button_nr) 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; @@ -1745,7 +1745,7 @@ static void HandleKeysSpecial(Key key) 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; @@ -1782,7 +1782,7 @@ static void HandleKeysSpecial(Key key) } } - /* 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")) @@ -1871,7 +1871,7 @@ void HandleKey(Key key, int key_status) 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) @@ -1882,7 +1882,7 @@ void HandleKey(Key key, int key_status) 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; @@ -1899,7 +1899,7 @@ void HandleKey(Key key, int key_status) 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; @@ -1920,7 +1920,7 @@ void HandleKey(Key key, int key_status) { 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; } @@ -1931,14 +1931,14 @@ void HandleKey(Key key, int key_status) 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); @@ -1947,7 +1947,7 @@ void HandleKey(Key key, int key_status) } 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); } @@ -2036,8 +2036,8 @@ void HandleKey(Key key, int key_status) 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; } @@ -2098,7 +2098,7 @@ void HandleKey(Key key, int key_status) 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; } @@ -2308,7 +2308,7 @@ static int HandleJoystickForAllPlayers(void) 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; @@ -2352,7 +2352,7 @@ void HandleJoystick(void) if (HandleGlobalAnimClicks(-1, -1, newbutton)) { - /* do not handle this button event anymore */ + // do not handle this button event anymore return; } @@ -2377,12 +2377,12 @@ void HandleJoystick(void) 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); } @@ -2499,7 +2499,7 @@ void HandleSpecialGameControllerKeys(Key key, int key_status) #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) @@ -2512,7 +2512,7 @@ void HandleSpecialGameControllerKeys(Key key, int key_status) 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); diff --git a/src/files.c b/src/files.c index 75e691c3..37e69816 100644 --- a/src/files.c +++ b/src/files.c @@ -23,58 +23,58 @@ #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 @@ -88,7 +88,7 @@ #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) @@ -120,7 +120,7 @@ #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; @@ -135,26 +135,26 @@ static int xx_string_length_unused; 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, @@ -218,13 +218,13 @@ static struct LevelFileConfigInfo chunk_config_INFO[] = { -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 }, { @@ -266,16 +266,16 @@ static struct LevelFileConfigInfo chunk_config_INFO[] = 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, @@ -308,7 +308,7 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = &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), @@ -876,7 +876,7 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = &li.score[SC_ELEM_BONUS], 10 }, - /* ---------- unused values ----------------------------------------------- */ + // ---------- unused values ------------------------------------------------- { EL_UNKNOWN, SAVE_CONF_NEVER, @@ -948,7 +948,7 @@ static struct LevelFileConfigInfo chunk_config_CUSX_base[] = &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), @@ -1118,7 +1118,7 @@ static struct LevelFileConfigInfo chunk_config_CUSX_base[] = &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, @@ -1137,7 +1137,7 @@ static struct LevelFileConfigInfo chunk_config_CUSX_base[] = 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, @@ -1145,7 +1145,7 @@ static struct LevelFileConfigInfo chunk_config_CUSX_change[] = &xx_current_change_page, -1 }, - /* ---------- (the remaining entries can be in any order) ----------------- */ + // ---------- (the remaining entries can be in any order) ------------------- { -1, -1, @@ -1321,7 +1321,7 @@ static struct LevelFileConfigInfo chunk_config_GRPX[] = } }; -static struct LevelFileConfigInfo chunk_config_CONF[] = /* (OBSOLETE) */ +static struct LevelFileConfigInfo chunk_config_CONF[] = // (OBSOLETE) { { EL_PLAYER_1, -1, @@ -1396,9 +1396,9 @@ filetype_id_list[] = }; -/* ========================================================================= */ -/* level file functions */ -/* ========================================================================= */ +// ============================================================================ +// level file functions +// ============================================================================ static boolean check_special_flags(char *flag) { @@ -1476,11 +1476,11 @@ static char *getDefaultElementDescription(struct ElementInfo *ei) 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]; @@ -1539,7 +1539,7 @@ static void setConfigToDefaultsFromConfigList(struct LevelFileConfigInfo *conf) 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; @@ -1591,7 +1591,7 @@ static void copyConfigFromConfigList(struct LevelFileConfigInfo *conf) 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); @@ -1605,15 +1605,15 @@ void copyElementInfo(struct ElementInfo *ei_from, struct ElementInfo *ei_to) { 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; @@ -1623,11 +1623,11 @@ void copyElementInfo(struct ElementInfo *ei_from, struct ElementInfo *ei_to) 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; } @@ -1648,7 +1648,7 @@ void setElementChangePages(struct ElementInfo *ei, int change_pages) 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); @@ -1668,9 +1668,9 @@ static void setLevelInfoToDefaults_Level(struct LevelInfo *level) { 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(); @@ -1689,17 +1689,17 @@ static void setLevelInfoToDefaults_Level(struct LevelInfo *level) 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; @@ -1709,15 +1709,15 @@ static void setLevelInfoToDefaults_Level(struct LevelInfo *level) 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); @@ -1742,7 +1742,7 @@ static void setLevelInfoToDefaults_Level(struct LevelInfo *level) break; default: - /* keep default value */ + // keep default value break; } } @@ -1756,17 +1756,17 @@ static void setLevelInfoToDefaults_Elements(struct LevelInfo *level) 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; @@ -1783,7 +1783,7 @@ static void setLevelInfoToDefaults_Elements(struct LevelInfo *level) 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); @@ -1805,7 +1805,7 @@ static void setLevelInfoToDefaults_Elements(struct LevelInfo *level) 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; @@ -1826,13 +1826,13 @@ static void setLevelInfoToDefaults_Elements(struct LevelInfo *level) { 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); @@ -1879,7 +1879,7 @@ static void ActivateLevelTemplate(void) 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) { @@ -1889,15 +1889,15 @@ static void ActivateLevelTemplate(void) 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]; @@ -1923,26 +1923,26 @@ static void ActivateLevelTemplate(void) { 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; } } @@ -1960,35 +1960,35 @@ static char *getLevelFilenameFromBasename(char *basename) 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; } @@ -2048,7 +2048,7 @@ static char *getPackedLevelBasename(int type) Directory *dir; DirectoryEntry *dir_entry; - strcpy(basename, UNDEFINED_FILENAME); /* default: undefined file */ + strcpy(basename, UNDEFINED_FILENAME); // default: undefined file if ((dir = openDirectory(directory)) == NULL) { @@ -2057,12 +2057,12 @@ static char *getPackedLevelBasename(int type) 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) @@ -2171,11 +2171,11 @@ char *getLocalLevelTemplateFilename(void) 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) { @@ -2187,7 +2187,7 @@ char *getGlobalLevelTemplateFilename(void) 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; @@ -2197,20 +2197,20 @@ static void determineLevelFileInfo_Filename(struct LevelFileInfo *lfi) { 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); @@ -2227,20 +2227,20 @@ static void determineLevelFileInfo_Filename(struct LevelFileInfo *lfi) { 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)) @@ -2250,12 +2250,12 @@ static void determineLevelFileInfo_Filename(struct LevelFileInfo *lfi) 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; @@ -2263,7 +2263,7 @@ static void determineLevelFileInfo_Filename(struct LevelFileInfo *lfi) 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; @@ -2271,12 +2271,12 @@ static void determineLevelFileInfo_Filename(struct LevelFileInfo *lfi) 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); } @@ -2292,10 +2292,10 @@ static void determineLevelFileInfo_Filetype(struct LevelFileInfo *lfi) 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); @@ -2312,13 +2312,13 @@ static void copyLevelFileInfo(struct LevelFileInfo *lfi_from, 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) { @@ -2369,11 +2369,11 @@ static int getMappedElement(int 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 : @@ -2382,7 +2382,7 @@ static int getMappedElementByVersion(int element, int game_version) 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 : @@ -2552,7 +2552,7 @@ static int LoadLevel_CONT(File *file, int chunk_size, struct LevelInfo *level) 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; @@ -2576,8 +2576,8 @@ static int LoadLevel_CNT2(File *file, int chunk_size, struct LevelInfo *level) 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); @@ -2586,7 +2586,7 @@ static int LoadLevel_CNT2(File *file, int chunk_size, struct LevelInfo *level) 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; @@ -2737,7 +2737,7 @@ static int LoadLevel_CUS3(File *file, int chunk_size, struct LevelInfo *level) 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); @@ -2787,10 +2787,10 @@ static int LoadLevel_CUS3(File *file, int chunk_size, struct LevelInfo *level) 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; } @@ -2806,7 +2806,7 @@ static int LoadLevel_CUS4(File *file, int chunk_size, struct LevelInfo *level) 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)); @@ -2826,7 +2826,7 @@ static int LoadLevel_CUS4(File *file, int chunk_size, struct LevelInfo *level) 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); @@ -2854,7 +2854,7 @@ static int LoadLevel_CUS4(File *file, int chunk_size, struct LevelInfo *level) 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); @@ -2869,7 +2869,7 @@ static int LoadLevel_CUS4(File *file, int chunk_size, struct LevelInfo *level) 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); @@ -2878,10 +2878,10 @@ static int LoadLevel_CUS4(File *file, int chunk_size, struct LevelInfo *level) 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); @@ -2890,10 +2890,10 @@ static int LoadLevel_CUS4(File *file, int chunk_size, struct LevelInfo *level) 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)) @@ -2934,14 +2934,14 @@ static int LoadLevel_CUS4(File *file, int chunk_size, struct LevelInfo *level) 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; @@ -2981,13 +2981,13 @@ static int LoadLevel_GRP1(File *file, int chunk_size, struct LevelInfo *level) 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; @@ -3034,13 +3034,13 @@ static int LoadLevel_MicroChunk(File *file, struct LevelFileConfigInfo *conf, 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 { @@ -3088,7 +3088,7 @@ static int LoadLevel_MicroChunk(File *file, struct LevelFileConfigInfo *conf, 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) : @@ -3139,7 +3139,7 @@ static int LoadLevel_INFO(File *file, int chunk_size, struct LevelInfo *level) { int real_chunk_size = 0; - li = *level; /* copy level data into temporary buffer */ + li = *level; // copy level data into temporary buffer while (!checkEndOfFile(file)) { @@ -3149,7 +3149,7 @@ static int LoadLevel_INFO(File *file, int chunk_size, struct LevelInfo *level) break; } - *level = li; /* copy temporary buffer back to level data */ + *level = li; // copy temporary buffer back to level data return real_chunk_size; } @@ -3158,7 +3158,7 @@ static int LoadLevel_CONF(File *file, int chunk_size, struct LevelInfo *level) { int real_chunk_size = 0; - li = *level; /* copy level data into temporary buffer */ + li = *level; // copy level data into temporary buffer while (!checkEndOfFile(file)) { @@ -3171,7 +3171,7 @@ static int LoadLevel_CONF(File *file, int chunk_size, struct LevelInfo *level) break; } - *level = li; /* copy temporary buffer back to level data */ + *level = li; // copy temporary buffer back to level data return real_chunk_size; } @@ -3180,7 +3180,7 @@ static int LoadLevel_ELEM(File *file, int chunk_size, struct LevelInfo *level) { int real_chunk_size = 0; - li = *level; /* copy level data into temporary buffer */ + li = *level; // copy level data into temporary buffer while (!checkEndOfFile(file)) { @@ -3193,7 +3193,7 @@ static int LoadLevel_ELEM(File *file, int chunk_size, struct LevelInfo *level) break; } - *level = li; /* copy temporary buffer back to level data */ + *level = li; // copy temporary buffer back to level data return real_chunk_size; } @@ -3204,7 +3204,7 @@ static int LoadLevel_NOTE(File *file, int chunk_size, struct LevelInfo *level) 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)) { @@ -3215,7 +3215,7 @@ static int LoadLevel_NOTE(File *file, int chunk_size, struct LevelInfo *level) 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; } @@ -3227,7 +3227,7 @@ static int LoadLevel_CUSX(File *file, int chunk_size, struct LevelInfo *level) 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; @@ -3257,21 +3257,21 @@ static int LoadLevel_CUSX(File *file, int chunk_size, struct LevelInfo *level) 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); @@ -3296,8 +3296,8 @@ static int LoadLevel_GRPX(File *file, int chunk_size, struct LevelInfo *level) 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)) { @@ -3339,13 +3339,13 @@ static void LoadLevelFromFileInfo_RND(struct LevelInfo *level, 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; @@ -3354,7 +3354,7 @@ static void LoadLevelFromFileInfo_RND(struct LevelInfo *level, 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")) @@ -3368,7 +3368,7 @@ static void LoadLevelFromFileInfo_RND(struct LevelInfo *level, 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) @@ -3398,13 +3398,13 @@ static void LoadLevelFromFileInfo_RND(struct LevelInfo *level, 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); } @@ -3465,7 +3465,7 @@ static void LoadLevelFromFileInfo_RND(struct LevelInfo *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); @@ -3485,9 +3485,9 @@ static void LoadLevelFromFileInfo_RND(struct LevelInfo *level, } -/* ------------------------------------------------------------------------- */ -/* functions for loading EM level */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// functions for loading EM level +// ---------------------------------------------------------------------------- static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) { @@ -3561,7 +3561,7 @@ 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; @@ -3573,7 +3573,7 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) 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]); @@ -3593,7 +3593,7 @@ static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) 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])) @@ -3690,7 +3690,7 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level) 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]); @@ -3703,7 +3703,7 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level) 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; @@ -3714,9 +3714,9 @@ static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level) } -/* ------------------------------------------------------------------------- */ -/* functions for loading SP level */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// functions for loading SP level +// ---------------------------------------------------------------------------- static void CopyNativeLevel_RND_to_SP(struct LevelInfo *level) { @@ -3735,7 +3735,7 @@ 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; @@ -3792,7 +3792,7 @@ static void CopyNativeLevel_RND_to_SP(struct LevelInfo *level) } else { - /* change special gravity port to normal port */ + // change special gravity port to normal port element += EL_SP_PORT_RIGHT - gravity_port_base_element; } @@ -3839,17 +3839,17 @@ static void CopyNativeLevel_SP_to_RND(struct LevelInfo *level) 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'; @@ -3892,27 +3892,27 @@ static void CopyNativeLevel_SP_to_RND(struct LevelInfo *level) 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++) @@ -3925,14 +3925,14 @@ static void CopyNativeTape_RND_to_SP(struct LevelInfo *level) 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; @@ -3971,13 +3971,13 @@ static void CopyNativeTape_SP_to_RND(struct LevelInfo *level) 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)); @@ -4011,9 +4011,9 @@ static void CopyNativeTape_SP_to_RND(struct LevelInfo *level) } -/* ------------------------------------------------------------------------- */ -/* functions for loading MM level */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// functions for loading MM level +// ---------------------------------------------------------------------------- static void CopyNativeLevel_RND_to_MM(struct LevelInfo *level) { @@ -4070,7 +4070,7 @@ static void CopyNativeLevel_MM_to_RND(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); @@ -4092,9 +4092,9 @@ static void CopyNativeLevel_MM_to_RND(struct LevelInfo *level) } -/* ------------------------------------------------------------------------- */ -/* functions for loading DC level */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// functions for loading DC level +// ---------------------------------------------------------------------------- #define DC_LEVEL_HEADER_SIZE 344 @@ -4146,11 +4146,11 @@ static int getMappedElement_DC(int element) 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; @@ -4168,11 +4168,11 @@ static int getMappedElement_DC(int element) 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; @@ -4192,19 +4192,19 @@ static int getMappedElement_DC(int element) 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; @@ -4295,15 +4295,15 @@ static int getMappedElement_DC(int element) 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; @@ -4355,15 +4355,15 @@ static int getMappedElement_DC(int element) 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; @@ -4383,41 +4383,41 @@ static int getMappedElement_DC(int element) 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; @@ -4429,915 +4429,915 @@ static int getMappedElement_DC(int element) 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; @@ -5377,91 +5377,91 @@ static int getMappedElement_DC(int element) 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; @@ -5533,8 +5533,8 @@ static int getMappedElement_DC(int element) element = EL_INVISIBLE_STEELWALL; break; - /* 0x16bc - 0x16cb: */ - /* EL_INVISIBLE_SAND */ + // 0x16bc - 0x16cb: + // EL_INVISIBLE_SAND case 0x16cc: element = EL_LIGHT_SWITCH; @@ -5545,9 +5545,9 @@ static int getMappedElement_DC(int element) 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; @@ -5583,7 +5583,7 @@ static void LoadLevelFromFileStream_DC(File *file, struct LevelInfo *level, 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++) { @@ -5593,12 +5593,12 @@ static void LoadLevelFromFileStream_DC(File *file, struct LevelInfo *level, 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) @@ -5610,14 +5610,14 @@ static void LoadLevelFromFileStream_DC(File *file, struct LevelInfo *level, 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; @@ -5747,11 +5747,11 @@ static void LoadLevelFromFileInfo_DC(struct LevelInfo *level, 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; @@ -5769,16 +5769,16 @@ static void LoadLevelFromFileInfo_DC(struct LevelInfo *level, 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; @@ -5789,10 +5789,10 @@ static void LoadLevelFromFileInfo_DC(struct LevelInfo *level, 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--; @@ -5815,9 +5815,9 @@ static void LoadLevelFromFileInfo_DC(struct LevelInfo *level, } -/* ------------------------------------------------------------------------- */ -/* functions for loading SB level */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// functions for loading SB level +// ---------------------------------------------------------------------------- int getMappedElement_SB(int element_ascii, boolean use_ces) { @@ -5829,14 +5829,14 @@ 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 }, }; @@ -5868,7 +5868,7 @@ static void LoadLevelFromFileInfo_SB(struct LevelInfo *level, 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'; @@ -5885,10 +5885,10 @@ static void LoadLevelFromFileInfo_SB(struct LevelInfo *level, 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; @@ -5905,49 +5905,49 @@ static void LoadLevelFromFileInfo_SB(struct LevelInfo *level, 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++) @@ -5959,7 +5959,7 @@ static void LoadLevelFromFileInfo_SB(struct LevelInfo *level, 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]); @@ -5970,14 +5970,14 @@ static void LoadLevelFromFileInfo_SB(struct LevelInfo *level, 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; @@ -5993,23 +5993,23 @@ static void LoadLevelFromFileInfo_SB(struct LevelInfo *level, 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; @@ -6022,7 +6022,7 @@ static void LoadLevelFromFileInfo_SB(struct LevelInfo *level, level->field[x][y] = mapped_sb_element; - /* continue with next tile column */ + // continue with next tile column x++; level->fieldx = MAX(x, level->fieldx); @@ -6030,14 +6030,14 @@ static void LoadLevelFromFileInfo_SB(struct LevelInfo *level, 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++; } @@ -6072,7 +6072,7 @@ static void LoadLevelFromFileInfo_SB(struct LevelInfo *level, 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 || @@ -6082,23 +6082,23 @@ static void LoadLevelFromFileInfo_SB(struct LevelInfo *level, 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, @@ -6114,7 +6114,7 @@ static void LoadLevelFromFileInfo_SP(struct LevelInfo *level, { 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; @@ -6165,15 +6165,15 @@ void SaveNativeLevel(struct LevelInfo *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) @@ -6210,7 +6210,7 @@ static void LoadLevelFromFileInfo(struct LevelInfo *level, 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); @@ -6225,11 +6225,11 @@ void LoadLevelFromFilename(struct LevelInfo *level, char *filename) { 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); @@ -6240,19 +6240,19 @@ static void LoadLevel_InitVersion(struct LevelInfo *level) { 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 @@ -6277,7 +6277,7 @@ static void LoadLevel_InitVersion(struct LevelInfo *level) 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), @@ -6289,49 +6289,49 @@ static void LoadLevel_InitVersion(struct LevelInfo *level) 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); @@ -6341,7 +6341,7 @@ static void LoadLevel_InitVersion(struct LevelInfo *level) 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++) { @@ -6358,7 +6358,7 @@ static void LoadLevel_InitVersion(struct LevelInfo *level) } } - /* 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]; @@ -6380,7 +6380,7 @@ static void LoadLevel_InitVersion(struct LevelInfo *level) 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 @@ -6404,15 +6404,15 @@ static void LoadLevel_InitVersion(struct LevelInfo *level) 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; } @@ -6421,7 +6421,7 @@ static void LoadLevel_InitStandardElements(struct LevelInfo *level) { 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++) @@ -6446,8 +6446,8 @@ static void LoadLevel_InitCustomElements(struct LevelInfo *level) { 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)) @@ -6457,8 +6457,8 @@ static void LoadLevel_InitCustomElements(struct LevelInfo *level) } } - /* 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)) @@ -6470,7 +6470,7 @@ static void LoadLevel_InitCustomElements(struct LevelInfo *level) } } - /* 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++) @@ -6482,7 +6482,7 @@ static void LoadLevel_InitCustomElements(struct LevelInfo *level) } } - /* 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++) @@ -6495,7 +6495,7 @@ static void LoadLevel_InitCustomElements(struct LevelInfo *level) } } - /* 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++) @@ -6516,8 +6516,8 @@ static void LoadLevel_InitCustomElements(struct LevelInfo *level) } } - /* 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++) @@ -6533,7 +6533,7 @@ static void LoadLevel_InitCustomElements(struct LevelInfo *level) } } - /* 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++) @@ -6542,14 +6542,14 @@ static void LoadLevel_InitCustomElements(struct LevelInfo *level) 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++) @@ -6571,7 +6571,7 @@ static void LoadLevel_InitElements(struct LevelInfo *level) 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(); } @@ -6580,30 +6580,30 @@ static void LoadLevel_InitPlayfield(struct LevelInfo *level) { 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(); } @@ -6868,7 +6868,7 @@ static void SaveLevel_CNT2(FILE *file, struct LevelInfo *level, int element) } 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); @@ -6938,7 +6938,7 @@ static void SaveLevel_CUS1(FILE *file, struct LevelInfo *level, } } - 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 @@ -6967,7 +6967,7 @@ static void SaveLevel_CUS2(FILE *file, struct LevelInfo *level, } } - 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 @@ -6996,7 +6996,7 @@ static void SaveLevel_CUS3(FILE *file, struct LevelInfo *level, 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); @@ -7042,7 +7042,7 @@ static void SaveLevel_CUS3(FILE *file, struct LevelInfo *level, 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); } @@ -7050,7 +7050,7 @@ static void SaveLevel_CUS3(FILE *file, struct LevelInfo *level, } } - 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 @@ -7061,7 +7061,7 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element) 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); @@ -7070,7 +7070,7 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int 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); @@ -7091,7 +7091,7 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element) 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); @@ -7106,7 +7106,7 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element) 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); @@ -7115,17 +7115,17 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element) 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]) @@ -7165,7 +7165,7 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element) 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]) @@ -7194,7 +7194,7 @@ static void SaveLevel_GRP1(FILE *file, struct LevelInfo *level, int element) 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++) @@ -7220,11 +7220,11 @@ static int SaveLevel_MicroChunk(FILE *file, struct LevelFileConfigInfo *entry, 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; @@ -7245,11 +7245,11 @@ static int SaveLevel_MicroChunk(FILE *file, struct LevelFileConfigInfo *entry, 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; @@ -7269,12 +7269,12 @@ static int SaveLevel_MicroChunk(FILE *file, struct LevelFileConfigInfo *entry, 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; @@ -7294,14 +7294,14 @@ static int SaveLevel_MicroChunk(FILE *file, struct LevelFileConfigInfo *entry, 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; @@ -7326,7 +7326,7 @@ static int SaveLevel_INFO(FILE *file, struct LevelInfo *level) 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); @@ -7339,7 +7339,7 @@ static int SaveLevel_ELEM(FILE *file, struct LevelInfo *level) 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); @@ -7355,7 +7355,7 @@ static int SaveLevel_NOTE(FILE *file, struct LevelInfo *level, int element) 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++) @@ -7372,9 +7372,9 @@ static int SaveLevel_CUSX(FILE *file, struct LevelInfo *level, int element) 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++) @@ -7386,7 +7386,7 @@ static int SaveLevel_CUSX(FILE *file, struct LevelInfo *level, int element) 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); @@ -7408,10 +7408,10 @@ static int SaveLevel_GRPX(FILE *file, struct LevelInfo *level, int element) 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++) @@ -7466,7 +7466,7 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename, 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); @@ -7477,14 +7477,14 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename, 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++) @@ -7492,7 +7492,7 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename, 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); @@ -7504,7 +7504,7 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename, 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); @@ -7590,23 +7590,23 @@ void DumpLevel(struct LevelInfo *level) } -/* ========================================================================= */ -/* 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; @@ -7636,13 +7636,13 @@ static int LoadTape_HEAD(File *file, int chunk_size, struct TapeInfo *tape) 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++) { @@ -7739,8 +7739,8 @@ static int LoadTape_BODY(File *file, int chunk_size, struct TapeInfo *tape) 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]; @@ -7766,15 +7766,15 @@ static int LoadTape_BODY(File *file, int chunk_size, struct TapeInfo *tape) } 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--; @@ -7847,7 +7847,7 @@ static void LoadTape_SokobanSolution(char *filename) case '\r': case '\t': case ' ': - /* ignore white-space characters */ + // ignore white-space characters break; default: @@ -7875,7 +7875,7 @@ void LoadTapeFromFilename(char *filename) File *file; int chunk_size; - /* always start with reliable default values */ + // always start with reliable default values setTapeInfoToDefaults(); if (strSuffix(filename, ".sln")) @@ -7895,7 +7895,7 @@ void LoadTapeFromFilename(char *filename) 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")) @@ -7909,7 +7909,7 @@ void LoadTapeFromFilename(char *filename) 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) @@ -7939,13 +7939,13 @@ void LoadTapeFromFilename(char *filename) 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); } @@ -7989,7 +7989,7 @@ void LoadTapeFromFilename(char *filename) } 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); @@ -8047,7 +8047,7 @@ static void SaveTape_HEAD(FILE *file, struct TapeInfo *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); @@ -8060,7 +8060,7 @@ static void SaveTape_HEAD(FILE *file, struct TapeInfo *tape) 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); @@ -8123,7 +8123,7 @@ void SaveTape(int nr) 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++; @@ -8241,9 +8241,9 @@ void DumpTape(struct TapeInfo *tape) } -/* ========================================================================= */ -/* score file functions */ -/* ========================================================================= */ +// ============================================================================ +// score file functions +// ============================================================================ void LoadScore(int nr) { @@ -8254,7 +8254,7 @@ 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); @@ -8264,7 +8264,7 @@ void LoadScore(int nr) 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') @@ -8308,7 +8308,7 @@ void SaveScore(int nr) 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))) @@ -8328,13 +8328,13 @@ void SaveScore(int nr) } -/* ========================================================================= */ -/* setup file functions */ -/* ========================================================================= */ +// ============================================================================ +// setup file functions +// ============================================================================ #define TOKEN_STR_PLAYER_PREFIX "player_" -/* global setup */ +// global setup enum { SETUP_TOKEN_PLAYER_NAME = 0, @@ -8400,7 +8400,7 @@ enum NUM_GLOBAL_SETUP_TOKENS }; -/* auto setup */ +// auto setup enum { SETUP_TOKEN_AUTO_EDITOR_ZOOM_TILESIZE = 0, @@ -8408,7 +8408,7 @@ enum NUM_AUTO_SETUP_TOKENS }; -/* editor setup */ +// editor setup enum { SETUP_TOKEN_EDITOR_EL_CLASSIC = 0, @@ -8421,7 +8421,7 @@ enum NUM_EDITOR_SETUP_TOKENS }; -/* editor cascade setup */ +// editor cascade setup enum { SETUP_TOKEN_EDITOR_CASCADE_BD = 0, @@ -8443,7 +8443,7 @@ enum NUM_EDITOR_CASCADE_SETUP_TOKENS }; -/* shortcut setup */ +// shortcut setup enum { SETUP_TOKEN_SHORTCUT_SAVE_GAME = 0, @@ -8471,7 +8471,7 @@ enum NUM_SHORTCUT_SETUP_TOKENS }; -/* player setup */ +// player setup enum { SETUP_TOKEN_PLAYER_USE_JOYSTICK = 0, @@ -8494,7 +8494,7 @@ enum NUM_PLAYER_SETUP_TOKENS }; -/* system setup */ +// system setup enum { SETUP_TOKEN_SYSTEM_SDL_VIDEODRIVER = 0, @@ -8504,7 +8504,7 @@ enum NUM_SYSTEM_SETUP_TOKENS }; -/* internal setup */ +// internal setup enum { SETUP_TOKEN_INT_PROGRAM_TITLE = 0, @@ -8530,7 +8530,7 @@ enum NUM_INTERNAL_SETUP_TOKENS }; -/* debug setup */ +// debug setup enum { SETUP_TOKEN_DEBUG_FRAME_DELAY_0 = 0, @@ -8560,7 +8560,7 @@ enum NUM_DEBUG_SETUP_TOKENS }; -/* options setup */ +// options setup enum { SETUP_TOKEN_OPTIONS_VERBOSE = 0, @@ -8788,13 +8788,13 @@ static struct TokenInfo options_setup_tokens[] = 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'; @@ -8852,18 +8852,18 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) 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; @@ -9102,7 +9102,7 @@ void setHideSetupEntry(void *setup_value) 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); @@ -9123,10 +9123,10 @@ static void setSetupInfoFromTokenText(SetupFileHash *setup_file_hash, 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); } @@ -9149,13 +9149,13 @@ static void decodeSetupFileHash(SetupFileHash *setup_file_hash) 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++) { @@ -9194,19 +9194,19 @@ static void decodeSetupFileHash(SetupFileHash *setup_file_hash) } } - /* 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]; @@ -9225,25 +9225,25 @@ static void decodeSetupFileHash(SetupFileHash *setup_file_hash) 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); @@ -9259,7 +9259,7 @@ static void decodeSetupFileHash_AutoSetup(SetupFileHash *setup_file_hash) 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, @@ -9275,7 +9275,7 @@ static void decodeSetupFileHash_EditorCascade(SetupFileHash *setup_file_hash) 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, @@ -9304,19 +9304,19 @@ static void LoadSetup_SpecialPostProcessing(void) { 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); } @@ -9325,16 +9325,16 @@ void LoadSetup(void) { 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); @@ -9347,7 +9347,7 @@ void LoadSetup_AutoSetup(void) 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); @@ -9367,7 +9367,7 @@ void LoadSetup_EditorCascade(void) 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); @@ -9447,11 +9447,11 @@ void SaveSetup(void) 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 || @@ -9464,7 +9464,7 @@ void SaveSetup(void) 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]; @@ -9493,19 +9493,19 @@ void SaveSetup(void) } } - /* 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]; @@ -9518,22 +9518,22 @@ void SaveSetup(void) 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++) @@ -9699,7 +9699,7 @@ static int get_token_parameter_value(char *token, char *value_raw) 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); } @@ -9707,7 +9707,7 @@ void InitMenuDesignSettings_Static(void) { 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); @@ -9722,10 +9722,10 @@ static void InitMenuDesignSettings_SpecialPreProcessing(void) { 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 = @@ -9768,8 +9768,8 @@ static void InitMenuDesignSettings_SpecialPreProcessing(void) 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; @@ -9783,11 +9783,11 @@ static void InitMenuDesignSettings_SpecialPreProcessing(void) 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]; @@ -9795,15 +9795,15 @@ static void InitMenuDesignSettings_SpecialPreProcessing(void) 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]; @@ -9828,11 +9828,11 @@ static void InitMenuDesignSettings_SpecialPostProcessing(void) }; 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) @@ -9865,7 +9865,7 @@ static void InitMenuDesignSettings_SpecialPostProcessing_AfterGraphics(void) }; 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 && @@ -9922,11 +9922,11 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) } 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" }, @@ -9939,19 +9939,19 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) } 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]" }, @@ -9962,7 +9962,7 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) { 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]" }, @@ -9981,10 +9981,10 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) 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"); @@ -9999,8 +9999,8 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) 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"); @@ -10020,8 +10020,8 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) } } - /* 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"); @@ -10033,8 +10033,8 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) 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"); @@ -10067,8 +10067,8 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) 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"; @@ -10119,8 +10119,8 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) 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"; @@ -10199,8 +10199,8 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) 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; @@ -10226,8 +10226,8 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) } } - /* 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; @@ -10259,12 +10259,12 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) } } - /* 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); @@ -10282,7 +10282,7 @@ void LoadMenuDesignSettings(void) 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)) @@ -10318,18 +10318,18 @@ void LoadUserDefinedEditorElementList(int **elements, int *num_elements) 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; @@ -10337,7 +10337,7 @@ void LoadUserDefinedEditorElementList(int **elements, int *num_elements) { 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); @@ -10371,7 +10371,7 @@ void LoadUserDefinedEditorElementList(int **elements, int *num_elements) 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); @@ -10417,7 +10417,7 @@ static struct MusicFileInfo *get_music_file_info_ext(char *basename, int music, 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) @@ -10432,7 +10432,7 @@ static struct MusicFileInfo *get_music_file_info_ext(char *basename, int music, 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"); @@ -10447,7 +10447,7 @@ static struct MusicFileInfo *get_music_file_info_ext(char *basename, int music, if (setup_file_hash == NULL) return NULL; - /* ---------- music file info found ---------- */ + // ---------- music file info found ---------- clear_mem(&tmp_music_file_info, sizeof(struct MusicFileInfo)); @@ -10544,7 +10544,7 @@ void LoadMusicInfo(void) 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; @@ -10563,13 +10563,13 @@ void LoadMusicInfo(void) 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); @@ -10613,7 +10613,7 @@ void LoadMusicInfo(void) 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; @@ -10675,7 +10675,7 @@ void LoadHelpAnimInfo(void) 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 = @@ -10699,7 +10699,7 @@ void LoadHelpAnimInfo(void) 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)); @@ -10721,35 +10721,35 @@ void LoadHelpAnimInfo(void) 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 "." */ + // token has format "." - 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 @@ -10762,7 +10762,7 @@ void LoadHelpAnimInfo(void) 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); @@ -10774,7 +10774,7 @@ void LoadHelpAnimInfo(void) 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); @@ -10786,10 +10786,10 @@ void LoadHelpAnimInfo(void) 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 @@ -10800,7 +10800,7 @@ void LoadHelpAnimInfo(void) continue; } - /* token has format ".." */ + // token has format ".." direction_token = strchr(action_token + 1, '.'); @@ -10809,10 +10809,10 @@ void LoadHelpAnimInfo(void) 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 @@ -10826,7 +10826,7 @@ void LoadHelpAnimInfo(void) 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); @@ -10837,10 +10837,10 @@ void LoadHelpAnimInfo(void) 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 @@ -10887,7 +10887,7 @@ void LoadHelpTextInfo(void) 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++) @@ -10907,9 +10907,9 @@ void LoadHelpTextInfo(void) } -/* ------------------------------------------------------------------------- */ -/* convert levels */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// convert levels +// ---------------------------------------------------------------------------- #define MAX_NUM_CONVERT_LEVELS 1000 @@ -11021,9 +11021,9 @@ void ConvertLevels(void) } -/* ------------------------------------------------------------------------- */ -/* 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) { @@ -11087,9 +11087,9 @@ 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) { diff --git a/src/files.h b/src/files.h index 601fdbeb..49077b9b 100644 --- a/src/files.h +++ b/src/files.h @@ -86,4 +86,4 @@ void ConvertLevels(void); void CreateLevelSketchImages(void); void CreateCustomElementImages(char *); -#endif /* FILES_H */ +#endif // FILES_H diff --git a/src/game.c b/src/game.c index 894ab64e..0d8c032e 100644 --- a/src/game.c +++ b/src/game.c @@ -22,14 +22,14 @@ #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 @@ -56,22 +56,22 @@ #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) @@ -86,7 +86,7 @@ #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 @@ -831,17 +831,17 @@ static struct GamePanelControlInfo game_panel_controls[] = } }; -/* 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 @@ -853,7 +853,7 @@ static struct GamePanelControlInfo game_panel_controls[] = #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) @@ -861,7 +861,7 @@ static struct GamePanelControlInfo game_panel_controls[] = (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) @@ -1004,7 +1004,7 @@ static struct GamePanelControlInfo game_panel_controls[] = #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 @@ -1026,7 +1026,7 @@ static struct GamePanelControlInfo game_panel_controls[] = #define NUM_GAME_BUTTONS 17 -/* forward declaration for internal use */ +// forward declaration for internal use static void CreateField(int, int, int); @@ -1119,8 +1119,8 @@ static int getInvisibleFromInvisibleActiveElement(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) \ @@ -1149,12 +1149,12 @@ static boolean recursion_loop_element; 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); @@ -1548,7 +1548,7 @@ static boolean trigger_events[MAX_NUM_ELEMENTS][NUM_CHANGE_EVENTS]; #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; @@ -1606,7 +1606,7 @@ static int get_move_delay_from_stepsize(int move_stepsize) 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; @@ -1619,10 +1619,10 @@ static void SetPlayerMoveSpeed(struct PlayerInfo *player, int 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) @@ -1719,16 +1719,16 @@ static void InitPlayerField(int x, int y, int element, boolean 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); @@ -1736,7 +1736,7 @@ static void InitPlayerField(int x, int y, int element, boolean init_game) { player->active = TRUE; - /* remove potentially duplicate players */ + // remove potentially duplicate players if (StorePlayer[jx][jy] == Feld[x][y]) StorePlayer[jx][jy] = 0; @@ -1765,7 +1765,7 @@ static void InitPlayerField(int x, int y, int element, boolean init_game) 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 } } @@ -1907,12 +1907,12 @@ static void InitField(int x, int y, boolean init_game) 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]; } @@ -1966,7 +1966,7 @@ static void InitField(int x, int y, boolean init_game) 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; @@ -1997,7 +1997,7 @@ static void InitField_WithBug1(int x, int y, boolean init_game) { 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); @@ -2009,7 +2009,7 @@ static void InitField_WithBug2(int x, int y, boolean init_game) 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)) @@ -2121,12 +2121,12 @@ static void InitGameControlValues(void) 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); @@ -2138,12 +2138,12 @@ static void InitGameControlValues(void) 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); } @@ -2153,7 +2153,7 @@ static void UpdatePlayfieldElementCount(void) 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; @@ -2222,9 +2222,9 @@ static void UpdateGameControlValues(void) 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; @@ -2238,7 +2238,7 @@ static void UpdateGameControlValues(void) { 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; @@ -2433,7 +2433,7 @@ static void UpdateGameControlValues(void) 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++) { @@ -2529,14 +2529,14 @@ static void DisplayGameControlValues(void) 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); @@ -2567,7 +2567,7 @@ static void DisplayGameControlValues(void) { 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); @@ -2580,11 +2580,11 @@ static void DisplayGameControlValues(void) } } - /* 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), @@ -2724,8 +2724,8 @@ static void DisplayGameControlValues(void) 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); } @@ -2736,10 +2736,10 @@ static void DisplayGameControlValues(void) 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); } @@ -2792,11 +2792,11 @@ static void InitGameEngine(void) { 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) @@ -2807,13 +2807,13 @@ static void InitGameEngine(void) 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: @@ -2883,15 +2883,15 @@ static void InitGameEngine(void) 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 @@ -2902,33 +2902,33 @@ static void InitGameEngine(void) 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)) @@ -2948,7 +2948,7 @@ static void InitGameEngine(void) } } - /* 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]; @@ -2970,7 +2970,7 @@ static void InitGameEngine(void) 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++) { @@ -2984,7 +2984,7 @@ static void InitGameEngine(void) } } - /* 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]; @@ -2996,7 +2996,7 @@ static void InitGameEngine(void) 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; @@ -3008,7 +3008,7 @@ static void InitGameEngine(void) } } - /* ---------- initialize reference elements in change conditions --------- */ + // ---------- initialize reference elements in change conditions ------------ for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { @@ -3027,7 +3027,7 @@ static void InitGameEngine(void) } } - /* ---------- initialize run-time trigger player and element ------------- */ + // ---------- initialize run-time trigger player and element ---------------- for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { @@ -3044,14 +3044,14 @@ static void InitGameEngine(void) } } - /* ---------- 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]; @@ -3088,14 +3088,14 @@ static void InitGameEngine(void) } } - /* ---------- 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; @@ -3109,7 +3109,7 @@ static void InitGameEngine(void) } } - /* 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; @@ -3118,14 +3118,14 @@ static void InitGameEngine(void) 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; @@ -3134,14 +3134,14 @@ static void InitGameEngine(void) } } - /* ---------- 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; @@ -3149,38 +3149,38 @@ static void InitGameEngine(void) 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)) @@ -3188,7 +3188,7 @@ static void InitGameEngine(void) 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 : @@ -3213,19 +3213,19 @@ static void InitGameEngine(void) } } - /* ---------- 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; @@ -3239,8 +3239,8 @@ static void InitGameEngine(void) 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; } @@ -3314,9 +3314,9 @@ void InitGame(void) 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; @@ -3342,7 +3342,7 @@ void InitGame(void) FadeOut(fade_mask); - /* needed if different viewport properties defined for playing */ + // needed if different viewport properties defined for playing ChangeViewportPropertiesIfNeeded(); ClearField(); @@ -3354,7 +3354,7 @@ void InitGame(void) 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++) @@ -3422,8 +3422,8 @@ void InitGame(void) 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]; @@ -3480,7 +3480,7 @@ void InitGame(void) 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; @@ -3537,7 +3537,7 @@ void InitGame(void) network_player_action_received = FALSE; - /* initial null action */ + // initial null action if (network_playing) SendToServer_MovePlayer(MV_NONE); @@ -3554,7 +3554,7 @@ void InitGame(void) ScreenMovPos = 0; ScreenGfxPos = 0; - ScrollStepSize = 0; /* will be correctly initialized by ScrollScreen() */ + ScrollStepSize = 0; // will be correctly initialized by ScrollScreen() AllPlayersGone = FALSE; @@ -3584,7 +3584,7 @@ void InitGame(void) 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++) @@ -3600,7 +3600,7 @@ void InitGame(void) 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; @@ -3648,7 +3648,7 @@ void InitGame(void) { 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); @@ -3661,25 +3661,25 @@ void InitGame(void) 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)) @@ -3699,17 +3699,17 @@ void InitGame(void) } } - /* 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]; } @@ -3751,7 +3751,7 @@ void InitGame(void) 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]; @@ -3765,9 +3765,9 @@ void InitGame(void) 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 && @@ -3775,7 +3775,7 @@ void InitGame(void) !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 && @@ -3835,7 +3835,7 @@ void InitGame(void) #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]; @@ -3847,7 +3847,7 @@ void InitGame(void) 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; @@ -3878,21 +3878,21 @@ void InitGame(void) 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 @@ -3935,9 +3935,9 @@ void InitGame(void) } #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++) { @@ -3963,7 +3963,7 @@ void InitGame(void) 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 @@ -4040,7 +4040,7 @@ void InitGame(void) { 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); @@ -4058,7 +4058,7 @@ void InitGame(void) 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); @@ -4077,7 +4077,7 @@ void InitGame(void) 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]; @@ -4105,7 +4105,7 @@ void InitGame(void) 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(); @@ -4123,14 +4123,14 @@ void InitGame(void) 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); @@ -4146,9 +4146,9 @@ void InitGame(void) 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); @@ -4170,7 +4170,7 @@ void InitGame(void) 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); @@ -4215,7 +4215,7 @@ void InitGame(void) 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) { @@ -4223,11 +4223,11 @@ void UpdateEngineValues(int actual_scroll_x, int actual_scroll_y, 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; } @@ -4350,7 +4350,7 @@ void InitMovDir(int x, int 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); @@ -4471,7 +4471,7 @@ void GameWon(void) { 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; @@ -4486,7 +4486,7 @@ void GameWon(void) 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(); @@ -4544,9 +4544,9 @@ void GameWon(void) 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 || @@ -4566,7 +4566,7 @@ void GameWon(void) PlayLevelSoundElementAction(ExitX, ExitY, element, ACTION_CLOSING); } - /* player disappears */ + // player disappears DrawLevelField(ExitX, ExitY); } @@ -4578,7 +4578,7 @@ void GameWon(void) { RemovePlayer(player); - /* player disappears */ + // player disappears DrawLevelField(player->jx, player->jy); } } @@ -4669,7 +4669,7 @@ void GameWon(void) 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; @@ -4677,14 +4677,14 @@ void GameEnd(void) 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) @@ -4716,8 +4716,8 @@ void GameEnd(void) 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) { @@ -4765,7 +4765,7 @@ int NewHiScore(int level_nr) { 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) { @@ -4777,7 +4777,7 @@ int NewHiScore(int level_nr) 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; } @@ -4800,7 +4800,7 @@ int NewHiScore(int level_nr) 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) @@ -4818,7 +4818,7 @@ static int getElementMoveStepsizeExt(int x, int y, int direction) 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) && @@ -4889,7 +4889,7 @@ static void InitMovingField(int x, int y, int direction) 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); @@ -4907,7 +4907,7 @@ static void InitMovingField(int x, int y, int direction) 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) { @@ -5094,7 +5094,7 @@ void DrawDynamite(int x, int y) 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]--; @@ -5174,7 +5174,7 @@ static void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir, 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(); @@ -5183,28 +5183,28 @@ static void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir, 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; @@ -5214,9 +5214,9 @@ static void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir, 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); @@ -5228,7 +5228,7 @@ static void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir, 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; @@ -5240,10 +5240,10 @@ static void DrawRelocateScreen(int old_x, int old_y, int x, int y, int move_dir, 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); } @@ -5277,15 +5277,15 @@ static void RelocatePlayer(int jx, int jy, int el_player_raw) 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); } @@ -5303,8 +5303,8 @@ static void RelocatePlayer(int jx, int jy, int el_player_raw) 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; } @@ -5325,12 +5325,12 @@ static void RelocatePlayer(int jx, int jy, int el_player_raw) 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); @@ -5364,7 +5364,7 @@ static void Explode(int ex, int ey, int phase, int mode) int last_phase; int border_element; - /* !!! eliminate this variable !!! */ + // !!! eliminate this variable !!! int delay = (game.emulation == EMU_SUPAPLEX ? 3 : 2); if (game.explosions_delayed) @@ -5373,26 +5373,26 @@ static void Explode(int ex, int ey, int phase, int mode) 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)) { @@ -5435,7 +5435,7 @@ static void Explode(int ex, int ey, int phase, int mode) 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) @@ -5444,7 +5444,7 @@ static void Explode(int ex, int ey, int phase, int mode) /* 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) || @@ -5455,7 +5455,7 @@ static void Explode(int ex, int ey, int phase, int mode) { 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; } @@ -5463,12 +5463,12 @@ static void Explode(int ex, int ey, int phase, int mode) 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]; @@ -5541,13 +5541,13 @@ static void Explode(int ex, int ey, int phase, int mode) 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; @@ -5595,7 +5595,7 @@ static void Explode(int ex, int ey, int phase, int mode) 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) { @@ -5611,7 +5611,7 @@ static void Explode(int ex, int ey, int phase, int mode) 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; @@ -5699,7 +5699,7 @@ static void DynaExplode(int ex, int ey) 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; @@ -5766,7 +5766,7 @@ void Bang(int x, int y) 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; @@ -5820,7 +5820,7 @@ static void InitBeltMovement(void) 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; @@ -5912,7 +5912,7 @@ static void ToggleBeltSwitch(int x, int y) 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; @@ -6076,7 +6076,7 @@ static void RedrawAllLightSwitchesAndInvisibleElements(void) TEST_DrawLevelField(x, y); - /* uncrumble neighbour fields, if needed */ + // uncrumble neighbour fields, if needed if (element == EL_INVISIBLE_SAND) TEST_DrawLevelFieldCrumbledNeighbours(x, y); } @@ -6089,7 +6089,7 @@ static void RedrawAllLightSwitchesAndInvisibleElements(void) 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); } @@ -6125,7 +6125,7 @@ static void RedrawAllInvisibleElementsForLenses(void) TEST_DrawLevelField(x, y); - /* uncrumble neighbour fields, if needed */ + // uncrumble neighbour fields, if needed if (element == EL_INVISIBLE_SAND) TEST_DrawLevelFieldCrumbledNeighbours(x, y); } @@ -6138,7 +6138,7 @@ static void RedrawAllInvisibleElementsForLenses(void) 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); } @@ -6246,7 +6246,7 @@ static void Impact(int x, int 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; @@ -6255,7 +6255,7 @@ static void Impact(int x, int y) 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; @@ -6288,14 +6288,14 @@ static void Impact(int x, int y) 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)) { @@ -6340,7 +6340,7 @@ static void Impact(int x, int y) 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 || @@ -6354,7 +6354,7 @@ static void Impact(int x, int y) 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) @@ -6476,7 +6476,7 @@ static void Impact(int x, int y) } } - /* 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 || @@ -6492,7 +6492,7 @@ static void Impact(int x, int y) 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); } @@ -6558,7 +6558,7 @@ static void TurnRoundExt(int x, int y) 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) @@ -6572,7 +6572,7 @@ static void TurnRoundExt(int x, int y) 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) @@ -6934,22 +6934,22 @@ static void TurnRoundExt(int x, int y) { 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 { @@ -6970,7 +6970,7 @@ static void TurnRoundExt(int x, int y) 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; @@ -6984,7 +6984,7 @@ static void TurnRoundExt(int x, int y) } } - if (can_clone) /* randomly find an element to clone */ + if (can_clone) // randomly find an element to clone { can_clone = FALSE; @@ -7012,7 +7012,7 @@ static void TurnRoundExt(int x, int y) } } - if (can_clone) /* randomly find a direction to move */ + if (can_clone) // randomly find a direction to move { can_clone = FALSE; @@ -7039,17 +7039,17 @@ static void TurnRoundExt(int x, int y) } } - 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; @@ -7081,7 +7081,7 @@ static void TurnRoundExt(int x, int y) 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) @@ -7199,7 +7199,7 @@ static void TurnRoundExt(int x, int y) 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); @@ -7255,7 +7255,7 @@ static void TurnRoundExt(int x, int y) 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; @@ -7285,14 +7285,14 @@ static void TurnRoundExt(int x, int y) 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; } @@ -7344,7 +7344,7 @@ static boolean JustBeingPushed(int x, int y) 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]) @@ -7671,7 +7671,7 @@ static void StartMoving(int x, int 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); @@ -7715,7 +7715,7 @@ static void StartMoving(int x, int y) 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)); @@ -7724,7 +7724,7 @@ static void StartMoving(int x, int y) 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; } @@ -7751,12 +7751,12 @@ static void StartMoving(int x, int y) } 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; @@ -7775,11 +7775,11 @@ static void StartMoving(int x, int y) 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 */ @@ -7805,7 +7805,7 @@ static void StartMoving(int x, int y) } } - if (MovDelay[x][y]) /* wait some time before next movement */ + if (MovDelay[x][y]) // wait some time before next movement { MovDelay[x][y]--; @@ -7878,7 +7878,7 @@ static void StartMoving(int x, int 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); @@ -7886,9 +7886,9 @@ static void StartMoving(int x, int y) } } - /* 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) && @@ -7979,7 +7979,7 @@ static void StartMoving(int x, int y) 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]) @@ -7990,7 +7990,7 @@ static void StartMoving(int x, int 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; } @@ -8004,7 +8004,7 @@ static void StartMoving(int x, int y) int change_delay = 8; int graphic; - /* android is moving diagonally */ + // android is moving diagonally CreateField(x, y, EL_DIAGONAL_SHRINKING); @@ -8065,7 +8065,7 @@ static void StartMoving(int x, int y) 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)) @@ -8174,11 +8174,11 @@ static void StartMoving(int x, int y) 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); @@ -8189,16 +8189,16 @@ static void StartMoving(int x, int y) (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)) @@ -8232,23 +8232,23 @@ void ContinueMoving(int x, int y) 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; } @@ -8351,7 +8351,7 @@ void ContinueMoving(int x, int y) 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]; @@ -8367,22 +8367,22 @@ void ContinueMoving(int x, int 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); @@ -8400,8 +8400,8 @@ void ContinueMoving(int x, int y) 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 && @@ -8413,15 +8413,15 @@ void ContinueMoving(int x, int y) 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; @@ -8443,7 +8443,7 @@ void ContinueMoving(int x, int y) 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); @@ -8459,7 +8459,7 @@ void ContinueMoving(int x, int y) 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) || @@ -8477,12 +8477,12 @@ void ContinueMoving(int x, int y) 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); @@ -8669,7 +8669,7 @@ static void AmoebeWaechst(int x, int y) 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; @@ -8680,7 +8680,7 @@ static void AmoebeWaechst(int x, int y) } } - 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))) @@ -8705,7 +8705,7 @@ static void AmoebaDisappearing(int x, int 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; @@ -8713,7 +8713,7 @@ static void AmoebaDisappearing(int x, int y) 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))) @@ -8761,17 +8761,17 @@ static void AmoebeAbleger(int ax, int ay) 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]; @@ -8792,7 +8792,7 @@ static void AmoebeAbleger(int ax, int ay) 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; @@ -8819,7 +8819,7 @@ static void AmoebeAbleger(int ax, int ay) 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)) { @@ -8827,7 +8827,7 @@ static void AmoebeAbleger(int ax, int ay) 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); @@ -8839,7 +8839,7 @@ static void AmoebeAbleger(int ax, int 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]; @@ -8856,7 +8856,7 @@ static void AmoebeAbleger(int ax, int 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) @@ -8870,18 +8870,18 @@ static void AmoebeAbleger(int ax, int ay) 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); @@ -8907,10 +8907,10 @@ static void Life(int ax, int 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]) @@ -8955,7 +8955,7 @@ static void Life(int ax, int 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]) @@ -8968,7 +8968,7 @@ static void Life(int ax, int ay) } } 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]) { @@ -9028,7 +9028,7 @@ static void ActivateMagicBall(int bx, int by) 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; @@ -9069,7 +9069,7 @@ static void CheckExit(int x, int y) 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; @@ -9092,7 +9092,7 @@ static void CheckExitEM(int x, int y) 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; @@ -9115,7 +9115,7 @@ static void CheckExitSteel(int x, int y) 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; @@ -9138,7 +9138,7 @@ static void CheckExitSteelEM(int x, int y) 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; @@ -9159,7 +9159,7 @@ static void CheckExitSP(int x, int y) 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; @@ -9192,10 +9192,10 @@ static void DrawTwinkleOnField(int x, int y) 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]--; @@ -9215,10 +9215,10 @@ static void MauerWaechst(int x, int 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]--; @@ -9274,10 +9274,10 @@ static void MauerAbleger(int ax, int 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]) @@ -9382,10 +9382,10 @@ static void MauerAblegerStahl(int ax, int 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]) @@ -9573,7 +9573,7 @@ static void ChangeActiveTrap(int x, int y) { 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); } @@ -9615,7 +9615,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) if (!change->has_action) return; - /* ---------- determine action paramater values -------------------------- */ + // ---------- determine action paramater values ----------------------------- int level_time_value = (level.time > 0 ? TimeLeft : @@ -9712,7 +9712,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) action_arg == CA_ARG_PLAYER_ACTION ? 1 << GET_PLAYER_NR(action_element) : PLAYER_BITS_ANY); - /* ---------- execute action -------------------------------------------- */ + // ---------- execute action ----------------------------------------------- switch (action_type) { @@ -9721,7 +9721,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) return; } - /* ---------- level actions ------------------------------------------- */ + // ---------- level actions ---------------------------------------------- case CA_RESTART_LEVEL: { @@ -9743,7 +9743,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) 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; @@ -9793,17 +9793,17 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) 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; @@ -9956,7 +9956,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) 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); @@ -10067,7 +10067,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) break; } - /* ---------- CE actions ---------------------------------------------- */ + // ---------- CE actions ------------------------------------------------- case CA_SET_CE_VALUE: { @@ -10163,7 +10163,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) break; } - /* ---------- engine actions ------------------------------------------ */ + // ---------- engine actions --------------------------------------------- case CA_SET_ENGINE_SCAN_MODE: { @@ -10206,7 +10206,7 @@ static void CreateFieldExt(int x, int y, int element, boolean is_change) 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); @@ -10219,7 +10219,7 @@ static void CreateFieldExt(int x, int y, int element, boolean is_change) /* 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)) { @@ -10228,12 +10228,12 @@ static void CreateFieldExt(int x, int y, int element, boolean is_change) 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); @@ -10272,13 +10272,13 @@ static boolean ChangeElement(int x, int y, int element, int page) 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; @@ -10287,11 +10287,11 @@ static boolean ChangeElement(int x, int y, int element, int page) 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) { @@ -10321,12 +10321,12 @@ static boolean ChangeElement(int x, int y, int element, int page) 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; } @@ -10396,9 +10396,9 @@ static boolean ChangeElement(int x, int y, int element, int page) 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 } } @@ -10428,7 +10428,7 @@ static boolean ChangeElement(int x, int y, int element, int page) 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; @@ -10453,21 +10453,21 @@ static void HandleElementChange(int x, int y, int page) } #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: @@ -10523,7 +10523,7 @@ static void HandleElementChange(int x, int y, int page) ChangeDelay[x][y]--; - if (ChangeDelay[x][y] != 0) /* continue element change */ + if (ChangeDelay[x][y] != 0) // continue element change { if (change->can_change) { @@ -10536,9 +10536,9 @@ static void HandleElementChange(int x, int y, int page) 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; @@ -10546,15 +10546,15 @@ static void HandleElementChange(int x, int y, int page) 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; @@ -10693,7 +10693,7 @@ static boolean CheckElementChangeExt(int x, int y, 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) || @@ -10716,7 +10716,7 @@ static boolean CheckElementChangeExt(int x, int y, (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] && @@ -10732,7 +10732,7 @@ static boolean CheckElementChangeExt(int x, int y, 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 @@ -10821,7 +10821,7 @@ static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting) if (is_waiting) { - if (!last_waiting) /* not waiting -> waiting */ + if (!last_waiting) // not waiting -> waiting { player->is_waiting = TRUE; @@ -10854,7 +10854,7 @@ static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting) 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 && @@ -10940,7 +10940,7 @@ static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting) } } } - else if (last_waiting) /* waiting -> not waiting */ + else if (last_waiting) // waiting -> not waiting { player->is_waiting = FALSE; player->is_bored = FALSE; @@ -10998,7 +10998,7 @@ static void CheckSingleStepMode(struct PlayerInfo *player) !player->is_dropping_pressed) { TapeTogglePause(TAPE_TOGGLE_AUTOMATIC); - SnapField(player, 0, 0); /* stop snapping */ + SnapField(player, 0, 0); // stop snapping } } @@ -11039,7 +11039,7 @@ static byte PlayerActions(struct PlayerInfo *player, byte player_action) } 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); @@ -11048,7 +11048,7 @@ static byte PlayerActions(struct PlayerInfo *player, byte player_action) 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; @@ -11087,7 +11087,7 @@ static void CheckLevelSolved(void) { 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); @@ -11099,13 +11099,13 @@ static void CheckLevelSolved(void) 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); @@ -11114,13 +11114,13 @@ static void CheckLevelSolved(void) 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); @@ -11129,7 +11129,7 @@ static void CheckLevelSolved(void) AllPlayersGone = TRUE; } - if (game_mm.game_over) /* game lost */ + if (game_mm.game_over) // game lost AllPlayersGone = TRUE; } } @@ -11181,7 +11181,7 @@ static void CheckLevelTime(void) 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; } @@ -11204,21 +11204,21 @@ void AdvanceFrameAndPlayerCounters(int player_nr) { 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; @@ -11237,7 +11237,7 @@ void AdvanceFrameAndPlayerCounters(int player_nr) 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++; @@ -11279,7 +11279,7 @@ static void GameActionsExt(void) 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 ", @@ -11291,7 +11291,7 @@ static void GameActionsExt(void) 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); @@ -11309,7 +11309,7 @@ static void GameActionsExt(void) 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 = @@ -11322,14 +11322,14 @@ static void GameActionsExt(void) #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 @@ -11337,30 +11337,30 @@ static void GameActionsExt(void) 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; @@ -11369,7 +11369,7 @@ static void GameActionsExt(void) 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; @@ -11426,7 +11426,7 @@ static void GameActionsExt(void) 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); @@ -11504,7 +11504,7 @@ static void GameActionsExt(void) CheckLevelSolved(); CheckLevelTime(); - AdvanceFrameAndPlayerCounters(-1); /* advance counters for all players */ + AdvanceFrameAndPlayerCounters(-1); // advance counters for all players if (global.show_frames_per_second) { @@ -11514,18 +11514,18 @@ static void GameActionsExt(void) 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; } @@ -11613,14 +11613,14 @@ void GameActions_RND(void) { 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) { @@ -11630,7 +11630,7 @@ void GameActions_RND(void) } if (game.set_centered_player && - ScreenMovPos == 0) /* screen currently aligned at tile position */ + ScreenMovPos == 0) // screen currently aligned at tile position { int sx, sy; @@ -11666,7 +11666,7 @@ void GameActions_RND(void) 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; @@ -11700,7 +11700,7 @@ void GameActions_RND(void) { 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; } @@ -11714,7 +11714,7 @@ void GameActions_RND(void) 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]--; @@ -11730,7 +11730,7 @@ void GameActions_RND(void) RemoveField(x, y); TEST_DrawLevelField(x, y); - TestIfElementTouchesCustomElement(x, y); /* for empty space */ + TestIfElementTouchesCustomElement(x, y); // for empty space } } @@ -11808,7 +11808,7 @@ void GameActions_RND(void) 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])) { @@ -11894,7 +11894,7 @@ void GameActions_RND(void) 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) @@ -11913,7 +11913,7 @@ void GameActions_RND(void) { 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 || @@ -11932,7 +11932,7 @@ void GameActions_RND(void) } #if USE_NEW_AMOEBA_CODE - /* new experimental amoeba growth stuff */ + // new experimental amoeba growth stuff if (!(FrameCounter % 8)) { static unsigned int random = 1684108901; @@ -12112,7 +12112,7 @@ void GameActions_RND(void) 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); } @@ -12313,9 +12313,9 @@ boolean MovePlayerOneStep(struct PlayerInfo *player, 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; @@ -12340,7 +12340,7 @@ boolean MovePlayerOneStep(struct PlayerInfo *player, 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 @@ -12373,18 +12373,18 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) 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; @@ -12393,7 +12393,7 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) 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) @@ -12444,46 +12444,46 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) 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; @@ -12515,7 +12515,7 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) 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; @@ -12526,7 +12526,7 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) 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 } @@ -12542,10 +12542,10 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy) 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)) @@ -12569,7 +12569,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) 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) @@ -12580,27 +12580,27 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) 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)) @@ -12611,12 +12611,12 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) 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) { @@ -12624,10 +12624,10 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) 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; } } @@ -12642,7 +12642,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) 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); @@ -12652,7 +12652,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) 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); @@ -12691,7 +12691,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) /* 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); @@ -12718,7 +12718,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) 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; @@ -12741,7 +12741,7 @@ void ScrollScreen(struct PlayerInfo *player, int mode) 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; @@ -12774,11 +12774,11 @@ void TestIfPlayerTouchesCustomElement(int x, int y) }; 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] = { @@ -12787,7 +12787,7 @@ void TestIfPlayerTouchesCustomElement(int x, int y) 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++) @@ -12801,18 +12801,18 @@ void TestIfPlayerTouchesCustomElement(int x, int y) 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); @@ -12831,14 +12831,14 @@ void TestIfPlayerTouchesCustomElement(int x, int y) 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, @@ -12874,11 +12874,11 @@ void TestIfElementTouchesCustomElement(int x, int y) }; 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] = { @@ -12888,7 +12888,7 @@ void TestIfElementTouchesCustomElement(int x, int y) 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; @@ -12904,13 +12904,13 @@ void TestIfElementTouchesCustomElement(int x, int y) 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; } @@ -12925,11 +12925,11 @@ void TestIfElementTouchesCustomElement(int x, int y) 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++) @@ -12942,7 +12942,7 @@ void TestIfElementTouchesCustomElement(int x, int y) 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, @@ -13012,7 +13012,7 @@ void TestIfElementHitsCustomElement(int x, int y, int direction) } } - /* "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); } @@ -13109,7 +13109,7 @@ void TestIfBadThingHitsGoodThing(int bad_x, int bad_y, int bad_move_dir) 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++) @@ -13133,18 +13133,18 @@ void TestIfBadThingHitsGoodThing(int bad_x, int bad_y, int bad_move_dir) 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; @@ -13198,7 +13198,7 @@ void TestIfGoodThingGetsHitByBadThing(int bad_x, int bad_y, int bad_move_dir) 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); @@ -13207,7 +13207,7 @@ void TestIfGoodThingGetsHitByBadThing(int bad_x, int bad_y, int bad_move_dir) 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; @@ -13329,10 +13329,10 @@ void KillPlayer(struct PlayerInfo *player) 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; @@ -13348,7 +13348,7 @@ void KillPlayer(struct PlayerInfo *player) 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); @@ -13407,13 +13407,13 @@ void RemovePlayer(struct PlayerInfo *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; } @@ -13451,10 +13451,10 @@ static boolean checkDiagonalPushing(struct PlayerInfo *player, { 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; @@ -13495,7 +13495,7 @@ static int DigField(struct PlayerInfo *player, 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) { @@ -13503,10 +13503,10 @@ static int DigField(struct PlayerInfo *player, 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; @@ -13518,16 +13518,16 @@ static int DigField(struct PlayerInfo *player, 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) { @@ -13554,7 +13554,7 @@ static int DigField(struct PlayerInfo *player, 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)) @@ -13571,7 +13571,7 @@ static int DigField(struct PlayerInfo *player, 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; @@ -13580,7 +13580,7 @@ static int DigField(struct PlayerInfo *player, 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)) @@ -13612,14 +13612,14 @@ static int DigField(struct PlayerInfo *player, 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 @@ -13629,9 +13629,9 @@ static int DigField(struct PlayerInfo *player, 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)) @@ -13692,12 +13692,12 @@ static int DigField(struct PlayerInfo *player, 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); } @@ -13724,7 +13724,7 @@ static int DigField(struct PlayerInfo *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); @@ -13790,8 +13790,8 @@ static int DigField(struct PlayerInfo *player, { player->num_white_keys++; - /* display white keys? */ - /* DrawGameDoorValues(); */ + // display white keys? + // DrawGameDoorValues(); } else if (IS_ENVELOPE(element)) { @@ -13810,7 +13810,7 @@ static int DigField(struct PlayerInfo *player, RedrawAllInvisibleElementsForMagnifier(); } else if (IS_DROPPABLE(element) || - IS_THROWABLE(element)) /* can be collected and dropped */ + IS_THROWABLE(element)) // can be collected and dropped { int i; @@ -13848,7 +13848,7 @@ static int DigField(struct PlayerInfo *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); @@ -13879,7 +13879,7 @@ static int DigField(struct PlayerInfo *player, 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; @@ -13914,14 +13914,14 @@ static int DigField(struct PlayerInfo *player, 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; @@ -13987,9 +13987,9 @@ static int DigField(struct PlayerInfo *player, 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, @@ -14171,9 +14171,9 @@ static int DigField(struct PlayerInfo *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; @@ -14193,7 +14193,7 @@ static boolean DigFieldByCE(int x, int y, int digging_element) 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)) @@ -14216,7 +14216,7 @@ static boolean DigFieldByCE(int x, int y, int digging_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); @@ -14224,7 +14224,7 @@ static boolean DigFieldByCE(int x, int y, int digging_element) 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; @@ -14268,7 +14268,7 @@ static boolean SnapField(struct PlayerInfo *player, int dx, int dy) 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; @@ -14298,7 +14298,7 @@ static boolean SnapField(struct PlayerInfo *player, int dx, int dy) 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); @@ -14330,34 +14330,34 @@ static boolean DropElement(struct PlayerInfo *player) 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); @@ -14387,8 +14387,8 @@ static boolean DropElement(struct PlayerInfo *player) 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); @@ -14398,7 +14398,7 @@ static boolean DropElement(struct PlayerInfo *player) TestIfElementTouchesCustomElement(dropx, dropy); } - else /* player is dropping a dyna bomb */ + else // player is dropping a dyna bomb { player->dynabombs_left--; @@ -14411,10 +14411,10 @@ static boolean DropElement(struct PlayerInfo *player) 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) @@ -14422,9 +14422,9 @@ static boolean DropElement(struct PlayerInfo *player) 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; } @@ -14440,9 +14440,9 @@ static boolean DropElement(struct PlayerInfo *player) return TRUE; } -/* ------------------------------------------------------------------------- */ -/* game sound playing functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// game sound playing functions +// ---------------------------------------------------------------------------- static int *loop_sound_frame = NULL; static int *loop_sound_volume = NULL; @@ -14553,9 +14553,9 @@ static void StopLevelSoundActionIfLoop(int x, int y, int action) 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) @@ -14663,7 +14663,7 @@ void PlayLevelSound_EM(int xx, int yy, int element_em, int sample) break; case SAMPLE_squash: - /* !!! CHECK THIS !!! */ + // !!! CHECK THIS !!! #if 1 PlayLevelSoundElementAction(x, y, element, ACTION_BREAKING); #else @@ -14897,7 +14897,7 @@ void RequestQuitGameExt(boolean skip_request, boolean quick_quit, char *message) { 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); @@ -14913,7 +14913,7 @@ void RequestQuitGameExt(boolean skip_request, boolean quick_quit, char *message) DrawMainMenu(); } } - else /* continue playing the game */ + else // continue playing the game { if (tape.playing && tape.deactivate_display) TapeDeactivateDisplayOff(TRUE); @@ -14960,7 +14960,7 @@ void CheckGameOver(void) 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; @@ -14989,7 +14989,7 @@ void CheckGameOver(void) 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; } @@ -15004,7 +15004,7 @@ boolean checkGameFailed(void) 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); } @@ -15014,9 +15014,9 @@ boolean checkGameEnded(void) } -/* ------------------------------------------------------------------------- */ -/* random generator functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// random generator functions +// ---------------------------------------------------------------------------- unsigned int InitEngineRandom_RND(int seed) { @@ -15038,19 +15038,19 @@ unsigned int RND(int max) } -/* ------------------------------------------------------------------------- */ -/* 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]; }; @@ -15161,7 +15161,7 @@ static ListNode *SaveEngineSnapshotBuffers(void) { 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(); @@ -15172,7 +15172,7 @@ static ListNode *SaveEngineSnapshotBuffers(void) 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)); @@ -15183,7 +15183,7 @@ static ListNode *SaveEngineSnapshotBuffers(void) 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)); @@ -15270,10 +15270,10 @@ void SaveEngineSnapshotSingle(void) { 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; } @@ -15302,7 +15302,7 @@ void SaveEngineSnapshotToList(void) ListNode *buffers = SaveEngineSnapshotBuffers(); - /* finally save all snapshot buffers to snapshot list */ + // finally save all snapshot buffers to snapshot list SaveSnapshotToList(buffers); } @@ -15315,7 +15315,7 @@ void SaveEngineSnapshotToListInitial(void) 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(); @@ -15360,7 +15360,7 @@ boolean CheckEngineSnapshotList(void) } -/* ---------- new game button stuff ---------------------------------------- */ +// ---------- new game button stuff ------------------------------------------- static struct { diff --git a/src/game.h b/src/game.h index bd26e264..553ec4b7 100644 --- a/src/game.h +++ b/src/game.h @@ -12,8 +12,8 @@ #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 @@ -101,7 +101,7 @@ struct GamePanelInfo 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; }; @@ -144,11 +144,11 @@ struct GameSnapshotInfo 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; @@ -157,25 +157,25 @@ struct GameInfo 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; @@ -188,68 +188,68 @@ struct GameInfo 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; @@ -257,12 +257,12 @@ struct PlayerInfo 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; @@ -304,7 +304,7 @@ struct PlayerInfo 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; diff --git a/src/game_em/export.h b/src/game_em/export.h index ae5f9a1b..90957d69 100644 --- a/src/game_em/export.h +++ b/src/game_em/export.h @@ -1,13 +1,13 @@ #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 @@ -542,9 +542,9 @@ enum }; -/* ------------------------------------------------------------------------- */ -/* data structure definitions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// data structure definitions +// ---------------------------------------------------------------------------- struct LEVEL { @@ -723,9 +723,9 @@ struct EngineSnapshotInfo_EM }; -/* ------------------------------------------------------------------------- */ -/* exported functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// exported functions +// ---------------------------------------------------------------------------- extern struct GlobalInfo_EM global_em_info; extern struct GameInfo_EM game_em; @@ -762,4 +762,4 @@ boolean checkIfAllPlayersFitToScreen(void); void tab_generate(void); void tab_generate_graphics_info_em(void); -#endif /* EXPORT_H */ +#endif // EXPORT_H diff --git a/src/game_em/main_em.h b/src/game_em/main_em.h index 6c965315..4b77e935 100644 --- a/src/game_em/main_em.h +++ b/src/game_em/main_em.h @@ -1,31 +1,31 @@ #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 @@ -68,9 +68,9 @@ extern int SX, SY; #define PLAY_ELEMENT_SOUND FALSE -/* ------------------------------------------------------------------------- */ -/* macro function definitions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// macro function definitions +// ---------------------------------------------------------------------------- #define ROUNDED_DIVIDE(x, y) (((x) + (y) - 1) / (y)) @@ -83,13 +83,13 @@ extern int SX, SY; #define DISPLAY_TIME(x) ROUNDED_DIVIDE(x, FRAMES_PER_SECOND) -/* ------------------------------------------------------------------------- */ -/* data structure definitions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// data structure definitions +// ---------------------------------------------------------------------------- -/* ------------------------------------------------------------------------- */ -/* exported variables */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// exported variables +// ---------------------------------------------------------------------------- extern unsigned int RandomEM; @@ -127,8 +127,8 @@ extern Bitmap *ttlBitmap; extern Bitmap *botBitmap; -/* ------------------------------------------------------------------------- */ -/* exported functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// exported functions +// ---------------------------------------------------------------------------- -#endif /* MAIN_EM_H */ +#endif // MAIN_EM_H diff --git a/src/game_mm/export.h b/src/game_mm/export.h index f9b40116..37c3eec1 100644 --- a/src/game_mm/export.h +++ b/src/game_mm/export.h @@ -1,13 +1,13 @@ #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 @@ -46,18 +46,18 @@ #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 { @@ -156,9 +156,9 @@ struct GameInfo_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; @@ -208,9 +208,9 @@ struct EngineSnapshotInfo_MM }; -/* ------------------------------------------------------------------------- */ -/* exported functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// exported functions +// ---------------------------------------------------------------------------- extern struct GlobalInfo_MM global_mm_info; extern struct GameInfo_MM game_mm; @@ -252,4 +252,4 @@ void SaveEngineSnapshotValues_MM(ListNode **); int getButtonFromTouchPosition(int, int, int, int); -#endif /* GAME_MM_EXPORT_H */ +#endif // GAME_MM_EXPORT_H diff --git a/src/game_mm/game_mm.h b/src/game_mm/game_mm.h index eab1a757..45327aaf 100644 --- a/src/game_mm/game_mm.h +++ b/src/game_mm/game_mm.h @@ -16,4 +16,4 @@ #include "export.h" -#endif /* GAME_MM_H */ +#endif // GAME_MM_H diff --git a/src/game_mm/main_mm.h b/src/game_mm/main_mm.h index 4eb98fc7..f54c62ec 100644 --- a/src/game_mm/main_mm.h +++ b/src/game_mm/main_mm.h @@ -1,31 +1,31 @@ #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; @@ -40,7 +40,7 @@ extern int SCR_FIELDX, SCR_FIELDY; #define MAX_BUF_XSIZE SCR_FIELDX #define MAX_BUF_YSIZE SCR_FIELDY -/* often used screen positions */ +// often used screen positions extern int SX, SY; @@ -55,13 +55,13 @@ extern int REAL_SX, REAL_SY; #define FULL_SYSIZE (2 + SYSIZE + 2) -/* ------------------------------------------------------------------------- */ -/* data structure definitions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// data structure definitions +// ---------------------------------------------------------------------------- -/* ------------------------------------------------------------------------- */ -/* exported variables */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// exported variables +// ---------------------------------------------------------------------------- extern struct LevelInfo_MM native_mm_level; @@ -73,8 +73,8 @@ extern int GfxGraphic[MM_MAX_PLAYFIELD_WIDTH][MM_MAX_PLAYFIELD_HEIGHT]; extern int GfxFrame[MM_MAX_PLAYFIELD_WIDTH][MM_MAX_PLAYFIELD_HEIGHT]; -/* ------------------------------------------------------------------------- */ -/* exported functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// exported functions +// ---------------------------------------------------------------------------- -#endif /* MAIN_MM_H */ +#endif // MAIN_MM_H diff --git a/src/game_mm/mm_files.c b/src/game_mm/mm_files.c index dee9445a..b2899f01 100644 --- a/src/game_mm/mm_files.c +++ b/src/game_mm/mm_files.c @@ -18,14 +18,14 @@ #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" @@ -40,9 +40,9 @@ int default_score[LEVEL_SCORE_ELEMENTS] = }; -/* ========================================================================= */ -/* level file functions */ -/* ========================================================================= */ +// ============================================================================ +// level file functions +// ============================================================================ static void ReadChunk_MM_VERS(File *file, int *file_version, int *game_version) { @@ -52,12 +52,12 @@ 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, @@ -80,12 +80,12 @@ static void WriteChunk_MM_VERS(FILE *file, int file_version, int game_version) 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) @@ -95,7 +95,7 @@ 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; @@ -264,7 +264,7 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) { NULL, 0, NULL } }; - /* always start with reliable default values */ + // always start with reliable default values setLevelInfoToDefaults_MM(); if (!(file = openFile(filename, MODE_READ))) @@ -278,7 +278,7 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) 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) @@ -290,7 +290,7 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) 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); @@ -342,7 +342,7 @@ boolean LoadNativeLevel_MM(char *filename, boolean level_info_only) } 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); @@ -424,7 +424,7 @@ void SaveNativeLevel_MM(char *filename) 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++) diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index 8e45cfb8..e4f4ba1b 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -17,19 +17,19 @@ #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 @@ -41,7 +41,7 @@ #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) @@ -56,20 +56,20 @@ #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) @@ -90,7 +90,7 @@ 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); @@ -100,23 +100,23 @@ static void InitMovingField_MM(int, int, 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] = { { @@ -318,7 +318,7 @@ static int get_opposite_angle(int angle) { 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; } @@ -326,7 +326,7 @@ static int get_mirrored_angle(int laser_angle, int mirror_angle) { 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; } @@ -377,7 +377,7 @@ static void CheckExitMM(void) { 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; @@ -386,7 +386,7 @@ static void CheckExitMM(void) } 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; @@ -478,7 +478,7 @@ static void InitField(int x, int y, boolean init_game) { 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) || @@ -521,7 +521,7 @@ static void InitCycleElements_RotateSingleStep(void) { 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++) @@ -572,7 +572,7 @@ static void InitLaser(void) 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, @@ -586,13 +586,13 @@ void InitGameEngine_MM(void) 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; @@ -610,7 +610,7 @@ void InitGameEngine_MM(void) 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; @@ -676,7 +676,7 @@ void InitGameActions_MM(void) 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 @@ -696,7 +696,7 @@ void InitGameActions_MM(void) #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 @@ -814,13 +814,13 @@ static int ScanPixel(void) 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) { @@ -836,8 +836,8 @@ static int ScanPixel(void) 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)) @@ -873,7 +873,7 @@ static int ScanPixel(void) 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; } @@ -887,7 +887,7 @@ void ScanLaser(void) 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; @@ -920,7 +920,7 @@ void ScanLaser(void) 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; @@ -952,7 +952,7 @@ void ScanLaser(void) { /* 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; } @@ -1100,7 +1100,7 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode) } #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; @@ -1108,13 +1108,13 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode) 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++) @@ -1128,7 +1128,7 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode) } } - /* 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; @@ -1168,7 +1168,7 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode) 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)) @@ -1176,14 +1176,14 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode) } 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; @@ -1219,7 +1219,7 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode) 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; @@ -1229,7 +1229,7 @@ static void DrawLaserExt(int start_edge, int num_edges, int mode) (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--; } @@ -1268,7 +1268,7 @@ void DrawLaser(int start_edge, int mode) 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]) { @@ -1277,7 +1277,7 @@ void DrawLaser(int start_edge, int mode) 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; @@ -1295,7 +1295,7 @@ void DrawLaser(int start_edge, int mode) 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); } @@ -1305,7 +1305,7 @@ void DrawLaser(int start_edge, int mode) 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]; @@ -1330,7 +1330,7 @@ void DrawLaser(int start_edge, int mode) 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); } } @@ -1368,10 +1368,10 @@ boolean HitElement(int element, int hit_mask) 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; @@ -1483,7 +1483,7 @@ boolean HitElement(int element, int hit_mask) 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; @@ -1492,7 +1492,7 @@ boolean HitElement(int element, int hit_mask) 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) { @@ -1672,7 +1672,7 @@ boolean HitElement(int element, int hit_mask) 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); @@ -1682,7 +1682,7 @@ boolean HitOnlyAnEdge(int element, int 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; @@ -1701,7 +1701,7 @@ boolean HitOnlyAnEdge(int element, int hit_mask) dx = -1; dy = +1; } - else /* (hit_mask == HIT_MASK_BOTTOMRIGHT) */ + else // (hit_mask == HIT_MASK_BOTTOMRIGHT) { dx = +1; dy = +1; @@ -1749,7 +1749,7 @@ boolean HitPolarizer(int element, int hit_mask) 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; @@ -1795,7 +1795,7 @@ boolean HitPolarizer(int element, int hit_mask) { return HitReflectingWalls(element, hit_mask); } - else /* IS_GRID_WOOD */ + else // IS_GRID_WOOD { return HitAbsorbingWalls(element, hit_mask); } @@ -1984,7 +1984,7 @@ boolean HitLaserDestination(int element, int 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 || @@ -1998,7 +1998,7 @@ boolean HitReflectingWalls(int element, int hit_mask) 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) @@ -2007,7 +2007,7 @@ boolean HitReflectingWalls(int element, int hit_mask) 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, @@ -2046,7 +2046,7 @@ boolean HitReflectingWalls(int element, int hit_mask) 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); @@ -2073,7 +2073,7 @@ boolean HitReflectingWalls(int element, int hit_mask) } } - /* 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) && @@ -2108,7 +2108,7 @@ boolean HitReflectingWalls(int element, int hit_mask) } } - /* 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) && @@ -2149,7 +2149,7 @@ boolean HitReflectingWalls(int element, int hit_mask) } } - /* 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) && @@ -2157,7 +2157,7 @@ boolean HitReflectingWalls(int element, int hit_mask) (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); @@ -2225,10 +2225,10 @@ boolean HitAbsorbingWalls(int element, int hit_mask) { 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); @@ -2290,10 +2290,10 @@ static void OpenExit(int x, int y) { 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; @@ -2315,10 +2315,10 @@ static void OpenSurpriseBall(int x, int y) { 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]--; @@ -2353,10 +2353,10 @@ static void MeltIce(int x, int 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]; @@ -2402,10 +2402,10 @@ static void GrowAmoeba(int x, int 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]; @@ -2437,13 +2437,13 @@ static void Explode_MM(int x, int y, int phase, int mode) 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); @@ -2650,7 +2650,7 @@ static void StartMoving_MM(int x, int 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]--; @@ -2658,9 +2658,9 @@ static void StartMoving_MM(int x, int 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]) && @@ -2674,7 +2674,7 @@ static void StartMoving_MM(int x, int y) 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); @@ -2700,7 +2700,7 @@ static void ContinueMoving_MM(int x, int 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; @@ -2730,7 +2730,7 @@ static void ContinueMoving_MM(int x, int y) } } } - else /* still moving on */ + else // still moving on { DrawField_MM(x, y); } @@ -2748,7 +2748,7 @@ boolean ClickElement(int x, int y, int button) if (button == -1) { - /* initialize static variables */ + // initialize static variables click_delay = 0; click_delay_value = CLICK_DELAY; new_button = TRUE; @@ -2756,7 +2756,7 @@ boolean ClickElement(int x, int y, int button) 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; @@ -2765,7 +2765,7 @@ boolean ClickElement(int x, int y, int button) 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; @@ -2774,7 +2774,7 @@ boolean ClickElement(int x, int y, int button) 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)) @@ -2868,7 +2868,7 @@ void RotateMirror(int x, int y, int button) { if (button == MB_RELEASED) { - /* release eventually hold auto-rotating mirror */ + // release eventually hold auto-rotating mirror hold_x = -1; hold_y = -1; @@ -2972,7 +2972,7 @@ static void AutoRotateMirrors(void) { 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; @@ -3121,9 +3121,9 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) 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; @@ -3411,7 +3411,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) 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; @@ -3473,7 +3473,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) 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; @@ -3930,7 +3930,7 @@ void GameWon_MM(void) 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, @@ -3974,9 +3974,9 @@ void GameWon_MM(void) } 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) { @@ -4015,7 +4015,7 @@ int NewHiScore_MM(void) { 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) { @@ -4025,7 +4025,7 @@ int NewHiScore_MM(void) 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 @@ -4050,7 +4050,7 @@ int NewHiScore_MM(void) #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 } @@ -4236,9 +4236,9 @@ void RaiseScoreElement_MM(int element) } -/* ------------------------------------------------------------------------- */ -/* Mirror Magic game engine snapshot handling functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// Mirror Magic game engine snapshot handling functions +// ---------------------------------------------------------------------------- void SaveEngineSnapshotValues_MM(ListNode **buffers) { @@ -4285,7 +4285,7 @@ void LoadEngineSnapshotValues_MM(void) { 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; diff --git a/src/game_mm/mm_main.c b/src/game_mm/mm_main.c index 7eafc2f5..6ead97a6 100644 --- a/src/game_mm/mm_main.c +++ b/src/game_mm/mm_main.c @@ -100,7 +100,7 @@ short Sign[16] = char *element_info_mm[] = { - "empty space", /* 0 */ + "empty space", // 0 "mirror (0\xb0)", "mirror (11.25\xb0)", "mirror (22.5\xb0)", @@ -110,7 +110,7 @@ char *element_info_mm[] = "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)", @@ -120,7 +120,7 @@ char *element_info_mm[] = "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)", @@ -130,7 +130,7 @@ char *element_info_mm[] = "opening exit", "open exit", "magic kettle", - "bomb", /* 30 */ + "bomb", // 30 "prism", "steel wall", "steel wall", @@ -140,7 +140,7 @@ char *element_info_mm[] = "steel wall", "steel wall", "steel wall", - "steel wall", /* 40 */ + "steel wall", // 40 "steel wall", "steel wall", "steel wall", @@ -150,7 +150,7 @@ char *element_info_mm[] = "steel wall", "wooden wall", "wooden wall", - "wooden wall", /* 50 */ + "wooden wall", // 50 "wooden wall", "wooden wall", "wooden wall", @@ -160,7 +160,7 @@ char *element_info_mm[] = "wooden wall", "wooden wall", "wooden wall", - "wooden wall", /* 60 */ + "wooden wall", // 60 "wooden wall", "wooden wall", "wooden wall", @@ -170,7 +170,7 @@ char *element_info_mm[] = "ice wall", "ice wall", "ice wall", - "ice wall", /* 70 */ + "ice wall", // 70 "ice wall", "ice wall", "ice wall", @@ -180,7 +180,7 @@ char *element_info_mm[] = "ice wall", "ice wall", "ice wall", - "amoeba wall", /* 80 */ + "amoeba wall", // 80 "amoeba wall", "amoeba wall", "amoeba wall", @@ -190,7 +190,7 @@ char *element_info_mm[] = "amoeba wall", "amoeba wall", "amoeba wall", - "amoeba wall", /* 90 */ + "amoeba wall", // 90 "amoeba wall", "amoeba wall", "amoeba wall", @@ -200,7 +200,7 @@ char *element_info_mm[] = "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)", @@ -210,7 +210,7 @@ char *element_info_mm[] = "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)", @@ -220,7 +220,7 @@ char *element_info_mm[] = "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)", @@ -230,7 +230,7 @@ char *element_info_mm[] = "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)", @@ -240,7 +240,7 @@ char *element_info_mm[] = "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", @@ -250,7 +250,7 @@ char *element_info_mm[] = "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)", @@ -260,7 +260,7 @@ char *element_info_mm[] = "unused", "unused", "unused", - "letter ' '", /* 160 */ + "letter ' '", // 160 "letter '!'", "letter '\"'", "letter '#'", @@ -270,7 +270,7 @@ char *element_info_mm[] = "letter '''", "letter '('", "letter ')'", - "letter '*'", /* 170 */ + "letter '*'", // 170 "letter '+'", "letter ','", "letter '-'", @@ -280,7 +280,7 @@ char *element_info_mm[] = "letter '1'", "letter '2'", "letter '3'", - "letter '4'", /* 180 */ + "letter '4'", // 180 "letter '5'", "letter '6'", "letter '7'", @@ -290,7 +290,7 @@ char *element_info_mm[] = "letter ';'", "letter '<'", "letter '='", - "letter '>'", /* 190 */ + "letter '>'", // 190 "letter '?'", "letter '@'", "letter 'A'", @@ -300,7 +300,7 @@ char *element_info_mm[] = "letter 'E'", "letter 'F'", "letter 'G'", - "letter 'H'", /* 200 */ + "letter 'H'", // 200 "letter 'I'", "letter 'J'", "letter 'K'", @@ -310,7 +310,7 @@ char *element_info_mm[] = "letter 'O'", "letter 'P'", "letter 'Q'", - "letter 'R'", /* 210 */ + "letter 'R'", // 210 "letter 'S'", "letter 'T'", "letter 'U'", @@ -320,7 +320,7 @@ char *element_info_mm[] = "letter 'Y'", "letter 'Z'", "letter '\xc4'", - "letter '\xd6'", /* 220 */ + "letter '\xd6'", // 220 "letter '\xdc'", "letter '^'", "letter ''", @@ -330,7 +330,7 @@ char *element_info_mm[] = "letter ''", "letter ''", "letter ''", - "letter ''", /* 230 */ + "letter ''", // 230 "letter ''", "letter ''", "letter ''", @@ -340,7 +340,7 @@ char *element_info_mm[] = "letter ''", "letter ''", "letter ''", - "mirror (0\xb0)", /* 240 */ + "mirror (0\xb0)", // 240 "mirror (11.25\xb0)", "mirror (22.5\xb0)", "mirror (33.75\xb0)", @@ -350,7 +350,7 @@ char *element_info_mm[] = "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)", @@ -360,7 +360,7 @@ char *element_info_mm[] = "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)", @@ -370,7 +370,7 @@ char *element_info_mm[] = "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", @@ -380,7 +380,7 @@ char *element_info_mm[] = "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", @@ -390,7 +390,7 @@ char *element_info_mm[] = "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", @@ -400,7 +400,7 @@ char *element_info_mm[] = "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", @@ -410,7 +410,7 @@ char *element_info_mm[] = "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)", @@ -420,7 +420,7 @@ char *element_info_mm[] = "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)", @@ -430,7 +430,7 @@ char *element_info_mm[] = "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)", @@ -440,7 +440,7 @@ char *element_info_mm[] = "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)", @@ -450,7 +450,7 @@ char *element_info_mm[] = "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)", @@ -460,7 +460,7 @@ char *element_info_mm[] = "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)", @@ -470,7 +470,7 @@ char *element_info_mm[] = "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)", @@ -480,7 +480,7 @@ char *element_info_mm[] = "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)", @@ -490,7 +490,7 @@ char *element_info_mm[] = "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)", @@ -500,7 +500,7 @@ char *element_info_mm[] = "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)", @@ -510,7 +510,7 @@ char *element_info_mm[] = "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)", @@ -520,7 +520,7 @@ char *element_info_mm[] = "blue teleporter (292.5\xb0)", "blue teleporter (315\xb0)", "blue teleporter (337.5\xb0)", - "unknown", /* 420 */ + "unknown", // 420 /* "-------------------------------", diff --git a/src/game_mm/mm_main.h b/src/game_mm/mm_main.h index 70758c24..38cb0e79 100644 --- a/src/game_mm/mm_main.h +++ b/src/game_mm/mm_main.h @@ -33,7 +33,7 @@ #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) @@ -135,7 +135,7 @@ #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 @@ -143,23 +143,23 @@ #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 @@ -177,7 +177,7 @@ #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 @@ -268,7 +268,7 @@ extern int num_bg_loops; 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 @@ -323,7 +323,7 @@ extern int num_element_info; #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 @@ -337,7 +337,7 @@ extern int num_element_info; ** 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 @@ -518,7 +518,7 @@ extern int num_element_info; #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 @@ -541,25 +541,25 @@ extern int num_element_info; #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 @@ -654,7 +654,7 @@ extern int num_element_info; #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 @@ -670,7 +670,7 @@ extern int num_element_info; #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 @@ -683,12 +683,12 @@ extern int num_element_info; #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 @@ -721,9 +721,9 @@ extern int num_element_info; #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) @@ -743,7 +743,7 @@ extern int num_element_info; #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) @@ -762,7 +762,7 @@ extern int num_element_info; #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 @@ -778,10 +778,10 @@ extern int num_element_info; #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) @@ -791,10 +791,10 @@ extern int num_element_info; #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) @@ -807,7 +807,7 @@ extern int num_element_info; #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 @@ -816,7 +816,7 @@ extern int num_element_info; #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 @@ -825,10 +825,10 @@ extern int num_element_info; #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 @@ -837,13 +837,13 @@ extern int num_element_info; #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 @@ -856,7 +856,7 @@ extern int num_element_info; #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) @@ -888,7 +888,7 @@ extern int num_element_info; #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) @@ -1004,7 +1004,7 @@ extern int num_element_info; #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 @@ -1028,7 +1028,7 @@ extern int num_element_info; #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 @@ -1083,13 +1083,13 @@ extern int num_element_info; #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 @@ -1099,18 +1099,18 @@ extern int num_element_info; #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 @@ -1122,7 +1122,7 @@ extern int num_element_info; #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) @@ -1130,12 +1130,12 @@ extern int num_element_info; (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 @@ -1146,12 +1146,12 @@ extern int num_element_info; #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 @@ -1174,7 +1174,7 @@ extern int num_element_info; #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) @@ -1197,8 +1197,8 @@ extern int num_element_info; PROGRAM_VERSION_MINOR, \ PROGRAM_VERSION_PATCH) -/* sound control */ +// sound control #define ST(x) (((x) - 8) * 16) -#endif /* MM_MAIN_H */ +#endif // MM_MAIN_H diff --git a/src/game_mm/mm_tools.c b/src/game_mm/mm_tools.c index 47c4af12..b4decbac 100644 --- a/src/game_mm/mm_tools.c +++ b/src/game_mm/mm_tools.c @@ -159,35 +159,35 @@ void DrawGraphicShifted_MM(int x,int y, int dx,int dy, int graphic, 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; @@ -195,13 +195,13 @@ void DrawGraphicShifted_MM(int x,int y, int dx,int dy, int graphic, 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; @@ -209,19 +209,19 @@ void DrawGraphicShifted_MM(int x,int y, int dx,int dy, int graphic, } 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)); } diff --git a/src/game_mm/mm_tools.h b/src/game_mm/mm_tools.h index d491c427..7b3df48c 100644 --- a/src/game_mm/mm_tools.h +++ b/src/game_mm/mm_tools.h @@ -17,18 +17,18 @@ #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) @@ -42,7 +42,7 @@ #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) @@ -52,7 +52,7 @@ #define REQUEST_WAIT_FOR (REQ_ASK | REQ_CONFIRM) -/* font types */ +// font types #define FS_SMALL 0 #define FS_BIG 1 #define FS_MEDIUM 2 diff --git a/src/game_sp/ASM.h b/src/game_sp/ASM.h index 88b48a99..56f6c8e7 100644 --- a/src/game_sp/ASM.h +++ b/src/game_sp/ASM.h @@ -15,4 +15,4 @@ int HighByte(int); int SgnHighByte(int); int ByteToInt(byte); -#endif /* ASM_H */ +#endif // ASM_H diff --git a/src/game_sp/BugsTerminals.c b/src/game_sp/BugsTerminals.c index 31bd9457..cf808c09 100644 --- a/src/game_sp/BugsTerminals.c +++ b/src/game_sp/BugsTerminals.c @@ -75,26 +75,26 @@ void subAnimateTerminals(int si) 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; diff --git a/src/game_sp/BugsTerminals.h b/src/game_sp/BugsTerminals.h index 857d0f5d..80c044a2 100644 --- a/src/game_sp/BugsTerminals.h +++ b/src/game_sp/BugsTerminals.h @@ -16,4 +16,4 @@ void subAnimateTerminals(int si); void subRandomize(void); int subGetRandomNumber(void); -#endif /* BUGSTERMINALS_H */ +#endif // BUGSTERMINALS_H diff --git a/src/game_sp/DDScrollBuffer.c b/src/game_sp/DDScrollBuffer.c index 62257d03..0db7e7fd 100644 --- a/src/game_sp/DDScrollBuffer.c +++ b/src/game_sp/DDScrollBuffer.c @@ -17,7 +17,7 @@ int getFieldbufferOffsetX_SP(void) { 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) @@ -32,7 +32,7 @@ int getFieldbufferOffsetY_SP(void) { 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) @@ -130,7 +130,7 @@ static void ScrollPlayfieldIfNeededExt(boolean reset) 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 || @@ -198,7 +198,7 @@ void UpdatePlayfield(boolean force_redraw) 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; @@ -240,7 +240,7 @@ void UpdatePlayfield(boolean force_redraw) 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(); diff --git a/src/game_sp/DDScrollBuffer.h b/src/game_sp/DDScrollBuffer.h index be011bb1..8dd904e2 100644 --- a/src/game_sp/DDScrollBuffer.h +++ b/src/game_sp/DDScrollBuffer.h @@ -20,4 +20,4 @@ void DDScrollBuffer_ScrollTo(int X, int Y); 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 diff --git a/src/game_sp/DDSpriteBuffer.c b/src/game_sp/DDSpriteBuffer.c index e4be4164..9865b930 100644 --- a/src/game_sp/DDSpriteBuffer.c +++ b/src/game_sp/DDSpriteBuffer.c @@ -19,7 +19,7 @@ static void Blt(int pX, int pY, Bitmap *bitmap, int SpriteX, int SpriteY) 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; diff --git a/src/game_sp/DDSpriteBuffer.h b/src/game_sp/DDSpriteBuffer.h index 8424ef9d..a8cec312 100644 --- a/src/game_sp/DDSpriteBuffer.h +++ b/src/game_sp/DDSpriteBuffer.h @@ -10,4 +10,4 @@ void DDSpriteBuffer_BltImg(int pX, int pY, int graphic, int sync_frame); -#endif /* DDSPRITEBUFFER_H */ +#endif // DDSPRITEBUFFER_H diff --git a/src/game_sp/Display.h b/src/game_sp/Display.h index adff5e8b..8b8d9f42 100644 --- a/src/game_sp/Display.h +++ b/src/game_sp/Display.h @@ -21,4 +21,4 @@ void ScrollTo(int, int); void ScrollTowards(int, int); void SoftScrollTo(int, int, int, int); -#endif /* DISPLAY_H */ +#endif // DISPLAY_H diff --git a/src/game_sp/DoGameStuff.c b/src/game_sp/DoGameStuff.c index 2ba35823..fbea5551 100644 --- a/src/game_sp/DoGameStuff.c +++ b/src/game_sp/DoGameStuff.c @@ -78,7 +78,7 @@ void subDoGameStuff(void) 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: } diff --git a/src/game_sp/DoGameStuff.h b/src/game_sp/DoGameStuff.h index a151f1cb..9f1ce493 100644 --- a/src/game_sp/DoGameStuff.h +++ b/src/game_sp/DoGameStuff.h @@ -12,4 +12,4 @@ extern byte AnimationSubTable[SP_MAX_PLAYFIELD_SIZE]; void subDoGameStuff(void); -#endif /* DOGAMESTUFF_H */ +#endif // DOGAMESTUFF_H diff --git a/src/game_sp/Electrons.h b/src/game_sp/Electrons.h index 4e35737d..cc81d4c0 100644 --- a/src/game_sp/Electrons.h +++ b/src/game_sp/Electrons.h @@ -23,4 +23,4 @@ void subElectronFromRight(int, int); void subElectronTurnLeft(int, int); void subElectronTurnRight(int, int); -#endif /* ELECTRONS_H */ +#endif // ELECTRONS_H diff --git a/src/game_sp/Explosions.h b/src/game_sp/Explosions.h index 4017d1c8..12c6c19c 100644 --- a/src/game_sp/Explosions.h +++ b/src/game_sp/Explosions.h @@ -14,4 +14,4 @@ void subClearFieldDueToExplosion(int); void subFollowUpExplosions(void); void subRedDiskReleaseExplosion(void); -#endif /* EXPLOSIONS_H */ +#endif // EXPLOSIONS_H diff --git a/src/game_sp/Globals.c b/src/game_sp/Globals.c index d3813f00..a73a6ffd 100644 --- a/src/game_sp/Globals.c +++ b/src/game_sp/Globals.c @@ -166,13 +166,13 @@ void InitGlobals(void) 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)); diff --git a/src/game_sp/Globals.h b/src/game_sp/Globals.h index 36bf0f3a..a202d07d 100644 --- a/src/game_sp/Globals.h +++ b/src/game_sp/Globals.h @@ -323,4 +323,4 @@ extern int SnikSnaksElectronsFrozen; extern int YellowDisksExploded; extern int YawnSleepCounter; -#endif /* GLOBALS_H */ +#endif // GLOBALS_H diff --git a/src/game_sp/Infotrons.h b/src/game_sp/Infotrons.h index e92e7304..4a404aee 100644 --- a/src/game_sp/Infotrons.h +++ b/src/game_sp/Infotrons.h @@ -11,4 +11,4 @@ void subAnimateInfotrons(int); void subCleanUpForInfotronsAbove(int); -#endif /* INFOTRONS_H */ +#endif // INFOTRONS_H diff --git a/src/game_sp/InitGameConditions.h b/src/game_sp/InitGameConditions.h index 6688a849..e1a1acc6 100644 --- a/src/game_sp/InitGameConditions.h +++ b/src/game_sp/InitGameConditions.h @@ -18,4 +18,4 @@ void subFetchAndInitLevelA(void); void subFetchAndInitLevelB(void); void subInitGameConditions(void); -#endif /* INITGAMECONDITIONS_H */ +#endif // INITGAMECONDITIONS_H diff --git a/src/game_sp/Input.h b/src/game_sp/Input.h index 2752b809..588542b4 100644 --- a/src/game_sp/Input.h +++ b/src/game_sp/Input.h @@ -10,4 +10,4 @@ void subProcessKeyboardInput(byte); -#endif /* INPUT_H */ +#endif // INPUT_H diff --git a/src/game_sp/MainForm.c b/src/game_sp/MainForm.c index 85f7a129..96d71a96 100644 --- a/src/game_sp/MainForm.c +++ b/src/game_sp/MainForm.c @@ -16,7 +16,7 @@ void DrawFrameIfNeeded(void) { DrawFrame(0); - /* !!! CHECK THIS !!! */ + // !!! CHECK THIS !!! if (! menBorder) DrawFrame(1); } @@ -173,19 +173,19 @@ void SetScrollEdges(void) 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; diff --git a/src/game_sp/MainForm.h b/src/game_sp/MainForm.h index d640e387..300e8f6f 100644 --- a/src/game_sp/MainForm.h +++ b/src/game_sp/MainForm.h @@ -24,4 +24,4 @@ void menPlay_Click(void); void Form_Load(void); -#endif /* MAINFORM_H */ +#endif // MAINFORM_H diff --git a/src/game_sp/MainGameLoop.c b/src/game_sp/MainGameLoop.c index dcbe62f4..72d0e283 100644 --- a/src/game_sp/MainGameLoop.c +++ b/src/game_sp/MainGameLoop.c @@ -74,7 +74,7 @@ void subMainGameLoop_Main(byte action, boolean warp_mode) // 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; } @@ -83,7 +83,7 @@ void subCalculateScreenScrollPos(void) { int jump_pos = TILEX / 2; - /* handle wrap-around */ + // handle wrap-around if (MurphyScreenXPos < -jump_pos) { MurphyScreenXPos = FieldWidth * TILEX + MurphyScreenXPos; diff --git a/src/game_sp/MainGameLoop.h b/src/game_sp/MainGameLoop.h index 9d76c0de..0dd629fb 100644 --- a/src/game_sp/MainGameLoop.h +++ b/src/game_sp/MainGameLoop.h @@ -17,4 +17,4 @@ void subMainGameLoop_Init(void); void subMainGameLoop_Main(byte, boolean); void subCalculateScreenScrollPos(void); -#endif /* MAINGAMELOOP_H */ +#endif // MAINGAMELOOP_H diff --git a/src/game_sp/Murphy.h b/src/game_sp/Murphy.h index 3ddba6df..28d12b03 100644 --- a/src/game_sp/Murphy.h +++ b/src/game_sp/Murphy.h @@ -17,4 +17,4 @@ void subCopyAnimToScreen(int, int, int); void subExplodeSnikSnaksBelow(int); void subSpPortTest(int); -#endif /* MURPHY_H */ +#endif // MURPHY_H diff --git a/src/game_sp/OrangeDisk.h b/src/game_sp/OrangeDisk.h index beab880c..3cbb3630 100644 --- a/src/game_sp/OrangeDisk.h +++ b/src/game_sp/OrangeDisk.h @@ -10,4 +10,4 @@ void subAnimateOrangeDisks(int); -#endif /* ORANGEDISK_H */ +#endif // ORANGEDISK_H diff --git a/src/game_sp/SnikSnaks.c b/src/game_sp/SnikSnaks.c index a03e332e..45442b74 100644 --- a/src/game_sp/SnikSnaks.c +++ b/src/game_sp/SnikSnaks.c @@ -33,7 +33,7 @@ void subAnimateSnikSnaks(int si) 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; diff --git a/src/game_sp/SnikSnaks.h b/src/game_sp/SnikSnaks.h index 7faca021..acb5ba27 100644 --- a/src/game_sp/SnikSnaks.h +++ b/src/game_sp/SnikSnaks.h @@ -11,4 +11,4 @@ void subAnimateSnikSnaks(int); void subDrawAnimatedSnikSnaks(int); -#endif /* SNIKSNAKS_H */ +#endif // SNIKSNAKS_H diff --git a/src/game_sp/Sound.h b/src/game_sp/Sound.h index c7a532c7..97f62336 100644 --- a/src/game_sp/Sound.h +++ b/src/game_sp/Sound.h @@ -10,4 +10,4 @@ void subSoundFX(int, int, int); -#endif /* GAME_SP_SOUND_H */ +#endif // GAME_SP_SOUND_H diff --git a/src/game_sp/Zonk.h b/src/game_sp/Zonk.h index 9b73a22c..603b9c32 100644 --- a/src/game_sp/Zonk.h +++ b/src/game_sp/Zonk.h @@ -9,4 +9,4 @@ void subAnimateZonks(int si); -#endif /* ZONK_H */ +#endif // ZONK_H diff --git a/src/game_sp/export.h b/src/game_sp/export.h index 1956c3a0..1ac2d311 100644 --- a/src/game_sp/export.h +++ b/src/game_sp/export.h @@ -1,13 +1,13 @@ #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 @@ -31,10 +31,10 @@ // 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 @@ -47,14 +47,14 @@ #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 @@ -80,7 +80,7 @@ typedef struct 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 @@ -94,13 +94,13 @@ struct GameInfo_SP 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; @@ -109,12 +109,12 @@ struct GameInfo_SP 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 @@ -128,7 +128,7 @@ struct LevelInfo_SP struct DemoInfo_SP demo; - /* used for runtime values */ + // used for runtime values struct GameInfo_SP *game_sp; }; @@ -147,7 +147,7 @@ struct GraphicInfo_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 @@ -164,9 +164,9 @@ struct EngineSnapshotInfo_SP }; -/* ------------------------------------------------------------------------- */ -/* exported functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// exported functions +// ---------------------------------------------------------------------------- extern struct GlobalInfo_SP global_sp_info; extern struct GameInfo_SP game_sp; @@ -205,4 +205,4 @@ int map_key_SP_to_RND(int); int getRedDiskReleaseFlag_SP(void); -#endif /* GAME_SP_EXPORT_H */ +#endif // GAME_SP_EXPORT_H diff --git a/src/game_sp/file.c b/src/game_sp/file.c index 8467cbf0..a1ff3e80 100644 --- a/src/game_sp/file.c +++ b/src/game_sp/file.c @@ -3,9 +3,9 @@ #include "global.h" -/* ------------------------------------------------------------------------- */ -/* functions for loading Supaplex level */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// functions for loading Supaplex level +// ---------------------------------------------------------------------------- static void setTapeInfoToDefaults_SP(void) { @@ -28,7 +28,7 @@ void setLevelInfoToDefaults_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]; @@ -51,7 +51,7 @@ void setLevelInfoToDefaults_SP(void) 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; @@ -72,11 +72,11 @@ void copyInternalEngineVars_SP(void) 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; @@ -84,7 +84,7 @@ void copyInternalEngineVars_SP(void) 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') { @@ -114,7 +114,7 @@ void copyInternalEngineVars_SP(void) 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]; @@ -133,7 +133,7 @@ void copyInternalEngineVars_SP(void) 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, @@ -148,8 +148,8 @@ 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++) @@ -162,21 +162,21 @@ static void LoadNativeLevelFromFileStream_SP(File *file, int width, int height, } } - /* 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 @@ -184,10 +184,10 @@ static void LoadNativeLevelFromFileStream_SP(File *file, int width, int height, (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]; @@ -197,30 +197,30 @@ static void LoadNativeLevelFromFileStream_SP(File *file, int width, int height, 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++) @@ -228,22 +228,22 @@ static void LoadNativeLevelFromFileStream_SP(File *file, int width, int height, 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); @@ -253,7 +253,7 @@ static void LoadNativeLevelFromFileStream_SP(File *file, int width, int height, { 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; } @@ -287,7 +287,7 @@ boolean LoadNativeLevel_SP(char *filename, int level_pos, 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(); @@ -352,7 +352,7 @@ boolean LoadNativeLevel_SP(char *filename, int level_pos, 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); } @@ -362,7 +362,7 @@ boolean LoadNativeLevel_SP(char *filename, int level_pos, 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); @@ -383,7 +383,7 @@ boolean LoadNativeLevel_SP(char *filename, int level_pos, 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; @@ -401,20 +401,20 @@ boolean LoadNativeLevel_SP(char *filename, int level_pos, 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) { @@ -424,7 +424,7 @@ boolean LoadNativeLevel_SP(char *filename, int level_pos, 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) { @@ -437,7 +437,7 @@ boolean LoadNativeLevel_SP(char *filename, int level_pos, break; } - /* ---------- check for finished multi-part level ---------- */ + // ---------- check for finished multi-part level ---------- if (reading_multipart_level && (!is_multipart_level || @@ -451,16 +451,16 @@ boolean LoadNativeLevel_SP(char *filename, int level_pos, 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; @@ -487,7 +487,7 @@ boolean LoadNativeLevel_SP(char *filename, int level_pos, 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++) @@ -531,12 +531,12 @@ void SaveNativeLevel_SP(char *filename) 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); @@ -566,7 +566,7 @@ void SaveNativeLevel_SP(char *filename) 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) { @@ -575,7 +575,7 @@ void SaveNativeLevel_SP(char *filename) 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); diff --git a/src/game_sp/game_sp.h b/src/game_sp/game_sp.h index 97477336..1db25425 100644 --- a/src/game_sp/game_sp.h +++ b/src/game_sp/game_sp.h @@ -16,4 +16,4 @@ #include "export.h" -#endif /* GAME_SP_H */ +#endif // GAME_SP_H diff --git a/src/game_sp/global.h b/src/game_sp/global.h index 91847c2c..9c7f5291 100644 --- a/src/game_sp/global.h +++ b/src/game_sp/global.h @@ -29,4 +29,4 @@ #include "Sound.h" #include "Zonk.h" -#endif /* GAME_SP_GLOBAL_H */ +#endif // GAME_SP_GLOBAL_H diff --git a/src/game_sp/init.c b/src/game_sp/init.c index eb14398c..040c18f9 100644 --- a/src/game_sp/init.c +++ b/src/game_sp/init.c @@ -72,7 +72,7 @@ void InitPrecedingPlayfieldMemory(void) 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; @@ -98,9 +98,9 @@ unsigned int InitEngineRandom_SP(int seed) } -/* ------------------------------------------------------------------------- */ -/* Supaplex game engine snapshot handling functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// Supaplex game engine snapshot handling functions +// ---------------------------------------------------------------------------- void SaveEngineSnapshotValues_SP(ListNode **buffers) { @@ -108,7 +108,7 @@ 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]; @@ -124,7 +124,7 @@ void SaveEngineSnapshotValues_SP(ListNode **buffers) 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)); @@ -196,11 +196,11 @@ void LoadEngineSnapshotValues_SP(void) { 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]; diff --git a/src/game_sp/main.c b/src/game_sp/main.c index 9e5ff836..02eeea93 100644 --- a/src/game_sp/main.c +++ b/src/game_sp/main.c @@ -96,8 +96,8 @@ void GameActions_SP(byte action[MAX_PLAYERS], boolean warp_mode) 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; } diff --git a/src/game_sp/main_sp.h b/src/game_sp/main_sp.h index f34baa69..2eee6ef6 100644 --- a/src/game_sp/main_sp.h +++ b/src/game_sp/main_sp.h @@ -1,31 +1,31 @@ #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; @@ -40,7 +40,7 @@ extern int SCR_FIELDX, SCR_FIELDY; #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; @@ -55,13 +55,13 @@ extern int REAL_SX, REAL_SY; #define FULL_SYSIZE (2 + SYSIZE + 2) -/* ------------------------------------------------------------------------- */ -/* data structure definitions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// data structure definitions +// ---------------------------------------------------------------------------- -/* ------------------------------------------------------------------------- */ -/* exported variables */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// exported variables +// ---------------------------------------------------------------------------- extern struct LevelInfo_SP native_sp_level; @@ -73,8 +73,8 @@ extern int GfxGraphic[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT]; extern int GfxFrame[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT]; -/* ------------------------------------------------------------------------- */ -/* exported functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// exported functions +// ---------------------------------------------------------------------------- -#endif /* MAIN_SP_H */ +#endif // MAIN_SP_H diff --git a/src/game_sp/vb_lib.c b/src/game_sp/vb_lib.c index 16382f2b..bab55517 100644 --- a/src/game_sp/vb_lib.c +++ b/src/game_sp/vb_lib.c @@ -7,7 +7,7 @@ #include "vb_lib.h" -/* helper functions for constructs not supported by C */ +// helper functions for constructs not supported by C int MyGetTickCount(void) { diff --git a/src/game_sp/vb_lib.h b/src/game_sp/vb_lib.h index 06405d4c..082da1e3 100644 --- a/src/game_sp/vb_lib.h +++ b/src/game_sp/vb_lib.h @@ -9,8 +9,8 @@ #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 diff --git a/src/init.c b/src/init.c index b53a039c..8d410a56 100644 --- a/src/init.c +++ b/src/init.c @@ -24,13 +24,13 @@ #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" @@ -84,7 +84,7 @@ static int copy_properties[][5] = }; -/* forward declaration for internal use */ +// forward declaration for internal use static int get_graphic_parameter_value(char *, char *, int); @@ -97,7 +97,7 @@ static void DrawInitAnim(void) 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) @@ -117,7 +117,7 @@ static void DrawInitAnim(void) 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) { @@ -216,23 +216,23 @@ static void InitElementSmallImages(void) 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)"); @@ -253,11 +253,11 @@ static void InitScaledImages(void) 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); } @@ -303,7 +303,7 @@ void InitImageTextures(void) } #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; @@ -312,7 +312,7 @@ void SetBitmaps_EM(Bitmap **em_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; @@ -323,7 +323,7 @@ static int getFontBitmapID(int font_nr) { 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; @@ -343,7 +343,7 @@ static int getFontFromToken(char *token) 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; } @@ -355,7 +355,7 @@ static void InitFontGraphicInfo(void) 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); @@ -363,13 +363,13 @@ static void InitFontGraphicInfo(void) 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; @@ -382,7 +382,7 @@ static void InitFontGraphicInfo(void) 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++) @@ -392,7 +392,7 @@ static void InitFontGraphicInfo(void) } } - /* 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; @@ -423,7 +423,7 @@ static void InitFontGraphicInfo(void) } } - /* 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; @@ -480,7 +480,7 @@ static void InitFontGraphicInfo(void) } } - /* 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++) @@ -488,7 +488,7 @@ static void InitFontGraphicInfo(void) 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; @@ -505,7 +505,7 @@ static void InitFontGraphicInfo(void) 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]; @@ -528,7 +528,7 @@ static void InitFontGraphicInfo(void) } } - /* ---------- initialize font bitmap array ---------- */ + // ---------- initialize font bitmap array ---------- if (font_bitmap_info != NULL) FreeFontInfo(font_bitmap_info); @@ -536,7 +536,7 @@ static void InitFontGraphicInfo(void) 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++) { @@ -551,14 +551,14 @@ static void InitFontGraphicInfo(void) 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; @@ -592,16 +592,16 @@ static void InitGlobalAnimGraphicInfo(void) 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; @@ -610,7 +610,7 @@ static void InitGlobalAnimGraphicInfo(void) 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; @@ -621,17 +621,17 @@ static void InitGlobalAnimGraphicInfo(void) 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; @@ -640,7 +640,7 @@ static void InitGlobalAnimGraphicInfo(void) 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; } @@ -664,13 +664,13 @@ static void InitGlobalAnimSoundInfo(void) 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; @@ -684,11 +684,11 @@ static void InitGlobalAnimSoundInfo(void) 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; @@ -713,13 +713,13 @@ static void InitGlobalAnimMusicInfo(void) 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; @@ -733,11 +733,11 @@ static void InitGlobalAnimMusicInfo(void) 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; @@ -762,10 +762,10 @@ static void InitElementGraphicInfo(void) 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++) @@ -783,7 +783,7 @@ static void InitElementGraphicInfo(void) 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; @@ -831,7 +831,7 @@ static void InitElementGraphicInfo(void) } } - /* 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; @@ -880,7 +880,7 @@ static void InitElementGraphicInfo(void) } } - /* 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]; @@ -913,10 +913,10 @@ static void InitElementGraphicInfo(void) } } - /* 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)) @@ -925,7 +925,7 @@ static void InitElementGraphicInfo(void) 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++) @@ -966,7 +966,7 @@ static void InitElementGraphicInfo(void) 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 && @@ -990,21 +990,21 @@ static void InitElementGraphicInfo(void) (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; } } @@ -1014,7 +1014,7 @@ static void InitElementGraphicInfo(void) 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]; @@ -1052,7 +1052,7 @@ static void InitElementGraphicInfo(void) 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; @@ -1060,7 +1060,7 @@ static void InitElementGraphicInfo(void) 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) @@ -1079,8 +1079,8 @@ static void InitElementGraphicInfo(void) 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]; @@ -1095,11 +1095,11 @@ static void InitElementGraphicInfo(void) 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 : @@ -1122,7 +1122,7 @@ static void InitElementGraphicInfo(void) 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 : @@ -1143,13 +1143,13 @@ static void InitElementSpecialGraphicInfo(void) 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; @@ -1171,7 +1171,7 @@ static void InitElementSpecialGraphicInfo(void) 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; @@ -1180,7 +1180,7 @@ static void InitElementSpecialGraphicInfo(void) 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); @@ -1190,7 +1190,7 @@ static void InitElementSpecialGraphicInfo(void) 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; @@ -1198,7 +1198,7 @@ static void InitElementSpecialGraphicInfo(void) 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) @@ -1277,24 +1277,24 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, 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; @@ -1311,22 +1311,22 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, 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]; @@ -1334,7 +1334,7 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, #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 @@ -1344,24 +1344,24 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, 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) @@ -1376,7 +1376,7 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, 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) @@ -1386,19 +1386,19 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, 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; } @@ -1418,51 +1418,51 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, 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]) @@ -1472,7 +1472,7 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, 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 = @@ -1480,12 +1480,12 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, 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) @@ -1493,22 +1493,22 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, 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) @@ -1522,7 +1522,7 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, 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) @@ -1532,7 +1532,7 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, 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]; @@ -1542,28 +1542,28 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, 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) @@ -1584,7 +1584,7 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, 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]; @@ -1599,11 +1599,11 @@ static void set_graphic_parameters(int graphic) 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, @@ -1659,7 +1659,7 @@ static void InitGraphicInfo(void) 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, @@ -1727,19 +1727,19 @@ static void InitGraphicInfo(void) 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); @@ -1752,23 +1752,23 @@ static void InitGraphicInfo(void) 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; @@ -1798,11 +1798,11 @@ static void InitGraphicInfo(void) 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); @@ -1850,17 +1850,17 @@ static void InitGraphicCompatibilityInfo(void) 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); @@ -1881,12 +1881,12 @@ static void InitElementSoundInfo(void) 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; @@ -1906,7 +1906,7 @@ static void InitElementSoundInfo(void) 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; @@ -1925,7 +1925,7 @@ static void InitElementSoundInfo(void) 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; @@ -1941,15 +1941,15 @@ static void InitElementSoundInfo(void) 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) @@ -1959,12 +1959,12 @@ static void InitElementSoundInfo(void) 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; } @@ -1983,11 +1983,11 @@ static void InitGameModeSoundInfo(void) { 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; @@ -1999,7 +1999,7 @@ static void InitGameModeSoundInfo(void) 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]; @@ -2010,21 +2010,21 @@ static void set_sound_parameters(int sound, char **parameter_raw) 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]; } @@ -2039,7 +2039,7 @@ static void InitSoundInfo(void) 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; @@ -2050,9 +2050,9 @@ static void InitSoundInfo(void) 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++) { @@ -2069,7 +2069,7 @@ static void InitSoundInfo(void) } } - /* associate elements and some selected sound actions */ + // associate elements and some selected sound actions for (j = 0; j < MAX_NUM_ELEMENTS; j++) { @@ -2102,13 +2102,13 @@ static void InitGameModeMusicInfo(void) 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; @@ -2120,7 +2120,7 @@ static void InitGameModeMusicInfo(void) 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; @@ -2134,7 +2134,7 @@ static void InitGameModeMusicInfo(void) 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; @@ -2150,7 +2150,7 @@ static void InitGameModeMusicInfo(void) 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++) @@ -2166,14 +2166,14 @@ static void set_music_parameters(int music, char **parameter_raw) 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]; } @@ -2192,9 +2192,9 @@ static void InitMusicInfo(void) 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++) { @@ -2220,28 +2220,28 @@ static void ReinitializeGraphics(void) 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(); @@ -2262,19 +2262,19 @@ static void ReinitializeGraphics(void) 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) @@ -2287,7 +2287,7 @@ 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 }, @@ -2295,7 +2295,7 @@ static int get_special_property_bit(int element, int property_bit_nr) { 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 }, @@ -2414,21 +2414,21 @@ static void ResolveGroupElementExt(int group_element, int recursion_depth) 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); @@ -2477,8 +2477,8 @@ void InitElementPropertiesStatic(void) 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, @@ -2532,8 +2532,8 @@ void InitElementPropertiesStatic(void) 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 @@ -2541,13 +2541,13 @@ void InitElementPropertiesStatic(void) 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, @@ -2555,11 +2555,11 @@ void InitElementPropertiesStatic(void) 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, @@ -2573,13 +2573,13 @@ void InitElementPropertiesStatic(void) 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, @@ -2810,7 +2810,7 @@ void InitElementPropertiesStatic(void) 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, @@ -2910,18 +2910,18 @@ void InitElementPropertiesStatic(void) 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, @@ -2949,12 +2949,12 @@ void InitElementPropertiesStatic(void) 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, @@ -3129,7 +3129,7 @@ void InitElementPropertiesStatic(void) 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, @@ -3142,7 +3142,7 @@ void InitElementPropertiesStatic(void) 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, @@ -3173,7 +3173,7 @@ void InitElementPropertiesStatic(void) 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, @@ -3204,18 +3204,18 @@ void InitElementPropertiesStatic(void) 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, @@ -3235,7 +3235,7 @@ void InitElementPropertiesStatic(void) EL_SP_SNIKSNAK, EL_SP_ELECTRON, - /* elements that can explode only by explosion */ + // elements that can explode only by explosion EL_BLACK_ORB, -1 @@ -3389,10 +3389,10 @@ void InitElementPropertiesStatic(void) 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, @@ -3435,10 +3435,10 @@ void InitElementPropertiesStatic(void) 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, @@ -3448,10 +3448,10 @@ void InitElementPropertiesStatic(void) 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, @@ -4040,7 +4040,7 @@ void InitElementPropertiesStatic(void) static int ep_can_turn_each_move[] = { - /* !!! do something with this one !!! */ + // !!! do something with this one !!! -1 }; @@ -4445,28 +4445,28 @@ void InitElementPropertiesStatic(void) 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); @@ -4512,24 +4512,24 @@ void InitElementPropertiesEngine(int engine_version) 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))); @@ -4550,19 +4550,19 @@ void InitElementPropertiesEngine(int engine_version) 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]) || @@ -4572,7 +4572,7 @@ void InitElementPropertiesEngine(int engine_version) 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 @@ -4580,14 +4580,14 @@ void InitElementPropertiesEngine(int engine_version) !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)) @@ -4599,101 +4599,101 @@ void InitElementPropertiesEngine(int engine_version) 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[] = { @@ -4718,23 +4718,23 @@ void InitElementPropertiesEngine(int engine_version) -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(); } @@ -4758,7 +4758,7 @@ static void InitGlobal(void) 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); @@ -4769,7 +4769,7 @@ static void InitGlobal(void) 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); @@ -4777,21 +4777,21 @@ static void InitGlobal(void) 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") || @@ -4802,14 +4802,14 @@ static void InitGlobal(void) 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)) @@ -4824,10 +4824,10 @@ static void InitGlobal(void) 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); } } @@ -4836,11 +4836,11 @@ static void InitGlobal(void) } } - /* 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; @@ -4849,11 +4849,11 @@ static void InitGlobal(void) 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; @@ -4862,11 +4862,11 @@ static void InitGlobal(void) 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; @@ -4946,7 +4946,7 @@ static void Execute_Command(char *command) 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); @@ -5012,7 +5012,7 @@ static void Execute_Command(char *command) 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 : @@ -5021,26 +5021,26 @@ static void Execute_Command(char *command) 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; @@ -5048,7 +5048,7 @@ static void Execute_Command(char *command) 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++; } @@ -5064,10 +5064,10 @@ static void Execute_Command(char *command) 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; @@ -5091,16 +5091,16 @@ static void Execute_Command(char *command) 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; @@ -5120,7 +5120,7 @@ static void InitPlayerInfo(void) { int i; - /* choose default local player */ + // choose default local player local_player = &stored_player[0]; for (i = 0; i < MAX_PLAYERS; i++) @@ -5191,12 +5191,12 @@ static void InitArtworkConfig(void) 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++; @@ -5209,7 +5209,7 @@ static void InitArtworkConfig(void) 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 *)); @@ -5217,7 +5217,7 @@ static void InitArtworkConfig(void) 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 *)); @@ -5301,11 +5301,11 @@ void InitGfxBuffers(void) 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); @@ -5318,7 +5318,7 @@ void InitGfxBuffers(void) 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); @@ -5329,7 +5329,7 @@ void InitGfxBuffers(void) 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(); @@ -5344,7 +5344,7 @@ static void InitGfx(void) 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++) @@ -5378,7 +5378,7 @@ static void InitGfx(void) 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(); @@ -5396,7 +5396,7 @@ static void InitGfx(void) 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, @@ -5406,7 +5406,7 @@ static void InitGfx(void) 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); @@ -5443,7 +5443,7 @@ static void InitGfx(void) 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)) @@ -5464,7 +5464,7 @@ static void InitGfx(void) } } - 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 = @@ -5475,7 +5475,7 @@ static void InitGfx(void) 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); @@ -5495,7 +5495,7 @@ static void InitGfx(void) 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; } @@ -5511,9 +5511,9 @@ static void InitGfxBackground(void) 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) @@ -5604,7 +5604,7 @@ static void InitSound(char *identifier) 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); @@ -5623,7 +5623,7 @@ static void InitMusic(char *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); @@ -5684,7 +5684,7 @@ void InitNetworkServer(void) 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); } @@ -5694,7 +5694,7 @@ static boolean CheckArtworkConfigForCustomElements(char *filename) 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) { @@ -5736,7 +5736,7 @@ static boolean CheckArtworkTypeForRedefinedCustomElements(int type) 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 @@ -5766,12 +5766,12 @@ static void InitOverrideArtwork(void) { 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) @@ -5786,14 +5786,14 @@ static void InitOverrideArtwork(void) 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); @@ -5817,13 +5817,13 @@ static char *getNewArtworkIdentifier(int type) 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; @@ -5848,7 +5848,7 @@ static char *getNewArtworkIdentifier(int type) /* 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; @@ -5856,20 +5856,20 @@ static char *getNewArtworkIdentifier(int type) 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; @@ -5880,7 +5880,7 @@ static char *getNewArtworkIdentifier(int type) 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; @@ -5943,15 +5943,15 @@ void ReloadCustomArtwork(int force_reload) 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); @@ -6022,21 +6022,21 @@ void DisplayExitMessage(char *format, va_list ap) 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) { @@ -6046,7 +6046,7 @@ void OpenAll(void) InitCounter(); - InitGlobal(); /* initialize some global variables */ + InitGlobal(); // initialize some global variables print_timestamp_time("[init global stuff]"); @@ -6069,16 +6069,16 @@ void OpenAll(void) 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)]"); @@ -6113,16 +6113,16 @@ void OpenAll(void) 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(); @@ -6187,7 +6187,7 @@ void CloseAllAndExit(int exit_value) 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(); @@ -6200,7 +6200,7 @@ void CloseAllAndExit(int exit_value) // 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 @@ -6210,12 +6210,12 @@ void CloseAllAndExit(int exit_value) 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); diff --git a/src/libgame/android.h b/src/libgame/android.h index fc477680..f0eca617 100644 --- a/src/libgame/android.h +++ b/src/libgame/android.h @@ -15,4 +15,4 @@ #include -#endif /* ANDROID_H */ +#endif // ANDROID_H diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 937f7a3a..4b237b88 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -18,7 +18,7 @@ #include "misc.h" -/* values for DrawGadget() */ +// values for DrawGadget() #define DG_UNPRESSED 0 #define DG_PRESSED 1 @@ -64,9 +64,9 @@ static int getNewGadgetID(void) { 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; } @@ -77,7 +77,7 @@ static int getNewGadgetID(void) 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; @@ -88,14 +88,14 @@ static struct GadgetInfo *getGadgetInfoFromMousePosition(int mx, int my, { 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 && @@ -105,7 +105,7 @@ static struct GadgetInfo *getGadgetInfoFromMousePosition(int mx, int my, 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 && @@ -116,11 +116,11 @@ static struct GadgetInfo *getGadgetInfoFromMousePosition(int mx, int my, 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 && @@ -130,7 +130,7 @@ static struct GadgetInfo *getGadgetInfoFromMousePosition(int mx, int my, 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 && @@ -156,12 +156,12 @@ static void setTextAreaCursorExt(struct GadgetInfo *gi, boolean set_cursor_pos) 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; @@ -273,23 +273,23 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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), @@ -309,27 +309,27 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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); @@ -338,7 +338,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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 + @@ -360,23 +360,23 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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, @@ -390,13 +390,13 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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, @@ -405,7 +405,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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, @@ -419,7 +419,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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); @@ -428,7 +428,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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, @@ -453,38 +453,38 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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); @@ -496,42 +496,42 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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, @@ -546,14 +546,14 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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, @@ -562,7 +562,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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, @@ -570,7 +570,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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, @@ -584,7 +584,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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; @@ -604,7 +604,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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'; @@ -623,13 +623,13 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) { 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; @@ -649,17 +649,17 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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, @@ -667,7 +667,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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, @@ -676,7 +676,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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, @@ -696,17 +696,17 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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, @@ -714,7 +714,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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, @@ -723,7 +723,7 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) + 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, @@ -764,14 +764,14 @@ static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct) 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++; @@ -899,7 +899,7 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) 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); @@ -915,7 +915,7 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) 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'; @@ -1026,7 +1026,7 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) 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; @@ -1038,11 +1038,11 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) 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; @@ -1054,7 +1054,7 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) 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; @@ -1107,22 +1107,22 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) 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) { @@ -1140,7 +1140,7 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) 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; } @@ -1171,7 +1171,7 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) 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; @@ -1187,12 +1187,12 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) 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; } @@ -1229,7 +1229,7 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) 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 ? @@ -1243,7 +1243,7 @@ static void HandleGadgetTags(struct GadgetInfo *gi, int first_tag, va_list ap) 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; } @@ -1294,7 +1294,7 @@ struct GadgetInfo *CreateGadget(int first_tag, ...) 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; @@ -1308,7 +1308,7 @@ struct GadgetInfo *CreateGadget(int first_tag, ...) 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; @@ -1327,7 +1327,7 @@ void FreeGadget(struct GadgetInfo *gi) 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; @@ -1366,7 +1366,7 @@ static void CheckRangeOfNumericInputGadget(struct GadgetInfo *gi) 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) @@ -1500,21 +1500,21 @@ void ClickOnGadget(struct GadgetInfo *gi, int button) 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); } @@ -1551,26 +1551,26 @@ boolean HandleGadgets(int mx, int my, int button) 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; @@ -1594,7 +1594,7 @@ boolean HandleGadgets(int mx, int my, int button) 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))) @@ -1602,7 +1602,7 @@ boolean HandleGadgets(int mx, int my, int button) 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); @@ -1613,7 +1613,7 @@ boolean HandleGadgets(int mx, int my, int button) 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; @@ -1648,55 +1648,55 @@ boolean HandleGadgets(int mx, int my, int button) 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; @@ -1724,7 +1724,7 @@ boolean HandleGadgets(int mx, int my, int button) { 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); @@ -1761,7 +1761,7 @@ boolean HandleGadgets(int mx, int my, int button) { 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); @@ -1776,7 +1776,7 @@ boolean HandleGadgets(int mx, int my, int button) } } - /* 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)) { @@ -1796,34 +1796,34 @@ boolean HandleGadgets(int mx, int my, int button) 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; } @@ -1837,7 +1837,7 @@ boolean HandleGadgets(int mx, int my, int button) 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; @@ -1882,7 +1882,7 @@ boolean HandleGadgets(int mx, int my, int button) } 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; @@ -1931,14 +1931,14 @@ boolean HandleGadgets(int mx, int my, int button) 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); } @@ -1975,7 +1975,7 @@ boolean HandleGadgets(int mx, int my, int button) { 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); @@ -1995,7 +1995,7 @@ boolean HandleGadgets(int mx, int my, int button) 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; @@ -2046,7 +2046,7 @@ boolean HandleGadgets(int mx, int my, int button) 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; @@ -2059,7 +2059,7 @@ boolean HandleGadgets(int mx, int my, int button) 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; @@ -2082,7 +2082,7 @@ boolean HandleGadgets(int mx, int my, int button) 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; @@ -2095,7 +2095,7 @@ static void insertCharIntoTextArea(struct GadgetInfo *gi, char c) 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); @@ -2119,7 +2119,7 @@ boolean HandleGadgetsKeyInput(Key key) { 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); @@ -2159,7 +2159,7 @@ boolean HandleGadgetsKeyInput(Key key) 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); @@ -2206,7 +2206,7 @@ boolean HandleGadgetsKeyInput(Key key) 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); @@ -2266,7 +2266,7 @@ boolean HandleGadgetsKeyInput(Key key) 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; diff --git a/src/libgame/gadgets.h b/src/libgame/gadgets.h index 5f873747..17fccafa 100644 --- a/src/libgame/gadgets.h +++ b/src/libgame/gadgets.h @@ -15,10 +15,10 @@ #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) @@ -40,7 +40,7 @@ #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) @@ -52,15 +52,15 @@ #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 @@ -114,7 +114,7 @@ #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)) @@ -122,149 +122,149 @@ typedef void (*gadget_function)(void *); 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 }; @@ -296,4 +296,4 @@ boolean HandleGadgetsKeyInput(Key); void DumpGadgetIdentifiers(void); boolean DoGadgetAction(int); -#endif /* GADGETS_H */ +#endif // GADGETS_H diff --git a/src/libgame/image.c b/src/libgame/image.c index 3d959cba..6bd09aa3 100644 --- a/src/libgame/image.c +++ b/src/libgame/image.c @@ -21,17 +21,17 @@ struct ImageInfo 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; @@ -186,7 +186,7 @@ void InitImageList(struct ConfigInfo *config_list, int num_file_list_entries, 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; @@ -202,7 +202,7 @@ void InitImageList(struct ConfigInfo *config_list, int num_file_list_entries, 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++) @@ -234,7 +234,7 @@ void InitImageList(struct ConfigInfo *config_list, int num_file_list_entries, 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 *); @@ -244,7 +244,7 @@ void InitImageList(struct ConfigInfo *config_list, int num_file_list_entries, 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; diff --git a/src/libgame/image.h b/src/libgame/image.h index bb9b21ee..a9185ada 100644 --- a/src/libgame/image.h +++ b/src/libgame/image.h @@ -74,4 +74,4 @@ void ScaleImage(int, int); void FreeAllImages(void); -#endif /* IMAGE_H */ +#endif // IMAGE_H diff --git a/src/libgame/joystick.c b/src/libgame/joystick.c index f092c11d..8e8f61e1 100644 --- a/src/libgame/joystick.c +++ b/src/libgame/joystick.c @@ -17,9 +17,9 @@ #include "misc.h" -/* ========================================================================= */ -/* platform independent joystick functions */ -/* ========================================================================= */ +// ============================================================================ +// platform independent joystick functions +// ============================================================================ #define TRANSLATE_JOYSYMBOL_TO_JOYNAME 0 #define TRANSLATE_JOYNAME_TO_JOYSYMBOL 1 @@ -320,7 +320,7 @@ void DeactivateJoystick(void) void ActivateJoystick(void) { - /* reactivate temporarily deactivated joystick */ + // reactivate temporarily deactivated joystick if (joystick.status & JOYSTICK_AVAILABLE) joystick.status |= JOYSTICK_ACTIVE; diff --git a/src/libgame/joystick.h b/src/libgame/joystick.h index 8cee40de..f9c51800 100644 --- a/src/libgame/joystick.h +++ b/src/libgame/joystick.h @@ -35,8 +35,8 @@ #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 @@ -83,4 +83,4 @@ int AnyJoystickButton(void); void DeactivateJoystick(void); void ActivateJoystick(void); -#endif /* JOYSTICK_H */ +#endif // JOYSTICK_H diff --git a/src/libgame/libgame.h b/src/libgame/libgame.h index a3a3c803..419d3b71 100644 --- a/src/libgame/libgame.h +++ b/src/libgame/libgame.h @@ -27,4 +27,4 @@ #include "setup.h" #include "misc.h" -#endif /* LIBGAME_H */ +#endif // LIBGAME_H diff --git a/src/libgame/macosx.h b/src/libgame/macosx.h index 236beccf..ac2f953a 100644 --- a/src/libgame/macosx.h +++ b/src/libgame/macosx.h @@ -13,16 +13,16 @@ #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 diff --git a/src/libgame/misc.c b/src/libgame/misc.c index e4939b19..37a2760b 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -33,13 +33,13 @@ #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 @@ -163,9 +163,9 @@ static void printf_log_line(char *line_chars, int line_length) } -/* ------------------------------------------------------------------------- */ -/* 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) { @@ -251,9 +251,9 @@ void PrintLineWithPrefix(char *prefix, 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, @@ -296,7 +296,7 @@ char *i_to_a(unsigned int i) 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); @@ -316,7 +316,7 @@ int log_2(unsigned int x) 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++; } @@ -329,11 +329,11 @@ boolean getTokenValueFromString(char *string, char **token, char **value) } -/* ------------------------------------------------------------------------- */ -/* 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) @@ -346,23 +346,23 @@ static unsigned int mainCounter(int mode) 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); } @@ -372,7 +372,7 @@ static void sleep_milliseconds(unsigned int milliseconds_delay) 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); } @@ -483,19 +483,19 @@ void SkipUntilDelayReached(unsigned int *counter_var, unsigned int 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); @@ -503,10 +503,10 @@ unsigned int init_random_number(int nr, int seed) 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); } @@ -521,9 +521,9 @@ unsigned int get_random_number(int nr, int max) } -/* ------------------------------------------------------------------------- */ -/* system info functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// system info functions +// ---------------------------------------------------------------------------- #if !defined(PLATFORM_ANDROID) static char *get_corrected_real_name(char *real_name) @@ -532,7 +532,7 @@ 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 @@ -624,22 +624,22 @@ time_t getFileTimestampEpochSeconds(char *filename) { 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; @@ -650,9 +650,9 @@ char *getBaseNamePtr(char *filename) 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) @@ -682,7 +682,7 @@ char *getBasePath(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); @@ -690,16 +690,16 @@ char *getBasePath(char *filename) 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) { @@ -901,9 +901,9 @@ boolean strSuffixLower(char *s, char *suffix) } -/* ------------------------------------------------------------------------- */ -/* command line option handling functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// command line option handling functions +// ---------------------------------------------------------------------------- void GetOptions(int argc, char *argv[], void (*print_usage_function)(void), @@ -914,11 +914,11 @@ void GetOptions(int argc, char *argv[], 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; @@ -944,7 +944,7 @@ void GetOptions(int argc, char *argv[], 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 @@ -966,22 +966,22 @@ void GetOptions(int argc, char *argv[], 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); } @@ -1002,13 +1002,13 @@ void GetOptions(int argc, char *argv[], 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); @@ -1092,13 +1092,13 @@ void GetOptions(int argc, char *argv[], 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 == '-') @@ -1123,13 +1123,13 @@ void GetOptions(int argc, char *argv[], } -/* ------------------------------------------------------------------------- */ -/* 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, ...) @@ -1162,11 +1162,11 @@ void Error(int mode, 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; @@ -1225,16 +1225,16 @@ void Error(int mode, char *format, ...) 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) { @@ -1272,14 +1272,14 @@ void *checked_realloc(void *ptr, 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--) @@ -1290,9 +1290,9 @@ void clear_mem(void *ptr, unsigned int size) } -/* ------------------------------------------------------------------------- */ -/* various helper functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// various helper functions +// ---------------------------------------------------------------------------- void swap_numbers(int *i1, int *i2) { @@ -1338,7 +1338,7 @@ int getFile16BitInteger(File *file, int byte_order) 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)); } @@ -1352,7 +1352,7 @@ int putFile16BitInteger(FILE *file, int value, int byte_order) 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); @@ -1369,7 +1369,7 @@ int getFile32BitInteger(File *file, int byte_order) (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) | @@ -1387,7 +1387,7 @@ int putFile32BitInteger(FILE *file, int value, int byte_order) 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); @@ -1404,13 +1404,13 @@ boolean getFileChunk(File *file, char *chunk_name, int *chunk_size, { 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); } @@ -1422,7 +1422,7 @@ int putFileChunk(FILE *file, char *chunk_name, int chunk_size, { int num_bytes = 0; - /* write chunk name */ + // write chunk name if (file != NULL) fputs(chunk_name, file); @@ -1430,7 +1430,7 @@ int putFileChunk(FILE *file, char *chunk_name, int chunk_size, if (chunk_size >= 0) { - /* write chunk size */ + // write chunk size if (file != NULL) putFile32BitInteger(file, chunk_size, byte_order); @@ -1498,9 +1498,9 @@ void WriteUnusedBytesToFile(FILE *file, unsigned int bytes) } -/* ------------------------------------------------------------------------- */ -/* 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 @@ -1516,17 +1516,17 @@ static void translate_keyname(Key *keysym, char **x11name, char **name, int mode 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" }, @@ -1534,7 +1534,7 @@ static void translate_keyname(Key *keysym, char **x11name, char **name, int mode { 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 +" }, @@ -1544,7 +1544,7 @@ static void translate_keyname(Key *keysym, char **x11name, char **name, int mode { 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" }, @@ -1554,13 +1554,13 @@ static void translate_keyname(Key *keysym, char **x11name, char **name, int mode { 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" }, @@ -1572,8 +1572,8 @@ static void translate_keyname(Key *keysym, char **x11name, char **name, int mode #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" }, @@ -1581,7 +1581,7 @@ static void translate_keyname(Key *keysym, char **x11name, char **name, int mode #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", "\"" }, @@ -1606,7 +1606,7 @@ static void translate_keyname(Key *keysym, char **x11name, char **name, int mode { 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", "]" }, @@ -1619,7 +1619,7 @@ static void translate_keyname(Key *keysym, char **x11name, char **name, int mode { 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" }, @@ -1630,7 +1630,7 @@ static void translate_keyname(Key *keysym, char **x11name, char **name, int mode { 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" }, @@ -1640,12 +1640,12 @@ static void translate_keyname(Key *keysym, char **x11name, char **name, int mode { 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" }, @@ -1658,7 +1658,7 @@ static void translate_keyname(Key *keysym, char **x11name, char **name, int mode { KSYM_KP_9, "XK_KP_9", "keypad 9" }, #endif - /* end-of-array identifier */ + // end-of-array identifier { 0, NULL, NULL } }; @@ -1906,7 +1906,7 @@ char getCharFromKey(Key key) 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 }, @@ -1916,7 +1916,7 @@ char getCharFromKey(Key key) { KSYM_udiaeresis, CHAR_BYTE_UMLAUT_u }, { KSYM_ssharp, CHAR_BYTE_SHARP_S }, - /* end-of-array identifier */ + // end-of-array identifier { 0, 0 } }; @@ -1948,17 +1948,17 @@ char getCharFromKey(Key key) 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) { @@ -2069,9 +2069,9 @@ int get_player_nr_from_string(char *s) } -/* ------------------------------------------------------------------------- */ -/* functions for generic lists */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// functions for generic lists +// ---------------------------------------------------------------------------- ListNode *newListNode(void) { @@ -2162,9 +2162,9 @@ static void dumpList(ListNode *node_first) #endif -/* ------------------------------------------------------------------------- */ -/* functions for file handling */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// functions for file handling +// ---------------------------------------------------------------------------- #define MAX_BUFFER_SIZE 4096 @@ -2355,9 +2355,9 @@ int copyFile(char *filename_from, char *filename_to) } -/* ------------------------------------------------------------------------- */ -/* functions for directory handling */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// functions for directory handling +// ---------------------------------------------------------------------------- Directory *openDirectory(char *dir_name) { @@ -2491,9 +2491,9 @@ void freeDirectoryEntry(DirectoryEntry *dir_entry) } -/* ------------------------------------------------------------------------- */ -/* functions for checking files and filenames */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// functions for checking files and filenames +// ---------------------------------------------------------------------------- boolean directoryExists(char *dir_name) { @@ -2628,13 +2628,13 @@ boolean FileIsArtworkType(char *filename, int type) 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" }, @@ -2677,7 +2677,7 @@ char *get_mapped_token(char *token) 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" }, @@ -2720,7 +2720,7 @@ static char *get_special_base_token(struct ArtworkListInfo *artwork_info, 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; @@ -2728,7 +2728,7 @@ static char *get_special_base_token(struct ArtworkListInfo *artwork_info, 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); @@ -2753,20 +2753,20 @@ static boolean string_has_parameter(char *s, char *s_contained) { 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++; @@ -2832,7 +2832,7 @@ static int get_anim_parameter_value(char *s) } } - /* 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; @@ -2870,7 +2870,7 @@ static int get_anim_action_parameter_value(char *token) 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")) { @@ -2986,11 +2986,11 @@ int get_parameter_value(char *value_raw, char *suffix, int type) 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) : @@ -3018,7 +3018,7 @@ struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list, 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], ""); @@ -3028,7 +3028,7 @@ struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list, 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; @@ -3079,7 +3079,7 @@ struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list, } } - /* 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; @@ -3121,7 +3121,7 @@ static boolean token_suffix_match(char *token, char *suffix, int start_pos) 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) @@ -3145,7 +3145,7 @@ static void read_token_parameters(SetupFileHash *setup_file_hash, 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; @@ -3154,17 +3154,17 @@ static void read_token_parameters(SetupFileHash *setup_file_hash, { 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); @@ -3174,7 +3174,7 @@ static void read_token_parameters(SetupFileHash *setup_file_hash, { 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); } @@ -3258,7 +3258,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, 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) @@ -3270,10 +3270,10 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, } 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) { @@ -3283,9 +3283,9 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, } 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); @@ -3295,10 +3295,10 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, { 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); @@ -3306,7 +3306,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, } 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); @@ -3314,7 +3314,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, 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); @@ -3323,18 +3323,18 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, } 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) { @@ -3345,10 +3345,10 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, } 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) { @@ -3369,7 +3369,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, 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); @@ -3381,7 +3381,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, 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++) @@ -3404,7 +3404,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, 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; @@ -3421,7 +3421,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, 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++) @@ -3436,7 +3436,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, 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; @@ -3459,7 +3459,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, 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++) { @@ -3473,7 +3473,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, 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; @@ -3496,7 +3496,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, 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++) { @@ -3510,7 +3510,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, 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; @@ -3545,7 +3545,7 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, 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) @@ -3626,7 +3626,7 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info) 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); @@ -3638,7 +3638,7 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info) 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++) @@ -3655,7 +3655,7 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info) &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); @@ -3666,7 +3666,7 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info) 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)) @@ -3715,13 +3715,13 @@ static void replaceArtworkListEntry(struct ArtworkListInfo *artwork_info, 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; @@ -3731,7 +3731,7 @@ static void replaceArtworkListEntry(struct ArtworkListInfo *artwork_info, 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; @@ -3745,7 +3745,7 @@ static void replaceArtworkListEntry(struct ArtworkListInfo *artwork_info, { 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; @@ -3755,7 +3755,7 @@ static void replaceArtworkListEntry(struct ArtworkListInfo *artwork_info, } } - /* 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). @@ -3765,10 +3765,10 @@ static void replaceArtworkListEntry(struct ArtworkListInfo *artwork_info, 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; @@ -3782,7 +3782,7 @@ static void replaceArtworkListEntry(struct ArtworkListInfo *artwork_info, 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); @@ -3791,7 +3791,7 @@ static void replaceArtworkListEntry(struct ArtworkListInfo *artwork_info, { 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; @@ -3871,11 +3871,11 @@ void FreeCustomArtworkLists(struct ArtworkListInfo *artwork_info) } -/* ------------------------------------------------------------------------- */ -/* 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) { @@ -3899,7 +3899,7 @@ void OpenLogFiles(void) 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); } } @@ -3940,9 +3940,9 @@ void NotifyUserAboutErrorFile(void) } -/* ------------------------------------------------------------------------- */ -/* the following is only for debugging purpose and normally not used */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// the following is only for debugging purpose and normally not used +// ---------------------------------------------------------------------------- #if DEBUG @@ -3961,7 +3961,7 @@ static double Counter_Microseconds(void) 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; @@ -3969,7 +3969,7 @@ static double Counter_Microseconds(void) ((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 @@ -4041,7 +4041,7 @@ static void debug_print_parent_only(char *format, ...) } #endif -#endif /* DEBUG */ +#endif // DEBUG static void print_timestamp_ext(char *message, char *mode) { diff --git a/src/libgame/misc.h b/src/libgame/misc.h index 0660811e..ddf6d747 100644 --- a/src/libgame/misc.h +++ b/src/libgame/misc.h @@ -19,11 +19,11 @@ #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 @@ -34,7 +34,7 @@ #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) @@ -51,32 +51,32 @@ #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 { @@ -111,7 +111,7 @@ typedef struct } Directory; -/* function definitions */ +// function definitions void fprintf_line(FILE *, char *, int); void fprintf_line_with_prefix(FILE *, char *, char *, int); @@ -291,4 +291,4 @@ void print_timestamp_time(char *); void print_timestamp_done(char *); -#endif /* MISC_H */ +#endif // MISC_H diff --git a/src/libgame/platform.h b/src/libgame/platform.h index 6587f9e3..8b13dc97 100644 --- a/src/libgame/platform.h +++ b/src/libgame/platform.h @@ -12,9 +12,9 @@ #ifndef PLATFORM_H #define PLATFORM_H -/* ========================================================================= */ -/* define main platform keywords */ -/* ========================================================================= */ +// ============================================================================ +// define main platform keywords +// ============================================================================ #if defined(WIN32) || defined(_WIN32) #define PLATFORM_WIN32 @@ -25,9 +25,9 @@ #endif -/* ========================================================================= */ -/* define additional platform keywords */ -/* ========================================================================= */ +// ============================================================================ +// define additional platform keywords +// ============================================================================ #if defined(_AIX) #define PLATFORM_AIX @@ -154,9 +154,9 @@ #endif -/* ========================================================================= */ -/* define additional target keywords */ -/* ========================================================================= */ +// ============================================================================ +// define additional target keywords +// ============================================================================ #if defined(TARGET_SDL2) #ifndef TARGET_SDL @@ -165,4 +165,4 @@ #endif -#endif /* PLATFORM_H */ +#endif // PLATFORM_H diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 9a771753..6d2cb4d1 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -15,16 +15,16 @@ #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; @@ -36,11 +36,11 @@ static boolean fullscreen_enabled = FALSE; 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 @@ -71,7 +71,7 @@ static void FinalizeScreen(int draw_target) 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 && @@ -282,7 +282,7 @@ static void SDLSetWindowIcon(char *basename) return; } - /* set transparent color */ + // set transparent color SDL_SetColorKey(surface, SET_TRANSPARENT_PIXEL, SDL_MapRGB(surface->format, 0x00, 0x00, 0x00)); @@ -513,11 +513,11 @@ void SDLInitVideoDisplay(void) 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 @@ -543,15 +543,15 @@ static void SDLInitVideoBuffer_VideoBuffer(boolean fullscreen) 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(); } @@ -570,10 +570,10 @@ static void SDLInitVideoBuffer_DrawBuffer(void) 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); } @@ -772,12 +772,12 @@ boolean SDLSetVideoMode(boolean fullscreen) 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 @@ -788,12 +788,12 @@ boolean SDLSetVideoMode(boolean fullscreen) 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 { @@ -1191,8 +1191,8 @@ void SDLFadeRectangle(int x, int y, int width, int height, 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; @@ -1200,7 +1200,7 @@ void SDLFadeRectangle(int x, int y, int width, int height, 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) @@ -1210,7 +1210,7 @@ void SDLFadeRectangle(int x, int y, int width, int height, // (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); @@ -1231,13 +1231,13 @@ void SDLFadeRectangle(int x, int y, int width, int height, 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; @@ -1279,7 +1279,7 @@ void SDLFadeRectangle(int x, int y, int width, int height, 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; @@ -1297,7 +1297,7 @@ void SDLFadeRectangle(int x, int y, int width, int height, 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; @@ -1345,7 +1345,7 @@ void SDLFadeRectangle(int x, int y, int width, int height, 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;) { @@ -1362,7 +1362,7 @@ void SDLFadeRectangle(int x, int y, int width, int height, 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) @@ -1370,14 +1370,14 @@ void SDLFadeRectangle(int x, int y, int width, int height, 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; @@ -1388,11 +1388,11 @@ void SDLFadeRectangle(int x, int y, int width, int height, 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; @@ -1404,17 +1404,17 @@ void SDLFadeRectangle(int x, int y, int width, int height, 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); } } @@ -1492,21 +1492,21 @@ Pixel SDLGetPixel(Bitmap *src_bitmap, int x, int y) 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; @@ -1522,7 +1522,7 @@ Pixel SDLGetPixel(Bitmap *src_bitmap, int x, int y) } break; - case 4: /* probably 32-bpp */ + case 4: // probably 32-bpp { return *((Uint32 *)surface->pixels + y * surface->pitch / 4 + x); } @@ -1533,11 +1533,11 @@ Pixel SDLGetPixel(Bitmap *src_bitmap, int x, int y) } -/* ========================================================================= */ -/* 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) { @@ -1547,25 +1547,25 @@ 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; @@ -1578,7 +1578,7 @@ static void _PutPixel(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color) case 4: { - /* Probably 32-bpp */ + // Probably 32-bpp *((Uint32 *)surface->pixels + y*surface->pitch/4 + x) = color; } break; @@ -1608,7 +1608,7 @@ static void _PutPixel24(SDL_Surface *surface, Sint16 x, Sint16 y, Uint32 color) 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; @@ -1707,25 +1707,25 @@ static void sge_pPutPixel(SDL_Surface *surface, Sint16 x, Sint32 ypitch, { 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; @@ -1738,7 +1738,7 @@ static void sge_pPutPixel(SDL_Surface *surface, Sint16 x, Sint32 ypitch, case 4: { - /* Probably 32-bpp */ + // Probably 32-bpp *((Uint32 *)surface->pixels + ypitch + x) = color; } break; @@ -1766,7 +1766,7 @@ static void sge_HLine(SDL_Surface *Surface, Sint16 x1, Sint16 x2, Sint16 y, 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) @@ -1805,7 +1805,7 @@ static void _HLine(SDL_Surface *Surface, Sint16 x1, Sint16 x2, Sint16 y, 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) @@ -1841,7 +1841,7 @@ static void sge_VLine(SDL_Surface *Surface, Sint16 x, Sint16 y1, Sint16 y2, 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) @@ -1880,7 +1880,7 @@ static void _VLine(SDL_Surface *Surface, Sint16 x, Sint16 y1, Sint16 y2, 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) @@ -1972,10 +1972,10 @@ void sge_Line(SDL_Surface *Surface, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, 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); @@ -2037,11 +2037,11 @@ void SDLCopyInverseMasked(Bitmap *src_bitmap, Bitmap *dst_bitmap, } -/* ========================================================================= */ -/* 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 +// ============================================================================ /* ----------------------------------------------------------------------------- @@ -2065,7 +2065,7 @@ static int zoomSurfaceRGBA_scaleDownBy2(SDL_Surface *src, SDL_Surface *dst) 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; @@ -2084,26 +2084,26 @@ static int zoomSurfaceRGBA_scaleDownBy2(SDL_Surface *src, SDL_Surface *dst) 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); } @@ -2117,27 +2117,27 @@ static int zoomSurfaceRGBA(SDL_Surface *src, SDL_Surface *dst) 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; @@ -2150,22 +2150,22 @@ static int zoomSurfaceRGBA(SDL_Surface *src, SDL_Surface *dst) 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); } @@ -2189,15 +2189,15 @@ static int zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst) 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++) @@ -2234,12 +2234,12 @@ static int zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst) 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++) { @@ -2247,22 +2247,22 @@ static int zoomSurfaceY(SDL_Surface * src, SDL_Surface * dst) 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; } @@ -2294,17 +2294,17 @@ static SDL_Surface *zoomSurface(SDL_Surface *src, int dst_width, int dst_height) 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)); @@ -2313,10 +2313,10 @@ static SDL_Surface *zoomSurface(SDL_Surface *src, int dst_width, int dst_height) 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, @@ -2325,40 +2325,40 @@ static SDL_Surface *zoomSurface(SDL_Surface *src, int dst_width, int dst_height) } 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; } @@ -2372,10 +2372,10 @@ static SDL_Surface *SDLGetOpaqueSurface(SDL_Surface *surface) 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; @@ -2387,36 +2387,36 @@ Bitmap *SDLZoomBitmap(Bitmap *src_bitmap, int dst_width, int dst_height) 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) { @@ -2425,7 +2425,7 @@ 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; @@ -2435,7 +2435,7 @@ Bitmap *SDLLoadImage(char *filename) 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()); @@ -2443,7 +2443,7 @@ Bitmap *SDLLoadImage(char *filename) 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"); @@ -2451,13 +2451,13 @@ Bitmap *SDLLoadImage(char *filename) 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"); @@ -2465,7 +2465,7 @@ Bitmap *SDLLoadImage(char *filename) UPDATE_BUSY_STATE(); - /* free temporary surface */ + // free temporary surface SDL_FreeSurface(sdl_image_tmp); new_bitmap->width = new_bitmap->surface->w; @@ -2477,9 +2477,9 @@ Bitmap *SDLLoadImage(char *filename) } -/* ------------------------------------------------------------------------- */ -/* custom cursor fuctions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// custom cursor fuctions +// ---------------------------------------------------------------------------- static SDL_Cursor *create_cursor(struct MouseCursorInfo *cursor_info) { @@ -2495,18 +2495,18 @@ void SDLSetMouseCursor(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); @@ -2514,9 +2514,9 @@ void SDLSetMouseCursor(struct MouseCursorInfo *cursor_info) } -/* ========================================================================= */ -/* audio functions */ -/* ========================================================================= */ +// ============================================================================ +// audio functions +// ============================================================================ void SDLOpenAudio(void) { @@ -2547,7 +2547,7 @@ 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; @@ -2565,9 +2565,9 @@ void SDLCloseAudio(void) } -/* ========================================================================= */ -/* event functions */ -/* ========================================================================= */ +// ============================================================================ +// event functions +// ============================================================================ void SDLWaitEvent(Event *event) { @@ -2621,9 +2621,9 @@ void SDLHandleWindowManagerEvent(Event *event) } -/* ========================================================================= */ -/* joystick functions */ -/* ========================================================================= */ +// ============================================================================ +// joystick functions +// ============================================================================ #if defined(TARGET_SDL2) static void *sdl_joystick[MAX_PLAYERS]; // game controller or joystick @@ -2908,7 +2908,7 @@ void SDLInitJoysticks(void) #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 @@ -2919,7 +2919,7 @@ void SDLInitJoysticks(void) 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 @@ -2954,10 +2954,10 @@ void SDLInitJoysticks(void) #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); @@ -2969,14 +2969,14 @@ void SDLInitJoysticks(void) 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); @@ -3008,9 +3008,9 @@ boolean SDLReadJoystick(int nr, int *x, int *y, boolean *b1, boolean *b2) } -/* ========================================================================= */ -/* touch input overlay functions */ -/* ========================================================================= */ +// ============================================================================ +// touch input overlay functions +// ============================================================================ #if defined(USE_TOUCH_INPUT_OVERLAY) static void DrawTouchInputOverlay_ShowGrid(int alpha) @@ -3241,7 +3241,7 @@ static void DrawTouchInputOverlay(void) 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, diff --git a/src/libgame/sdl.h b/src/libgame/sdl.h index d61e0b26..58434681 100644 --- a/src/libgame/sdl.h +++ b/src/libgame/sdl.h @@ -21,7 +21,7 @@ #include #endif -/* definitions needed for "system.c" */ +// definitions needed for "system.c" #if defined(TARGET_SDL2) #define SURFACE_FLAGS (0) @@ -37,7 +37,7 @@ #define UNSET_TRANSPARENT_PIXEL (0) #endif -/* system dependent definitions */ +// system dependent definitions #if defined(TARGET_SDL2) #define TARGET_STRING "SDL2" @@ -60,7 +60,7 @@ #define CURSOR_MAX_HEIGHT 32 -/* SDL type definitions */ +// SDL type definitions typedef struct SDLSurfaceInfo Bitmap; typedef struct SDLSurfaceInfo DrawBuffer; @@ -92,7 +92,7 @@ typedef SDL_Event FocusChangeEvent; typedef SDL_Event ClientMessageEvent; -/* structure definitions */ +// structure definitions struct SDLSurfaceInfo { @@ -117,7 +117,7 @@ struct MouseCursorInfo }; -/* SDL symbol definitions */ +// SDL symbol definitions #define None 0L @@ -218,7 +218,7 @@ struct MouseCursorInfo #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 @@ -247,11 +247,11 @@ struct MouseCursorInfo #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 @@ -430,7 +430,7 @@ struct MouseCursorInfo #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 | \ @@ -440,7 +440,7 @@ struct MouseCursorInfo #define KMOD_TextInput (KMOD_Shift | KMOD_Alt_R) #endif -/* SDL function definitions */ +// SDL function definitions boolean SDLSetNativeSurface(SDL_Surface **); SDL_Surface *SDLGetNativeSurface(SDL_Surface *); @@ -506,4 +506,4 @@ void PrepareFadeBitmap(int); void Delay_WithScreenUpdates(unsigned int); -#endif /* SDL_H */ +#endif // SDL_H diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 80ebcfa7..ccac1c30 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -30,8 +30,8 @@ #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 @@ -101,9 +101,9 @@ static SetupFileHash *artworkinfo_cache_new = NULL; static boolean use_artworkinfo_cache = TRUE; -/* ------------------------------------------------------------------------- */ -/* file functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// file functions +// ---------------------------------------------------------------------------- static char *getLevelClassDescription(TreeInfo *ti) { @@ -454,7 +454,7 @@ static char *getLevelArtworkDir(int type) 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; @@ -570,7 +570,7 @@ char *getScoreFilename(int nr) 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; @@ -681,38 +681,38 @@ char *getLevelSetTitleMessageFilename(int nr, boolean initial) 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; @@ -720,19 +720,19 @@ char *getLevelSetTitleMessageFilename(int nr, boolean initial) 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) @@ -751,31 +751,31 @@ char *getCustomImageFilename(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; @@ -783,14 +783,14 @@ char *getCustomImageFilename(char *basename) 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; @@ -803,14 +803,14 @@ char *getCustomImageFilename(char *basename) 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) @@ -824,31 +824,31 @@ 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; @@ -856,14 +856,14 @@ char *getCustomSoundFilename(char *basename) 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; @@ -876,14 +876,14 @@ char *getCustomSoundFilename(char *basename) 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) @@ -897,31 +897,31 @@ 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; @@ -929,14 +929,14 @@ char *getCustomMusicFilename(char *basename) 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; @@ -949,14 +949,14 @@ char *getCustomMusicFilename(char *basename) 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) @@ -996,31 +996,31 @@ char *getCustomMusicDirectory(void) 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; @@ -1028,19 +1028,19 @@ char *getCustomMusicDirectory(void) 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) @@ -1102,9 +1102,9 @@ static void InitCacheDirectory(void) } -/* ------------------------------------------------------------------------- */ -/* some functions to handle lists of level and artwork directories */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// some functions to handle lists of level and artwork directories +// ---------------------------------------------------------------------------- TreeInfo *newTreeInfo(void) { @@ -1149,16 +1149,16 @@ TreeInfo *getFirstValidTreeInfoEntry(TreeInfo *node) 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; } @@ -1167,9 +1167,9 @@ TreeInfo *getTreeInfoFirstGroupEntry(TreeInfo *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; } @@ -1253,10 +1253,10 @@ static TreeInfo *cloneTreeNode(TreeInfo **node_top, TreeInfo *node_parent, 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, @@ -1341,11 +1341,11 @@ void sortTreeInfoBySortFunction(TreeInfo **node_first, 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; @@ -1353,21 +1353,21 @@ void sortTreeInfoBySortFunction(TreeInfo **node_first, 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) { @@ -1384,9 +1384,9 @@ void sortTreeInfo(TreeInfo **node_first) } -/* ========================================================================= */ -/* some stuff from "files.c" */ -/* ========================================================================= */ +// ============================================================================ +// some stuff from "files.c" +// ============================================================================ #if defined(PLATFORM_WIN32) #ifndef S_IRGRP @@ -1413,9 +1413,9 @@ void sortTreeInfo(TreeInfo **node_first) #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) @@ -1475,7 +1475,7 @@ char *getCommonDataDir(void) 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; @@ -1569,8 +1569,8 @@ void createDirectory(char *dir, char *text, int permission_class) 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); @@ -1585,7 +1585,7 @@ void createDirectory(char *dir, char *text, int permission_class) 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) @@ -1611,7 +1611,7 @@ char *getCookie(char *file_type) 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, @@ -1679,25 +1679,25 @@ boolean checkCookieString(const char *cookie, const char *template) } -/* ------------------------------------------------------------------------- */ -/* 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; @@ -1822,7 +1822,7 @@ unsigned int get_hash_from_key(void *key) int c; while ((c = *str++)) - hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ + hash = ((hash << 5) + hash) + c; // hash * 33 + c return hash; } @@ -1848,7 +1848,7 @@ void freeSetupFileHash(SetupFileHash *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) @@ -1868,7 +1868,7 @@ void setHashEntry(SetupFileHash *hash, char *token, char *value) 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"); @@ -1917,7 +1917,7 @@ static boolean getTokenValueFromSetupLineExt(char *line, 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); @@ -1928,7 +1928,7 @@ static boolean getTokenValueFromSetupLineExt(char *line, 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 == '#') @@ -1938,33 +1938,33 @@ static boolean getTokenValueFromSetupLineExt(char *line, } } - /* 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; @@ -1973,15 +1973,15 @@ static boolean getTokenValueFromSetupLineExt(char *line, } #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; @@ -2018,12 +2018,12 @@ static boolean getTokenValueFromSetupLineExt(char *line, } #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; @@ -2071,51 +2071,51 @@ static boolean loadSetupFileData(void *setup_file_data, char *filename, 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; @@ -2242,7 +2242,7 @@ SetupFileList *loadSetupFileList(char *filename) 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); @@ -2264,15 +2264,15 @@ SetupFileHash *loadSetupFileHash(char *filename) } -/* ========================================================================= */ -/* 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 @@ -2307,7 +2307,7 @@ static LevelDirTree ldi; 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" }, @@ -2339,7 +2339,7 @@ static struct TokenInfo levelinfo_tokens[] = 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" }, @@ -2388,8 +2388,8 @@ static void setTreeInfoToDefaults(TreeInfo *ti, int type) 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; @@ -2440,7 +2440,7 @@ static void setTreeInfoToDefaultsFromParent(TreeInfo *ti, TreeInfo *parent) return; } - /* copy all values from the parent structure */ + // copy all values from the parent structure ti->type = parent->type; @@ -2510,7 +2510,7 @@ static TreeInfo *getTreeInfoCopy(TreeInfo *ti) { TreeInfo *ti_copy = newTreeInfo(); - /* copy all values from the original structure */ + // copy all values from the original structure ti_copy->type = ti->type; @@ -2642,7 +2642,7 @@ void setSetupInfo(struct TokenInfo *token_info, 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: @@ -2787,9 +2787,9 @@ static TreeInfo *createTopTreeInfoNode(TreeInfo *node_first) } -/* -------------------------------------------------------------------------- */ -/* functions for handling level and custom artwork info cache */ -/* -------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// functions for handling level and custom artwork info cache +// ---------------------------------------------------------------------------- static void LoadArtworkInfoCache(void) { @@ -2799,10 +2799,10 @@ 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(); @@ -2835,7 +2835,7 @@ static char *getCacheTokenPrefix(char *prefix1, char *prefix2) 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; @@ -2859,7 +2859,7 @@ static boolean modifiedFileTimestamp(char *filename, char *timestamp_string) 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)); @@ -2885,14 +2885,14 @@ static TreeInfo *getArtworkInfoCacheEntry(LevelDirTree *level_node, int type) 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); } @@ -2904,14 +2904,14 @@ static TreeInfo *getArtworkInfoCacheEntry(LevelDirTree *level_node, int type) 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 ".conf" file has changed */ + // check if corresponding ".conf" file has changed token_main = getCacheToken(token_prefix, "TIMESTAMP_ARTWORKINFO"); cache_entry = getHashEntry(artworkinfo_cache_old, token_main); @@ -2977,11 +2977,11 @@ static void setArtworkInfoCacheEntry(TreeInfo *artwork_info, } -/* -------------------------------------------------------------------------- */ -/* 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, @@ -2995,7 +2995,7 @@ 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); @@ -3027,7 +3027,7 @@ static boolean LoadLevelInfoFromLevelConf(TreeInfo **node_first, 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, @@ -3043,12 +3043,12 @@ static boolean LoadLevelInfoFromLevelConf(TreeInfo **node_first, 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); @@ -3060,7 +3060,7 @@ static boolean LoadLevelInfoFromLevelConf(TreeInfo **node_first, 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()) || @@ -3078,7 +3078,7 @@ static boolean LoadLevelInfoFromLevelConf(TreeInfo **node_first, 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); @@ -3090,10 +3090,10 @@ static boolean LoadLevelInfoFromLevelConf(TreeInfo **node_first, 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); } @@ -3119,12 +3119,12 @@ static void LoadLevelInfoFromLevelDir(TreeInfo **node_first, 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, "..")) { @@ -3133,8 +3133,8 @@ static void LoadLevelInfoFromLevelDir(TreeInfo **node_first, 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); @@ -3155,10 +3155,10 @@ static void LoadLevelInfoFromLevelDir(TreeInfo **node_first, 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, "."); } @@ -3198,7 +3198,7 @@ void LoadLevelInfo(void) 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) @@ -3225,7 +3225,7 @@ static boolean LoadArtworkInfoFromArtworkConf(TreeInfo **node_first, 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; @@ -3269,9 +3269,9 @@ static boolean LoadArtworkInfoFromArtworkConf(TreeInfo **node_first, 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, @@ -3288,12 +3288,12 @@ static boolean LoadArtworkInfoFromArtworkConf(TreeInfo **node_first, 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); @@ -3302,12 +3302,12 @@ static boolean LoadArtworkInfoFromArtworkConf(TreeInfo **node_first, 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, ".")) { @@ -3322,7 +3322,7 @@ static boolean LoadArtworkInfoFromArtworkConf(TreeInfo **node_first, 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, @@ -3357,19 +3357,19 @@ static void LoadArtworkInfoFromArtworkDir(TreeInfo **node_first, 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, "..")) { @@ -3378,8 +3378,8 @@ static void LoadArtworkInfoFromArtworkDir(TreeInfo **node_first, 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); @@ -3388,7 +3388,7 @@ static void LoadArtworkInfoFromArtworkDir(TreeInfo **node_first, 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); @@ -3396,7 +3396,7 @@ static void LoadArtworkInfoFromArtworkDir(TreeInfo **node_first, 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); @@ -3407,7 +3407,7 @@ static void LoadArtworkInfoFromArtworkDir(TreeInfo **node_first, 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); @@ -3457,7 +3457,7 @@ void LoadArtworkInfo(void) 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) @@ -3508,11 +3508,11 @@ static void LoadArtworkInfoFromLevelInfo(ArtworkDirTree **artwork_node, { 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); @@ -3530,7 +3530,7 @@ static void LoadArtworkInfoFromLevelInfo(ArtworkDirTree **artwork_node, 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; @@ -3545,7 +3545,7 @@ static void LoadArtworkInfoFromLevelInfo(ArtworkDirTree **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); } @@ -3578,7 +3578,7 @@ void LoadLevelArtworkInfo(void) 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)) { @@ -3677,14 +3677,14 @@ char *getArtworkIdentifierForUserLevelSet(int type) { 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 = @@ -3806,7 +3806,7 @@ boolean CreateUserLevelSet(char *level_subdir, char *level_name, 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); @@ -3844,7 +3844,7 @@ boolean CreateUserLevelSet(char *level_subdir, char *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)) @@ -3947,10 +3947,10 @@ char *getSetupLine(struct TokenInfo *token_info, char *prefix, int token_nr) 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) @@ -3958,11 +3958,11 @@ char *getSetupLine(struct TokenInfo *token_info, char *prefix, int token_nr) 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, " "); @@ -3977,14 +3977,14 @@ char *getSetupLine(struct TokenInfo *token_info, char *prefix, int token_nr) void LoadLevelSetup_LastSeries(void) { - /* ----------------------------------------------------------------------- */ - /* ~/./levelsetup.conf */ - /* ----------------------------------------------------------------------- */ + // -------------------------------------------------------------------------- + // ~/./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)) @@ -4017,9 +4017,9 @@ void LoadLevelSetup_LastSeries(void) static void SaveLevelSetup_LastSeries_Ext(boolean deactivate_last_level_series) { - /* ----------------------------------------------------------------------- */ - /* ~/./levelsetup.conf */ - /* ----------------------------------------------------------------------- */ + // -------------------------------------------------------------------------- + // ~/./levelsetup.conf + // -------------------------------------------------------------------------- // check if the current level directory structure is available at this point if (leveldir_current == NULL) @@ -4070,7 +4070,7 @@ static void checkSeriesInfo(void) 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) : @@ -4094,7 +4094,7 @@ void LoadLevelSetup_SeriesInfo(void) 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++) @@ -4105,9 +4105,9 @@ void LoadLevelSetup_SeriesInfo(void) checkSeriesInfo(); - /* ----------------------------------------------------------------------- */ - /* ~/./levelsetup//levelsetup.conf */ - /* ----------------------------------------------------------------------- */ + // -------------------------------------------------------------------------- + // ~/./levelsetup//levelsetup.conf + // -------------------------------------------------------------------------- level_subdir = leveldir_current->subdir; @@ -4117,7 +4117,7 @@ void LoadLevelSetup_SeriesInfo(void) { 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); @@ -4131,7 +4131,7 @@ void LoadLevelSetup_SeriesInfo(void) 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); @@ -4150,7 +4150,7 @@ void LoadLevelSetup_SeriesInfo(void) 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) { @@ -4165,12 +4165,12 @@ void LoadLevelSetup_SeriesInfo(void) 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) @@ -4194,9 +4194,9 @@ void SaveLevelSetup_SeriesInfo(void) FILE *file; int i; - /* ----------------------------------------------------------------------- */ - /* ~/./levelsetup//levelsetup.conf */ - /* ----------------------------------------------------------------------- */ + // -------------------------------------------------------------------------- + // ~/./levelsetup//levelsetup.conf + // -------------------------------------------------------------------------- InitLevelSetupDirectory(level_subdir); diff --git a/src/libgame/setup.h b/src/libgame/setup.h index fdda5d5c..64f51d13 100644 --- a/src/libgame/setup.h +++ b/src/libgame/setup.h @@ -16,7 +16,7 @@ #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) @@ -31,7 +31,7 @@ #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) @@ -46,19 +46,19 @@ #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 | \ @@ -93,7 +93,7 @@ struct TokenInfo char *text; }; -/* some definitions for list and hash handling */ +// some definitions for list and hash handling typedef struct SetupFileList SetupFileList; typedef struct hashtable SetupFileHash; @@ -112,7 +112,7 @@ 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 @@ -189,7 +189,7 @@ typedef struct hashtable SetupFileHash; 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 @@ -340,4 +340,4 @@ void LevelStats_setSolved(int, int); void LevelStats_incPlayed(int); void LevelStats_incSolved(int); -#endif /* MISC_H */ +#endif // MISC_H diff --git a/src/libgame/snapshot.h b/src/libgame/snapshot.h index cd59d7e3..41fca640 100644 --- a/src/libgame/snapshot.h +++ b/src/libgame/snapshot.h @@ -18,7 +18,7 @@ #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 @@ -42,4 +42,4 @@ boolean CheckSnapshotList(void); void FreeSnapshotSingle(void); void FreeSnapshotList(void); -#endif /* SNAPSHOT_H */ +#endif // SNAPSHOT_H diff --git a/src/libgame/sound.c b/src/libgame/sound.c index 9d894b3c..ed50734b 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -27,10 +27,10 @@ #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 @@ -67,10 +67,10 @@ 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 @@ -80,9 +80,9 @@ 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; @@ -102,9 +102,9 @@ struct SoundControl 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; @@ -119,8 +119,8 @@ static int stereo_volume[SOUND_MAX_LEFT2RIGHT + 1]; 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; @@ -136,9 +136,9 @@ static SoundInfo *getSoundInfoEntryFromSoundID(int); static MusicInfo *getMusicInfoEntryFromMusicID(int); -/* ------------------------------------------------------------------------- */ -/* mixer functions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// mixer functions +// ---------------------------------------------------------------------------- void Mixer_InitChannels(void) { @@ -196,7 +196,7 @@ static void Mixer_StartChannel(int channel) 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) @@ -314,14 +314,14 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) 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(); @@ -335,12 +335,12 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) 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++) @@ -350,7 +350,7 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) 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; @@ -362,13 +362,13 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) 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; @@ -396,7 +396,7 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) 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)) { @@ -434,7 +434,7 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) 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) @@ -451,12 +451,12 @@ static void HandleSoundRequest(SoundControl snd_ctrl) { 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++) @@ -467,7 +467,7 @@ static void HandleSoundRequest(SoundControl snd_ctrl) 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)) { @@ -479,7 +479,7 @@ static void HandleSoundRequest(SoundControl 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)) { @@ -491,11 +491,11 @@ static void HandleSoundRequest(SoundControl 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); } @@ -508,19 +508,19 @@ void StartMixer(void) 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) { @@ -580,7 +580,7 @@ static void *Load_WAV_or_MOD(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; @@ -592,7 +592,7 @@ static void LoadCustomMusic_NoConf(void) 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); @@ -612,14 +612,14 @@ static void LoadCustomMusic_NoConf(void) 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); @@ -672,7 +672,7 @@ struct FileInfo *getSoundListEntry(int pos) 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] : @@ -685,7 +685,7 @@ struct FileInfo *getMusicListEntry(int 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] : @@ -701,7 +701,7 @@ static SoundInfo *getSoundInfoEntryFromSoundID(int 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]; @@ -716,12 +716,12 @@ static MusicInfo *getMusicInfoEntryFromMusicID(int 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; @@ -778,7 +778,7 @@ void InitSoundList(struct ConfigInfo *config_list, int num_file_list_entries, 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; @@ -794,7 +794,7 @@ void InitSoundList(struct ConfigInfo *config_list, int num_file_list_entries, 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++) @@ -826,7 +826,7 @@ void InitSoundList(struct ConfigInfo *config_list, int num_file_list_entries, 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 *); @@ -836,7 +836,7 @@ void InitSoundList(struct ConfigInfo *config_list, int num_file_list_entries, 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; @@ -853,7 +853,7 @@ void InitMusicList(struct ConfigInfo *config_list, int num_file_list_entries, 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; @@ -869,7 +869,7 @@ void InitMusicList(struct ConfigInfo *config_list, int num_file_list_entries, 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++) @@ -901,7 +901,7 @@ void InitMusicList(struct ConfigInfo *config_list, int num_file_list_entries, 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 *); @@ -911,7 +911,7 @@ void InitMusicList(struct ConfigInfo *config_list, int num_file_list_entries, 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; @@ -994,7 +994,7 @@ void PlaySoundExt(int nr, int volume, int stereo_position, int state) 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; @@ -1055,7 +1055,7 @@ void StopSoundExt(int nr, int state) 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; @@ -1071,7 +1071,7 @@ void ExpireSoundLoops(boolean active) 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; @@ -1090,7 +1090,7 @@ static void ReloadCustomMusic(void) 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(); } @@ -1172,5 +1172,5 @@ void FreeAllMusic(void) FreeAllMusic_NoConf(); } -/* THE STUFF ABOVE IS ONLY USED BY THE MAIN PROCESS */ -/* ========================================================================= */ +// THE STUFF ABOVE IS ONLY USED BY THE MAIN PROCESS +// ============================================================================ diff --git a/src/libgame/sound.h b/src/libgame/sound.h index cbafa9b7..deb4e38e 100644 --- a/src/libgame/sound.h +++ b/src/libgame/sound.h @@ -15,7 +15,7 @@ #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 @@ -47,7 +47,7 @@ #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) @@ -93,15 +93,15 @@ #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); diff --git a/src/libgame/system.c b/src/libgame/system.c index 63c0de47..7b67677c 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -21,12 +21,12 @@ #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; @@ -64,9 +64,9 @@ int redraw_mask = REDRAW_NONE; 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, @@ -164,11 +164,11 @@ void InitExitFunction(void (*exit_function)(int)) { 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); } @@ -212,8 +212,8 @@ void InitGfxFieldInfo(int sx, int sy, int sxsize, int sysize, 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) @@ -272,8 +272,8 @@ void InitGfxWindowInfo(int win_xsize, int win_ysize) 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; } @@ -452,7 +452,7 @@ static void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask) 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) @@ -468,32 +468,32 @@ static void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask) 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) { @@ -620,8 +620,8 @@ Bitmap *CreateBitmapStruct(void) 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); @@ -636,12 +636,12 @@ void ReCreateBitmap(Bitmap **bitmap, int width, int height) { 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); } @@ -738,7 +738,7 @@ static boolean InClippedRectangle(Bitmap *bitmap, int *x, int *y, { 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); @@ -753,7 +753,7 @@ static boolean InClippedRectangle(Bitmap *bitmap, int *x, int *y, 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 || @@ -761,7 +761,7 @@ static boolean InClippedRectangle(Bitmap *bitmap, int *x, int *y, *y >= clip_y + clip_height) return FALSE; - /* clip if rectangle overlaps bitmap */ + // clip if rectangle overlaps bitmap if (*x < clip_x) { @@ -806,17 +806,17 @@ void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap, !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) { @@ -827,14 +827,14 @@ void BlitBitmap(Bitmap *src_bitmap, 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) { @@ -894,7 +894,7 @@ void FadeRectangle(int x, int y, int width, int height, 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; @@ -945,11 +945,11 @@ void BlitBitmapOnBackground(Bitmap *src_bitmap, Bitmap *dst_bitmap, { 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); } @@ -1167,7 +1167,7 @@ void ReloadCustomImage(Bitmap *bitmap, char *basename) 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; @@ -1260,12 +1260,12 @@ static void CreateScaledBitmaps(Bitmap **bitmaps, int zoom_factor, 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 @@ -1280,10 +1280,10 @@ static void CreateScaledBitmaps(Bitmap **bitmaps, int zoom_factor, 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; @@ -1297,10 +1297,10 @@ static void CreateScaledBitmaps(Bitmap **bitmaps, int zoom_factor, 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; @@ -1316,7 +1316,7 @@ static void CreateScaledBitmaps(Bitmap **bitmaps, int zoom_factor, 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; @@ -1328,7 +1328,7 @@ static void CreateScaledBitmaps(Bitmap **bitmaps, int zoom_factor, 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 @@ -1336,7 +1336,7 @@ static void CreateScaledBitmaps(Bitmap **bitmaps, int zoom_factor, 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 @@ -1344,7 +1344,7 @@ static void CreateScaledBitmaps(Bitmap **bitmaps, int zoom_factor, 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 @@ -1352,7 +1352,7 @@ static void CreateScaledBitmaps(Bitmap **bitmaps, int zoom_factor, 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 @@ -1360,7 +1360,7 @@ static void CreateScaledBitmaps(Bitmap **bitmaps, int zoom_factor, 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 @@ -1391,7 +1391,7 @@ static void CreateScaledBitmaps(Bitmap **bitmaps, int zoom_factor, 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); @@ -1430,24 +1430,24 @@ void ScaleBitmap(Bitmap **bitmaps, int zoom_factor) } -/* ------------------------------------------------------------------------- */ -/* 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 " ", " ", " ", @@ -1465,22 +1465,22 @@ static const char *cursor_image_none[] = " ", " ", - /* 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 ", @@ -1498,7 +1498,7 @@ static const char *cursor_image_dot[] = " ", " ", - /* hot spot */ + // hot spot "1,1" }; static const char **cursor_image_playfield = cursor_image_dot; @@ -1579,13 +1579,13 @@ void SetMouseCursor(int mode) } -/* ========================================================================= */ -/* 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; @@ -1621,9 +1621,9 @@ void SetAudioMode(boolean enabled) } -/* ========================================================================= */ -/* event functions */ -/* ========================================================================= */ +// ============================================================================ +// event functions +// ============================================================================ boolean PendingEvent(void) { @@ -1653,7 +1653,7 @@ void CheckQuitEvent(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 @@ -1678,7 +1678,7 @@ KeyMod HandleKeyModState(Key key, int key_status) { 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; @@ -1774,26 +1774,26 @@ boolean CheckCloseWindowEvent(ClientMessageEvent *event) 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(); } diff --git a/src/libgame/system.h b/src/libgame/system.h index 711b2273..be48d889 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -27,7 +27,7 @@ #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" @@ -39,11 +39,11 @@ #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 @@ -52,14 +52,14 @@ #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" @@ -82,7 +82,7 @@ #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" @@ -95,11 +95,11 @@ #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" @@ -118,7 +118,7 @@ #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 @@ -126,7 +126,7 @@ #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 @@ -141,7 +141,7 @@ #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 @@ -164,7 +164,7 @@ #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 @@ -192,12 +192,12 @@ #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 @@ -225,7 +225,7 @@ (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 @@ -233,7 +233,7 @@ #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 @@ -241,27 +241,27 @@ #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) @@ -316,8 +316,8 @@ (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) @@ -330,8 +330,8 @@ #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) @@ -341,19 +341,19 @@ #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) @@ -366,10 +366,10 @@ #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) @@ -392,7 +392,7 @@ #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 @@ -404,7 +404,7 @@ #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) @@ -422,7 +422,7 @@ #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) @@ -448,39 +448,39 @@ #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 @@ -510,7 +510,7 @@ #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 '>' @@ -533,38 +533,38 @@ 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 @@ -576,7 +576,7 @@ #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" @@ -602,7 +602,7 @@ #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" @@ -653,16 +653,16 @@ #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) @@ -677,7 +677,7 @@ #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) @@ -690,7 +690,7 @@ #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()) @@ -702,7 +702,7 @@ #endif -/* values for artwork type */ +// values for artwork type #define ARTWORK_TYPE_GRAPHICS 0 #define ARTWORK_TYPE_SOUNDS 1 #define ARTWORK_TYPE_MUSIC 2 @@ -710,7 +710,7 @@ #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 @@ -739,7 +739,7 @@ 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 : \ @@ -841,19 +841,19 @@ } -/* 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; @@ -863,9 +863,9 @@ struct ProgramInfo 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; @@ -959,7 +959,7 @@ struct AudioSystemInfo 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; @@ -975,14 +975,14 @@ struct FontBitmapInfo { 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; @@ -1055,21 +1055,21 @@ struct GfxInfo 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; @@ -1085,12 +1085,12 @@ struct OverlayInfo 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; @@ -1114,7 +1114,7 @@ struct SetupTouchInfo 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; @@ -1301,9 +1301,9 @@ struct SetupInfo 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; @@ -1328,69 +1328,69 @@ struct SetupInfo 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; @@ -1452,8 +1452,8 @@ struct FileInfo 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; @@ -1470,7 +1470,7 @@ struct SetupFileList struct ListNodeInfo { - char *source_filename; /* primary key for node list */ + char *source_filename; // primary key for node list int num_references; }; @@ -1486,39 +1486,39 @@ struct PropertyMapping 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 @@ -1568,25 +1568,25 @@ struct DoorPartPosInfo 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 @@ -1611,9 +1611,9 @@ struct LevelStats }; -/* ========================================================================= */ -/* exported variables */ -/* ========================================================================= */ +// ============================================================================ +// exported variables +// ============================================================================ extern struct ProgramInfo program; extern struct NetworkInfo network; @@ -1652,7 +1652,7 @@ extern int redraw_mask; extern int FrameCounter; -/* function definitions */ +// function definitions void InitProgramInfo(char *, char *, char *, char *, char *, char *, char *, char *, int); @@ -1774,4 +1774,4 @@ boolean ReadJoystick(int, int *, int *, boolean *, boolean *); boolean CheckJoystickOpened(int); void ClearJoystickState(void); -#endif /* SYSTEM_H */ +#endif // SYSTEM_H diff --git a/src/libgame/text.c b/src/libgame/text.c index 0974481a..c7c5f45b 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -16,9 +16,9 @@ #include "misc.h" -/* ========================================================================= */ -/* font functions */ -/* ========================================================================= */ +// ============================================================================ +// font functions +// ============================================================================ void InitFontInfo(struct FontBitmapInfo *font_bitmap_info, int num_fonts, int (*select_font_function)(int), @@ -85,11 +85,11 @@ static int getFontCharPosition(int font_nr, char c) 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; @@ -110,9 +110,9 @@ void getFontCharSource(int font_nr, char c, Bitmap **bitmap, int *x, int *y) } -/* ========================================================================= */ -/* text string helper functions */ -/* ========================================================================= */ +// ============================================================================ +// text string helper functions +// ============================================================================ int maxWordLengthInRequestString(char *text) { @@ -132,9 +132,9 @@ int maxWordLengthInRequestString(char *text) } -/* ========================================================================= */ -/* simple text drawing functions */ -/* ========================================================================= */ +// ============================================================================ +// simple text drawing functions +// ============================================================================ void DrawInitText(char *text, int ypos, int font_nr) { @@ -247,11 +247,11 @@ void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text, 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; @@ -260,11 +260,11 @@ void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text, 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; @@ -272,14 +272,14 @@ void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text, 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; @@ -291,7 +291,7 @@ void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text, 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); } @@ -299,7 +299,7 @@ void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text, { 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); } @@ -307,7 +307,7 @@ void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text, 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); @@ -318,9 +318,9 @@ void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text, } -/* ========================================================================= */ -/* text buffer drawing functions */ -/* ========================================================================= */ +// ============================================================================ +// text buffer drawing functions +// ============================================================================ #define MAX_LINES_FROM_FILE 1024 @@ -336,13 +336,13 @@ char *GetTextBufferFromFile(char *filename, int max_lines) 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; @@ -372,14 +372,14 @@ static boolean RenderLineToBuffer(char **src_buffer_ptr, char *dst_buffer, 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++; @@ -390,18 +390,18 @@ static boolean RenderLineToBuffer(char **src_buffer_ptr, char *dst_buffer, { 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++] = ' '; @@ -413,13 +413,13 @@ static boolean RenderLineToBuffer(char **src_buffer_ptr, char *dst_buffer, } 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'; @@ -445,14 +445,14 @@ static boolean getCheckedTokenValueFromString(char *string, char **token, 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; @@ -514,25 +514,25 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr, 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, @@ -561,7 +561,7 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr, 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') @@ -571,7 +571,7 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr, } } - if (strlen(line) == 0) /* special case: force empty line */ + if (strlen(line) == 0) // special case: force empty line strcpy(line, "\n"); line_ptr = line; diff --git a/src/libgame/text.h b/src/libgame/text.h index cfc9e3f1..24c1fd1f 100644 --- a/src/libgame/text.h +++ b/src/libgame/text.h @@ -15,22 +15,22 @@ #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) @@ -43,7 +43,7 @@ #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) @@ -67,13 +67,13 @@ (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 *)); @@ -110,4 +110,4 @@ int DrawTextBufferVA(int, int, char *, va_list, int, int, int, int, int, int, int DrawTextFile(int, int, char *, int, int, int, int, int, int, boolean, boolean, boolean); -#endif /* TEXT_H */ +#endif // TEXT_H diff --git a/src/libgame/types.h b/src/libgame/types.h index 94fd58b6..646bb3e9 100644 --- a/src/libgame/types.h +++ b/src/libgame/types.h @@ -76,4 +76,4 @@ struct ListNode }; typedef struct ListNode ListNode; -#endif /* TYPES_H */ +#endif // TYPES_H diff --git a/src/libgame/windows.h b/src/libgame/windows.h index faf9deac..4965e134 100644 --- a/src/libgame/windows.h +++ b/src/libgame/windows.h @@ -12,13 +12,13 @@ #ifndef WINDOWS_H #define WINDOWS_H -/* prevent including lots of conflicting macros */ +// prevent including lots of conflicting macros #define WIN32_LEAN_AND_MEAN #include -/* some symbols are already defined on Windows */ +// some symbols are already defined on Windows typedef int boolean_internal; #define boolean boolean_internal @@ -42,4 +42,4 @@ typedef int boolean_internal; #define DrawText DrawText_internal #endif -#endif /* WINDOWS_H */ +#endif // WINDOWS_H diff --git a/src/main.c b/src/main.c index 0e266755..48b5d577 100644 --- a/src/main.c +++ b/src/main.c @@ -186,20 +186,20 @@ SetupFileHash *font_token_hash = NULL; 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", @@ -6271,9 +6271,9 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = "wooden wall (DF style)", }, - /* ----------------------------------------------------------------------- */ - /* "real" (and therefore drawable) runtime elements */ - /* ----------------------------------------------------------------------- */ + // -------------------------------------------------------------------------- + // "real" (and therefore drawable) runtime elements + // -------------------------------------------------------------------------- { "dynabomb_player_1.active", @@ -6682,9 +6682,9 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = "pac man (eating down)" }, - /* ----------------------------------------------------------------------- */ - /* "unreal" (and therefore not drawable) runtime elements */ - /* ----------------------------------------------------------------------- */ + // -------------------------------------------------------------------------- + // "unreal" (and therefore not drawable) runtime elements + // -------------------------------------------------------------------------- { "blocked", @@ -6807,9 +6807,9 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = "-" }, - /* ----------------------------------------------------------------------- */ - /* dummy elements (never used as game elements, only used as graphics) */ - /* ----------------------------------------------------------------------- */ + // -------------------------------------------------------------------------- + // dummy elements (never used as game elements, only used as graphics) + // -------------------------------------------------------------------------- { "steelwall_topleft", @@ -7237,7 +7237,7 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = "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, @@ -7247,9 +7247,9 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = }; -/* ------------------------------------------------------------------------- */ -/* element action and direction definitions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// element action and direction definitions +// ---------------------------------------------------------------------------- struct ElementActionInfo element_action_info[NUM_ACTIONS + 1 + 1] = { @@ -7372,7 +7372,7 @@ 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 } @@ -7431,18 +7431,18 @@ struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] = { ".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! @@ -7499,10 +7499,10 @@ struct FontInfo font_info[NUM_FONTS + 1] = 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", }, @@ -7536,7 +7536,7 @@ struct GlobalAnimNameInfo global_anim_name_info[NUM_GLOBAL_ANIM_TOKENS + 1] = { "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", }, @@ -7574,9 +7574,9 @@ struct GlobalAnimNameInfo global_anim_name_info[NUM_GLOBAL_ANIM_TOKENS + 1] = }; -/* ------------------------------------------------------------------------- */ -/* music token prefix definitions */ -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- +// music token prefix definitions +// ---------------------------------------------------------------------------- struct MusicPrefixInfo music_prefix_info[NUM_MUSIC_PREFIXES + 1] = { @@ -7586,9 +7586,9 @@ struct MusicPrefixInfo music_prefix_info[NUM_MUSIC_PREFIXES + 1] = }; -/* ========================================================================= */ -/* main() */ -/* ========================================================================= */ +// ============================================================================ +// main() +// ============================================================================ static void print_usage(void) { @@ -7762,5 +7762,5 @@ int main(int argc, char *argv[]) EventLoop(); CloseAllAndExit(0); - return 0; /* to keep compilers happy */ + return 0; // to keep compilers happy } diff --git a/src/main.h b/src/main.h index 77430622..d17064c6 100644 --- a/src/main.h +++ b/src/main.h @@ -26,9 +26,9 @@ #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) @@ -81,8 +81,8 @@ #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 @@ -116,8 +116,8 @@ #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 @@ -146,13 +146,13 @@ #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 @@ -177,18 +177,18 @@ #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 @@ -207,7 +207,7 @@ (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 @@ -276,7 +276,7 @@ #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) @@ -289,7 +289,7 @@ #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 @@ -302,7 +302,7 @@ #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 @@ -310,11 +310,11 @@ #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 @@ -324,7 +324,7 @@ #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 @@ -332,11 +332,11 @@ #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 @@ -344,7 +344,7 @@ #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 @@ -373,7 +373,7 @@ #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 @@ -382,7 +382,7 @@ #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 @@ -483,7 +483,7 @@ #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 @@ -499,7 +499,7 @@ #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) @@ -516,7 +516,7 @@ #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) @@ -526,23 +526,23 @@ #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) @@ -576,13 +576,13 @@ #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) @@ -611,7 +611,7 @@ #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) @@ -651,7 +651,7 @@ #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) @@ -805,7 +805,7 @@ #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 && \ @@ -818,8 +818,8 @@ 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 @@ -928,11 +928,11 @@ #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 @@ -956,16 +956,16 @@ #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 @@ -989,14 +989,14 @@ #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 @@ -1014,10 +1014,10 @@ #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 @@ -1026,10 +1026,10 @@ #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 @@ -1149,13 +1149,13 @@ #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) @@ -1171,9 +1171,9 @@ #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) @@ -1269,7 +1269,7 @@ #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 @@ -1340,14 +1340,14 @@ #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 @@ -1358,20 +1358,20 @@ #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 @@ -1381,7 +1381,7 @@ #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 @@ -1456,7 +1456,7 @@ #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) @@ -1892,7 +1892,7 @@ #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) @@ -1982,7 +1982,7 @@ #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) @@ -2012,7 +2012,7 @@ #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) @@ -2066,7 +2066,7 @@ #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) @@ -2117,7 +2117,7 @@ #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 @@ -2243,7 +2243,7 @@ #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 @@ -2283,7 +2283,7 @@ #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 @@ -2295,9 +2295,9 @@ #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 @@ -2318,7 +2318,7 @@ #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 @@ -2385,7 +2385,7 @@ #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 @@ -2393,13 +2393,13 @@ #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 @@ -2447,10 +2447,10 @@ #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) @@ -2465,11 +2465,11 @@ #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 @@ -2509,16 +2509,16 @@ #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 @@ -2567,13 +2567,13 @@ 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 @@ -2586,7 +2586,7 @@ #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 @@ -2595,7 +2595,7 @@ #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) @@ -2996,23 +2996,23 @@ struct LevelInfo 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; @@ -3056,7 +3056,7 @@ struct LevelInfo 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; @@ -3075,35 +3075,35 @@ struct LevelInfo 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; @@ -3111,33 +3111,33 @@ struct LevelInfo 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 @@ -3157,10 +3157,10 @@ 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; @@ -3169,40 +3169,40 @@ struct GlobalInfo 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 */ @@ -3210,247 +3210,247 @@ struct ElementChangeInfo 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; @@ -3460,7 +3460,7 @@ struct GraphicInfo 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 @@ -3699,4 +3699,4 @@ extern struct ConfigInfo music_config[]; extern struct ConfigInfo helpanim_config[]; extern struct ConfigInfo helptext_config[]; -#endif /* MAIN_H */ +#endif // MAIN_H diff --git a/src/netserv.c b/src/netserv.c index 4c09803f..a2325b14 100644 --- a/src/netserv.c +++ b/src/netserv.c @@ -40,10 +40,10 @@ static struct NetworkServerPlayerInfo *first_player = NULL; #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; @@ -140,7 +140,7 @@ void initNetworkBufferForReading(struct NetworkBuffer *nb) { resetNetworkBufferForReading(nb); - /* skip message length header */ + // skip message length header getNetworkBuffer32BitInteger(nb); } @@ -149,7 +149,7 @@ void initNetworkBufferForWriting(struct NetworkBuffer *nb, int message_type, { 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); @@ -164,7 +164,7 @@ static void copyNetworkBufferForWriting(struct NetworkBuffer *nb_from, int message_type = getNetworkBuffer8BitInteger(nb_from); - /* skip player number */ + // skip player number getNetworkBuffer8BitInteger(nb_from); initNetworkBufferForWriting(nb_to, message_type, player_nr); @@ -179,7 +179,7 @@ static void copyNetworkBufferForWriting(struct NetworkBuffer *nb_from, 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); } @@ -351,7 +351,7 @@ int putNetworkBufferFile(struct NetworkBuffer *nb, char *filename) 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))) @@ -375,7 +375,7 @@ int putNetworkBufferFile(struct NetworkBuffer *nb, char *filename) closeFile(file); - /* set file size */ + // set file size putNetwork32BitInteger(&nb->buffer[filesize_pos], num_bytes); return num_bytes; @@ -405,14 +405,14 @@ static void SendNetworkBufferToAllButOne(struct NetworkBuffer *nb, { 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); } } @@ -426,10 +426,10 @@ static void SendNetworkBufferToAll(struct NetworkBuffer *nb) 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); } @@ -472,7 +472,7 @@ static void RemovePlayer(struct NetworkServerPlayerInfo *player) 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) @@ -695,12 +695,12 @@ static void Handle_OP_START_PLAYING(struct NetworkServerPlayerInfo *player) 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; @@ -757,7 +757,7 @@ static void Handle_OP_MOVE_PLAYER(struct NetworkServerPlayerInfo *player) 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) @@ -767,7 +767,7 @@ static void Handle_OP_MOVE_PLAYER(struct NetworkServerPlayerInfo *player) } } - /* 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) @@ -779,11 +779,11 @@ static void Handle_OP_MOVE_PLAYER(struct NetworkServerPlayerInfo *player) 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; @@ -837,7 +837,7 @@ int NetworkServerThread(void *ptr) { NetworkServer(*((int *) ptr), 0); - /* should never be reached */ + // should never be reached return 0; } @@ -916,7 +916,7 @@ void NetworkServer(int port, int serveronly) 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"); @@ -929,7 +929,7 @@ void NetworkServer(int port, int serveronly) AddPlayer(newsock); } - /* accept incoming UDP packets */ + // accept incoming UDP packets if (SDLNet_SocketReady(udp)) { Error(ERR_DEBUG, "got UDP packet"); @@ -969,7 +969,7 @@ void NetworkServer(int port, int serveronly) int message_type = getNetworkBuffer8BitInteger(read_buffer); - /* skip player number */ + // skip player number getNetworkBuffer8BitInteger(read_buffer); if (!player->introduced && diff --git a/src/network.c b/src/network.c index 1d263b5a..2730c7b0 100644 --- a/src/network.c +++ b/src/network.c @@ -38,11 +38,11 @@ static struct NetworkClientPlayerInfo first_player = 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; @@ -82,7 +82,7 @@ static void DrawNetworkTextExt(char *message, int font_nr, boolean initialize) 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; @@ -135,10 +135,10 @@ static void SendNetworkBufferToServer(struct NetworkBuffer *nb) 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); } @@ -150,7 +150,7 @@ static struct NetworkClientPlayerInfo *getNetworkPlayer(int player_nr) 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); @@ -235,7 +235,7 @@ boolean ConnectToServer(char *hostname, int port) 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 = @@ -252,7 +252,7 @@ boolean ConnectToServer(char *hostname, int port) 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) @@ -322,7 +322,7 @@ boolean ConnectToServer(char *hostname, int port) // 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 ..."); } @@ -361,17 +361,17 @@ boolean ConnectToServer(char *hostname, int port) 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!"); @@ -385,7 +385,7 @@ boolean ConnectToServer(char *hostname, int port) 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; } @@ -442,7 +442,7 @@ void SendToServer_LevelFile(void) 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 @@ -539,7 +539,7 @@ static void Handle_OP_YOUR_NUMBER(void) 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; @@ -571,19 +571,19 @@ static void Handle_OP_NUMBER_WANTED(void) 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; @@ -592,7 +592,7 @@ static void Handle_OP_NUMBER_WANTED(void) 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; @@ -600,7 +600,7 @@ static void Handle_OP_NUMBER_WANTED(void) 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]; @@ -726,7 +726,7 @@ static void Handle_OP_START_PLAYING(void) 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(); @@ -822,7 +822,7 @@ static void Handle_OP_MOVE_PLAYER(void) 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); @@ -892,7 +892,7 @@ static void Handle_OP_LEVEL_FILE(void) 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 @@ -978,7 +978,7 @@ static void HandleNetworkingMessage(void) 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); } @@ -987,7 +987,7 @@ static char *HandleNetworkingPackets(void) { while (1) { - /* ---------- check network server for activity ---------- */ + // ---------- check network server for activity ---------- int num_active_sockets = SDLNet_CheckSockets(rfds, 0); @@ -997,7 +997,7 @@ static char *HandleNetworkingPackets(void) if (num_active_sockets == 0) break; // no active sockets, stop here - /* ---------- read packets from network server ---------- */ + // ---------- read packets from network server ---------- initNetworkBufferForReceiving(read_buffer); @@ -1054,7 +1054,7 @@ static void HandleNetworkingDisconnect(void) 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; diff --git a/src/screens.c b/src/screens.c index 3c12d6b5..f5ffa0c5 100644 --- a/src/screens.c +++ b/src/screens.c @@ -27,7 +27,7 @@ #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 @@ -39,9 +39,9 @@ #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 @@ -57,11 +57,11 @@ #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 @@ -89,7 +89,7 @@ #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" @@ -121,7 +121,7 @@ #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 @@ -132,7 +132,7 @@ #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) @@ -171,7 +171,7 @@ #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 @@ -194,7 +194,7 @@ #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 @@ -221,7 +221,7 @@ #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); @@ -525,7 +525,7 @@ static struct ValueTextInfo grid_sizes_list[] = (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) @@ -584,7 +584,7 @@ static struct ValueTextInfo grid_sizes_list[] = 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) @@ -605,7 +605,7 @@ struct TitleControlInfo 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 @@ -725,7 +725,7 @@ static struct MainControlInfo main_controls[] = 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, @@ -1013,7 +1013,7 @@ static void InitializeTitleControlsExt_AddTitleInfo(boolean is_image, 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++; } @@ -1047,18 +1047,18 @@ static void InitializeTitleControls(boolean show_title_initial) { 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; } @@ -1077,7 +1077,7 @@ static void InitializeMainControls(void) 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, @@ -1096,7 +1096,7 @@ static void InitializeMainControls(void) 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]; @@ -1132,15 +1132,15 @@ static void InitializeMainControls(void) 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) @@ -1158,7 +1158,7 @@ static void InitializeMainControls(void) } } - 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)) { @@ -1240,7 +1240,7 @@ static void DrawCursorAndText_Main_Ext(int nr, boolean active_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); @@ -1253,7 +1253,7 @@ static void DrawCursorAndText_Main_Ext(int nr, boolean active_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); @@ -1352,11 +1352,11 @@ static void clearMenuListArea(void) { 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); } @@ -1423,19 +1423,19 @@ static void DrawTitleScreenImage(int nr, boolean initial) 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; @@ -1460,34 +1460,34 @@ static void DrawTitleScreenMessage(int nr, boolean initial) 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); @@ -1515,13 +1515,13 @@ static boolean CheckTitleScreen(boolean levelset_has_changed) 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); @@ -1537,7 +1537,7 @@ void DrawMainMenu(void) 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(); @@ -1550,7 +1550,7 @@ void DrawMainMenu(void) 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); @@ -1562,23 +1562,23 @@ void DrawMainMenu(void) 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)) @@ -1598,12 +1598,12 @@ void DrawMainMenu(void) 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; @@ -1640,20 +1640,20 @@ void DrawMainMenu(void) 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); @@ -1664,7 +1664,7 @@ void DrawMainMenu(void) FadeIn(fade_mask); FadeSetEnterMenu(); - /* update screen area with special editor door */ + // update screen area with special editor door redraw_mask |= REDRAW_ALL; BackToFront(); @@ -1675,11 +1675,11 @@ void DrawMainMenu(void) 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); @@ -1727,7 +1727,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) { FadeSetEnterScreen(); - /* use individual title fading instead of global "enter screen" fading */ + // use individual title fading instead of global "enter screen" fading fading = getTitleFading(tci); } @@ -1735,10 +1735,10 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) { 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:", @@ -1751,10 +1751,10 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) 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) @@ -1777,7 +1777,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) FadeIn(REDRAW_ALL); - DelayReached(&title_delay, 0); /* reset delay counter */ + DelayReached(&title_delay, 0); // reset delay counter return; } @@ -1840,7 +1840,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) FadeIn(REDRAW_ALL); - DelayReached(&title_delay, 0); /* reset delay counter */ + DelayReached(&title_delay, 0); // reset delay counter } else { @@ -1854,7 +1854,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) { 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) @@ -1865,7 +1865,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) DrawInfoScreen(); } - else /* default: return to main menu */ + else // default: return to main menu { SetGameStatus(GAME_MODE_MAIN); @@ -1892,7 +1892,7 @@ static void HandleMainMenu_SelectLevel(int step, int direction, 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)) { @@ -1926,9 +1926,9 @@ static void HandleMainMenu_SelectLevel(int step, int direction, UpdateScreenMenuGadgets(SCREEN_MASK_MAIN_HAS_SOLUTION, hasSolutionTape()); - /* needed because DrawPreviewLevelInitial() takes some time */ + // needed because DrawPreviewLevelInitial() takes some time BackToFront(); - /* SyncDisplay(); */ + // SyncDisplay(); } } @@ -1947,7 +1947,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) return; } - if (mx || my) /* mouse input */ + if (mx || my) // mouse input { pos = -1; @@ -1963,7 +1963,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) } } - /* check if level preview was clicked */ + // check if level preview was clicked if (insidePreviewRect(&preview, mx - SX, my - SY)) pos = MAIN_CONTROL_GAME; @@ -1984,7 +1984,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) 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)) @@ -2117,13 +2117,13 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) } -/* ========================================================================= */ -/* 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) { @@ -2273,7 +2273,7 @@ static void drawMenuInfoList(int first_entry, int num_page_entries, 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) || @@ -2333,14 +2333,14 @@ static void DrawInfoScreen_Main(void) 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); @@ -2386,8 +2386,8 @@ static void HandleMenuScreen(int mx, int my, int dx, int dy, int button, 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; @@ -2410,7 +2410,7 @@ static void HandleMenuScreen(int mx, int my, int dx, int dy, int button, 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++; @@ -2458,28 +2458,28 @@ static void HandleMenuScreen(int mx, int my, int dx, int dy, int button, 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) { @@ -2490,7 +2490,7 @@ static void HandleMenuScreen(int mx, int my, int dx, int dy, int button, if (dy < 0 && first_entry > 0) { - /* scroll page/line up */ + // scroll page/line up first_entry -= step; if (first_entry < 0) @@ -2500,7 +2500,7 @@ static void HandleMenuScreen(int mx, int my, int dx, int dy, int button, } 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) @@ -2563,7 +2563,7 @@ static void HandleMenuScreen(int mx, int my, int dx, int dy, int button, 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) @@ -2633,7 +2633,7 @@ static void HandleMenuScreen(int mx, int my, int dx, int dy, int button, menu_callback_function(); - /* absolutely needed because function changes 'menu_info'! */ + // absolutely needed because function changes 'menu_info'! break; } } @@ -2645,17 +2645,17 @@ static void HandleMenuScreen(int mx, int my, int dx, int dy, int button, { 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--; @@ -2884,22 +2884,22 @@ void DrawInfoScreen_HelpText(int element, int action, int direction, int ypos) 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, @@ -3799,29 +3799,29 @@ static void DrawInfoScreen_LevelSet(void) 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 @@ -3909,9 +3909,9 @@ void HandleInfoScreen(int mx, int my, int dx, int dy, int button) } -/* ========================================================================= */ -/* type name functions */ -/* ========================================================================= */ +// ============================================================================ +// type name functions +// ============================================================================ void HandleTypeName(int newxpos, Key key) { @@ -3988,9 +3988,9 @@ void HandleTypeName(int newxpos, Key key) } -/* ========================================================================= */ -/* tree menu functions */ -/* ========================================================================= */ +// ============================================================================ +// tree menu functions +// ============================================================================ static void DrawChooseTree(TreeInfo **ti_ptr) { @@ -4015,7 +4015,7 @@ 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) @@ -4115,7 +4115,7 @@ static void drawChooseTreeInfo(int entry_pos, TreeInfo *ti) 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); @@ -4144,7 +4144,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, 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; } @@ -4152,7 +4152,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, (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; } @@ -4224,21 +4224,21 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, 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) { @@ -4249,7 +4249,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, if (dy < 0 && ti->cl_first > 0) { - /* scroll page/line up */ + // scroll page/line up ti->cl_first -= step; if (ti->cl_first < 0) @@ -4259,7 +4259,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, } 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) @@ -4281,7 +4281,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, return; } - /* handle moving cursor one line */ + // handle moving cursor one line y = ti->cl_cursor + dy; } @@ -4488,7 +4488,7 @@ void DrawChooseLevelNr(void) 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; @@ -4508,14 +4508,14 @@ void DrawChooseLevelNr(void) 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; @@ -4539,10 +4539,10 @@ void DrawHallOfFame(int level_nr, int highlight_position) 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); @@ -4555,7 +4555,7 @@ void DrawHallOfFame(int level_nr, int highlight_position) FadeOut(fade_mask); - /* needed if different viewport properties defined for scores */ + // needed if different viewport properties defined for scores ChangeViewportPropertiesIfNeeded(); PlayMenuSoundsAndMusic(); @@ -4629,7 +4629,7 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) 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) @@ -4680,13 +4680,13 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) } -/* ========================================================================= */ -/* 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; @@ -4753,7 +4753,7 @@ static void execSetupGame_setGameSpeeds(boolean update_value) 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; @@ -4761,16 +4761,16 @@ static void execSetupGame_setGameSpeeds(boolean update_value) 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; @@ -4782,7 +4782,7 @@ static void execSetupGame_setGameSpeeds(boolean update_value) 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; } @@ -4813,26 +4813,26 @@ static void execSetupGame_setScrollDelays(void) 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; } @@ -4863,26 +4863,26 @@ static void execSetupGame_setSnapshotModes(void) 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; } @@ -4899,7 +4899,7 @@ static void execSetupGame_setNetworkServerText(void) 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; } @@ -5010,28 +5010,28 @@ static void execSetupGraphics_setWindowSizes(boolean update_list) 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; } @@ -5062,26 +5062,26 @@ static void execSetupGraphics_setScalingTypes(void) 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; } @@ -5112,27 +5112,27 @@ static void execSetupGraphics_setRenderingModes(void) 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; } @@ -5163,7 +5163,7 @@ static void execSetupGraphics_setVsyncModes(boolean update_value) 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; @@ -5171,23 +5171,23 @@ static void execSetupGraphics_setVsyncModes(boolean update_value) 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; } @@ -5334,19 +5334,19 @@ static void execSetupSound(void) 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; } @@ -5402,19 +5402,19 @@ static void execSetupSound(void) 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; } @@ -5470,19 +5470,19 @@ static void execSetupSound(void) 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; } @@ -5491,7 +5491,7 @@ static void execSetupSound(void) 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; @@ -5595,19 +5595,19 @@ static void execSetupTouch(void) 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; } @@ -5635,21 +5635,21 @@ static void execSetupTouch(void) 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; } @@ -5677,21 +5677,21 @@ static void execSetupTouch(void) 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; } @@ -5719,21 +5719,21 @@ static void execSetupTouch(void) 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; } @@ -5772,17 +5772,17 @@ static void execSetupTouch(void) 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], @@ -5790,7 +5790,7 @@ static void execSetupTouch(void) 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]; } @@ -5814,7 +5814,7 @@ static void execSetupTouch(void) } } - /* 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; @@ -5842,10 +5842,10 @@ static void execSetupArtwork(void) 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; @@ -5994,7 +5994,7 @@ static void ToggleGameSpeedsListIfNeeded(void) 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 : @@ -6029,7 +6029,7 @@ static void ModifyGameSpeedIfNeeded(void) 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); @@ -6044,7 +6044,7 @@ static void DisableVsyncIfNeeded(void) 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); @@ -6491,9 +6491,9 @@ static Key getSetupKey(void) { 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; } @@ -6618,13 +6618,13 @@ static void drawSetupValue(int screen_pos, int setup_info_pos_raw) } } - /* 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; @@ -6641,8 +6641,8 @@ static void drawSetupValue(int screen_pos, int setup_info_pos_raw) 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; @@ -6745,21 +6745,21 @@ static struct TokenInfo *getSetupInfoFinal(struct TokenInfo *setup_info_orig) 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; @@ -6791,7 +6791,7 @@ static void DrawSetupScreen_Generic(void) 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); @@ -6871,7 +6871,7 @@ static void DrawSetupScreen_Generic(void) 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); @@ -6930,11 +6930,11 @@ static void DrawSetupScreen_Input(void) 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); @@ -7095,7 +7095,7 @@ void HandleSetupScreen_Input(int mx, int my, int dx, int dy, int button) 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--; @@ -7106,7 +7106,7 @@ void HandleSetupScreen_Input(int mx, int my, int dx, int dy, int button) 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; @@ -7125,12 +7125,12 @@ void HandleSetupScreen_Input(int mx, int my, int dx, int dy, int button) 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); @@ -7239,7 +7239,7 @@ static boolean CustomizeKeyboardMain(int player_nr) 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(); @@ -7271,7 +7271,7 @@ static boolean CustomizeKeyboardMain(int player_nr) { 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(); @@ -7281,18 +7281,18 @@ static boolean CustomizeKeyboardMain(int player_nr) 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); @@ -7300,13 +7300,13 @@ static boolean CustomizeKeyboardMain(int player_nr) 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; @@ -7315,7 +7315,7 @@ static boolean CustomizeKeyboardMain(int player_nr) 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, @@ -7339,7 +7339,7 @@ static boolean CustomizeKeyboardMain(int player_nr) 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; @@ -7375,7 +7375,7 @@ void CustomizeKeyboard(int player_nr) DrawSetupScreen_Input(); } -/* game controller mapping generator by Gabriel Jacobo */ +// game controller mapping generator by Gabriel Jacobo #define MARKER_BUTTON 1 #define MARKER_AXIS_X 2 @@ -7455,7 +7455,7 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) 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", @@ -7463,16 +7463,16 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) 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); @@ -7649,7 +7649,7 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) case SDL_FINGERDOWN: case SDL_MOUSEBUTTONDOWN: - /* skip this step */ + // skip this step i++; next = TRUE; @@ -7661,14 +7661,14 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) { 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--; @@ -7681,7 +7681,7 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) event.key.keysym.sym == KSYM_Return || event.key.keysym.sym == KSYM_Menu) { - /* skip this step */ + // skip this step i++; next = TRUE; @@ -7690,7 +7690,7 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) if (event.key.keysym.sym == KSYM_Escape) { - /* leave screen */ + // leave screen success = FALSE; done = TRUE; } @@ -7725,7 +7725,7 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick) 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; @@ -7879,7 +7879,7 @@ static boolean ConfigureVirtualButtonsMain(void) { 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++) @@ -7893,7 +7893,7 @@ static boolean ConfigureVirtualButtonsMain(void) 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 || @@ -7925,7 +7925,7 @@ static boolean ConfigureVirtualButtonsMain(void) break; } - /* all virtual buttons configured */ + // all virtual buttons configured if (step_nr == 6) { finished = TRUE; @@ -7940,7 +7940,7 @@ static boolean ConfigureVirtualButtonsMain(void) overlay.grid_button_highlight = grid_button[step_nr]; - /* query next virtual button */ + // query next virtual button ClearField(); @@ -8225,14 +8225,14 @@ void HandleGameActions(void) 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) { @@ -8336,13 +8336,13 @@ static struct { { 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" } @@ -8360,8 +8360,8 @@ static struct { { 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" @@ -8381,7 +8381,7 @@ static struct { 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" @@ -8459,7 +8459,7 @@ static void CreateScreenScrollbuttons(void) 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; @@ -8480,7 +8480,7 @@ static void CreateScreenScrollbuttons(void) 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; @@ -8525,7 +8525,7 @@ static void CreateScreenScrollbars(void) { 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; @@ -8550,7 +8550,7 @@ static void CreateScreenScrollbars(void) 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; diff --git a/src/screens.h b/src/screens.h index eb9da595..256fddb0 100644 --- a/src/screens.h +++ b/src/screens.h @@ -14,7 +14,7 @@ #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) @@ -45,4 +45,4 @@ void setHideRelatedSetupEntries(void); void DumpScreenIdentifiers(void); boolean DoScreenAction(int); -#endif /* SCREENS_H */ +#endif // SCREENS_H diff --git a/src/tape.c b/src/tape.c index 8e2f627d..d1d4aa6b 100644 --- a/src/tape.c +++ b/src/tape.c @@ -21,7 +21,7 @@ #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 @@ -33,10 +33,10 @@ #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); @@ -44,9 +44,9 @@ 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 | \ @@ -98,9 +98,9 @@ static struct GadgetInfo *tape_gadget[NUM_TAPE_BUTTONS]; #define NUM_TAPE_FUNCTION_STATES 2 -/* ========================================================================= */ -/* video display functions */ -/* ========================================================================= */ +// ============================================================================ +// video display functions +// ============================================================================ static void DrawVideoDisplay_Graphics(unsigned int state, unsigned int value) { @@ -134,7 +134,7 @@ 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 }, }, @@ -160,11 +160,11 @@ static void DrawVideoDisplay_Graphics(unsigned int state, unsigned int value) }, }; - 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; @@ -186,20 +186,20 @@ static void DrawVideoDisplay_Graphics(unsigned int state, unsigned int value) 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); @@ -402,11 +402,11 @@ void DrawCompleteVideoDisplay(void) { 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); @@ -461,9 +461,9 @@ void TapeDeactivateDisplayOff(boolean redraw_display) } -/* ========================================================================= */ -/* tape logging functions */ -/* ========================================================================= */ +// ============================================================================ +// tape logging functions +// ============================================================================ static void PrintTapeReplayProgress(boolean replay_finished) { @@ -501,9 +501,9 @@ static void PrintTapeReplayProgress(boolean replay_finished) } -/* ========================================================================= */ -/* tape control functions */ -/* ========================================================================= */ +// ============================================================================ +// tape control functions +// ============================================================================ void TapeSetDateFromEpochSeconds(time_t epoch_seconds) { @@ -660,7 +660,7 @@ boolean TapeAddAction(byte action[MAX_PLAYERS]) { 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; @@ -680,7 +680,7 @@ boolean TapeAddAction(byte action[MAX_PLAYERS]) 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]; @@ -696,7 +696,7 @@ void TapeRecordAction(byte action_raw[MAX_PLAYERS]) 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++) @@ -835,7 +835,7 @@ byte *TapePlayAction(void) } } - 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) { @@ -1003,7 +1003,7 @@ void TapeQuickSave(void) 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)) { @@ -1071,7 +1071,7 @@ void TapeQuickLoad(void) 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); @@ -1145,7 +1145,7 @@ void AutoPlayTape(void) if (autoplay_initialized) { - /* just finished auto-playing tape */ + // just finished auto-playing tape PrintTapeReplayProgress(TRUE); num_levels_played++; @@ -1213,7 +1213,7 @@ void AutoPlayTape(void) } #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 @@ -1266,7 +1266,7 @@ void AutoPlayTape(void) } -/* ---------- new tape button stuff ---------------------------------------- */ +// ---------- new tape button stuff ------------------------------------------- static struct { @@ -1281,7 +1281,7 @@ 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" }, @@ -1483,7 +1483,7 @@ static void HandleTapeButtonsExt(int id) } else if (tape.pausing) { - if (tape.playing) /* PLAY -> PAUSE -> RECORD */ + if (tape.playing) // PLAY -> PAUSE -> RECORD TapeAppendRecording(); else TapeTogglePause(TAPE_TOGGLE_MANUAL); @@ -1492,7 +1492,7 @@ static void HandleTapeButtonsExt(int id) 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) @@ -1508,25 +1508,25 @@ static void HandleTapeButtonsExt(int id) } 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; diff --git a/src/tape.h b/src/tape.h index f18f4ee6..dfb0a627 100644 --- a/src/tape.h +++ b/src/tape.h @@ -13,21 +13,21 @@ #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 @@ -41,7 +41,7 @@ #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) @@ -94,7 +94,7 @@ #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 @@ -162,9 +162,9 @@ struct TapeTextInfo 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; @@ -203,9 +203,9 @@ struct TapeInfo 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 }; diff --git a/src/tools.c b/src/tools.c index f81ff9d9..8d8fba9c 100644 --- a/src/tools.c +++ b/src/tools.c @@ -23,11 +23,11 @@ #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 @@ -38,7 +38,7 @@ #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 @@ -165,7 +165,7 @@ static struct DoorPartControlInfo door_part_controls[] = }; -/* 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); @@ -466,7 +466,7 @@ void SetDrawtoField(int mode) drawto_field = fieldbuffer; } - else /* DRAW_TO_BACKBUFFER */ + else // DRAW_TO_BACKBUFFER { FX = SX; FY = SY; @@ -559,7 +559,7 @@ static void DrawMaskedBorderExt_DOOR_2(int draw_target) static void DrawMaskedBorderExt_DOOR_3(int draw_target) { - /* currently not available */ + // currently not available } static void DrawMaskedBorderExt_ALL(int draw_target) @@ -572,7 +572,7 @@ 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; @@ -719,20 +719,20 @@ static void DrawFramesPerSecond(void) 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; } @@ -906,7 +906,7 @@ static void FadeExt(int fade_mask, int fade_mode, int fade_type) { 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; @@ -931,7 +931,7 @@ static void FadeExt(int fade_mask, int fade_mode, int fade_type) 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; @@ -951,11 +951,11 @@ static void FadeExt(int fade_mask, int fade_mode, int fade_type) 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; @@ -1090,21 +1090,21 @@ void FadeSetEnterMenu(void) { 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) @@ -1112,12 +1112,12 @@ 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) @@ -1225,7 +1225,7 @@ void SetPanelBackground(void) 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)) @@ -1423,11 +1423,11 @@ void ClearField(void) { 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); @@ -1450,7 +1450,7 @@ void SetBorderElement(void) 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; @@ -1477,7 +1477,7 @@ void FloodFillLevelExt(int from_x, int from_y, int fill_element, 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; @@ -1518,7 +1518,7 @@ void SetRandomAnimationValue(int x, int y) 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; @@ -1549,7 +1549,7 @@ void getGraphicSourceXY(int graphic, int frame, int *x, int *y, 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; @@ -1557,7 +1557,7 @@ void getGraphicSourceXY(int graphic, int frame, int *x, int *y, *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; @@ -1565,7 +1565,7 @@ void getGraphicSourceXY(int graphic, int frame, int *x, int *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; @@ -1793,35 +1793,35 @@ static void DrawGraphicShiftedNormal(int x, int y, int dx, int dy, 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; @@ -1829,13 +1829,13 @@ static void DrawGraphicShiftedNormal(int x, int y, int dx, int dy, 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; @@ -1843,17 +1843,17 @@ static void DrawGraphicShiftedNormal(int x, int y, int dx, int 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)); } @@ -1912,17 +1912,17 @@ static void DrawGraphicShiftedDouble(int x, int y, int dx, int 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); @@ -1940,7 +1940,7 @@ static void DrawGraphicShiftedDouble(int x, int y, int dx, int dy, 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); @@ -1970,7 +1970,7 @@ static void DrawGraphicShifted(int x, int y, int dx, int dy, 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); @@ -1996,14 +1996,14 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element, 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); @@ -2070,7 +2070,7 @@ void DrawLevelFieldThruMask(int x, int y) 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) || \ @@ -2101,17 +2101,17 @@ static void DrawLevelFieldCrumbledInnerCorners(int x, int y, int dx, int dy, 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); @@ -2140,7 +2140,7 @@ static void DrawLevelFieldCrumbledBorders(int x, int y, int graphic, int frame, 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); @@ -2151,12 +2151,12 @@ static void DrawLevelFieldCrumbledBorders(int x, int y, int graphic, int frame, 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) { @@ -2165,12 +2165,12 @@ static void DrawLevelFieldCrumbledBorders(int x, int y, int graphic, int frame, 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); @@ -2221,12 +2221,12 @@ static void DrawLevelFieldCrumbledExt(int x, int y, int graphic, int frame) 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]; @@ -2235,7 +2235,7 @@ static void DrawLevelFieldCrumbledExt(int x, int y, int graphic, int frame) 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) @@ -2244,7 +2244,7 @@ static void DrawLevelFieldCrumbledExt(int x, int y, int graphic, int frame) 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) { @@ -2259,9 +2259,9 @@ static void DrawLevelFieldCrumbledExt(int x, int y, int graphic, int frame) 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]; @@ -2288,7 +2288,7 @@ static void DrawLevelFieldCrumbledExt(int x, int y, int graphic, int frame) 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); @@ -2367,7 +2367,7 @@ void DrawLevelFieldCrumbledNeighbours(int x, int y) }; 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]; @@ -2384,7 +2384,7 @@ void DrawLevelFieldCrumbledNeighbours(int x, int y) 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); @@ -2823,7 +2823,7 @@ void ShowEnvelope(int envelope_nr) 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); @@ -2988,7 +2988,7 @@ static void DrawEnvelopeRequest(char *text) 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, @@ -3099,8 +3099,8 @@ static void ShowEnvelopeRequest(char *text, unsigned int req_state, int action) 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); @@ -3136,7 +3136,7 @@ static void ShowEnvelopeRequest(char *text, unsigned int req_state, int action) DrawEnvelopeRequest(text); } - game.envelope_active = TRUE; /* needed for RedrawPlayfield() events */ + game.envelope_active = TRUE; // needed for RedrawPlayfield() events if (action == ACTION_OPENING) { @@ -3391,7 +3391,7 @@ static void DrawPreviewLevelExt(boolean restart) DrawPreviewLevelInfo(MICROLABEL_LEVEL_NAME); DrawPreviewLevelInfo(MICROLABEL_LEVEL_AUTHOR); - /* initialize delay counters */ + // initialize delay counters DelayReached(&scroll_delay, 0); DelayReached(&label_delay, 0); @@ -3415,7 +3415,7 @@ static void DrawPreviewLevelExt(boolean restart) 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)) @@ -3471,8 +3471,8 @@ static void DrawPreviewLevelExt(boolean restart) 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) && @@ -3528,7 +3528,7 @@ static void DrawPreviewPlayers(void) 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++) @@ -3565,15 +3565,15 @@ static void DrawPreviewPlayers(void) 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]) @@ -3649,7 +3649,7 @@ static void DrawNetworkPlayersExt(boolean force) 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 && @@ -3665,7 +3665,7 @@ static void DrawNetworkPlayersExt(boolean force) } } - /* ... 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 && @@ -3796,14 +3796,14 @@ static int getPlayerGraphic(struct PlayerInfo *player, int move_dir) { 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); @@ -3904,9 +3904,9 @@ void DrawPlayer(struct PlayerInfo *player) 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) { @@ -3944,9 +3944,9 @@ void DrawPlayer(struct PlayerInfo *player) 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]); @@ -3972,7 +3972,7 @@ void DrawPlayer(struct PlayerInfo *player) { 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)) @@ -3983,9 +3983,9 @@ void DrawPlayer(struct PlayerInfo *player) } #if !DRAW_PLAYER_OVER_PUSHED_ELEMENT - /* ----------------------------------------------------------------------- */ - /* draw player himself */ - /* ----------------------------------------------------------------------- */ + // ----------------------------------------------------------------------- + // draw player himself + // ----------------------------------------------------------------------- graphic = getPlayerGraphic(player, move_dir); @@ -4029,9 +4029,9 @@ void DrawPlayer(struct PlayerInfo *player) } #endif - /* ----------------------------------------------------------------------- */ - /* draw things the player is pushing, if needed */ - /* ----------------------------------------------------------------------- */ + // -------------------------------------------------------------------------- + // draw things the player is pushing, if needed + // -------------------------------------------------------------------------- if (player->is_pushing && player->is_moving) { @@ -4044,7 +4044,7 @@ void DrawPlayer(struct PlayerInfo *player) 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]; @@ -4055,10 +4055,10 @@ void DrawPlayer(struct PlayerInfo *player) 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]); @@ -4074,23 +4074,23 @@ void DrawPlayer(struct PlayerInfo *player) 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); @@ -4124,9 +4124,9 @@ void DrawPlayer(struct PlayerInfo *player) } #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)) { @@ -4152,23 +4152,23 @@ void DrawPlayer(struct PlayerInfo *player) 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)) @@ -4178,7 +4178,7 @@ void DrawPlayer(struct PlayerInfo *player) MarkTileDirty(sx, sy); } -/* ------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------------- void WaitForEventToContinue(void) { @@ -4187,7 +4187,7 @@ 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); @@ -4243,7 +4243,7 @@ static int RequestHandleEvents(unsigned int req_state) 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; @@ -4260,7 +4260,7 @@ static int RequestHandleEvents(unsigned int req_state) { 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); @@ -4270,7 +4270,7 @@ static int RequestHandleEvents(unsigned int req_state) 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); } } @@ -4309,7 +4309,7 @@ static int RequestHandleEvents(unsigned int req_state) button_status = MB_RELEASED; } - /* this sets 'request_gadget_id' */ + // this sets 'request_gadget_id' HandleGadgets(mx, my, button_status); switch (request_gadget_id) @@ -4375,7 +4375,7 @@ static int RequestHandleEvents(unsigned int req_state) 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; @@ -4387,7 +4387,7 @@ static int RequestHandleEvents(unsigned int req_state) 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; @@ -4541,7 +4541,7 @@ static int RequestHandleEvents(unsigned int req_state) { 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); } } @@ -4572,13 +4572,13 @@ static boolean RequestDoor(char *text, unsigned int req_state) 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 && @@ -4587,20 +4587,20 @@ static boolean RequestDoor(char *text, unsigned int req_state) 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); } @@ -4608,13 +4608,13 @@ static boolean RequestDoor(char *text, unsigned int req_state) 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]; @@ -4671,7 +4671,7 @@ static boolean RequestDoor(char *text, unsigned int req_state) 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); @@ -4719,14 +4719,14 @@ static boolean RequestDoor(char *text, unsigned int req_state) 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(); @@ -4740,20 +4740,20 @@ static boolean RequestEnvelope(char *text, unsigned int req_state) 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); @@ -4763,7 +4763,7 @@ static boolean RequestEnvelope(char *text, unsigned int req_state) // 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); @@ -4804,14 +4804,14 @@ static boolean RequestEnvelope(char *text, unsigned int req_state) 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(); @@ -4883,7 +4883,7 @@ void InitGraphicCompatibilityInfo_Doors(void) 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++) { @@ -4894,7 +4894,7 @@ void InitGraphicCompatibilityInfo_Doors(void) door_gfx_redefined = TRUE; } - /* check for old-style door graphic/animation modifications */ + // check for old-style door graphic/animation modifications if (!door_gfx_redefined) { @@ -4910,7 +4910,7 @@ void InitGraphicCompatibilityInfo_Doors(void) 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++) { @@ -4922,7 +4922,7 @@ void InitGraphicCompatibilityInfo_Doors(void) 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; @@ -4954,18 +4954,18 @@ void InitGraphicCompatibilityInfo_Doors(void) 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) { @@ -4986,7 +4986,7 @@ void InitGraphicCompatibilityInfo_Doors(void) 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) { @@ -5015,7 +5015,7 @@ void InitDoors(void) 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) { @@ -5023,12 +5023,12 @@ void InitDoors(void) 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); } @@ -5220,7 +5220,7 @@ unsigned int MoveDoor(unsigned int door_state) } 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); @@ -5408,7 +5408,7 @@ unsigned int MoveDoor(unsigned int door_state) 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(); } @@ -5418,7 +5418,7 @@ unsigned int MoveDoor(unsigned int door_state) 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) @@ -5482,7 +5482,7 @@ void DrawSpecialEditorDoor(void) 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, @@ -5506,7 +5506,7 @@ void UndrawSpecialEditorDoor(void) 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, @@ -5526,7 +5526,7 @@ void UndrawSpecialEditorDoor(void) } -/* ---------- new tool button stuff ---------------------------------------- */ +// ---------- new tool button stuff ------------------------------------------- static struct { @@ -5686,8 +5686,8 @@ static void HandleToolButtons(struct GadgetInfo *gi) 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; @@ -5757,7 +5757,7 @@ em_object_mapping_list[] = Xbomb_force_w, FALSE, FALSE, EL_BOMB, -1, MV_BIT_LEFT }, -#endif /* EM_ENGINE_BAD_ROLL */ +#endif // EM_ENGINE_BAD_ROLL { Xstone, TRUE, FALSE, @@ -7610,7 +7610,7 @@ int map_element_RND_to_EM(int element_rnd) { 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; @@ -7639,7 +7639,7 @@ int map_element_EM_to_RND(int element_em) { 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; @@ -7738,7 +7738,7 @@ int map_direction_EM_to_RND(int direction) 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) @@ -7838,7 +7838,7 @@ int map_element_MM_to_RND(int element_mm) 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; } @@ -7929,18 +7929,18 @@ int el2img_mm(int element_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]; } @@ -8180,7 +8180,7 @@ static int get_effective_element_EM(int tile, int frame_em) return element; } } - else /* frame_em == 7 */ + else // frame_em == 7 { switch (tile) { @@ -8337,7 +8337,7 @@ void SetGfxAnimation_EM(struct GraphicInfo_EM *g_em, 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)); @@ -8361,7 +8361,7 @@ void SetGfxAnimation_EM(struct GraphicInfo_EM *g_em, 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 @@ -8380,7 +8380,7 @@ void SetGfxAnimation_EM(struct GraphicInfo_EM *g_em, { 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]++; @@ -8391,7 +8391,7 @@ void SetGfxAnimation_EM(struct GraphicInfo_EM *g_em, 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); @@ -8450,7 +8450,7 @@ void getGraphicSourceObjectExt_EM(struct GraphicInfo_EM *g_em, 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); @@ -8506,7 +8506,7 @@ void InitGraphicInfo_EM(void) 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; } @@ -8514,7 +8514,7 @@ void InitGraphicInfo_EM(void) 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; @@ -8523,7 +8523,7 @@ void InitGraphicInfo_EM(void) 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++) @@ -8624,7 +8624,7 @@ void InitGraphicInfo_EM(void) 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 && @@ -8795,7 +8795,7 @@ void InitGraphicInfo_EM(void) 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) { @@ -8808,7 +8808,7 @@ void InitGraphicInfo_EM(void) g_em->dst_offset_y = cy * step; } } - else /* tile where movement ends */ + else // tile where movement ends { if (dx < 0 || dy < 0) { @@ -8826,7 +8826,7 @@ void InitGraphicInfo_EM(void) 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 @@ -8836,7 +8836,7 @@ void InitGraphicInfo_EM(void) #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; @@ -8926,7 +8926,7 @@ void InitGraphicInfo_EM(void) 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]; @@ -8995,7 +8995,7 @@ void InitGraphicInfo_EM(void) #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; @@ -9308,7 +9308,7 @@ void ToggleFullscreenOrChangeWindowScalingIfNeeded(void) { 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; @@ -9320,27 +9320,27 @@ void ToggleFullscreenOrChangeWindowScalingIfNeeded(void) { 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); } } @@ -9502,7 +9502,7 @@ void ChangeViewportPropertiesIfNeeded(void) 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; diff --git a/src/tools.h b/src/tools.h index a96930f1..5243401b 100644 --- a/src/tools.h +++ b/src/tools.h @@ -16,18 +16,18 @@ #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) @@ -55,7 +55,7 @@ #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) @@ -286,4 +286,4 @@ void ChangeViewportPropertiesIfNeeded(void); boolean CheckIfPlayfieldViewportHasChanged(void); boolean CheckIfGlobalBorderOrPlayfieldViewportHasChanged(void); -#endif /* TOOLS_H */ +#endif // TOOLS_H