If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!
User:LolHacksRule/Ms. Pac-Man (iOS, 2008)
Jump to navigation
Jump to search
ImagePackInfo.pl
A Perl script.
#!/usr/bin/perl # usage: when you want to add an image to an image pack group (menuImages, coffeebreakImages, or gameImages), # add its IDI_tag to its array here. # make sure its IDI_ is also in new_texture_data.cpp with all its corresponding offset info. # run this script: # > ./ImagePackInfo.pl # and it will generate the two files: IDI_pack_arrays.h and IMG_pack_enums.h # which get #included in the code where they need to be. # make sure to run order_IDIs.pl too to create the IDI_list.h # IDI_'s of each image pack @menuImages = ( IDI_TITLE, IDI_MENU_FRAME, IDI_MENU_FRAME_OVERLAY, IDI_BUTTON_STATE0_TOP, IDI_BUTTON_STATE0_MID, IDI_BUTTON_STATE0_BOTTOM, IDI_BUTTON_STATE1_TOP, IDI_BUTTON_STATE1_MID, IDI_BUTTON_STATE1_BOTTOM, IDI_TITLE_FONT_EN, IDI_MENU_FONT_EN_STATE0, IDI_MENU_FONT_EN_STATE1, IDI_JAPANESE_TEXT, IDI_MENU_ICON_BLUE_GHOST, IDI_MENU_ICON_WHITE_GHOST, IDI_MENU_ICON_GHOST_INKY, IDI_MENU_ICON_GHOST_PINKY, IDI_MENU_ICON_GHOST_BLINKY, IDI_MENU_ICON_GHOST_CLYDE_LEFT, IDI_MENU_ICON_DEATH_BLINK, IDI_MENU_ICON_MSPAC_RIGHT, IDI_MENU_WHEEL_ICON, IDI_MENU_ICON_STRAWBERRY, IDI_MENU_ICON_BANANA, IDI_MENU_ICON_APPLE, IDI_MENU_ICON_MELON, IDI_MENU_ICON_PEAR, IDI_MENU_ICON_PEACH, IDI_MENU_ICON_PRETZEL, IDI_MENU_ICON_CHERRY, IDI_ARROWL_STATE0, IDI_ARROWL_STATE1, IDI_ARROWL_STATE2, IDI_ARROWL_DISABLED_STATE0, IDI_ARROWL_DISABLED_STATE1, IDI_ARROWL_DISABLED_STATE2, IDI_ARROWR_STATE0, IDI_ARROWR_STATE1, IDI_ARROWR_STATE2, IDI_ARROWR_DISABLED_STATE0, IDI_ARROWR_DISABLED_STATE1, IDI_ARROWR_DISABLED_STATE2, ); @coffeebreakImages = ( IDI_CB1_ACT_ONE, IDI_CB1_HEART, IDI_CB1_INKYLEFT_ANIM, IDI_CB1_INKYRIGHT_ANIM, IDI_CB1_MSPACLEFT_ANIM, IDI_CB1_MSPACRIGHT_ANIM, IDI_CB1_MSPACUP_ANIM, IDI_CB1_PACLEFT_ANIM, IDI_CB1_PACRIGHT_ANIM, IDI_CB1_PACUP_ANIM, IDI_CB1_PINKYLEFT_ANIM, IDI_CB1_PINKYRIGHT_ANIM, IDI_CB1_TEXT_THEY_MEET, IDI_CB2_ACT_TWO, IDI_CB2_TEXT_THE_CHASE, IDI_CB3_ACT_THREE, IDI_CB3_BABY, IDI_CB3_BABYBAG, IDI_CB3_MSPACRIGHT, IDI_CB3_PACRIGHT, IDI_CB3_STORK, IDI_CB3_TEXT_JUNIOR, IDI_CB_ACT_ANIM, IDI_CB_ACT_ANIM1, IDI_CB_ACT_ANIM2, IDI_CHERRY, IDI_STRAWBERRY, IDI_ORANGE, IDI_PRETZEL, IDI_APPLE, IDI_PEAR, IDI_BANANA, ); @gameImages = ( IDI_GAME_MAP00, IDI_GAME_MAP01, IDI_GAME_MAP02, IDI_GAME_MAP03, IDI_GAME_MAP04, IDI_GAME_MAP05, IDI_MAZE_BLUE, IDI_MAZE_BLUE_FLASH, IDI_JSTICK_DOWN, IDI_JSTICK_LEFT, IDI_JSTICK_REG, IDI_JSTICK_RIGHT, IDI_JSTICK_UP, IDI_DPAD_DOWN, IDI_DPAD_LEFT, IDI_DPAD_REG, IDI_DPAD_RIGHT, IDI_DPAD_UP, IDI_APPLE, IDI_BANANA, IDI_BLINKYDOWN_ANIM, IDI_BLINKYLEFT_ANIM, IDI_BLINKYRIGHT_ANIM, IDI_BLINKYUP_ANIM, IDI_BLUEGHOST_ANIM, IDI_CHERRY, IDI_CLYDEDOWN_ANIM, IDI_CLYDELEFT_ANIM, IDI_CLYDERIGHT_ANIM, IDI_CLYDEUP_ANIM, #// Fruit score numbers are out of order due to our image packing system IDI_FRUIT_SCORE_100, IDI_FRUIT_SCORE_1000, IDI_FRUIT_SCORE_10000, IDI_FRUIT_SCORE_200, IDI_FRUIT_SCORE_2000, IDI_FRUIT_SCORE_500, IDI_FRUIT_SCORE_5000, IDI_FRUIT_SCORE_700, IDI_GHOST_EYES_DOWN, IDI_GHOST_EYES_LEFT, IDI_GHOST_EYES_RIGHT, IDI_GHOST_EYES_UP, #// Ghost score numbers are out of order due to our image packing system IDI_GHOST_SCORE_1600, IDI_GHOST_SCORE_200, IDI_GHOST_SCORE_400, IDI_GHOST_SCORE_800, IDI_INKYDOWN_ANIM, IDI_INKYLEFT_ANIM, IDI_INKYRIGHT_ANIM, IDI_INKYUP_ANIM, IDI_NEST_GATE, IDI_ORANGE, IDI_PACDOWN_ANIM, IDI_PACDYING_ANIM, IDI_PACLEFT_ANIM, IDI_PACRIGHT_ANIM, IDI_PACUP_ANIM, IDI_PEAR, IDI_PELLET_AQUA, IDI_PELLET_RED, IDI_PELLET_WHITE, IDI_PELLET_YELLOW, IDI_PINKYDOWN_ANIM, IDI_PINKYLEFT_ANIM, IDI_PINKYRIGHT_ANIM, IDI_PINKYUP_ANIM, IDI_POWER_PELLET_AQUA, IDI_POWER_PELLET_RED, IDI_POWER_PELLET_WHITE, IDI_POWER_PELLET_YELLOW, IDI_PRETZEL, IDI_STRAWBERRY, IDI_TEXT_GAME_OVER, IDI_TEXT_NUMBERS, IDI_TEXT_PLAYER_ONE, IDI_TEXT_READY, IDI_WHITEGHOST_ANIM, IDI_TEXT_SCORE, IDI_TEXT_STAGE, IDI_TEXT_1UP, IDI_HELP_CONTROL_ICON, #IDI_HELP_BOX_ARROW_DOWN, IDI_HIGH_SCORE, IDI_INGAME_FRAME, IDI_MENU_BUTTON_PRESSED, IDI_MENU_BUTTON_REG, IDI_SOUND_ICON, ); @packNames = ("menuImages", "gameImages", "coffeebreakImages"); @enumNames = ("EMenuImages", "EGameImages", "ECoffeebreakImages"); @enumNameTags = ("MENU", "GAME", "CB"); # @texArrays = ([@menuImages], [@gameImages], [@coffeebreakImages]); $texArray[0] = [@menuImages]; $texArray[1] = [@gameImages]; $texArray[2] = [@coffeebreakImages]; $arrayFileStr = ""; $enumFileStr = ""; for($idx = 0; $idx < 3; $idx++) { $imageArrayStr = "const u16 " . @packNames[$idx] . "[] =\n{\n"; $imageEnumStr = "typedef enum _@enumNames[$idx]\n{\n "; $arrayRef = $texArray[$idx]; foreach $tex (@$arrayRef) { $copyOfTex = $tex; $imageArrayStr .= "\t$tex,\n"; $copyOfTex =~ s/IDI/IMG_$enumNameTags[$idx]/; $imageEnumStr .= "\t$copyOfTex,\n"; } $imageEnumStr .= "\n\tIMG_$enumNameTags[$idx]_MAX\n"; $imageArrayStr .= "};\n\n"; $imageEnumStr .= "} @enumNames[$idx];\n\n"; $arrayFileStr .= $imageArrayStr; $enumFileStr .= $imageEnumStr; } open(ENUM_HEADER, ">IMG_pack_enums.h"); open(ARRAY_HEADER, ">IDI_pack_arrays.h"); print ENUM_HEADER "#ifndef __IMG_PACK_ENUMS_H__\n#define __IMG_PACK_ENUMS_H__\n\n"; print ARRAY_HEADER "#ifndef __IDI_PACK_ARRAYS_H__\n#define __IDI_PACK_ARRAYS_H__\n\n"; print ENUM_HEADER $enumFileStr; print ARRAY_HEADER $arrayFileStr; print ENUM_HEADER "\n#endif\n"; print ARRAY_HEADER "\n#endif\n";