Peds
Peds (pedestrians) are the many varied denizens of the Death Dawn world. Ranging from humans to cyborgs to androids to mutants to zombies, if it's vaguely humanoid and after your blood, it's a ped.
Ped types
There are various types of ped in the game. Generally each ped type will be different in appearance, AI motivations, faction alignment, weapons proficiency, speed, hitpoints, etc. Mod developers can add and remove ped types with ease, via the use of mission scripts and ped definition files.
Codewise, ped types are handled by pedtypes.c. This file contains the definition of the pedtype structure, and functions to load pedtypes from disc, and retrieve a definition from storage in memory. Each type has the following attributes:
- Sprite set
- Size (radius), in map units
- Initial/max health value
- Initial armour value
- Max armour value
- Punch strength
- AI goal list
- Predefined recolour blocks
- Animation data
- Type name, reference count
This type data comes from two sources: The textual ped definition file, and the sprite file giving the ped appearance.
Ped sprites and appearance
Each ped sprite file contains a set of sprites, each using the same 256 colour palette. This palette contains 4 recolour blocks, allowing the shirt, pants, hair and skin colour of each ped to be modified by changing the corresponding palette entries at runtime. When a ped is spawned, these recolour blocks are initialised using a random combination of the colours specified in the ped definition file; they can also later be changed in the mission script, by using the RECOLOUR command.
Each ped type also has a 'fullbright count', indicating how many of the palette entries should not be recoloured as part of the day-night cycle. This value is specified using the FULLBRIGHT attribute in the peddef file.
TODO:
MUST-DOCS: UNKNOWN: Ped code? Movement? Animation? Sound?
MUST-CODE: QUICK: Fix ped_move_slide() to trigger touch events for any solids that are touched (move existing code out of no_ped_collisions()
MUST-CODE: QUICK: Make pain anim have random occurence (with stat in peddef file?)
CODE: UNKNOWN: Fix peds getting stuck in walls! Drive mirano up ramp, and get out while jumping over the gap -> ped gets stuck in edge of wall on other side. Also, car exit code doesn't seem to check if exit coord is inside a block.
DOCS: UNKNOWN: Move PEDTURNSPEED to peddef files?
CODE: MED: Fix movement to not get stuck at block boundaries when running at low framerates
DOCS: QUICK: Decide which peds will be able to damage cars by punching them. Just ones made of metal? Would also need to introduce flag to say the ped is metallic (which would alter blood sprites etc. as appropriate)
MUST-CODE: MED: Sort out armour mechanic! Armour collection/loss needs to modify ped resist values
CODE: MED: Fix door selection for door anim to be more deterministic. Maybe mark in the ped struct which door is being used? Or calculate distance to door?
MUST-CODE: QUICK: Make it so that S_GUN uses gun name instead of number. And do the same for cars!
MUST-CODE: MED: Fix jumping up slopes to not kill player.
MUST-CODE: QUICK: Fix jumping over moving cars to not hurt the player.
MUST-CODE: MED: Visual drowning & electrocution effects.
???
Profit!