Forums

You need to log in to create posts and topics.

Welcome (Read FIRST!) MODDING INFO INSIDE

12

More Detailed War2.exe info! PART 2

Spoiler

Small Fire
Big Fire
Ballista/Catapult Impact
Normal Spell
Explosion
Cannon
Cannon Explosion
Cannon-Tower Explosion
Daemon Fire
Green Cross
Offset 848388: Word. Sound to play when missile hits target. Sometimes has high bit set.
Misc. File References
Tables
Offset 845588: Terrain list. 4 words, with references to the palette for the terrain type. Also loads the next 3 entries.
Offset 870684: Intro Image list. 52 words. File references for images to shown during intro of level. Alternates between human and orc, first with 14 original levels, then 12 expansion.
Offset 870788: Intro Sound list. File references to the wavs of the mission briefings. Each level has 1 or more file references, terminated by a word with value 0. Starts with the 14 basic orc levels, then the 12 expansion orc levels, then the 14 basic human levels, then the 12 expansion human levels.
Single Reference
Offset 486404 {489876}: 1000. Default UDTA.
Offset 493616 {497088}: 1001. Default UGRD.
Offset 576847 {581247}: 1187. Symbol GFX: Gold, Wood, Oil, Mana.
Offset 487253: 1192. First human level. Also refers to subsequent levels.
Offset 487298: 1192. First human level. Also refers to subsequent levels.
Offset 487315: 1192. First human level. Also refers to subsequent levels.
Offset 488263: 1192. First human level. Also refers to subsequent levels.
Offset 488278: 1192. First human level. Also refers to subsequent levels.
Offset 533377: 1192. First human level. Also refers to subsequent levels.
Offset 533514: 1192. First human level. Also refers to subsequent levels.
Offset 640277: 1192. First human level. Also refers to subsequent levels.
Offset 533370: 1193. First orc level. Also refers to subsequent levels.
Offset 533507: 1193. First orc level. Also refers to subsequent levels.
Offset 640220: 1193. First orc level. Also refers to subsequent levels.
Offset 487629: 1218. Last human level.
Offset 487757: 1218: Last human level.
Offset 487305: 1219. Last orc level.
Offset 488270: 1219. Last orc level.
Offset 469905 {473377}: 1277. AI control programs.
Offset 535987 {540387}: 1278. Unit movement control programs.
Offset 488615 {492087}: 1279. Font: Large font: episode titles.
Offset 488600 {492072}: 1280. Font: Small font: episode titles.
Offset 486073 {489545}: 1281. Font: Large font: menus.
Offset 486058 {489530}: 1282. Font: Small font: menus.
Offset 486043 {489515}: 1283. Font: Game font.
Offset 569957 {574357}: 1293. Image: Minimap border (top). Use this value if human, add one if orc.
Offset 495406 {498878}: 1295. Image: Minimap. Use this value if human, add one if orc.
Offset 569369 {573769}: 1297. Image: Panel (actions). Use this value if human, add one if orc.
Offset 569610 {574010}: 1297. Image: Panel (actions). Use this value if human, add one if orc.
Offset 582531 {586931}: 1299. Image: Title Screen.
Offset 485999 {489471}: 1300. Palette: for 299.
Offset 582559 {586959}: 1300. Palette: for 299.
Offset 486016 {489488}: 1301. Cursor: Human Gauntlet.
Offset 447264 {450736}: 1301. All of the cursors. A number from 0-21 is added to this.
Offset 486031 {489503}: 1313. Cursor: Hourglass.
Offset 466874 {470346}: 1323. Symbol GFX: Bloodlust, Haste, Slow, Invisibility, Shield.
Offset 466825 {470297}: 1324. All the Missile GFX. A number from 0-27 is added to this, depending on which missile it is.
Offset 466855 {470327}: 1353. GFX: Unit shadow.
Offset 571363 {575763}: 1354. Graphics: Panel (Unit stats). Use this value if human, add one if orc.
Offset 571336 {575736}: 1356. Icon GFX. Use this value if forest, add one if winter, add two if wasteland.
Offset 618269 {622697}: 1359. Images: Human/Orc Win/Lose. Use this value if human, add one if orc. Add two if you lost.
Offset 618239 {6222667}: 1363. Palettes: Human/Orc Win/Lose. Use this value if human, add one if orc. Add two if you lost.
Offset 634944 {639408}: 1367. Palette for Level Intro Images. Use this value if human, add one if orc.
Offset 537727 {542127}: 1432. Wav file.
Offset 539878 {544278}: 1432. Wav file.
Offset 571329 {575729}: 1471. Icon GFX for swamp.
Offset 486462 {489934}: 1472. Default UDTA for expansion.
Offset 493582 {497054}: 1472. Default UDTA for expansion.
Offset 454083 {457555}: 3000. Button GFX. Use this value if human, add one if orc.
Offset 486299 {489771}: 3001. Button GFX.
Offset 582311 {586711}: 3001. Button GFX.
Offset 402479 {404715}: 3002. Image: CD icon.
Offset 503339 {506811}: 3003. Image: Panel. Use this value if human, add one if orc.
Offset 620159 {624623}: 3003. Image: Panel. Use this value if human, add one if orc.
Offset 620747 {625211}: 3003. Image: Panel. Use this value if human, add one if orc.
Offset 622439 {626903}: 3003. Image: Panel. Use this value if human, add one if orc.
Offset 628123 {632587}: 3003. Image: Panel. Use this value if human, add one if orc.
Offset 629083 {633547}: 3003. Image: Panel. Use this value if human, add one if orc.
Offset 630235 {634699}: 3003. Image: Panel. Use this value if human, add one if orc.
Offset 404013 {406333}: 3005. Image: Panel. Use this value if human, add one if orc.
Offset 633311 {637775}: 3005. Image: Panel. Use this value if human, add one if orc.
Offset 625271 {629735}: 3007. Image: Panel. Use this value if human, add one if orc.
Offset 386151 {388215}: 3009. Image: Panel. Use this value if human, add one if orc.
Offset 386467 {388531}: 3009. Image: Panel. Use this value if human, add one if orc.
Offset 497610 {501082}: 3009. Image: Panel. Use this value if human, add one if orc.
Offset 611859 {616275}: 3009. Image: Panel. Use this value if human, add one if orc.
Offset 612143 {616563}: 3009. Image: Panel. Use this value if human, add one if orc.
Offset 612239 {616659}: 3009. Image: Panel. Use this value if human, add one if orc.
Offset 623615 {628079}: 3011. Image: Panel. Use this value if human, add one if orc.
Offset 582702 {587102}: 3013. Image: menu background with title. Also this value plus one, Palette.
Offset 582833 (587233}: 3013. Image: menu background with title. Also this value plus one, Palette.
Offset 638379 {642843}: 3014. Palette: for 0-13, 15, 91.
Offset 489126 {78436}: 3017. Palette: for maps.
Offset 635662 {640126}: 3027. Palette: for 28, 29.
Offset 635674 {640138}: 3028. Image: Credits background.
Offset 452592 {456064}: 3029. Image: End. Use this value if human, add one if orc.
Offset 452562 {456034}: 3031. Palette for Image: End. Use this value if human, add one if orc.
Offset 571385 {575785}: 3037. Screen layout info.
Offset 571400 {575800}: 3038. Screen layout info.
Offset 571420 {575820}: 3039. Screen layout info.
Offset 638830 {643294}: 3041. Screen layout info.
Offset 639915 {644379}: 3042. Screen layout info.
Offset 640173 {644637}: 3043. Screen layout info.
Offset 620995 {625459}: 3044. Screen layout info.
Offset 621965 {626429}: 3044. Screen layout info.
Offset 622127 {626591}: 3044. Screen layout info.
Offset 622386 {626850}: 3044. Screen layout info.
Offset 622830 {627294}: 3044. Screen layout info.
Offset 621766 {626230): 3045. Screen layout info.
Offset 622866 {627330}: 3045. Screen layout info.
Offset 621125 {625689}: 3046. Screen layout info.
Offset 621329 {625793}: 3046. Screen layout info.
Offset 621425 {625889}: 3046. Screen layout info.
Offset 621588 {626052}: 3046. Screen layout info.
Offset 621819 {626283}: 3046. Screen layout info.
Offset 622938 {627402}: 3046. Screen layout info.
Offset 621734 {626198}: 3047. Screen layout info.
Offset 622902 {627366}: 3047. Screen layout info.
Offset 620538 {625002}: 3048. Screen layout info.
Offset 629342 {633806}: 3049. Screen layout info.
Offset 628458 {632922}: 3050. Screen layout info.
Offset 622327 {626791}: 3051. Screen layout info.
Offset 622974 {627438}: 3051. Screen layout info.
Offset 623145 {627609}: 3052. Screen layout info.
Offset 622249 {626713}: 3055. Screen layout info.
Offset 623010 {627474}: 3055. Screen layout info.
Offset 622294 {626758}: 3056. Screen layout info.
Offset 623046 {627510}: 3056. Screen layout info.
Offset 612047 {616468}: 3057. Screen layout info.
Offset 612371 {616976}: 3058. Screen layout info.
Offset 618978 {623423}: 3062. Screen layout info.
Offset 626799 {631263}: 3063. Screen layout info.
Offset 626890 {631354}: 3063. Screen layout info.
Offset 626932 {631396}: 3063. Screen layout info.
Offset 627051 {631515}: 3063. Screen layout info.
Offset 626722 {631186}: 3064. Screen layout info. Add one sometimes.
Offset 626849 {631313}: 3064. Screen layout info. Add one sometimes.
Offset 630610 {635074}: 3066. Screen layout info.
Offset 630642 {635106}: 3067. Screen layout info.
Offset 404641 {406961}: 3068. Screen layout info.
Offset 404610 {406930}: 3069. Screen layout info.
Offset 404581 {406901}: 3070. Screen layout info.
Offset 404808 {407128}: 3070. Screen layout info.
Offset 404553 {406873}: 3071. Screen layout info.
Offset 404776 {407096}: 3071. Screen layout info.
Offset 632127 {636591}: 3072. Screen layout info.
Offset 632746 {637210}: 3073. Screen layout info.
Offset 632814 {637278}: 3074. Screen layout info.
Offset 385844 {387908}: 3075. Screen layout info.
Offset 499194 {502666}: 3076. Screen layout info.
Offset 633594 {638058}: 3077. Screen layout info.
Offset 386610 {388674}: 3078. Screen layout info.
Offset 638059 {642523}: 3079. Screen layout info.
Offset 638442 (642906}: 3079. Screen layout info.
Offset 402457 {404693}: 3080. Screen layout info.
Offset 621138 {625602}: 3081. Screen layout info.
Offset 621793 {626257}: 3081. Screen layout info.
Offset 635567 {640031}: 3082. Screen layout info. Use this value if human, add one if orc.
Offset 636438 {640902}: 3084. Screen layout info.
Offset 503570 {507042}: 3085. Screen layout info.
Offset 503706 {507178}: 3085. Screen layout info.
Offset 623962 {628426}: 3086. Screen layout info.
Offset 497983 {501455}: 3087. Screen layout info.
Offset 489789 {493261}: 3088. Screen layout info.
Offset 410351 {412675}: 3089. Screen layout info.
Offset 453390 {456862}: 3090. Screen layout info.
Offset 453462 {456934}: 3090. Screen layout info.
Offset 453535 {457007}: 3090. Screen layout info.
Offset 402494 {404730}: 3091. Image: Patch.
Offset 402440 {404676}: 3092. Screen layout info.
Offset 636102 {640566}: 3093. Palette for 94.
Offset 636114 {640578}: 3094. Image: Credits for extension background.
Offset 636468 {640932}: 3095. Screen layout info.
Offset 571299 {575699}: 4001. Strings: Unit names, etc.
Offset 384007 {386071}: 4040. Strings: Error and game messages.
Offset 633261 {637725}: 4043. Strings: Tips.
Offset 402350 {404586}: 4046. Strings: Multiplayer selections.
Offset 638042 {642506}: 4051. Strings: Insert CD-ROM.
Offset 620776 {625240}: 4054. Strings: Level objectives and titles.
Offset 634677 {639141}: 4054. Strings: Level objectives and titles.
Offset 452952 {456424}: 4058. Strings: Credits.
Offset 635738 {640202}: 4058. Strings: Credits.
Offset 618887 {623332}: 4059. Strings: Ranks.
Offset 623658 {628122}: 4060. Strings: Help dialog.
Offset 631490 {635954}: 4061. Strings: Modem dialog.
Offset 639579 {644042}: 4061. Strings: Modem dialog.
Offset 489156 {492628}: 4062. Strings: Act titles.
Offset 411775 {414099}: 4064. Strings: Titles of built in extra levels.
Offset 635045 {639509}: 4065. Strings: Intro for level. Add a value from 0-27. The value to add is (level number -1) * 2, +1 if orc. This is only used for Tides of Darkness levels.
Offset 635032 {639496}: 4071. Strings: Intro for level. Add a value from 28-51. The value to add is (level number - 13) * 2, +1 if orc. This is only used for Beyond the Dark Portal levels.
Offset 452691 {456163}: 4093. Strings: Final victory messages.
Offset 636144 {640608}: 4123. Strings: Credits.
Offset 638254 {642818}: 4125. Strings: Insert CD-ROM.
Offset 402375 {404611}: 6001. Screen layout info.
Offset 639174 {643638}: 6007. Screen layout info.
Offset 402416 {404652}: 6013. Screen layout info.
Misc.
Version Info: v1.0 offset 440788; v1.2 offset 441764; v1.3 offset 451460; v1.33 offset 451604. This is the string printed when you exit WarCraft, and includes the version number. For example, in 1.0 it is WARCRAFT 2 RETAIL v1.0.
Offset 855150 / 855138 - 7 pairs of 2 bytes. Each is a string number. I would guess the 7 longs following them are function calls for each of these.
Some 2 byte string values:      These offset are only for 1.3, I haven't bothered finding them in 1.33 yet.
Offset 561342: "Food Usage"
Offset 561389: "Used:"
Offset 561450: "Grown:"
Well, that's it for now. This page will be updated as I learn more. If you have any questions or comments, email me at peterhatch@juno.com.

Thanks! Tupac Administrator

More verbose .sav file format

Spoiler

SAV File Format

00:0000-00:001F	$ Description (31 characters+line terminator=1A)
00:0020-00:0023	L Game Id tag,if saved campaign then =0
		  else contains PUD Id tag.		
00:0024-00:0027	L Game clock ???
00:0028-00:002B	$ Indentify caption "War2"
00:002C-00:002F	L Version number ***
		  9F=1.33
00:0030-00:0031	W In campaign game,agrees with number+1000 of entry
		  in maindat.war,where pud is stored.	
00:0032		B Reserved1
00:0033		B Allied Victory
00:0034-00:0073	L Units and buildings allowed flags (16 players)
		  b00:	Footman/Grunt
		  b01:	Peasant/Peon
		  b02:	Ballista/Catapult
		  b03:	Knight/Ogre
		  b04:	Archer/Axe Thrower
		  b05:	Mage/Death Knight
		  b06:	Tanker
		  b07:	Destroyer
		  b08:	Transport
		  b09:	Battleship/Juggernaught
		  b0A:	Submarine/Giant Turtle
		  b0B:	Flying Machine/Gobblin Zeppelin
		  b0C:	Gryphon/Dragon
		  b0D:	Unused       
		  b0E:	Dwarves/Sappers
		  b0F:	Aviary/Roost
		  b10:	Farm
		  b11:	Barracks
		  b12:	Lumber Mill
		  b13:	Stables/Mound
		  b14:	Mage Tower/Temple
		  b15:	Foundry
		  b16:	Refinery
		  b17:	Inventor/Alchemists
		  b18:	Church/Altar of Storms
		  b19:	Tower
		  b1A:	Town Hall/Great Hall
		  b1B:	Keep/Stronghold
		  b1C:	Castle/Fortress
		  b1D:	Blacksmith
		  b1E:	Shipyard
		  b1F:	Wall in multiplayer
00:0074-00:00B3	L Spells already known flags (16 players)
		  b00:	Holy Vision
		  b01:	Healing
		  b02:	Unused
		  b03:	Exorcism
		  b04:	Flame Shield
		  b05:	Fireball
		  b06:	Slow
		  b07:	Invisibility
		  b08:	Polymorph
		  b09:	Blizzard
		  b0A:	Eye of Killrog
		  b0B:	Bloodlust
		  b0C:	Unused
		  b0D:	Raise Dead
		  b0E:	Death Coil
		  b0F:	Whirlwind
		  b10:	Haste
		  b11:	Unholy Armor
		  b12:	Runes
		  b13:	Death and Decay
		  b14:	Unused
		  :	Unused
		  b1F:	Unused
00:00B4-00:00F3	L Spells allowed to research flags
		  *bits like above
00:00F4-00:0133	L Spells currently researching
		  *bits like above
00:0134-00:0173	L Upgrades allowed
		  b00	Arrow 1
		  b01	Arrow 2
		  b02	Sword 1
		  b03	Sword 2
		  b04	Shield 1
		  b05	Shield 2
		  b06	Ship Cannon 1
		  b07	Ship Cannon 2
		  b08	Ship Armor 1
		  b09	Ship Armor 2
		  b0A	Unused
		  b0B	Unused
		  b0C	Ballista 1
		  b0D	Ballista 2
		  b0E	Unused
		  b0F	Unused
		  b10	Elven Rangers
		  b11	Longbow
		  b12	Scouting
		  b13	Ranger Markmanship
		  b14	Paladins
		  b15	Unused
		  :	Unused
		  b1F	Unused
00:0174-00:01B3	L Upgrades currently being acquired
		  *bits like above	  
00:01B4-00:01F3	L Player's (0..15) lumber amount
00:01F4-00:0233	L Player's gold amount
00:0234-00:0273	L Player's oil amount
00:0274-00:0283	B Player's arrow upgrade# 0=none,1=arrow 1,2=arrow 2
00:0284-00:0293	B Player's sword upgrade state,like above
00:0294-00:02A3	B Player's horses/wolfs upgrade state (War1 redundant)
00:02A4-00:02B3	B Player's shield upgrade state
00:02B4-00:02C3	B Player's ship armor upgrade state
00:02C4-00:02D3	B Player's ship cannon upgrade state
00:02D4-00:02E3	B Player's ship speed upgrade state ( unused )
00:02E4-00:02F3 B Player's(0..15) race , 0=Human,1=Orc,2=Neutral
00:02F4-00:0303 B Player's(0..15) owners,0=person,1=computer,
					 2=passive,3=nobody
00:0304-00:0305	W Tileset(0=forest,1=ice,2=wasteland,3=swamp)
00:0306-00:0307	W Song currently played
00:0308-00:0309	W Scenario objectives
		  00=own 4 farms and 1 barracks
		  01=own 4 oil platforms and 1 shipyard
		  02=any oil refineries in game
		  03=kill attack peasants,build castle,
		     destroy enemy
		  04=never used
		  05=free mages and peasants,destroy
		     castle
		  06=destroy transports,oil platforms and
		     shipyards
		  07=never used
		  08=destroy dark portal
		  09=destroy castle,have runestone at end
		  0A=build shipyard and fortress by circle
		     of power
		  0B=destroy death knights and their
		     temple , Grom must survive
		  0C=get violet player units,destory green,
		     rescue white and have all heroes
		  0D=destroy all,Teron must survive
		  0E=capture dragons,capture dragon roost
		  0F=destroy all enemy ships,have
		     5 shipyards
		  10=kill daemon
		  11=destroy human buildings,rescue mage,
		     return him to circle of power
		  12=destroy all mage towers,destroy 
		     violet player
		  13=destroy all humans,capture dark portal
		  14=rescue X units , Alleria , Danath ,
		     Turalyon must survive
		  15=destroy all,Danath must survive
		  16=destroy all strongholds and fortresses,
		     Turalyon must survive,rescue X units
		  17=destroy enemy,have castle
		  18=destroy enemy shipyards , have 3 owns
		  19=destroy orange,bring Turalyon and
		     Danath to circle
		  1A=Kill Deathwing,Khadgar , Alleria ,
		     Kurdran must survive
		  1B=destroy black fortress,raze altar
		  1C=play until retreat,heroes must survive
		  1D=destroy enemy,heroes must survive
		  1E=destroy dark prtal,only Khadgar can
		     do this,must survive
		  0100=destroy all
		  0200=rescue X units,described below
00:030A		B Number of units to rescue.
00:030B		B Which units need to be rescued
		  16=only Hero flag units,0=any units
00:030C-00:030D	W Victory region ***
00:030E-00:032D	W Player's (0..15) Rescued persons number
00:032E-00:034D	W Player's (0..15) Captured persons number
00:034E-00:034F	W Map Dimensions,only one
00:0350-00:0351	W Reserved2
00:0352-00:0353	W Current map ***
00:0354		B Flag if Fog of war is enabled
		  *1=yes,0=no
00:0355		B Right click mouse style ***
00:0356-00:0357	W Color cycles ***
00:0358		B Local Players
00:0359		B Total Players
00:035A		B Number of Person Players
00:035B		B Player side
00:035C		B Message filter ***
00:035D		B Flag if it is a custom game
		  *1=yes,0=no
00:035E-00:035F	W X Position of map window ???
00:0360-00:0361	W Y Position of map window ???
00:0362-00:0381	W Player's (0..15) men in progress *** (men trained ???)
00:0382-00:03A1	W Player's (0..15) dead men table (men by others killed ???)
00:03A2-00:03C1	W Player's buildings in progress (buildings build ???)
00:03C2-00:03E1	W Player's destroyed buildings table (buildings by others destr???)
00:03E2-00:0401	W Player's kills
00:0402-00:0421	W Player's razings
00:0422-00:0423	W Total rescued
00:0424-00:0425	W Total NPCs
00:0426-00:0465	L Player's total gold mined
00:0466-00:04A5	L Player's total lumber chopped
00:04A6-00:04E5	L Player's total oil hauled
00:04E6-00:05E5	B Enemy table ***
00:05E6-00:062D	B Save map locations ??? (72 bytes)
00:062E-00:0631	L Campaign score
00:0632-00:0671	L Player's score
00:0672-00:0679	B Valid players ***
00:067A-00:07B9	$ Player's names each player 40 chars, $00=terminator
00:07BA-00:07D9	$ Customname ???
00:07DA-00:07F9	$ Map description , $00=terminator
00:07FA-00:07FD	L Custom checksum
00:07FE-00:083D	L Selected group time ???
00:083E-00:0841	L Saved score
00:0842-00:0851	B Player's ballista upgrade state
		  0=none,1=ballista 1,2=ballista 2
00:0852-00:0861	B Player's Ranger/Berserker upgrade state
00:0862-00:0871	B Player's Longbow/Light Axes upgrade state
00:0872-00:0881	B Player's Scouting upgrade state
00:0882-00:0891	B Player's Marksmanship/Regeneration state
00:0892-00:08C3	B Rune X position , max. 50 rune places=10 
		  at once available runes ???
00:08C4-00:08F5	B Rune Y position , see above
00:08F6-00:0959	W Runes delay , countdown ???
00:095A-00:0B09	B Computer upgrade table ???
00:0B0A-00:0B0B	W Patch signal , used by savefix.exe ???
00:0B0C-00:0B1B	B Team color reorder ???
00:0B1C-00:0B1D	W Saved by ... ???
00:0B1E-00:0FCF	B 04B2 Reserved3 bytes
00:0FD0-00:8FCF	W Reaction tile map
		  0000	Water
		  4000	Land
		  FAFF	Island (No Trans, no Land)
		  FBFF	Wall
		  FDFF	Rocks
		  FEFF	Forest
00:8FD0-01:0FCF	W Tile map 0..384 tiles,any order
		  +extended tiles like wall with 75 hits etc.
01:0FD0-01:8FCF	W Movement map : Lo-bytes 01=land
					  11=dirt
					  40=water
					  81=forest
					  82=coast
					
			         Hi-bytes 01=here is a land unit
					  02=here is an air unit
					  04=here is a naval unit
					  08=here is a building
01:8FD0-02:8FCF	L Ground & sea unit map,containing unit number 0..599
		  indexing unit array,FFFF:FFFF=no unit here
02:8FD0-03:8FD0	L Flying unit map,see above.
03:8FD0-03:CFCF B Viewing map,fog of war map
 
					Tiles :
					xx	xx	xx
					xo =01	oo =02 	ox =03
					
					xo	oo	ox
					xo =04	oo =00	ox =06

					xo	oo	ox
					xx =07	xx =08	xx =09

				xo	ox	oo	oo
				oo =0A	oo =0B	xo =0C	ox =0D

					xo	ox	oxo
					ox =0E	xo =0F	oxo =05

03:CFD0-04:0FD0	B Discovering map,full black,tiles like above
04:4FD0-04:52CF	R30 Player's(0..15) AI info table , record like this

		  Index :	Feature :

		  00 L		AI timer
		  04 L		AI sequence pointer
		  08 B		Player flags
		  09 B		Flag if can attack land
		  0A B		Flag if can attack water
		  0B B		Flag if can attack air
		  0C B		Flag if strategy is on
		  0D B		Land attack group size
		  0E B		Amount of land attack groups
		  0F B		Sea attack group size
		  10 B		Amount of sea attack groups
		  11 B		Air attack group size
		  12 B		Amount of air attack groups
		  13 B		Number of wanted peasants
		  14 B		Number of wanted footmans
		  15 B		Number of wanted archers
		  16 B		Number of wanted catapults
		  17 B		Number of wanted knights
		  18 B		Number of wanted oil tankers
		  19 B		Number of wanted destroyers
		  1A B		Number of wanted transports
		  1B B		Number of wanted battleships
		  1C B		Number of wanted submarines
		  1D B		Number of wanted mages
		  1E B		Number of wanted flying machines
		  1F B		Number of wanted demolition squads
		  20 B		Number of wanted dragons
		  21 B		Agressiveness level
		  22 B		Maximum buildable units ???
		  23 L		Building order table
		  27 L		Building wait table
		  2B B		North ???
		  2C B		East ???
		  2D B		South ???
		  2E B		West ???
		  2F B		Next side ???
04:52D0-04:53AB	W Overlap frames for each unit (0..109)
		  * group to belong number
		  * see unit array section on 04:6C1A for units order
04:53AC-04:54A9	W Obsolete General grafix frames
		  b00
		  :	Entry number counting all archives
		  b0C
		  b0D	Flag #2
		  b0E	Flag #1
		  b0F	Repeat flag
		  *FFFF means no frame available
		  *Units from 0-126
04:54AA-04:55A7	W Obsolete Forest grafix frames
		  *see above
04:55A8-04:56A5	W Obsolete Winter grafix frames
		  *see above
04:55A6-04:57A3	W Obsolete Wastelands grafix frames
		  *see above
04:57A4-04:595B	L Units sight range (110 units)
04:595C-04:5A37	W Units hit points (110 units)
04:5A38-04:5AA5	B Flag if unit is magic
		  0=no,1=yes
04:5AA6-04:5B13	B Units build time
		  * 6 = one second
04:5B14-04:5B81	B Units gold cost divided by 10
04:5B82-04:5BEF	B Units lumber cost divided by 10
04:5BF0-04:5C5D	B Units oil cost divided by 10
04:5C5E-04:5E15	L Units size in tiles , first X , then Y
04:5E16-04:5FCD	L Units box size in pixels , first X , then Y
04:5FCE-04:603B	B Units attack range
04:603C-04:60A9	B Computer units reaction range
04:60AA-04:6117	B Person units reaction range
04:6118-04:6185	B Units armor amount
04:6186-04:61F3	B Selectable thru rectangle
		  0=no,1=yes
04:61F4-04:6261	B Priority , AI treatment, high x low
04:6262-04:62CF	B Basic damage
04:62D0-04:633D	B Piercing damage
04:633E-04:63AB	B Weapon upgradable
		  0=no,1=yes
04:63AC-04:6419	B Armor upgradable
		  0=no,1=yes
04:641A-04:6487	B Missile weapon type
		  00	Lightning
		  01	Griffon Hammer
		  02	Dragon Breath
		  03	Flame Shield
		  04	???
		  05	???
		  06	???
		  07	Big Cannon
		  08	???
		  09	???
		  0A	Touch of Death
		  0B	???
		  0C	???
		  0D    Catapult Rock
		  0E	Ballista Bolt
		  0F	Arrow
		  10	Axe
		  11	Submarine Missile
		  12	Turtle Missile
		  13	???
		  14	???
		  15	???
		  16	???
		  17	???
		  18    Small Cannon
		  19	???
		  1A	???
		  1B	Daemon Fire
		  1C	???
		  1D    None
		  *1E-FF ???
04:6488-04:64F5	B Unit type
		  0=land,1=fly,2=naval
		  *changes only appearance
04:64F6-04:6563	B Decay rate
		  *dies in dacay * 6 , 0=never
		  *only for units created via spell
04:6564-04:65D1	B Annoy computer factor
04:65D2-04:660B	B Second mouse button click
		  01	Attack
		  02	Move
		  03	Harvest
		  04	Haul Oil
		  05	Demolish
		  06	Sail
		  *only the first 58 units
04:660C-04:66E7	W Point value for killing unit
04:66E8-04:6755	B Which terrain can unit target
		  00	Nothing
		  01	Land
		  02	Sea
		  03	Land and Sea
		  04	Air
		  05	Land and Air
		  06	Land and Sea
		  07	Everything
		  *Some missiles can not hit air units
04:6756-04:690D	L Unit flags
		  b00:	Land unit 
		  b01:	Air unit
		  b02:	Explode when killed (used on catapult)
		  b03:	Sea unit
		  b04:	Critter 
		  b05:	Is a building
		  b06:	Is a submarine
		  b07:	Can see submarine
		  b08:	Is a peon
		  b09:	Is a tanker
		  b0A:	Is a transport
		  b0B:	Is a place to get oil
		  b0C:	Is a storage for gold
		  b0D:	Not used
		  b0E:	Can ground attack (only catapult and ships)
		  b0F:	Is undead (exorcism work on them)
		  b10:	Is a Shore building
		  b11:	Can cast spell
		  b12:	Is a storage for wood
		  b13:	Can attack
		  b14:	Is a tower
		  b15:	Is an oil patch
		  b16:	Is a mine
		  b17:	Is a hero
		  b18:	Is a storage for oil
		  b19:	Invisibility/Unholy armor kill this unit
		  b1A:	This unit act like a mage
		  b1B:	Is this unit organic (spells)
		  b1C:	Not used
		  b1D:	Not used
		  b1E:	Not used
		  b1F:	Not used
04:690E-04:6941	B Upgrade time
		  *Upgrade type offsets
		  00	Sword 1
		  01	Sword 2
		  02	Axe 1
		  03	Axe 2
		  04	Arrow 1
		  05	Arrow 2
		  06	Spear 1
		  07	Spear 2
		  08	Human Shield 1
		  09	Human Shield 2
		  0A	Orc Shield 1
		  0B	Orc Shield 2
		  0C	Human Ship Cannon 1
		  0D	Human Ship Cannon 2
		  0E	Orc Ship Cannon 1
		  0F	Orc Ship Cannon 2
		  10	Human Ship Armor 1
		  11	Human Ship Armor 2
		  12	Orc Ship Armor 1
		  13	Orc Ship Armor 2
		  14	Catapult 1
		  15	Catapult 2
		  16	Ballista 1
		  17	Ballista 2
		  18	Train Rangers
		  19	Longbow
		  1A	Ranger Scouting
		  1B	Ranger Marksmanship
		  1C	Train Berserkers
		  1D	Lighter Axes
		  1E	Berserker Scouting
		  1F	Berserker Regeneration
		  20	Train Ogre Mages
		  21	Train Paladins
		  22	Holy Vision
		  23	Healing
		  24	Exorcism
		  25	Flame Shield
		  26	Fireball
		  27	Slow
		  28	Invisibility
		  29	Polymorph
		  2A	Blizzard
		  2B	Eye of Killrogg
		  2C	Bloodlust
		  2D	Raise Dead
		  2E	Death Coil
		  2F	Whirlwind
		  30	Haste
		  31	Unholy Armor
		  32	Runes
		  33	Death and Decay
04:6942-04:69A9	W Upgrade gold cost
04:69AA-04:6A11	W Upgrade lumber cost
04:6A12-04:6A79	W Upgrade oil cost
04:6A7A-04:6AE1	W Upgrade icon
04:6AE2-04:6B49	W Upgrade group applies to
04:6B4A-04:6C19	L Affect flags,what upgrade gives 
		  *For flags see unit and buildings
		  *allowed section on 00:0034
04:6C1A-05:A179 R84 Units array,600 units , record 134 B long
		
		Index:	Unit Feature:
	
		00 W	Display and clickable X position*32
		02 W	Display and clickable Y position*32
		04 W	Animator pointer in entry #278
		06 B	???
		07 B	Wait counter in entry #278 ???
		08 B	???
		09 B	Unit frame nr.
		0A B	Orientation 0-7 , 0=N,1=NE,...,7=NW
		:
		:
		10 W	Real X position,used by minimap too
		12 W	Real Y position,used by minimap too
		:
		:
		16 B	Flags if unit can be healed ???
		:
		:
		1A W	Hit points
		1C B	???
		1D B	Icon menu,available abilities to command
		1E B	Magic pts/Complete pts bar
		1F B	Unit identity,what really unit is
		20 W	Flag if unit slot is valid (FFFF=free)
		22 B	Move mode,0=ground,1=fly,2=water,3=nothing
		23 B	Look out,how unit is drawn on big map
		24 B	Which player control this unit
		25 B	Unit color of player dress
		26 B	Unit current action type
		:
		:
		3C W	Invisibility remaining time
		3E W	Unholy armor remaining time
		40 W	Bloodlust remaining time
		42 W	Haste/Slow remaining time
			Positive is haste , nagative slow
		44 W	???
		46 W	Flame shield remaining time
		:
		:
		50 W	X position in tiles ???
		52 W	Y position in tiles ???
		:
		:
		64 W	Start X position in tiles
		66 W	Start Y position in tiles
		
		6D B	If bit 5 set , unit has goods
			If bit 6 set , computer controlled ???
		:
		:
		76 B	Command (14=building)???
		77 B	Building what ???
		78 W	Building X position ???
		7A W	Gold in mine/Oil in patch divided by 100
			Building Y position ???
		7C W	Target X position/ % completed
		7E W	Target Y position
		80 L	Offset to unit array section to targeted
			unit ***

		*Unit Types

		00	Footman
		01	Grunt
		02	Peasant
		03	Peon
		04	Ballista
		05	Catapult
		06	Knight
		07	Ogre
		08	Archer
		09	Axethrower
		0A	Mage
		0B	Death Knight
		0C	Paladin
		0D	Ogre Mage
		0E	Dwarves
		0F	Goblin Sappers
		10	Attack Peasant
		11	Attack Peon
		12	Ranger
		13	Berserker
		14	Alleria
		15	Teron Gorefiend
		16	Kurdan and Sky'ree
		17	Dentarg
		18	Khadgar
		19	Grom Hellscream
		1A	Tanker H
		1B	Tanker O
		1C	Transport H
		1D	Transport O
		1E	Elven Destroyer
		1F	Troll Destroyer
		20	Battleship
		21	Juggernaught
		22	Nothing
		23	Deathwing
		24	Nothing
		25	Nothing
		26	Gnomish Submarine
		27	Giant Turtle
		28	Gnomish Flying Machine
		29	Goblin Zeppelin
		2A	Gryphon Rider
		2B	Dragon
		2C	Turalyon
		2D	Eye of Kilrogg
		2E	Danath
		2F	Korgath Bladefist
		30	Nothing
		31	Cho'gall
		32	Lothar
		33	Gul'dan
		34	Uther Lightbringer
		35	Zuljin
		36	Nothing
		37	Skeleton
		38	Daemon
		39	Critter
		3A	Farm
		3B	Pig Farm
		3C	Barracks H
		3D	Barracks O
		3E	Church
		3F	Altar of Storms
		40	Scout Tower H
		41	Scout Tower O
		42	Stables
		43	Ogre Mound
		44	Gnomish Inventor
		45	Goblin Alchemist
		46	Gryphon Aviary
		47	Dragon Roost
		48	Shipyard H
		49	Shipyard O
		4A	Town Hall
		4B	Great Hall
		4C	Elven lumber mill
		4D	Troll Lumber Mill
		4E	Foundry H
		4F	Foundry O
		50	Mage Tower
		51	Temple of the Damned
		52	Blacksmith H
		53	Blacksmith O
		54	Refinery H
		55	Refinery O
		56	Oil Platform H
		57	Oil Platform O
		58	Keep
		59	Stronghold
		5A	Castle
		5B	Fortress
		5C	Gold Mine
		5D	Oil Patch
		5E	Start Location H
		5F	Start Location O
		60	Guard Tower H
		61	Guard Tower O
		62	Cannon Tower H
		63	Cannon Tower O
		64	Circle of Power
		65	Dark Portal
		66	Runestone
		67	Wall H - not yet build
		68	Wall O - not yet build
		69	Dead Body
		6A	1x1 Destroyed Place
		6B	2x2 Destroyed Place
		6C	3x3 Destroyed Place
		6D	4x4 Destroyed Place
		6E
		:	Warcraft II Crashes
		FF

05:A17A-05:CA19	R34 Missiles array,200 missiles,record 52 B long

		  Index :	Missile Feature :

		  00 B		???
		  :
		  10 W		Half of greater X or Y distance
				rounded down , but at least 1
		  12 W		The greater of X or Y distance
				to target
		  14 W		The lesser of X or Y distance
				to target
		  :
		  17 B		
				b05	Set if Y direction positive
				b06	Set if X direction positive
				b07	Set if X distance >= Y
		  18 W		The greater of X or Y distance
				to target
		  :
		  1E W		Left time to hit target ???
		  20 W		X position in pixels of target
		  22 W		Y position in pixels of target
		  24 L		Offset to start of data
				for targeted unit
		  :
		  2C B		Missille type ???
		  :
		  2F B		Damage amount

		  *Missile types

		  00	Lightning
		  01	Griffon Hammer
		  02	Dragon Breath and Fireball
		  03	Fireball by Flame Shield
		  04	Flame Shield
		  05	Blizzard
		  06	Death and Deacy
		  07	Big Cannon
		  08	Exorcism
		  09	Heal Effect
		  0A	Touch of Death
		  0B	Rune
		  0C	Whirlwind
		  0D    Catapult Rock
		  0E	Ballista Bolt
		  0F	Arrow
		  10	Axe
		  11	Submarine Missile
		  12	Turtle Missile
		  13	Small Fire
		  14	Big Fire
		  15	Ballista and Catapult impact
		  16	Normal Spell
		  17	Explosion
		  18    Small Cannon
		  19	Cannon Explosion
		  1A	Cannon Tower Explosion
		  1B	Daemon Fire
		  1C	Green Cross
		  1D    None
		  *1E-FF ???

05:CA1A-05:D6FD	B ??? Unknown 3300 bytes
05:D6FE-05:D93D	B ??? Unknown 576 bytes

05:D93E		< End of File

 

Thanks! Tupac Administrator

Icon stuff 1.33

Spoiler

Explanation of the icon banks (unit/building graphics use exactly the same format)
==================================================================================

The icons (or "buttons") are stored in maindat.war, entry #356 (summer), #357 (winter), #358 (wasteland) and #471 (swamp).
(The respective color palettes are #2,#10,#18 and #438.)

Table of contents:
  1. File header format
  2. Icon data header
  3. Icon graphics data
  4. Example


*1* File header format:

The icon file starts with an offset-table, similar to war-archives or string-tables:

(Offs.)		(Len)		(Explanation)				(I'll refer to this as..)
$0000		1 word		number of entries (icons)		"nument"
$0002		1 word		maximum width  in pixels (46)		"maxw"
$0004		1 word		maximum height in pixels (38)		"maxh"
$0006		8 bytes		infos and offset for icon #0		(see below)
$000E		8 bytes		infos and offset for icon #1		(see below)
...
6+(nument-2)*8	8 bytes		infos and offset for icon #(nument-2)	(see below)
6+(nument-1)*8	8 bytes		infos and offset for icon #(nument-1)	(see below)

The 8 bytes for each icon are structured like this:
1 byte X displacement
1 byte Y displacement
1 byte width  in pixels
1 byte height in pixels
1 long offset from beginning of file to the actual icon data


*2* Icon data header:

This starts with an offset table again; these offsets are relative to the start of the icon data, and
there is one offset (word) for each vertical line. (I'll refer to the start of the icon data as "IStart"):

(Fileoffset)		(Len)	(explanation)
IStart + $0000		1 word	offset to graphics data for line 0
IStart + $0002		1 word	offset to graphics data for line 1
...
IStart + (height-1)*2	1 word	offset to graphics data for line (height-1)


*3* Icon graphics data:

The actual graphics data is compressed with a variation of RLE (Run Length Encoding):
The first byte is a control byte (I'll call it "count").
If bit #6 is set in count (count AND $40 <> 0): repeat the next byte (count - $40) times
If bit #7 is set in count (count AND $80 <> 0): leave (count - $80) pixels transparent
If neither bit #6 or #7 are set:		take the next (count) bytes as pixel values

     "count"(binary)   action to perform
       00xxxxxx        take the next xxxxxx bytes as pixel values
       01xxxxxx        repeat the next byte xxxxxx times
       1yyyyyyy        leave yyyyyyy pixels transparent


After the pixel values there is another control byte, and so on....

Attention: if you write a decoding routine, keep in mind that in some cases the length
of the "compressed" data is actually longer than uncompressed !



*4* Example:

Ok, let's extract the icon of a grunt (icon #3); we'll use the summer icons (entry #356).
First we need to get the information entry for this icon:
  Go to file position 6+3*8 (= $1E).
  Read two bytes "X -" and "Y displacement" (both 0)
  Read one byte "width"  ($2E = dec. 46)
  Read one byte "height" ($26 = dec. 38)
  Read one long "IStart" ($000018F6)

Now we know the icon has size 46 x 38. Let's decode the first line (line #0):
  Go to file position (IStart + line# * 2); for line #0 this is IStart ($18F6)
  Read one word "dataoffset" ($004C)
  Go to file position (IStart + dataoffset) ($1942)
  Read one byte "count" ($82)
  $82 has bit #7 set and #6 cleared, so this means we have to make the next 2 pixels transparent;
    Preserve the value of coordinates (0,0);
    Preserve the value of coordinates (1,0);
    (or set them both to the background colour; depends on what you use transparent pixels for)
  Read one byte "count" ($03)
  $03 has neither bit #6 or #7 set, meaning the following three bytes are pixel values:
    Read one byte ($EF), put color $EF to coordinates (2,0);
    Read one byte ($EF), put color $EF to coordinates (3,0);
    Read one byte ($63), put color $63 to coordinates (4,0);
  Read one byte "count" ($45)
  $45 has bit #7 cleared and #6 set, meaning that we have to repeat the next byte 5 times:
    Read one byte ($65)
    Put color $65 to coordinates (5,0),(6,0),(7,0),(8,0) and (9,0)
  Read one byte "count" ($21)
  $21 has neither bit #6 or #7 set, meaning the following $21 (dec.33) bytes are pixel values:
    Read one byte ($68), put color $68 to coordinates (10,0);
    Read one byte ($6B), put color $6B to coordinates (11,0);
    ......
    Read one byte ($86), put color $86 to coordinates (42,0);
  Read one byte "count" ($43)
  $43 has bit #7 cleared and #6 set, meaning that we have to repeat the next byte 3 times:
    Read one byte ($87)
    Put color $87 to coordinates (43,0),(44,0) and (45,0)
  Since the icon width is 45, we are done with line #0.
  Now repeat this for lines #1 - #37;





If you find that there is something wrong with the above explanation, please let me know.

Alexander Cech <e8900070@student.tuwien.ac.at>

Thanks! Tupac Administrator

Tile info

Spoiler

How the map tile graphics are stored
====================================

In maindat.war there is a section for each terrain-type, consisting of 7 entries.
I will refer to these entries as "entry A" ... "entry G"

For summer these are entry 2-8, wasteland: 10-16, winter: 18-24 and swamp: 438-444.

I will use the expressions
   - "minitile" for 8x8 pixel raw graphic data
   - "megatile" for 32x32 pixel graphics, composed out of 16 minitiles
   - "map tile" for the values used in the MTXM section in PUDs

Entry A: Color palette for the terrain type (256 * 3 bytes [RGBRGBRGB... and so on])
Entry B: Information about how to find the "minitiles" (8x8) for "megatiles" (32x32)
Entry C: Contains 16 masks (32x32) for the fog of war, followed by the minitile-data
Entry D: Information about how to find the "megatiles" for "map tiles" (the values in MTXM)
Entry E-G: Still unknown.

Confused by now ? Well, it isn't too complicated:
Each megatile is composed out of 16 minitiles in this order:

        01 02 03 04
        05 06 07 08
        09 10 11 12
        13 14 15 16

Entry B contains 16 words for each mega-tile; the last two bits of this word are mirror-flags.
if bit #0 is set you have to flip the minitile about its Y-axis, if bit #1 is set, the X-axis.
The rest of the word (word AND $FFFC) has to be multiplied by 16 to get an offset into entry C:
there you find the respective mini-tile data.

Entry D contains a chunk of 42 bytes for each unique map tile ($000x - $09Dx).
The first 16 words of this chunk contain tile-numbers for the variations of this map tile (the "x" above).
If one of these words is zero, that means the respective tile-number is not used.
(to get the correct offset just use this formula: ((map tile >> 4) * 42 + (map tile AND 15) * 2)
Then come 8 bytes and 1 word; these are still unknown.

Ok, I think an example will make this *much* clearer:
Suppose we find map tile $0052 (light grass) in MTXM.
This means we need the third (counting starts with 0) word in the fifth chunk of entry D:
5 * 42 + 2 * 2 = 214, so we read the word at offset 214 in entry D. (This is 356 for summer)
Now we have the tile-number. We need to multiply this by 32, because entry B contains 32 bytes (16 words)
for each tile-number: 356 * 32 = 11392. We go to offset 11392 in entry B; there we find an array of
16 words: $1288, $10F8, $1104, ...., $114F, $11F8.
                                         ^__ notice this one ! (see text below)

Each of these (words AND $FFFC) is the file-offset into entry C, divided by 16.
So to read the data for the first mini-tile we go to offset $12880 (= $1288 * 16) in entry C and read
64 bytes of data (64, because each minitile is size 8x8). This minitile goes directly (because neither
bit #0 or #1 is set) into the upper left corner, of the megatile.
Now the next minitile: go to offset $10F80 (= $10F8 * 16) in entry C, read 64 bytes,
place it into the second "column" in the first "row" (see illustration above). And so on...
We eventually reach the word $114F - this has both bit #0 and #1 set, meaning the tile we find at
offset $114C0 (= ($114F AND $FFFC) * 16) has to be X-flipped AND Y-flipped before copying it into
position 15 (according to the diagram above).
Continue, until we have read the last minitile at offset $11F80 and placed it into the lower right corner.
DONE!

Note that there are a lot of zeroes in entry D, because not all theoretically possible map tiles are used.


If you find that there is something wrong with the above explanation, please let me know.

Alexander Cech <e8900070@student.tuwien.ac.at>

Appendix:

The tilenumbers 0-15 are reserved for the masks; the first "real" tilenumber is 16.
Entry B contains the following data in its first 16 chunks (each 32 bytes long):
(Offset) (Data)
$0000    $0000, 15 x $0000
$0020    $0004, 15 x $0000
$0040    $0008, 15 x $0000
$0060    $000C, 15 x $0000
     ...
$01E0    $003C, 15 x $0000

The 8 unknown bytes for each megatile in entry B are used by the map editor to
set the surroundings of a placed tile.

Thanks! Tupac Administrator
12