Fleshed out first prototype player, Hue Hauser, along with his chaps and handgun.

This commit is contained in:
Martin Haye 2015-10-01 08:34:49 -07:00
parent 9ff4aeb793
commit 679a9ae6fb
8 changed files with 297 additions and 191 deletions

View File

@ -29,7 +29,7 @@ MAX_SEGS = 96
DO_COMP_CHECKSUMS = 0 ; during compression debugging
DEBUG_DECOMP = 0
DEBUG = 1
DEBUG = 0
SANITY_CHECK = 0 ; also prints out request data
; Zero page temporary variables

View File

@ -79,8 +79,8 @@ const callbacks = $300
const OVERMAP_NUM = 1
const OVERMAP_IS_3D = 0
//include "playtype_consts.plh"
include "heaptest_consts.plh"
include "playtype.plh"
//include "heaptest.plh"
word global // the global heap object, from which all live objects must be reachable
@ -1477,7 +1477,8 @@ def removeFromList(pList, toRemove)
fin
end
include "heaptest_defs.plh"
include "playtype.pla"
//include "heaptest.pla"
///////////////////////////////////////////////////////////////////////////////////////////////////
// Set up the small-object heap
@ -1493,7 +1494,7 @@ end
// Main code.
//
initHeap()
testHeap()
addToList(global + p_players, new_Player_Hue_Hauser())
loadTitle()
setCallbacks()
mapIs3D = OVERMAP_IS_3D

View File

@ -0,0 +1,108 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
def addTypes()
mmgr(HEAP_ADD_TYPE, @typeTbl_Global)
global = mmgr(HEAP_ALLOC, TYPE_GLOBAL)
mmgr(HEAP_ADD_TYPE, @typeTbl_Player)
mmgr(HEAP_ADD_TYPE, @typeTbl_Item)
mmgr(HEAP_ADD_TYPE, @typeTbl_Modifier)
mmgr(HEAP_ADD_TYPE, @typeTbl_Effect)
mmgr(HEAP_ADD_TYPE, @typeTbl_Item)
mmgr(HEAP_ADD_TYPE, @typeTbl_Weapon)
mmgr(HEAP_ADD_TYPE, @typeTbl_Armor)
mmgr(HEAP_ADD_TYPE, @typeTbl_Stuff)
mmgr(HEAP_ADD_TYPE, @typeTbl_Enemy)
end
///////////////////////////////////////////////////////////////////////////////////////////////////
def new_Modifier(kind, value)
word p
p = mmgr(HEAP_ALLOC, TYPE_MODIFIER)
p->b_modKind = kind
p->b_modValue = value
return p
end
///////////////////////////////////////////////////////////////////////////////////////////////////
def new_Armor_Chaps
word p
p = mmgr(HEAP_ALLOC, TYPE_ARMOR)
p=>s_name = mmgr(HEAP_INTERN, "Chaps")
p->b_itemKind = KIND_PANTS
p=>w_cost = -99 // for now
// no modifiers, max uses, etc. for now
p->b_armorValue = 2
return p
end
///////////////////////////////////////////////////////////////////////////////////////////////////
def encodeDice(nDice, dieSize, add)
return (nDice << 12) | (dieSize << 8) | add
end
///////////////////////////////////////////////////////////////////////////////////////////////////
def new_Weapon_Handgun
word p
p = mmgr(HEAP_ALLOC, TYPE_WEAPON)
p=>s_name = mmgr(HEAP_INTERN, "Handgun")
p->b_itemKind = KIND_HANDGUN
p=>w_cost = -99 // for now
// no modifiers, max uses, etc. for now
p->b_ammoKind = KIND_BULLET
p->b_clipSize = 6
p->r_meleeDmg = encodeDice(1, 6, 0) // 1d6
p->r_projectileDmg = encodeDice(1, 6, 0) // 1d6
p->ba_attacks[0] = 1 // single attack
p->b_range = 40
p->s_combatText = mmgr(HEAP_INTERN, "shoots")
return p
end
///////////////////////////////////////////////////////////////////////////////////////////////////
def calcPlayerArmor(player)
word pItem
player->b_armor = 0
pItem = player=>p_items
while pItem
if pItem->t_type == TYPE_ARMOR
player->b_armor = player->b_armor + pItem->b_armorValue
fin
pItem = pItem=>p_nextObj
loop
end
///////////////////////////////////////////////////////////////////////////////////////////////////
def new_Player_Hue_Hauser
word p, pItem
p = mmgr(HEAP_ALLOC, TYPE_PLAYER)
p=>s_name = mmgr(HEAP_INTERN, "Hue Hauser")
p->b_intelligence = 5
p->b_strength = 6
p->b_agility = 3
p->b_bravery = 6
p->b_stamina = 4
p->b_charisma = 7
p->b_spirit = 5
// Basic skills
p->b_aiming = 2
p->b_dodging = 3
p->b_wilderness = 5
// Skills
addToList(p + p_skills, new_Modifier(KIND_MINING, 0))
addToList(p + p_skills, new_Modifier(KIND_NATIVE_BOND, 0))
addToList(p + p_skills, new_Modifier(KIND_PYRE_WARE, 0))
// Items
addToList(p + p_items, new_Armor_Chaps())
addToList(p + p_items, new_Weapon_Handgun())
// Calculated attributes
calcPlayerArmor(p)
// (No buffs or debuffs to start with.)
// All done with the player.
return p
end

View File

@ -0,0 +1,183 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// Structures for the heap
const TYPE_GLOBAL = $80
struc Global
byte t_type
word p_players
end
byte typeTbl_Global[] = Global, p_players, 0
const TYPE_PLAYER = $81
struc Player
byte t_type
word p_nextObj
word s_name
// Innate attributes
byte b_intelligence
byte b_strength
byte b_agility
byte b_bravery
byte b_stamina
byte b_charisma
byte b_spirit
// Calculated attributes
byte b_armor
// Basic skills
byte b_aiming
byte b_dodging
byte b_wilderness
// Status
word w_health
word w_maxHealth
// Lists
word p_skills // list:Modifier
word p_items // list:Item
word p_buffs // list:Effect
word p_debuffs // list:Effect
end
byte typeTbl_Player[] = Player, p_nextObj, s_name, p_skills, p_items, p_buffs, p_debuffs, 0
// Combat skills, weapon modifiers, etc.
const TYPE_MODIFIER = $82
struc Modifier
byte t_type
word p_nextObj
byte b_modKind
byte b_modValue
end
byte typeTbl_Modifier[] = Modifier, p_nextObj, 0
// Buffs and debuffs, that last until a specified time
const TYPE_EFFECT = $83
struc Effect
byte t_type
word p_nextObj
byte b_modKind
byte b_modValue
word s_effectDescrip
word w_endTurn
end
byte typeTbl_Effect[] = Effect, p_nextObj, s_effectDescrip, 0
const TYPE_ITEM = $84
struc Item
byte t_type
word p_nextObj
word s_name
byte b_itemKind
word w_cost
word p_modifiers // list:modifier
end
byte typeTbl_Item[] = Item, p_nextObj, s_name, p_modifiers, 0
const WEAPON_FLAG_SINGLE_USE = $01
const WEAPON_FLAG_WHOLE_GROUP = $02
const TYPE_WEAPON = $85
struc Weapon
// Item properties
byte t_type
word p_nextObj
word s_name
byte b_itemKind
word w_cost
word p_modifiers // list:modifier
// Usables properties
byte b_maxUses
byte b_curUses
// Weapon properties
byte b_weaponFlags // WEAPON_FLAG_* above
byte b_ammoKind
byte b_clipSize
byte b_clipCurrent
word r_meleeDmg // 3 hex digits: num dice, die size, add. E.g. $361 = 3d6+1
word r_projectileDmg // ditto
byte ba_attacks[3] // each is: 0=none, 1=single, 2=double, 3+ = multi-shot
byte b_range
word s_combatText
end
byte typeTbl_Weapon[] = Weapon, p_nextObj, s_name, p_modifiers, s_combatText, 0
const TYPE_ARMOR = $87
struc Armor
// General item properties
byte t_type
word p_nextObj
word s_name
byte b_itemKind
word w_cost
word p_modifiers // list:modifier
// Usables properties
byte b_maxUses
byte b_curUses
// Armor properties
byte b_armorValue
end
byte typeTbl_Armor[] = Armor, p_nextObj, s_name, p_modifiers, 0
// Countable things, e.g. ammo and pelts
const TYPE_STUFF = $88
struc Stuff
// General item properties
byte t_type
word p_nextObj
word s_name
byte b_itemKind
word w_cost
// Stuff properties
word w_count
word w_maxCount
end
byte typeTbl_Stuff[] = Stuff, p_nextObj, s_name, 0
const TYPE_ENEMY = $89
struc Enemy
byte t_type
word p_nextObj
word s_name
byte ba_images[2]
word w_hitPoints
byte b_hitBonus
byte b_attackType // 1=melee, 2=projectile
word s_attackText
end
byte typeTbl_Enemy[] = Enemy, p_nextObj, s_name, s_attackText, 0
// Weapon kinds
const KIND_BOW = 1; byte[] kind_bow_str = "bow(s)"
const KIND_BLADE = 2; byte[] kind_blade_str = "blade(s)"
const KIND_EXPLOSIVE = 3; byte[] kind_explosive_str = "explosive(s)"
const KIND_HANDGUN = 4; byte[] kind_handgun_str = "handgun(s)"
const KIND_HAND_TO_HAND = 5; byte[] kind_hand_to_hand_str = "hand to hand"
const KIND_RIFLE = 6; byte[] kind_rifle_str = "rifle(s)"
const KIND_THROWING = 7; byte[] kind_throwing_str = "throwing"
// Skill kinds
const KIND_MINING = 8; byte[] kind_mining_str = "mining"
const KIND_NATIVE_BOND = 9; byte[] kind_native_bond_str = "native bond"
const KIND_PYRE_WARE = 10; byte[] kind_pyre_ware_str = "pyre ware"
// Ammo kinds
const KIND_BULLET = 11; byte[] kind_bullet_str = "bullet(s)"
const KIND_ARROW = 12; byte[] kind_arrow_str = "arrow(s)"
const KIND_BUCK = 13; byte[] kind_buck_str = "buck"
const KIND_QUARREL = 14; byte[] kind_quarrel_str = "quarrel(s)"
// Armor kinds
const KIND_SHOES = 15; byte[] kind_shoes_str = "shoes"
const KIND_COAT = 16; byte[] kind_coat_str = "coat(s)"
const KIND_HAT = 17; byte[] kind_hat_str = "hat(s)"
const KIND_PANTS = 18; byte[] kind_pants_str = "pants"
const KIND_SHIRT = 19; byte[] kind_shirt_str = "shirt(s)"
const KIND_GLOVES = 20; byte[] kind_gloves_str = "gloves"
const KIND_SHIELD = 21; byte[] kind_shield_str = "shield(s)"
// Text table for translating a kind to a string
word[] kinds = @kind_bow_str, @kind_blade_str, @kind_explosive_str, @kind_handgun_str, @kind_hand_to_hand_str, @kind_rifle_str, @kind_throwing_str
word = @kind_mining_str, @kind_native_bond_str, @kind_pyre_ware_str
word = @kind_bullet_str, @kind_arrow_str, @kind_buck_str, @kind_quarrel_str
word = @kind_shoes_str, @kind_coat_str, @kind_hat_str, @kind_pants_str, @kind_shirt_str, @kind_gloves_str, @kind_shield_str
word = NULL

View File

@ -1,180 +0,0 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// Structures for the heap
const TYPE_GLOBAL = $80
struc Global
byte type
word id
word players
end
const TYPE_PLAYER = $81
struc Player
byte t_type
word p_nextObj
word s_name
// Innate attributes
byte b_intelligence
byte b_strength
byte b_agility
byte b_bravery
byte b_health
byte b_charisma
byte b_spirit
// Calculated attributes
byte b_armor
// Basic skills
byte b_aiming
byte b_dodging
byte b_wilderness
// Lists
word p_skills // list:Modifier
word p_items // list:Item
word p_buffs // list:TempModifier
word p_debuffs // list:TempModifier
end
// Combat skills, weapon modifiers, etc.
const TYPE_MODIFIER = $82
struc Modifier
byte t_type
word p_nextObj
byte b_modKind
byte b_modValue
end
const TYPE_TEMP_MODIFIER = $83
struc TempModifier
byte t_type
word p_nextObj
byte b_modKind
byte b_modValue
word s_tempModDescrip
word w_endTurn
end
const TYPE_ITEM = $84
struc Item
byte t_type
word p_nextObj
word s_name
byte b_itemKind
word w_cost
word p_itemModifiers
end
const WEAPON_FLAG_SINGLE_USE = $01
const WEAPON_FLAG_WHOLE_GROUP = $02
const TYPE_WEAPON = $85
struc Weapon
// General item properties
byte t_type
word p_nextObj
word s_name
byte b_itemKind
word w_cost
word p_itemModifiers
// Usables properties
byte b_maxUses
byte b_curUses
// Weapon properties
byte b_weaponFlags
byte b_ammoKind
byte b_clipSize
byte b_clipCurrent
word r_meleeDmg // 3 hex digits: num dice, die size, add. E.g. $361 = 3d6+1
word r_projectileDmg // ditto
byte ba_attacks[3] // each is: 0=none, 1=single, 2=double, 3+ = multi-shot
byte b_range
word s_combatText
end
const TYPE_ARMOR = $87
struc Armor
// General item properties
byte t_type
word p_nextObj
word s_name
byte b_itemKind
word w_cost
word p_itemModifiers
// Usables properties
byte b_maxUses
byte b_curUses
// Armor properties
byte armorValue
byte maxUses
byte curUses
end
// Countable things, e.g. ammo and pelts
const TYPE_STUFF = $88
struc Stuff
// General item properties
byte t_type
word p_nextObj
word s_name
byte b_itemKind
word w_cost
word p_itemModifiers
// Stuff properties
word count
word maxCount
end
const TYPE_ENEMY = $89
struc Enemy
byte t_type
word p_nextObj
word s_name
byte ba_images[2]
word w_hitPoints
byte b_hitBonus
byte b_attackType // 1=melee, 2=projectile
word s_attackText
end
// Table per type, starts with length, then pointer offsets, ending with zero.
// Hints so the heap management code knows how to traverse the structures
byte typeTbl_Global[] = Global, players, 0
byte typeTbl_Player[] = Player, p_nextObj, s_name, p_skills, p_items, p_buffs, p_debuffs, 0
byte typeTbl_Modifier[] = Modifier, p_nextObj, 0
byte typeTbl_TempModifier[] = TempModifier, p_nextObj, s_tempModDescrip, 0
byte typeTbl_Item[] = Item, p_nextObj, s_name, p_itemModifiers, 0
// Weapon kinds
byte[] kind_bow = "bow(s)"
byte[] kind_blade = "blade(s)"
byte[] kind_explosive = "explosive(s)"
byte[] kind_handgun = "handgun(s)"
byte[] kind_hand_to_hand = "hand to hand"
byte[] kind_rifle = "rifle(s)"
byte[] kind_throwing = "throwing"
// Skill kinds
byte[] kind_mining = "mining"
byte[] kind_native_bond = "native bond"
byte[] kind_pyre_ware = "pyre ware"
// Ammo kinds
byte[] kind_bullet = "bullet(s)"
byte[] kind_arrow = "arrow(s)"
byte[] kind_buck = "buck"
byte[] kind_quarrel = "quarrel(s)"
// Armor kinds
byte[] kind_shoes = "shoes"
byte[] kind_coat = "coat(s)"
byte[] kind_hat = "hat(s)"
byte[] kind_pants = "pants"
byte[] kind_shirt = "shirt(s)"
byte[] kind_gloves = "gloves"
byte[] kind_shield = "shield(s)"
// Text table for translating a kind to a string
//word[] kinds = kind_bow, kind_blade, kind_explosive, kind_handgun, kind_hand_to_hand, kind_rifle, kind_throwing
//word = kind_mining, kind_native_bond, kind_pyre_ware
//word = kind_bullet, kind_arrow, kind_buck, kind_quarrel
//word = kind_shoes, kind_coat, kind_hat, kind_pants, kind_shirt, kind_gloves, kind_shield

View File

@ -1,6 +0,0 @@
def new_Player_Hue_Hauser
word p
p = mmgr(HEAP_ALLOC, TYPE_PLAYER)
p=>s_name = mmgr(HEAP_INTERN, "Hue Hauser")
end