HOW TO EDIT THE BATTLEFIELD: 1942 HUD


Updated September 25, 2003

HUD means "Heads Up Display", and are the elements overlaid on the screen above the 3D content. The textures for the various 2D images that are overlaid on the screen are in Menu.rfa in the menu\Texture directory and its subdirectories. Most of the images are in the DDS format, some in the TGA (Targa) format. Often in a .con file a ".tga" suffix file will be specified, but in fact a DDS file (with a .dds suffix) will be used. In general, paths specified in the text .con files are relative to menu\Texture directory. All textures must be a power of 2 along each edge.

I highly recommend using the free Irfanview program (also get the plugins package for this program) to browse these image directories. Open Irfanview and hit the "T" key and you can see thumbnails of the images in directories. The Menu.rfa's directories break down as follows:

Menu.rfa Structure

The Menu.rfa file contains files concerned with aspects of the game menus and the heads-up displays that appear during the game.

There are two types of files in Menu.rfa: menu control, and textures. The main root directory contains the menu control and sound script files, the Texture directory and its subdirectories contain all the menu textures.

The menu control files seem to be in a semi-binary format called "MemeFile 2.0.", which is used to control the menus. MDT TOOL???

The menu\Texture directory contains some miscellaneous images, such as the binoculars and sniper scope view, minimap repair and medical attention icons, flags, etc. It also contains many subdirectories, the purpose of most of which is fairly obvious:

  • Ammo - the type of ammunition your weapon shoots
  • Briefing - the briefing windows shown when a battle starts
  • Debriefing - after the battle windows, etc.
    • classes - the class icons for the player list
    • medals - stars for the best players
  • Ingame - most in-game HUD-related images are located here
    • Artillery - for when an artilleryman uses a scout's sighting
    • cpbar - the color bars for how many flags are Axis/Allied/Neutral on the bottom edge of the minimap
    • respawn - menu window elements for the spawn screen
    • text-mess - areas for text messages
  • Kits - the kit (character class) image for the spawn screen
  • Load - the background image shown while loading a battle
  • Menu - menu background image and menu frame images
    • buttons - buttons you can click, such as picking which battle you want to create
    • multiplayer - serverlist window
    • options - still more menu frames, for options
    • serverinfo - icons related to server status
    • singleplayer - menu frames, for single player mode
  • Minimap - uncolored minimap icons for soldiers, tanks, planes, etc.
  • Radio - the radio buttons
  • Soldier - HUD soldier status, for each nationality: standing, crouched, prone
  • Submarine - Submarine HUD elements
  • ToolTip - tooltip menuing elements (not the tooltips themselves)
  • Vehicle - HUD vehicle icons, used when showing what position you are in
  • Weapon - HUD hand weapon icons, displayed when a new weapon is selected
The Objects.rfa file contains many text .con property files associated with the Heads Up Display and other images. There are a few different kinds of files where these properties are set: soldier body files, soldier kit files, handweapon object files, and vehicle object files. Each will be described in turn, with illustrations at the end.

Soldier Body

The soldier body files each define a different nationality soldier. Each is concerned mostly with gluing together the various soldier geometry files, but each also contains some HUD information important to the nationality. The objects\Soldiers directory holds subdirectories of the various nationalities of soldiers, and each of these subdirectories contains an Objects.con file for the soldier.
  ObjectTemplate.SetSoldierStandingIcon "Soldier/icon_*_soldier_standing.dds"
  ObjectTemplate.SetSoldierCrouchIcon "Soldier/icon_*_soldier_crouching.dds"
  ObjectTemplate.SetSoldierProneIcon "Soldier/icon_*_soldier_lying.dds"
These set the standing/crouching/lying icons on the in-game HUD to show a soldier's status.
  ObjectTemplate.setMinimapIcon "flag_*.tga"
  ObjectTemplate.setControlPointIcon "conp_*.tga"
  ObjectTemplate.setTicketIcon "flag_ticket_*.tga"
These all have to do with the minimap. SetMinimapIcon is used for vehicles (see below), but this setting is ignored for soldiers (the image Minimap\minimap_icon_soldier_16x16.dds is always used). SetControlPointIcon defines what flag icon is used when this soldier's side controls a flag. SetTicketIcon is for the little flag next to the ticket counter on the minimap.
  ObjectTemplate.setTeamFlagIcon "Icon_flag_*.tga"
This is used with the soldier spawn page. It sets the team flag in the upper left corner when you select your class (i.e. above all the classes).

Soldier Kit

The soldier kit files are in the objects\Items directory, and describe the various classes a player can choose. In this directory are subdirectories for the various nationalities (BritKit, USKit, etc.), and in each of these are subdirectories for the various classes (AntiTank, Assault, etc.). Finally, in each of these directories is an Objects.con file.

Here are the properties set in all kit files that are relevant to the HUD:

  ObjectTemplate.SetHealthBarIcon "Ingame/Healthbar_empty_*_64x64.tga"
  ObjectTemplate.SetHealthBarFullIcon "Ingame/Healthbar_full_*_64x64.tga"
A commonly used technique in the HUD is to have two icons for each gauge, one showing the gauge empty and one showing it full. The actual value of the property is then used to display part of one icon and part of the other on the HUD, so showing any state between the two.
  ObjectTemplate.AddWeaponIcon "Weapon/Icon_*.tga"
When a weapon is selected (via keys 1-6 or the mousewheel), the weapons a soldier can choose from are displayed at the bottom of the HUD. The weapon icon displayed for each weapon choice is set in the corresponding soldier kit file, which contains a series of AddWeaponIcon property settings which specify the weapon icons to be displayed.
  ObjectTemplate.setKitIcon 0 "kits/Icon_*_selected.tga"
This associates the class icon on the soldier spawn screen with the soldier kit file.

Handweapon Object

Handweapon object files are located in the objects\HandWeapons directory, with each weapon in a subdirectory. In each subdirectory is an Objects.con file, which defines the weapon. This file also includes information for the HUD for when a soldier is armed with the weapon:
  ObjectTemplate.setHudAmmoType ATTypeName
SetHudAmmoType sets the type of ammo that is to be displayed. The ATTypeName value specifies the format. This type is also used by vehicles' HUD displays. Here are the values and what they mean:
  • ATNone - for positions that have no weapons; set for vehicles without weapons
  • ATAmmoBar - for weapons that use a full and empty icon for their ammo bar.
  • ATIcon - for weapons with an icon that does not change, e.g. bazooka, knife.
  • ATIconAndHeatBar - for the medpack, as the "heat" bar shows the healing level left.
  • ATIconAndReloadBar - for the engineer, with the "reload" bar showing repair level left.
  • ATIconAndStrengthBar - for grenades, as the right mouse button can vary the strength of the throw.
If the format set by SetHudAmmoType is ATAmmoBar, then these properties are set:
  ObjectTemplate.setAmmoBar "Ingame/*_empty_32x64.dds"
  ObjectTemplate.setAmmoBarFill "Ingame/*_full_32x64.dds"
  ObjectTemplate.setAmmoBarSize #
SetAmmoBar and SetAmmoBarFill are used to show how full the ammo clip is, using images of the clip itself. The setAmmoBarSize is the height of the useful area of the ammo bar. All textures have to be a power of 2 along their edges, and all ammo bars are 32 or 64 pixels wide, but the useful height varies.

If SetHudAmmoType is set to any of the ATIcon* types, then this property is set:

  ObjectTemplate.setAmmoIcon "Ammo/Icon_*.tga"
This property defines the (unchanging) image of the type of ammo used.
  ObjectTemplate.SetScopeIcon "*.tga"
This property is used to set the image for the sniperscope and binoculars views.

Vehicle Object

Vehicle object files are the Objects.con found in the objects\Vehicles directories in Objects.rfa.
  ObjectTemplate.setVehicleIcon "Vehicle/Icon_*.tga"
  ObjectTemplate.setVehicleIconPos x/y
This HUD icon shows what sort of weapon you are currently inside. The position you are manning is overlaid on this icon, and is measured in pixels from the upper left-hand corner of the icon.
  ObjectTemplate.setNumberOfWeaponIcons #
  ObjectTemplate.setPrimaryAmmoIcon "Ammo/Icon_*.tga"
  ObjectTemplate.setPrimaryAmmoBar ABTypeName
  ObjectTemplate.setSecondaryAmmoIcon "Ammo/Icon_*.tga"
  ObjectTemplate.setSecondaryAmmoBar ABTypeName
These all have to do with the ammunition/overheating status display for each weapon, the primary (left mouse fire) and secondary (right mouse), if any. SetNumberOfWeaponIcons specifies the number of weapons that have a display on the HUD, a value from 0 to 2. SetPrimaryAmmoBar sets the type of display needed for the weapon, similar to how handweapons use this value. Note that the defined names are different, though, starting with AB instead of AT. Here are the values used for vehicle weapons:
  • ABNone - for positions that have no weapons; set for vehicles without weapons
  • ABAmmoBar - for weapons with no reload wait time but can run out of ammo, like fighter plane guns
  • ABAmmoBarHeatBar - for weapons that overheat and run out of ammo, like machineguns on tanks
  • ABAmmoBarReloadBar - for weapons that need time to reload, like tank or ship guns
  • ABHeatBarOnly - for weapons that overheat but never run out of ammo, like stationary MGs
  • ABReloadBarOnly - never runs out of ammo but wait to reload, e.g. destroyer and battleship guns
  • ABIconOnly - never overheats, never runs out of ammo, never needs to reload, e.g. flak guns
If SetPrimaryAmmoBar is any setting except for ABNone, the setPrimaryAmmoIcon property is set, to define an image of the type of ammo used (bullet, rocket, etc).
  ObjectTemplate.setHasTurretIcon 1
If setHasTurretIcon is 1, then a turret and tank direction indicator is drawn, in the bottom center of the HUD.
  ObjectTemplate.setMinimapIcon "Minimap/minimap_icon_*.tga"
How this vehicle is represented on the minimap.

Game Setup

There is one other area where images are loaded: in the battle levels themselves. In the file bf1942\levels\*\Menu\init.con file for a battle, the image shown when the level is loaded is defined by:
  game.setLoadPicture Load/*.tga

Illustrations

Many of these properties are marked on the images below.