Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // MapFileParser.h -- Here we parse various halo map files.
- // Zeus
- //
- // Created by Sparky on 11/16/11.
- // Copyright 2011 MacGamingMods.com and HaloDemoMods.com. All rights reserved.
- //
- // basic things to include
- #import <Foundation/Foundation.h>
- // include the map file types we will be handling... nevermind, that's not how this will work. see the method comments below for more information
- @interface MapFileParser : NSObject { // this object will interpret map file data for classes like DetermineHaloMapFileType
- @private
- //variables
- NSMutableData * map; // this object will hold the map file data in memory
- // all the information we gather from our map file
- // first, the basics about the map
- NSMutableData * mapheader; // this object will hold the map file header data
- NSString * mapbuildversion; // this will hold the version as stored in the map file
- NSMutableData * mapchecksum; // this will hold the map file checksum
- NSString * mapplatform; // this will hold the platform, whether mac, pc, xbox, etc.
- NSMutableData * maptype; // this will hold whether it's singleplayer or multiplayer
- NSString * mapname; // this will hold the name of the map, ie. bloodgulch
- NSMutableData * mapdatasize; // the size of the data in the map file
- NSMutableData * mapmetadatasize; // the size of the tag data in the map file
- NSNumber * maptagcount; // number of tags in the map
- NSMutableData * mapmodelvertexdatasize; // size of the vertex coordinate data for models in the map
- NSNumber * mapmodelvertexcount; // number of model vertices in the map
- NSMutableData * mapmodelindexdatasize; // size of the index data for models in the map
- NSNumber * mapmodelindexcount; // number of model indeces in the map
- NSMutableData * mapmagicprimary; // the primary map magic used in calculating offsets to tag metadata
- NSMutableData * mapmagicsecondary; // the secondary map magic used in calculating offsets to referenced data besides tag info (correct?)
- // next, the metadata related to each tag type (named after the four-letter tag names... ya like that? hehe.)
- NSMutableData * h1_actr; // Actor
- NSMutableData * h1_actv; // Actor Variant
- NSMutableData * h1_ant; // Antenna
- NSMutableData * h1_antr; // Animation Trigger (model animations)
- NSMutableData * h1_bipd; // Biped
- NSMutableData * h1_bitm; // Bitmap
- NSMutableData * h1_boom; // Spheroid
- NSMutableData * h1_cdmg; // Continuous Damage Effect
- NSMutableData * h1_coll; // Model Collision Geometry
- NSMutableData * h1_colo; // Color Table
- NSMutableData * h1_cont; // Contrail
- NSMutableData * h1_ctrl; // Device Control
- NSMutableData * h1_deca; // Decal
- NSMutableData * h1_dela; // UI Widget Definition
- NSMutableData * h1_devc; // Input Device Defaults
- NSMutableData * h1_devi; // Device
- NSMutableData * h1_dobc; // Detail Object Collection
- NSMutableData * h1_effe; // Effect
- NSMutableData * h1_elec; // Lightning
- NSMutableData * h1_eqip; // Equipment
- NSMutableData * h1_flag; // Flag
- NSMutableData * h1_fog; // Fog
- NSMutableData * h1_font; // Font
- NSMutableData * h1_foot; // Material Effects
- NSMutableData * h1_garb; // Garbage
- NSMutableData * h1_glw; // Glow
- NSMutableData * h1_grhi; // Grenade HUD Interface
- NSMutableData * h1_hmt; // HUD Message Text
- NSMutableData * h1_hud; // HUD Number
- NSMutableData * h1_hudg; // HUD Globals
- NSMutableData * h1_item; // Item
- NSMutableData * h1_itmc; // Item Collection
- NSMutableData * h1_jpt; // Damage Effect
- NSMutableData * h1_lens; // Lens Flare
- NSMutableData * h1_lifi; // Device Light Fixture
- NSMutableData * h1_ligh; // Light
- NSMutableData * h1_lsnd; // Sound Looping
- NSMutableData * h1_mach; // Device Machine
- NSMutableData * h1_matg; // Game Globals
- NSMutableData * h1_metr; // Meter
- NSMutableData * h1_mgs2; // Light Volume
- NSMutableData * h1_mod2; // Gearbox Model (pc model)
- NSMutableData * h1_mode; // Model
- NSMutableData * h1_mply; // Multiplayer Scenario Description
- NSMutableData * h1_ngpr; // Network Game Preferences
- NSMutableData * h1_obje; // Object
- NSMutableData * h1_part; // Particle
- NSMutableData * h1_pctl; // Particle System
- NSMutableData * h1_phys; // Physics
- NSMutableData * h1_plac; // Placeholder
- NSMutableData * h1_pphy; // Point Physics
- NSMutableData * h1_proj; // Projectile
- NSMutableData * h1_rain; // Weather Particle System
- NSMutableData * h1_sbsp; // Scenario Structure BSP
- NSMutableData * h1_scen; // Scenery
- NSMutableData * h1_scex; // Shader Transparent Chicago Extended
- NSMutableData * h1_schi; // Shader Transparent Chicago
- NSMutableData * h1_scnr; // Scenario
- NSMutableData * h1_senv; // Shader Environment
- NSMutableData * h1_sgla; // Shader Transparent Glass
- NSMutableData * h1_shdr; // Shader
- NSMutableData * h1_sky; // Sky
- NSMutableData * h1_smet; // Shader Transparent Meter
- NSMutableData * h1_snd; // Sound
- NSMutableData * h1_snde; // Sound Environment
- NSMutableData * h1_soso; // Shader Model
- NSMutableData * h1_sotr; // Shader Transparent Generic
- NSMutableData * h1_soul; // UI Widget Collection
- NSMutableData * h1_spla; // Shader Transparent Plasma
- NSMutableData * h1_ssce; // Sound Scenery
- NSMutableData * h1_str; // String List
- NSMutableData * h1_swat; // Shader Transparent Water
- NSMutableData * h1_tagc; // Tag Collection
- NSMutableData * h1_trak; // Camera Track
- NSMutableData * h1_udlg; // Unit Dialogue
- NSMutableData * h1_unhi; // Unit HUD Interface
- NSMutableData * h1_unit; // Unit
- NSMutableData * h1_ustr; // Unicode String List
- NSMutableData * h1_vcky; // Virtual Keyboard
- NSMutableData * h1_vehi; // Vehicle
- NSMutableData * h1_weap; // Weapon
- NSMutableData * h1_wind; // Wind
- NSMutableData * h1_wphi; // Weapon HUD Interface
- }
- //methods
- // the methods that parse each element (header, tags, other data) of the map file are defined here
- // the methods that represent each element (return its data) are defined within the respective header files within the folder "Map File Types"
- // methods that are used to change (write) the data to a map are also found in those specific map type header files
- // we do this because the map file parser does not need to handle specific collections of tags unique to a map file, but handles all the possible map data
- // therefore, the type of map can be identified by the information gathered by this class; this info is used by DetermineHaloMapFileType
- // after a map file is chosen to be opened by the user, DetermineHaloMapFileType will use the methods in MapFileParser to identify the map based upon its header information
- // we'll use one method for each type of data parsing (header, each type of tag, each type of data), and then within that method will be specific parsing code for each type of supported map file; although this code is specific to each map file, it will be handled here because it still relates to parsing; so if we add new types of supported map files, we will need to add the data and tag objects (as you see above) and add new methods (as you see below) for parsing that data here, and then add a new class under "Map File Types" for handling those objects specifically in other ways such as reading and writing their specific types of data
- // so this MapFileParser class is basically the heart of the matter which interprets the information for all the map creation and editing tasks; within various other files, specific tasks (such as determining the map file type and interpreting user modifications to the map scenario) are handled within classes related to those specific tasks, while specific map types are handled within their appropriately-named classes under "Map File Types" where for example the Halo1DemoTrialMacPCMapClass class uses the tag objects seen above prefixed with h1_ which represents Halo 1 tags
- -(id)parse_map:(NSMutableData *)map; // define the generic parsing method for the entire map; used to rebuild mapfile data from memory to file
- -(id)parse_mapheader:(NSMutableData *)mapheader; // this instance method will be used to parse the header data of each supported map type
- -(id)parse_mapbuildversion:(NSString *)mapbuildversion; // this parses the build version data... not sure if I should use the following technique instead:
- // -(NSString *)buildversion; ...which maintains interpretation as a string
- -(id)parse_mapchecksum:(NSMutableData *)mapchecksum;
- -(id)parse_mapplatform:(NSString *)mapplatform;
- -(id)parse_maptype:(NSMutableData *)maptype; // I forgot how this is stored. Maybe as a number? Might use NSNumber then.
- -(id)parse_mapname:(NSString *)mapname;
- -(id)parse_mapdatasize:(NSMutableData *)mapdatasize;
- -(id)parse_mapmetadatasize:(NSMutableData *)mapmetadatasize;
- -(id)parse_maptagcount:(NSNumber *)maptagcount;
- -(id)parse_mapmodelvertexdatasize:(NSMutableData *)mapmodelvertexdatasize;
- -(id)parse_mapmodelvertexcount:(NSNumber *)mapmodelvertexcount;
- -(id)parse_mapmodelindexdatasize:(NSMutableData *)mapmodelindexdatasize;
- -(id)parse_mapmodelindexcount:(NSNumber *)mapmodelindexcount;
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement