Makes rank names, attribute names, and ability names pull from arrays instead of using generic vals.

This commit is contained in:
2023-03-17 07:08:06 -07:00
parent 82df15364f
commit 32959aaf8c
2 changed files with 102 additions and 41 deletions

53
TODO.md
View File

@@ -24,19 +24,9 @@
* Would be a neat thing to do it by character age where an old enough VtM character either gets additional access to VtDA stuff or for certain things only has access to VtDA stuff. * Would be a neat thing to do it by character age where an old enough VtM character either gets additional access to VtDA stuff or for certain things only has access to VtDA stuff.
* Allowing them to also spend points on any of the VtDA talents/skills/knowledges/backgrounds/disciplines, but only let them choose VtDA clans. * Allowing them to also spend points on any of the VtDA talents/skills/knowledges/backgrounds/disciplines, but only let them choose VtDA clans.
* Extract the menu stuff to it's own bas file. * Extract the menu stuff to it's own bas file.
* https://qb64.com/wiki/TYPE
* https://qb64.com/wiki/$INCLUDE
* lib.BI - Type definitions. Include at the beginning of program.
* Include any dim, const, shared, or data.
* lib.BM - Sub/Function definitions. Include at the end of program.
* pm, PrintMenu, PrintMenuWithValues
* MenuItem/NewMenuItem
* MenuStyle/NewMenuStyle
* GetRandomMenuItem
* GetChoice? * GetChoice?
* GetRandomInt? * GetRandomInt?
* Extract each of the top-level menu items into their own files. * Extract each of the top-level menu items into their own files.
* Extract CharacterType and it's associated funcs/subs to their own files. (CharacterType.bi, CharacterType.bm)
* Extract show character sheet and save character to their own files or maybe put them in the CharacterType files. * Extract show character sheet and save character to their own files or maybe put them in the CharacterType files.
* Extract the ui utility funcs/subs into their own files. MakeFit*, itos$, ... * Extract the ui utility funcs/subs into their own files. MakeFit*, itos$, ...
* Add support for roads. * Add support for roads.
@@ -52,9 +42,12 @@
* GetAbilityValue/SetAbilityValue use a select case and individual GetTalent, GetSkill, ... functions. Try to find a way around this. * GetAbilityValue/SetAbilityValue use a select case and individual GetTalent, GetSkill, ... functions. Try to find a way around this.
* Maybe not possible without abstracting further in CharacterType and maybe also not possible to support the array defined stuff. * Maybe not possible without abstracting further in CharacterType and maybe also not possible to support the array defined stuff.
* Same for GetAttributeValue/SetAttribute. * Same for GetAttributeValue/SetAttribute.
* Make pm and MenuStyle and thus PrintMenu and PrintMenuWithValues let you print inside of ascii art boxes like the main menu screen. * Make PrintMenu and MenuStyle let you print inside of ascii art boxes like the main menu screen.
* Make pm and MenuStyle let you print menus like the main menu both full screen and wrap_content width and/or height. Hell maybe let you center them vertically/horizontally and still take up a full screen. * Make PrintMenu and MenuStyle let you print menus like the main menu both full screen and wrap_content width and/or height. Hell maybe let you center them vertically/horizontally and still take up a full screen.
* Find a way to support PrintMenuWithValues(Disciplines(), DISCIPLINES_COUNT, ch, ...) * Find a way to support PrintMenu(Disciplines(), DISCIPLINES_COUNT, ch, ...)
* Ideally this would be PrintMenu(Disciplines(), DISCIPLINES_COUNT, ch, (id as Integer, ch as CharacterType) { return ch.getDisciplineValue(id);}), but we don't have anonymous functions, function pointers, or inheritance.
* Maybe something like PrintMenu(Disciplines(), DISCIPLINES_COUNT, ch, VALUE_DISCIPLINE)
* This would call something like BuildValues(ch, VALUE_DISCIPLINE) internally before doing the actual print.
* Instead of PrintMenuWithValues(Disciplines(), disciplineValues(), DISCIPLINES_COUNT) * Instead of PrintMenuWithValues(Disciplines(), disciplineValues(), DISCIPLINES_COUNT)
* This would use the extra params to inspect ch for the discipline values instead of building a separate array. * This would use the extra params to inspect ch for the discipline values instead of building a separate array.
* This should also work for backgrounds. * This should also work for backgrounds.
@@ -64,7 +57,6 @@
* PrintMenuWithValues(PROP_ATTRIBUTES, ch, ATTRIBUTE_PHYSICAL) * PrintMenuWithValues(PROP_ATTRIBUTES, ch, ATTRIBUTE_PHYSICAL)
* All of these would do something like build a MenuItem for each with an id of the attribute id const, a label of the attribute name, and a value of ch(attrGroup, attrIndex) * All of these would do something like build a MenuItem for each with an id of the attribute id const, a label of the attribute name, and a value of ch(attrGroup, attrIndex)
* This will probably just go away by converting to pm over PrintMenu and PrintMenuWithValues, because we'll be creating an array of MenuItems for each one. We still have to fill the array each time, but we can look into making that suck less afterwards. * This will probably just go away by converting to pm over PrintMenu and PrintMenuWithValues, because we'll be creating an array of MenuItems for each one. We still have to fill the array each time, but we can look into making that suck less afterwards.
* Get attribute/ability/rank names from arrays when to print them (plural and singular) in loops like "Choose your tertiary attribute?" and "Which talent would you like to spend 1 of your 6 points on?"
* Consider supporting freeform gender strings. * Consider supporting freeform gender strings.
* The main reason for not doing this is limiting the string length. * The main reason for not doing this is limiting the string length.
* We don't do it for other strings, but we don't want to add more until we have a good way to handle them. * We don't do it for other strings, but we don't want to add more until we have a good way to handle them.
@@ -121,7 +113,6 @@
* Custom error codes from 100 to 199 * Custom error codes from 100 to 199
* Maybe use 27 - Out of paper. * Maybe use 27 - Out of paper.
* Use LogError in all of the SELECT CASE blocks without a CASE ELSE to throw an unknown index error. * Use LogError in all of the SELECT CASE blocks without a CASE ELSE to throw an unknown index error.
* Sort virtues better on the character sheet.
* Start work on ports * Start work on ports
* Mainly the C++ port. * Mainly the C++ port.
* Consider a python port to refresh my python skills. * Consider a python port to refresh my python skills.
@@ -147,7 +138,7 @@
* Is age a freeform string or not. * Is age a freeform string or not.
* How are the saved characters getting things like "lllllll" for a demeanor. * How are the saved characters getting things like "lllllll" for a demeanor.
* How are the saved characters getting blank lines "________" for age/name/nature/demeanor/clan/...? * How are the saved characters getting blank lines "________" for age/name/nature/demeanor/clan/...?
* What happens if you choose physical as your primary, secondary, and tertiray attribute? Probably something bad.
# Reference # Reference
* QB64 Wiki [https://qb64.com/wiki] * QB64 Wiki [https://qb64.com/wiki]
@@ -221,8 +212,13 @@
* Youth ? runaway, child, apprentice, heir, squire, urchin * Youth ? runaway, child, apprentice, heir, squire, urchin
## Roads (from page 102, see page 113) ## Roads (from page 102, see page 113)
* Road of the Beast: Feed the Beast, that it will not break its chains. * Road of Blood: Vampiric blood grants the power for revenge. * Road of Chivalry: Treat your equals with honor and your betters with respect. * Road of the Beast: Feed the Beast, that it will not break its chains.
* Road of the Devil: We are created evil and must play our part. * Road of Heaven: God made us vampires to exact His wrath. * Road of Humanity: The struggle to maintain one?s humanity. * Road of Paradox: Existence is a lie; change reality for the better. * Road of Blood: Vampiric blood grants the power for revenge.
* Road of Chivalry: Treat your equals with honor and your betters with respect.
* Road of the Devil: We are created evil and must play our part.
* Road of Heaven: God made us vampires to exact His wrath.
* Road of Humanity: The struggle to maintain one?s humanity.
* Road of Paradox: Existence is a lie; change reality for the better.
* Road of Typhon: Sin and corruption are the keys to under- standing. * Road of Typhon: Sin and corruption are the keys to under- standing.
## Clans (from page 103) ## Clans (from page 103)
@@ -244,15 +240,24 @@
## Backgrounds (from page 103) ## Backgrounds (from page 103)
* Allies: Human confederates, usually family or friends. * Allies: Human confederates, usually family or friends.
* Contacts: The number of information sources the character possesses. * Contacts: The number of information sources the character possesses.
* Generation: How far removed from Caine the character is. * Herd: The vessels to which the character has free and safe access. * Influence: The character?s political power within mortal society. * Mentor: The Cainite patron who advises and supports the character. * Generation: How far removed from Caine the character is.
* Resources: Wealth, belongings and monthly income. * Retainers: Followers, guards and servants. * Herd: The vessels to which the character has free and safe access.
* Influence: The character?s political power within mortal society.
* Mentor: The Cainite patron who advises and supports the character.
* Resources: Wealth, belongings and monthly income.
* Retainers: Followers, guards and servants.
* Status: The character?s standing in undead society. * Status: The character?s standing in undead society.
## Disciplines (from page 103) ## Disciplines (from page 103)
* Animalism: Supernatural affinity with and control of animals. * Auspex: Extrasensory perception, awareness and premonitions. * Celerity: Supernatural quickness and reflexes. * Animalism: Supernatural affinity with and control of animals.
* Chimerstry: The ability to create illusions and hallucinations. * Dementation: The ability to pass madness on to a victim. * Auspex: Extrasensory perception, awareness and premonitions.
* Dominate: Mind control practiced through the piercing gaze. * Fortitude: Unearthly toughness, even to the point of resisting fire and sunlight. * Celerity: Supernatural quickness and reflexes.
* Mortis: The supernatural power to control the process of death. * Obfuscate: The ability to remain obscure and unseen, even in crowds. * Chimerstry: The ability to create illusions and hallucinations.
* Dementation: The ability to pass madness on to a victim.
* Dominate: Mind control practiced through the piercing gaze.
* Fortitude: Unearthly toughness, even to the point of resisting fire and sunlight.
* Mortis: The supernatural power to control the process of death.
* Obfuscate: The ability to remain obscure and unseen, even in crowds.
* Obtenebration: The unearthly control over shadows. * Obtenebration: The unearthly control over shadows.
* Potence: The Discipline of physical vigor and strength. * Potence: The Discipline of physical vigor and strength.
* Presence: The ability to attract, sway and control crowds. * Presence: The ability to attract, sway and control crowds.

View File

@@ -11,6 +11,38 @@ Const INITIAL_GENERATION = 13
'$include: 'menus.bi' '$include: 'menus.bi'
'$include: 'character.bi' '$include: 'character.bi'
Const RANK_PRIMARY = 1
Const RANK_PRIMARY_LABEL = "Primary"
Const RANK_SECONDARY = 2
Const RANK_SECONDARY_LABEL = "Secondary"
Const RANK_TERTIARY = 3
Const RANK_TERTIARY_LABEL = "Tertiary"
Const RANKS_COUNT = 3
Type RankType
id As Integer
label As String
End Type
Dim Shared Ranks(1 To RANKS_COUNT) As RankType
Type AbilityType
id As Integer
singular As String
plural As String
End Type
Const ABILITY_TALENTS_ID = 1
Const ABILITY_TALENTS_SINGULAR = "Talent"
Const ABILITY_TALENTS_PLURAL = "Talents"
Const ABILITY_SKILLS_ID = 2
Const ABILITY_SKILLS_SINGULAR = "Skill"
Const ABILITY_SKILLS_PLURAL = "Skills"
Const ABILITY_KNOWLEDGES_ID = 3
Const ABILITY_KNOWLEDGES_SINGULAR = "Knowledge"
Const ABILITY_KNOWLEDGES_PLURAL = "Knowledges"
Const ABILITIES_COUNT = 3
Dim Shared Abilities(1 To ABILITIES_COUNT) As AbilityType
Call InitializeMemory Call InitializeMemory
' Run "tests" at startup. Uncomment the end instruction to see the output and not run the rest of the program. ' Run "tests" at startup. Uncomment the end instruction to see the output and not run the rest of the program.
@@ -21,6 +53,33 @@ Call MainMenu
' This initializes shared variables. ' This initializes shared variables.
Sub InitializeMemory Sub InitializeMemory
Call Initialize_Character_Lib Call Initialize_Character_Lib
Dim rank As RankType
Call NewRank(rank, RANK_PRIMARY, RANK_PRIMARY_LABEL)
Ranks(RANK_PRIMARY) = rank
Call NewRank(rank, RANK_SECONDARY, RANK_SECONDARY_LABEL)
Ranks(RANK_SECONDARY) = rank
Call NewRank(rank, RANK_TERTIARY, RANK_TERTIARY_LABEL)
Ranks(RANK_TERTIARY) = rank
Dim ability As AbilityType
Call NewAbility(ability, ABILITY_TALENTS_ID, ABILITY_TALENTS_SINGULAR, ABILITY_TALENTS_PLURAL)
Abilities(ABILITY_TALENTS_ID) = ability
Call NewAbility(ability, ABILITY_SKILLS_ID, ABILITY_SKILLS_SINGULAR, ABILITY_SKILLS_PLURAL)
Abilities(ABILITY_SKILLS_ID) = ability
Call NewAbility(ability, ABILITY_KNOWLEDGES_ID, ABILITY_SKILLS_SINGULAR, ABILITY_SKILLS_PLURAL)
Abilities(ABILITY_KNOWLEDGES_ID) = ability
End Sub
Sub NewAbility (ability As AbilityType, id As Integer, singular As String, plural As String)
ability.id = id
ability.singular = singular
ability.plural = plural
End Sub
Sub NewRank (rank As RankType, id As Integer, label As String)
rank.id = id
rank.label = label
End Sub End Sub
Sub SplashScreen Sub SplashScreen
@@ -236,7 +295,7 @@ Sub CGGetAttributes (ch As CharacterType)
Call NewMenuStyle(msWithoutValues) Call NewMenuStyle(msWithoutValues)
Dim msWithValues As MenuStyle Dim msWithValues As MenuStyle
Call NewMenuStyle(msWithValues) Call NewMenuStyle(msWithValues)
Dim ranks(1 To ATTRIBUTE_GROUPS_COUNT) As Integer Dim attributeRanks(1 To ATTRIBUTE_GROUPS_COUNT) As Integer
' Attribute groups menu (physical/social/mental) ' Attribute groups menu (physical/social/mental)
Dim mnuAttributeGroups(1 To ATTRIBUTE_GROUPS_COUNT) As MenuItem Dim mnuAttributeGroups(1 To ATTRIBUTE_GROUPS_COUNT) As MenuItem
@@ -250,10 +309,9 @@ Sub CGGetAttributes (ch As CharacterType)
groupSum = 0 groupSum = 0
rankSum = 1 rankSum = 1
For i = 1 To ATTRIBUTE_GROUPS_COUNT - 1 For i = 1 To ATTRIBUTE_GROUPS_COUNT - 1
' TODO: Pull this from an array like ranks or rank_names so "Choose your primary attribute?" instead nextGroup = ChooseMenuItemId(mnuAttributeGroups(), msWithoutValues, ATTRIBUTE_GROUPS_COUNT, "Choose your " + LCase$(Ranks(i).label) + " attribute?", TRUE)
nextGroup = ChooseMenuItemId(mnuAttributeGroups(), msWithoutValues, ATTRIBUTE_GROUPS_COUNT, "Choose your next attribute?", TRUE)
mnuAttributeGroups(nextGroup).isVisible = FALSE mnuAttributeGroups(nextGroup).isVisible = FALSE
ranks(nextGroup) = i attributeRanks(nextGroup) = i
rankSum = rankSum + i + 1 rankSum = rankSum + i + 1
groupSum = groupSum + nextGroup groupSum = groupSum + nextGroup
Next Next
@@ -261,18 +319,18 @@ Sub CGGetAttributes (ch As CharacterType)
' (Sum from 1 to count) - (Sum of all previous choice IDs) ' (Sum from 1 to count) - (Sum of all previous choice IDs)
' Sum(1..AllAttributesCount)-Sum(Choice[1]..Choice[AllAttributesCount-1]) ' Sum(1..AllAttributesCount)-Sum(Choice[1]..Choice[AllAttributesCount-1])
lastGroup = rankSum - groupSum lastGroup = rankSum - groupSum
ranks(lastGroup) = ATTRIBUTE_GROUPS_COUNT attributeRanks(lastGroup) = ATTRIBUTE_GROUPS_COUNT
' Spend attribute points ' Spend attribute points
For group = 1 To ATTRIBUTE_GROUPS_COUNT For group = 1 To ATTRIBUTE_GROUPS_COUNT
count = GetNumAttributesInGroup(group) count = GetNumAttributesInGroup(group)
ReDim attributes(1 To count) As String ReDim attributes(1 To count) As String
Call FillAttributesInGroup(group, attributes()) Call FillAttributesInGroup(group, attributes())
rank = ranks(group) rank = attributeRanks(group)
ReDim values(1 To count) As Integer ReDim values(1 To count) As Integer
For attrPoints = GetAttributePointsForRank(rank) To 1 Step -1 For attrPoints = GetAttributePointsForRank(rank) To 1 Step -1
Call FillAttributeValues(ch, values(), group) Call FillAttributeValues(ch, values(), group)
attribute = ChooseStringIdWithValues(attributes(), values(), msWithValues, count, "Which attribute do you want to spend 1 of your " + itos$(attrPoints) + " points on?") attribute = ChooseStringIdWithValues(attributes(), values(), msWithValues, count, "Which " + LCase$(AttributeGroups(group)) + " attribute do you want to spend 1 of your " + itos$(attrPoints) + " points on?")
Call SetAttributeValue(ch, group, attribute, GetAttributeValue(ch, group, attribute) + 1) Call SetAttributeValue(ch, group, attribute, GetAttributeValue(ch, group, attribute) + 1)
Next Next
Next Next
@@ -283,7 +341,7 @@ Sub CGGetAbilities (ch As CharacterType)
Call NewMenuStyle(msWithoutValues) Call NewMenuStyle(msWithoutValues)
Dim msWithValues As MenuStyle Dim msWithValues As MenuStyle
Call NewMenuStyle(msWithValues) Call NewMenuStyle(msWithValues)
Dim ranks(1 To ABILITY_GROUPS_COUNT) As Integer Dim abilityRanks(1 To ABILITY_GROUPS_COUNT) As Integer
' Ability groups menu (talents/skills/knowledges) ' Ability groups menu (talents/skills/knowledges)
Dim mnuAbilityGroups(1 To ABILITY_GROUPS_COUNT) As MenuItem Dim mnuAbilityGroups(1 To ABILITY_GROUPS_COUNT) As MenuItem
@@ -297,10 +355,9 @@ Sub CGGetAbilities (ch As CharacterType)
groupSum = 0 groupSum = 0
rankSum = 1 rankSum = 1
For i = 1 To ABILITY_GROUPS_COUNT - 1 For i = 1 To ABILITY_GROUPS_COUNT - 1
' TODO: Pull this from an array like ranks or rank_names so "Choose your primary ability?" instead nextAbility = ChooseMenuItemId(mnuAbilityGroups(), msWithoutValues, ABILITY_GROUPS_COUNT, "Choose your " + LCase$(Ranks(i).label) + " ability?", TRUE)
nextAbility = ChooseMenuItemId(mnuAbilityGroups(), msWithoutValues, ABILITY_GROUPS_COUNT, "Choose your next ability?", TRUE)
mnuAbilityGroups(nextAbility).isVisible = FALSE mnuAbilityGroups(nextAbility).isVisible = FALSE
ranks(nextAbility) = i abilityRanks(nextAbility) = i
rankSum = rankSum + i + 1 rankSum = rankSum + i + 1
groupSum = groupSum + nextAbility groupSum = groupSum + nextAbility
Next Next
@@ -308,19 +365,18 @@ Sub CGGetAbilities (ch As CharacterType)
' (Sum from 1 to count) - (Sum of all previous choice IDs) ' (Sum from 1 to count) - (Sum of all previous choice IDs)
' Sum(1..AllAttributesCount)-Sum(Choice[1]..Choice[AllAttributesCount-1]) ' Sum(1..AllAttributesCount)-Sum(Choice[1]..Choice[AllAttributesCount-1])
lastGroup = rankSum - groupSum lastGroup = rankSum - groupSum
ranks(lastGroup) = ABILITY_GROUPS_COUNT abilityRanks(lastGroup) = ABILITY_GROUPS_COUNT
' Spend ability points ' Spend ability points
For group = 1 To ABILITY_GROUPS_COUNT For group = 1 To ABILITY_GROUPS_COUNT
count = GetNumItemsForAbilityGroup(group) count = GetNumItemsForAbilityGroup(group)
ReDim abilities(1 To count) As String ReDim abilityNames(1 To count) As String
Call FillAbilitiesForAbilityGroup(group, abilities()) Call FillAbilitiesForAbilityGroup(group, abilityNames())
rank = ranks(group) rank = abilityRanks(group)
ReDim values(1 To count) As Integer ReDim values(1 To count) As Integer
For abilityPoints = GetAbilityPointsForRank(rank) To 1 Step -1 For abilityPoints = GetAbilityPointsForRank(rank) To 1 Step -1
Call FillAbilityValues(ch, values(), group) Call FillAbilityValues(ch, values(), group)
' TODO: Pull this from an array like AbilityGroupsSingle so "Which talent would you like to spend 1 of your 5 points on?" ability = ChooseStringIdWithValues(abilityNames(), values(), msWithValues, count, "Which " + LCase$(Abilities(i).singular) + " would you like to spend 1 of your " + itos$(abilityPoints) + " points on?")
ability = ChooseStringIdWithValues(abilities(), values(), msWithValues, count, "Which ability would you like to spend 1 of your " + itos$(abilityPoints) + " points on?")
Call SetAbilityValue(ch, group, ability, GetAbilityValue(ch, group, ability) + 1) Call SetAbilityValue(ch, group, ability, GetAbilityValue(ch, group, ability) + 1)
Next Next
Next Next