Skip to content
Browse files

Merge branch 'master' of https://github.com/clintbellanger/flare-engine

  • Loading branch information...
2 parents 2d54dfa + 6531a68 commit 26f62d531e93d621acb827bd6bd6be1c8b8ee8c7 @clintbellanger committed
View
3 .travis.yml
@@ -2,10 +2,9 @@ language: cpp
compiler:
- gcc
- clang
- - /usr/lib/gcc-snapshot/bin/gcc
before_install:
- sudo apt-get update -qq
- - sudo apt-get install -qq libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev cppcheck gcc-snapshot
+ - sudo apt-get install -qq libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev cppcheck
script: cmake . && make
after_script: cppcheck --verbose --enable=all --std=posix --std=c++11 --quiet `git ls-files src/\*.cpp`
notifications:
View
8 CMakeLists.txt
@@ -32,10 +32,10 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-pg")
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "-pg")
else()
- set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -pg")
- set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-pg")
- set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-pg")
- set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "-pg")
+ set(CMAKE_CXX_FLAGS "-g3 -pg")
+ set(CMAKE_EXE_LINKER_FLAGS "-pg")
+ set(CMAKE_SHARED_LINKER_FLAGS "-pg")
+ set(CMAKE_MODULE_LINKER_FLAGS "-pg")
endif()
set(BINDIR "games" CACHE STRING "Directory from CMAKE_INSTALL_PREFIX where game executable will be installed.")
View
1 mods/default/engine/languages.txt
@@ -9,6 +9,7 @@ fr=Français
gl=Galego
it=Italiano
ja=Nihongo
+nb=Norsk Bokmål
nl=Nederlands
pl=Polski
ru=Русский
View
10 mods/default/languages/engine.gl.po
@@ -7,9 +7,9 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-09-26 20:53+0300\n"
-"PO-Revision-Date: 2012-10-27 17:58+0200\n"
-"Last-Translator: Adrián Chaves Fernández <adriyetichaves@gmail.com>\n"
-"Language-Team: Galician <kde-i18n-doc@kde.org>\n"
+"PO-Revision-Date: 2012-12-26 18:30+0100\n"
+"Last-Translator: Adrian Chaves Fernandez <adriyetichaves@gmail.com>\n"
+"Language-Team: Galician <proxecto@trasno.net>\n"
"Language: gl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -24,7 +24,7 @@ msgstr "Parabéns, chegaches ao nivel %d!"
#: ../../../src/Avatar.cpp:446
msgid "You may increase one attribute through the Character Menu."
-msgstr "Podes aumentar un atributo dende o menú da personaxe."
+msgstr "Podes aumentar un atributo desde o menú da personaxe."
#: ../../../src/Avatar.cpp:633
msgid "You are defeated. Game over! Press Enter to exit to Title."
@@ -771,7 +771,7 @@ msgstr "Prema Ctrl e un ítem para vendelo."
#: ../../../src/MenuInventory.cpp:387
msgid "This item can only be used from the action bar."
-msgstr "Este ítem só pode empregarse dende a barra de acción."
+msgstr "Este ítem só pode empregarse desde a barra de acción."
#: ../../../src/MenuLog.cpp:78
msgid "Notes"
View
926 mods/default/languages/engine.nb.po
@@ -0,0 +1,926 @@
+# Norwegian Bokmal translations for FLARE (Free/Libre Action RPG Engine).
+# Copyright (C) 2012 Clint Bellanger
+# This file is distributed under the same license as the FLARE package.
+# Hans Joachim Desserud <github@desserud.org>, 2012.
+msgid ""
+msgstr ""
+"Project-Id-Version: Flare 0.17\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-09-26 20:53+0300\n"
+"PO-Revision-Date: 2012-12-24 14:36+0100\n"
+"Last-Translator: Hans Joachim Desserud <github@desserud.org>\n"
+"Language-Team: Norwegian Bokmal\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: nb\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: ../../../src/Avatar.cpp:444
+#, c-format
+msgid "Congratulations, you have reached level %d!"
+msgstr "Gratulerer, du har nådd nivå %d!"
+
+#: ../../../src/Avatar.cpp:446
+msgid "You may increase one attribute through the Character Menu."
+msgstr ""
+
+#: ../../../src/Avatar.cpp:633
+msgid "You are defeated. Game over! Press Enter to exit to Title."
+msgstr ""
+
+#: ../../../src/Avatar.cpp:636
+#, c-format
+msgid "You are defeated. You lose half your %s. Press Enter to continue."
+msgstr ""
+
+#: ../../../src/Avatar.cpp:708 ../../../src/Enemy.cpp:168
+msgid "miss"
+msgstr "bom"
+
+#: ../../../src/Avatar.cpp:795 ../../../src/Enemy.cpp:261
+#: ../../../src/PowerManager.cpp:762 ../../../src/PowerManager.cpp:764
+#: ../../../src/PowerManager.cpp:773 ../../../src/PowerManager.cpp:775
+#, c-format
+msgid "+%d HP"
+msgstr ""
+
+#: ../../../src/CampaignManager.cpp:141
+#, c-format
+msgid "You receive %s."
+msgstr ""
+
+#: ../../../src/CampaignManager.cpp:143
+#, c-format
+msgid "You receive %s x%d."
+msgstr ""
+
+#: ../../../src/CampaignManager.cpp:151
+#, c-format
+msgid "You receive %d %s."
+msgstr ""
+
+#: ../../../src/CampaignManager.cpp:158
+#, c-format
+msgid "You receive %d XP."
+msgstr ""
+
+#: ../../../src/CampaignManager.cpp:164
+msgid "HP restored."
+msgstr ""
+
+#: ../../../src/CampaignManager.cpp:168
+msgid "MP restored."
+msgstr ""
+
+#: ../../../src/CampaignManager.cpp:173
+msgid "HP and MP restored."
+msgstr ""
+
+#: ../../../src/CampaignManager.cpp:177
+msgid "Negative effects removed."
+msgstr ""
+
+#: ../../../src/CampaignManager.cpp:183
+msgid "HP and MP restored, negative effects removed"
+msgstr ""
+
+#: ../../../src/Enemy.cpp:268 ../../../src/PowerManager.cpp:784
+#: ../../../src/PowerManager.cpp:786
+#, c-format
+msgid "+%d MP"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:77
+msgid "Ok"
+msgstr "Ok"
+
+#: ../../../src/GameStateConfig.cpp:82 ../../../src/GameStateConfig.cpp:161
+msgid "Defaults"
+msgstr "Standardinnstillinger"
+
+#: ../../../src/GameStateConfig.cpp:87 ../../../src/GameStateNew.cpp:49
+#: ../../../src/InputState.cpp:55
+msgid "Cancel"
+msgstr "Avbryt"
+
+#: ../../../src/GameStateConfig.cpp:152
+msgid "Video"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:153
+msgid "Audio"
+msgstr "Lyd"
+
+#: ../../../src/GameStateConfig.cpp:154
+msgid "Interface"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:155
+msgid "Input"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:156
+msgid "Keybindings"
+msgstr "Hurtigtaster"
+
+#: ../../../src/GameStateConfig.cpp:157
+msgid "Mods"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:160 ../../../src/GameStateConfig.cpp:905
+#: ../../../src/GameStateConfig.cpp:907
+msgid "Assign: "
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:161
+msgid "Reset ALL settings?"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:238
+msgid "Full Screen Mode"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:251
+msgid "Move hero using mouse"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:264
+msgid "Show combat text"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:278
+msgid "Hardware surfaces"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:291
+msgid "Double buffering"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:305
+msgid "Use joystick"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:318
+msgid "High Quality Textures"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:331
+msgid "Allow changing gamma"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:344
+msgid "Animated tiles"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:357
+msgid "Mouse aim"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:370
+msgid "Show FPS"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:384
+msgid "Music Volume"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:397
+msgid "Sound Volume"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:410
+msgid "Gamma"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:424
+msgid "Resolution"
+msgstr "Oppløsning"
+
+#: ../../../src/GameStateConfig.cpp:435
+msgid "Active Mods"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:445
+msgid "Available Mods"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:461
+msgid "Joystick"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:473
+msgid "Language"
+msgstr "Språk"
+
+#: ../../../src/GameStateConfig.cpp:508 ../../../src/GameStateConfig.cpp:515
+#: ../../../src/GameStateConfig.cpp:522
+msgid "Disable for performance"
+msgstr ""
+
+#: ../../../src/GameStateConfig.cpp:529
+msgid "Experimental"
+msgstr "Eksperimentell"
+
+#: ../../../src/GameStateConfig.cpp:549
+msgid "<< Disable"
+msgstr "<< Deaktiver"
+
+#: ../../../src/GameStateConfig.cpp:557
+msgid "Enable >>"
+msgstr "Aktiver >>"
+
+#: ../../../src/GameStateLoad.cpp:56 ../../../src/GameStateLoad.cpp:68
+msgid "Delete Save"
+msgstr "Slett lagret spill"
+
+#: ../../../src/GameStateLoad.cpp:56
+msgid "Delete this save?"
+msgstr ""
+
+#: ../../../src/GameStateLoad.cpp:58
+msgid "Exit to Title"
+msgstr ""
+
+#: ../../../src/GameStateLoad.cpp:64
+msgid "Choose a Slot"
+msgstr ""
+
+#: ../../../src/GameStateLoad.cpp:378 ../../../src/GameStateLoad.cpp:424
+#: ../../../src/GameStateLoad.cpp:447 ../../../src/GameStateLoad.cpp:466
+#: ../../../src/GameStateLoad.cpp:491
+msgid "New Game"
+msgstr "Nytt spill"
+
+#: ../../../src/GameStateLoad.cpp:428 ../../../src/GameStateLoad.cpp:451
+#: ../../../src/GameStateLoad.cpp:470
+msgid "Load Game"
+msgstr "Last spill"
+
+#: ../../../src/GameStateLoad.cpp:558
+msgid "Entering game world..."
+msgstr ""
+
+#: ../../../src/GameStateLoad.cpp:560
+msgid "Loading saved game..."
+msgstr "Laster lagret spill..."
+
+#: ../../../src/GameStateLoad.cpp:581
+#, c-format
+msgid "Level %d %s"
+msgstr "Nivå %d %s"
+
+#: ../../../src/GameStateLoad.cpp:603
+msgid "Empty Slot"
+msgstr "Ledig plass"
+
+#: ../../../src/GameStateNew.cpp:55
+msgid "Create"
+msgstr ""
+
+#: ../../../src/GameStateNew.cpp:133
+msgid "Choose a Portrait"
+msgstr "Velg et portrett"
+
+#: ../../../src/GameStateNew.cpp:135
+msgid "Choose a Name"
+msgstr ""
+
+#: ../../../src/GameStateNew.cpp:137
+msgid "Permadeath?"
+msgstr ""
+
+#: ../../../src/GameStatePlay.cpp:90
+msgid "Loading..."
+msgstr "Laster..."
+
+#: ../../../src/GameStatePlay.cpp:202 ../../../src/GameStatePlay.cpp:203
+#: ../../../src/MenuManager.cpp:383 ../../../src/MenuManager.cpp:384
+#: ../../../src/MenuManager.cpp:408 ../../../src/MenuManager.cpp:409
+#: ../../../src/MenuManager.cpp:592 ../../../src/MenuManager.cpp:593
+#: ../../../src/MenuManager.cpp:612 ../../../src/MenuManager.cpp:613
+msgid "Inventory is full."
+msgstr ""
+
+#: ../../../src/GameStateTitle.cpp:40
+msgid "Play Game"
+msgstr ""
+
+#: ../../../src/GameStateTitle.cpp:45
+msgid "Configuration"
+msgstr "Innstillinger"
+
+#: ../../../src/GameStateTitle.cpp:50
+msgid "Exit Game"
+msgstr ""
+
+#: ../../../src/GameStateTitle.cpp:57
+msgid "Flare Alpha v0.17"
+msgstr "Flare alfa v0.17"
+
+#: ../../../src/InputState.cpp:56
+msgid "Accept"
+msgstr ""
+
+#: ../../../src/InputState.cpp:57
+msgid "Up"
+msgstr "Opp"
+
+#: ../../../src/InputState.cpp:58
+msgid "Down"
+msgstr "Ned"
+
+#: ../../../src/InputState.cpp:59
+msgid "Left"
+msgstr "Venstre"
+
+#: ../../../src/InputState.cpp:60
+msgid "Right"
+msgstr "Høyre"
+
+#: ../../../src/InputState.cpp:61
+msgid "Bar1"
+msgstr ""
+
+#: ../../../src/InputState.cpp:62
+msgid "Bar2"
+msgstr ""
+
+#: ../../../src/InputState.cpp:63
+msgid "Bar3"
+msgstr ""
+
+#: ../../../src/InputState.cpp:64
+msgid "Bar4"
+msgstr ""
+
+#: ../../../src/InputState.cpp:65
+msgid "Bar5"
+msgstr ""
+
+#: ../../../src/InputState.cpp:66
+msgid "Bar6"
+msgstr ""
+
+#: ../../../src/InputState.cpp:67
+msgid "Bar7"
+msgstr ""
+
+#: ../../../src/InputState.cpp:68
+msgid "Bar8"
+msgstr ""
+
+#: ../../../src/InputState.cpp:69
+msgid "Bar9"
+msgstr ""
+
+#: ../../../src/InputState.cpp:70
+msgid "Bar0"
+msgstr ""
+
+#: ../../../src/InputState.cpp:71 ../../../src/MenuCharacter.cpp:207
+msgid "Character"
+msgstr "Karakter"
+
+#: ../../../src/InputState.cpp:72 ../../../src/MenuInventory.cpp:167
+#: ../../../src/MenuVendor.cpp:48
+msgid "Inventory"
+msgstr ""
+
+#: ../../../src/InputState.cpp:73 ../../../src/MenuPowers.cpp:168
+msgid "Powers"
+msgstr ""
+
+#: ../../../src/InputState.cpp:74 ../../../src/MenuLog.cpp:170
+msgid "Log"
+msgstr "Logg"
+
+#: ../../../src/InputState.cpp:75
+msgid "Main1"
+msgstr ""
+
+#: ../../../src/InputState.cpp:76
+msgid "Main2"
+msgstr ""
+
+#: ../../../src/InputState.cpp:77
+msgid "Ctrl"
+msgstr ""
+
+#: ../../../src/InputState.cpp:78
+msgid "Shift"
+msgstr ""
+
+#: ../../../src/InputState.cpp:79
+msgid "Delete"
+msgstr ""
+
+#: ../../../src/InputState.cpp:81
+msgid "lmb"
+msgstr ""
+
+#: ../../../src/InputState.cpp:82
+msgid "mmb"
+msgstr ""
+
+#: ../../../src/InputState.cpp:83
+msgid "rmb"
+msgstr ""
+
+#: ../../../src/InputState.cpp:84
+msgid "wheel up"
+msgstr ""
+
+#: ../../../src/InputState.cpp:85
+msgid "wheel down"
+msgstr ""
+
+#: ../../../src/InputState.cpp:86
+msgid "mbx1"
+msgstr ""
+
+#: ../../../src/InputState.cpp:87
+msgid "mbx2"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:512
+#, c-format
+msgid "Level %d"
+msgstr "Nivå %d"
+
+#: ../../../src/ItemManager.cpp:523
+#, c-format
+msgid "Melee damage: %d-%d"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:525
+#, c-format
+msgid "Melee damage: %d"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:529
+#, c-format
+msgid "Ranged damage: %d-%d"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:531
+#, c-format
+msgid "Ranged damage: %d"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:535
+#, c-format
+msgid "Mental damage: %d-%d"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:537
+#, c-format
+msgid "Mental damage: %d"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:543
+#, c-format
+msgid "Absorb: %d-%d"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:545
+#, c-format
+msgid "Absorb: %d"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:553 ../../../src/ItemManager.cpp:632
+#, c-format
+msgid "Increases %s by %d"
+msgstr "Øker %s med %d"
+
+#: ../../../src/ItemManager.cpp:560 ../../../src/ItemManager.cpp:635
+#, c-format
+msgid "Decreases %s by %d"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:580 ../../../src/MenuPowers.cpp:516
+#: ../../../src/MenuPowers.cpp:518
+#, c-format
+msgid "Requires Physical %d"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:584 ../../../src/MenuPowers.cpp:522
+#: ../../../src/MenuPowers.cpp:524
+#, c-format
+msgid "Requires Mental %d"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:588 ../../../src/MenuPowers.cpp:504
+#: ../../../src/MenuPowers.cpp:506
+#, c-format
+msgid "Requires Offense %d"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:592 ../../../src/MenuPowers.cpp:510
+#: ../../../src/MenuPowers.cpp:512
+#, c-format
+msgid "Requires Defense %d"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:602
+#, c-format
+msgid "Buy Price: %d %s"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:604
+#, c-format
+msgid "Buy Price: %d %s each"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:614
+#, c-format
+msgid "Sell Price: %d %s"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:616
+#, c-format
+msgid "Sell Price: %d %s each"
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:628
+msgid "Set: "
+msgstr ""
+
+#: ../../../src/ItemManager.cpp:632 ../../../src/ItemManager.cpp:635
+#, c-format
+msgid "%d items: "
+msgstr ""
+
+#: ../../../src/LootManager.cpp:282 ../../../src/MenuInventory.cpp:171
+#, c-format
+msgid "%d %s"
+msgstr "%d %s"
+
+#: ../../../src/main.cpp:125
+msgid "Flare"
+msgstr "Flare"
+
+#: ../../../src/MapRenderer.cpp:1183
+msgid "Unknown destination"
+msgstr ""
+
+#: ../../../src/MenuActionBar.cpp:399
+msgid "Character Menu (C)"
+msgstr ""
+
+#: ../../../src/MenuActionBar.cpp:403
+msgid "Inventory Menu (I)"
+msgstr ""
+
+#: ../../../src/MenuActionBar.cpp:407
+msgid "Power Menu (P)"
+msgstr ""
+
+#: ../../../src/MenuActionBar.cpp:411
+msgid "Log Menu (L)"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:220
+msgid "Name"
+msgstr "Navn"
+
+#: ../../../src/MenuCharacter.cpp:221
+msgid "Level"
+msgstr "Nivå"
+
+#: ../../../src/MenuCharacter.cpp:222
+msgid "Physical"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:223
+msgid "Mental"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:224
+msgid "Offense"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:225
+msgid "Defense"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:287
+msgid "points remaining"
+msgstr "ubrukte poeng"
+
+#: ../../../src/MenuCharacter.cpp:298
+msgid "Max HP:"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:299
+#, c-format
+msgid "Each point of Physical grants +%d HP. Each level grants +%d HP"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:304
+msgid "HP Regen:"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:305
+#, c-format
+msgid ""
+"Ticks of HP regen per minute. Each point of Physical grants +%d HP regen. "
+"Each level grants +%d HP regen"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:310
+msgid "Max MP:"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:311
+#, c-format
+msgid "Each point of Mental grants +%d MP. Each level grants +%d MP"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:316
+msgid "MP Regen:"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:317
+#, c-format
+msgid ""
+"Ticks of MP regen per minute. Each point of Mental grants +%d MP regen. Each "
+"level grants +%d MP regen"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:322
+msgid "Accuracy (vs lvl 1):"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:323 ../../../src/MenuCharacter.cpp:329
+#, c-format
+msgid ""
+"Each point of Offense grants +%d accuracy. Each level grants +%d accuracy"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:328
+msgid "Accuracy (vs lvl 5):"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:334
+msgid "Avoidance (vs lvl 1):"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:335 ../../../src/MenuCharacter.cpp:341
+#, c-format
+msgid ""
+"Each point of Defense grants +%d avoidance. Each level grants +%d avoidance"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:340
+msgid "Avoidance (vs lvl 5):"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:349
+msgid "Melee Damage:"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:360
+msgid "Ranged Damage:"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:371
+msgid "Mental Damage:"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:381
+msgid "Crit:"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:387
+msgid "Absorb:"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:410
+#, c-format
+msgid "XP: %d"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:412
+#, c-format
+msgid "Next: %d"
+msgstr "Neste: %d"
+
+#: ../../../src/MenuCharacter.cpp:416
+msgid "Physical (P) increases melee weapon proficiency and total HP."
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:417 ../../../src/MenuCharacter.cpp:421
+#: ../../../src/MenuCharacter.cpp:425 ../../../src/MenuCharacter.cpp:429
+#, c-format
+msgid "base (%d), bonus (%d)"
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:420
+msgid "Mental (M) increases mental weapon proficiency and total MP."
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:424
+msgid "Offense (O) increases ranged weapon proficiency and accuracy."
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:428
+msgid "Defense (D) increases armor proficiency and avoidance."
+msgstr ""
+
+#: ../../../src/MenuCharacter.cpp:432
+msgid "Unspent attribute points"
+msgstr ""
+
+#: ../../../src/MenuEnemy.cpp:134
+msgid "Dead"
+msgstr "Død"
+
+#: ../../../src/MenuEnemy.cpp:140 ../../../src/MenuEnemy.cpp:142
+#, c-format
+msgid "%s level %d"
+msgstr "%s nivå %d"
+
+#: ../../../src/MenuExit.cpp:31
+msgid "Exit"
+msgstr ""
+
+#: ../../../src/MenuExit.cpp:60
+msgid "Save and exit to title?"
+msgstr ""
+
+#: ../../../src/MenuInventory.cpp:212
+msgid "Use SHIFT to move only one item."
+msgstr "Bruk SHIFT for å flytte en enkelt gjenstand."
+
+#: ../../../src/MenuInventory.cpp:213
+msgid "CTRL-click a carried item to sell it."
+msgstr ""
+
+#: ../../../src/MenuInventory.cpp:387
+msgid "This item can only be used from the action bar."
+msgstr ""
+
+#: ../../../src/MenuLog.cpp:78
+msgid "Notes"
+msgstr "Notater"
+
+#: ../../../src/MenuLog.cpp:79
+msgid "Quests"
+msgstr "Oppdrag"
+
+#: ../../../src/MenuLog.cpp:80
+msgid "Stats"
+msgstr "Statistikk"
+
+#: ../../../src/MenuManager.cpp:217
+#, c-format
+msgid "XP: %d/%d"
+msgstr ""
+
+#: ../../../src/MenuManager.cpp:378 ../../../src/MenuManager.cpp:379
+#: ../../../src/MenuManager.cpp:587 ../../../src/MenuManager.cpp:588
+msgid "Not enough money."
+msgstr "Ikke nok penger."
+
+#: ../../../src/MenuPowers.cpp:429
+msgid "Unspent skill points:"
+msgstr ""
+
+#: ../../../src/MenuPowers.cpp:470
+msgid "Requires a physical weapon"
+msgstr ""
+
+#: ../../../src/MenuPowers.cpp:472
+msgid "Requires a mental weapon"
+msgstr ""
+
+#: ../../../src/MenuPowers.cpp:474
+msgid "Requires an offense weapon"
+msgstr ""
+
+#: ../../../src/MenuPowers.cpp:480 ../../../src/MenuPowers.cpp:482
+#, c-format
+msgid "Requires Physical Offense %d"
+msgstr ""
+
+#: ../../../src/MenuPowers.cpp:486 ../../../src/MenuPowers.cpp:488
+#, c-format
+msgid "Requires Physical Defense %d"
+msgstr ""
+
+#: ../../../src/MenuPowers.cpp:492 ../../../src/MenuPowers.cpp:494
+#, c-format
+msgid "Requires Mental Offense %d"
+msgstr ""
+
+#: ../../../src/MenuPowers.cpp:498 ../../../src/MenuPowers.cpp:500
+#, c-format
+msgid "Requires Mental Defense %d"
+msgstr ""
+
+#: ../../../src/MenuPowers.cpp:530 ../../../src/MenuPowers.cpp:533
+#, c-format
+msgid "Requires Level %d"
+msgstr ""
+
+#: ../../../src/MenuPowers.cpp:541 ../../../src/MenuPowers.cpp:546
+#, c-format
+msgid "Requires %d Skill Point"
+msgstr ""
+
+#: ../../../src/MenuPowers.cpp:554
+msgid "Click to Unlock"
+msgstr ""
+
+#: ../../../src/MenuPowers.cpp:561 ../../../src/MenuPowers.cpp:564
+#, c-format
+msgid "Requires Power: %s"
+msgstr ""
+
+#: ../../../src/MenuPowers.cpp:569
+#, c-format
+msgid "Costs %d MP"
+msgstr ""
+
+#: ../../../src/MenuPowers.cpp:573
+#, c-format
+msgid "Cooldown: %d seconds"
+msgstr ""
+
+#: ../../../src/MenuStash.cpp:125
+msgid "Shared Stash"
+msgstr ""
+
+#: ../../../src/MenuTalker.cpp:47
+msgid "Trade"
+msgstr ""
+
+#: ../../../src/MenuVendor.cpp:49
+msgid "Buyback"
+msgstr ""
+
+#: ../../../src/MenuVendor.cpp:156
+msgid "Vendor"
+msgstr ""
+
+#: ../../../src/PowerManager.cpp:795 ../../../src/PowerManager.cpp:797
+#, c-format
+msgid "+%d Shield"
+msgstr ""
+
+#: ../../../src/PowerManager.cpp:1114
+msgid "You are already transformed, untransform first."
+msgstr ""
+
+#: ../../../src/StatBlock.cpp:401
+msgid "Grand Master"
+msgstr "Stormester"
+
+#: ../../../src/StatBlock.cpp:404
+msgid "Master"
+msgstr "Mester"
+
+#: ../../../src/StatBlock.cpp:407
+msgid "Warrior"
+msgstr "Kriger"
+
+#: ../../../src/StatBlock.cpp:409
+msgid "Wizard"
+msgstr ""
+
+#: ../../../src/StatBlock.cpp:411
+msgid "Ranger"
+msgstr ""
+
+#: ../../../src/StatBlock.cpp:413
+msgid "Paladin"
+msgstr "Paladin"
+
+#: ../../../src/StatBlock.cpp:416
+msgid "Rogue"
+msgstr ""
+
+#: ../../../src/StatBlock.cpp:418
+msgid "Knight"
+msgstr "Ridder"
+
+#: ../../../src/StatBlock.cpp:420
+msgid "Shaman"
+msgstr "Sjaman"
+
+#: ../../../src/StatBlock.cpp:422
+msgid "Cleric"
+msgstr ""
+
+#: ../../../src/StatBlock.cpp:424
+msgid "Battle Mage"
+msgstr ""
+
+#: ../../../src/StatBlock.cpp:426
+msgid "Heavy Archer"
+msgstr ""
+
+#: ../../../src/StatBlock.cpp:428
+msgid "Adventurer"
+msgstr "Eventyrer"
View
73 src/Avatar.cpp
@@ -35,6 +35,7 @@ FLARE. If not, see http://www.gnu.org/licenses/
#include "PowerManager.h"
#include "SharedResources.h"
#include "UtilsParsing.h"
+#include "UtilsMath.h"
#include <sstream>
@@ -53,6 +54,7 @@ Avatar::Avatar(PowerManager *_powers, MapRenderer *_map)
, attacking (false)
, drag_walking(false)
, respawn(false)
+ , close_menus(false)
{
init();
@@ -622,6 +624,9 @@ void Avatar::logic(int actionbar_power, bool restrictPowerUse) {
// raise the death penalty flag. Another module will read this and reset.
stats.death_penalty = true;
+ // close menus in GameStatePlay
+ close_menus = true;
+
if (sound_die)
Mix_PlayChannel(-1, sound_die, 0);
if (stats.permadeath) {
@@ -694,31 +699,26 @@ bool Avatar::takeHit(const Hazard &h) {
// check miss
int avoidance = stats.avoidance;
if (stats.effects.triggered_block) avoidance *= 2;
- if (MAX_AVOIDANCE < avoidance) avoidance = MAX_AVOIDANCE;
- if (rand() % 100 > (h.accuracy - avoidance + 25)) {
+ clampCeil(avoidance, MAX_AVOIDANCE);
+ if (percentChance(avoidance - h.accuracy - 25)) {
combat_text->addMessage(msg->get("miss"), stats.pos, COMBAT_MESSAGE_MISS, true);
return false;
}
- int dmg;
- if (h.dmg_min == h.dmg_max) dmg = h.dmg_min;
- else dmg = h.dmg_min + (rand() % (h.dmg_max - h.dmg_min + 1));
+ int dmg = randBetween(h.dmg_min, h.dmg_max);
// apply elemental resistance
int vulnerable;
- for (unsigned int i=0; i<stats.vulnerable.size(); i++) {
- if (h.trait_elemental == (signed)i) {
- if (MAX_RESIST < stats.vulnerable[i] && stats.vulnerable[i] < 100) vulnerable = MAX_RESIST;
- else vulnerable = stats.vulnerable[i];
- dmg = (dmg * vulnerable) / 100;
- }
+ if (h.trait_elemental >= 0 && unsigned(h.trait_elemental) < stats.vulnerable.size()) {
+ unsigned i = h.trait_elemental;
+ if (MAX_RESIST < stats.vulnerable[i] && stats.vulnerable[i] < 100) vulnerable = MAX_RESIST;
+ else vulnerable = stats.vulnerable[i];
+ dmg = (dmg * vulnerable) / 100;
}
if (!h.trait_armor_penetration) { // armor penetration ignores all absorption
- int absorption; // apply absorption
-
- if (stats.absorb_min == stats.absorb_max) absorption = stats.absorb_min;
- else absorption = stats.absorb_min + (rand() % (stats.absorb_max - stats.absorb_min + 1));
+ // apply absorption
+ int absorption = randBetween(stats.absorb_min, stats.absorb_max);
if (stats.effects.triggered_block) {
absorption += absorption + stats.absorb_max; // blocking doubles your absorb amount
@@ -833,45 +833,28 @@ void Avatar::transform() {
stats.cur_state = AVATAR_STANCE;
// damage
- if (charmed_stats->dmg_melee_min > stats.dmg_melee_min)
- stats.dmg_melee_min = charmed_stats->dmg_melee_min;
-
- if (charmed_stats->dmg_melee_max > stats.dmg_melee_max)
- stats.dmg_melee_max = charmed_stats->dmg_melee_max;
-
- if (charmed_stats->dmg_ment_min > stats.dmg_ment_min)
- stats.dmg_ment_min = charmed_stats->dmg_ment_min;
+ clampFloor(stats.dmg_melee_min, charmed_stats->dmg_melee_min);
+ clampCeil(stats.dmg_melee_max, charmed_stats->dmg_melee_max);
- if (charmed_stats->dmg_ment_max > stats.dmg_ment_max)
- stats.dmg_ment_max = charmed_stats->dmg_ment_max;
+ clampFloor(stats.dmg_ment_min, charmed_stats->dmg_ment_min);
+ clampCeil(stats.dmg_ment_max, charmed_stats->dmg_ment_max);
- if (charmed_stats->dmg_ranged_min > stats.dmg_ranged_min)
- stats.dmg_ranged_min = charmed_stats->dmg_ranged_min;
-
- if (charmed_stats->dmg_ranged_max > stats.dmg_ranged_max)
- stats.dmg_ranged_max = charmed_stats->dmg_ranged_max;
+ clampFloor(stats.dmg_ranged_min, charmed_stats->dmg_ranged_min);
+ clampCeil(stats.dmg_ranged_max, charmed_stats->dmg_ranged_max);
// dexterity
- if (charmed_stats->absorb_min > stats.absorb_min)
- stats.absorb_min = charmed_stats->absorb_min;
-
- if (charmed_stats->absorb_max > stats.absorb_max)
- stats.absorb_max = charmed_stats->absorb_max;
+ clampFloor(stats.absorb_min, charmed_stats->absorb_min);
+ clampCeil(stats.absorb_max, charmed_stats->absorb_max);
- if (charmed_stats->avoidance > stats.avoidance)
- stats.avoidance = charmed_stats->avoidance;
+ clampFloor(stats.avoidance, charmed_stats->avoidance);
- if (charmed_stats->accuracy > stats.accuracy)
- stats.accuracy = charmed_stats->accuracy;
+ clampFloor(stats.accuracy, charmed_stats->accuracy);
- if (charmed_stats->crit > stats.crit)
- stats.crit = charmed_stats->crit;
+ clampFloor(stats.crit, charmed_stats->crit);
// resistances
- for (unsigned int i=0; i<stats.vulnerable.size(); i++) {
- if (charmed_stats->vulnerable[i] < stats.vulnerable[i])
- stats.vulnerable[i] = charmed_stats->vulnerable[i];
- }
+ for (unsigned int i=0; i<stats.vulnerable.size(); i++)
+ clampCeil(stats.vulnerable[i], charmed_stats->vulnerable[i]);
loadStepFX("NULL");
}
View
4 src/Avatar.h
@@ -57,7 +57,8 @@ enum AvatarState {
AVATAR_SHOOT = 7
};
-struct Layer_gfx {
+class Layer_gfx {
+public:
std::string gfx;
std::string type;
Layer_gfx()
@@ -130,6 +131,7 @@ class Avatar : public Entity {
bool drag_walking;
bool newLevelNotification;
bool respawn;
+ bool close_menus;
private:
void handlePower(int actionbar_power);
View
17 src/BehaviorStandard.cpp
@@ -23,6 +23,7 @@ FLARE. If not, see http://www.gnu.org/licenses/
#include "MapRenderer.h"
#include "PowerManager.h"
#include "StatBlock.h"
+#include "UtilsMath.h"
BehaviorStandard::BehaviorStandard(Enemy *_e) : EnemyBehavior(_e) {
los = false;
@@ -210,7 +211,7 @@ void BehaviorStandard::checkPower() {
// check half dead power use
if (!e->stats.on_half_dead_casted && e->stats.hp <= e->stats.maxhp/2) {
- if ((rand() % 100) < e->stats.power_chance[ON_HALF_DEAD]) {
+ if (percentChance(e->stats.power_chance[ON_HALF_DEAD])) {
e->newState(ENEMY_POWER);
e->stats.activated_powerslot = ON_HALF_DEAD;
return;
@@ -220,12 +221,12 @@ void BehaviorStandard::checkPower() {
// check ranged power use
if (dist > e->stats.melee_range) {
- if ((rand() % 100) < e->stats.power_chance[RANGED_PHYS] && e->stats.power_ticks[RANGED_PHYS] == 0) {
+ if (percentChance(e->stats.power_chance[RANGED_PHYS]) && e->stats.power_ticks[RANGED_PHYS] == 0) {
e->newState(ENEMY_POWER);
e->stats.activated_powerslot = RANGED_PHYS;
return;
}
- if ((rand() % 100) < e->stats.power_chance[RANGED_MENT] && e->stats.power_ticks[RANGED_MENT] == 0) {
+ if (percentChance(e->stats.power_chance[RANGED_MENT]) && e->stats.power_ticks[RANGED_MENT] == 0) {
e->newState(ENEMY_POWER);
e->stats.activated_powerslot = RANGED_MENT;
return;
@@ -234,12 +235,12 @@ void BehaviorStandard::checkPower() {
}
else { // check melee power use
- if ((rand() % 100) < e->stats.power_chance[MELEE_PHYS] && e->stats.power_ticks[MELEE_PHYS] == 0) {
+ if (percentChance(e->stats.power_chance[MELEE_PHYS]) && e->stats.power_ticks[MELEE_PHYS] == 0) {
e->newState(ENEMY_POWER);
e->stats.activated_powerslot = MELEE_PHYS;
return;
}
- if ((rand() % 100) < e->stats.power_chance[MELEE_MENT] && e->stats.power_ticks[MELEE_MENT] == 0) {
+ if (percentChance(e->stats.power_chance[MELEE_MENT]) && e->stats.power_ticks[MELEE_MENT] == 0) {
e->newState(ENEMY_POWER);
e->stats.activated_powerslot = MELEE_MENT;
return;
@@ -324,7 +325,7 @@ void BehaviorStandard::checkMove() {
if (dist < e->stats.melee_range) {
// too close, do nothing
}
- else if ((rand() % 100) < e->stats.chance_pursue) {
+ else if (percentChance(e->stats.chance_pursue)) {
if (e->move()) {
e->newState(ENEMY_MOVE);
@@ -469,7 +470,7 @@ void BehaviorStandard::updateState() {
e->stats.effects.clearEffects();
}
if (e->activeAnimation->isSecondLastFrame()) {
- if ((rand() % 100) < e->stats.power_chance[ON_DEATH])
+ if (percentChance(e->stats.power_chance[ON_DEATH]))
e->powers->activate(e->stats.power_index[ON_DEATH], &e->stats, e->stats.pos);
}
if (e->activeAnimation->isLastFrame()) e->stats.corpse = true; // puts renderable under object layer
@@ -485,7 +486,7 @@ void BehaviorStandard::updateState() {
e->stats.effects.clearEffects();
}
if (e->activeAnimation->isSecondLastFrame()) {
- if ((rand() % 100) < e->stats.power_chance[ON_DEATH])
+ if (percentChance(e->stats.power_chance[ON_DEATH]))
e->powers->activate(e->stats.power_index[ON_DEATH], &e->stats, e->stats.pos);
}
if (e->activeAnimation->isLastFrame()) e->stats.corpse = true; // puts renderable under object layer
View
2 src/BehaviorStandard.h
@@ -24,7 +24,7 @@ FLARE. If not, see http://www.gnu.org/licenses/
// forward declarations
class Enemy;
-struct Point;
+class Point;
class BehaviorStandard : public EnemyBehavior {
private:
View
3 src/CombatText.h
@@ -43,7 +43,8 @@ FLARE. If not, see http://www.gnu.org/licenses/
class WidgetLabel;
-struct Combat_Text_Item {
+class Combat_Text_Item {
+public:
WidgetLabel *label;
int lifespan;
Point pos;
View
3 src/EffectManager.h
@@ -39,7 +39,8 @@ class Hazard;
class MapCollision;
class PowerManager;
-struct Effect{
+class Effect{
+public:
int id;
int icon;
int ticks;
View
33 src/Enemy.cpp
@@ -30,6 +30,7 @@ FLARE. If not, see http://www.gnu.org/licenses/
#include "MapRenderer.h"
#include "PowerManager.h"
#include "SharedResources.h"
+#include "UtilsMath.h"
#include <sstream>
@@ -166,31 +167,27 @@ bool Enemy::takeHit(const Hazard &h) {
// if it's a miss, do nothing
int avoidance = stats.avoidance;
- if (MAX_AVOIDANCE < avoidance) avoidance = MAX_AVOIDANCE;
- if (rand() % 100 > (h.accuracy - avoidance + 25)) {
+ clampCeil(avoidance, MAX_AVOIDANCE);
+ if (percentChance(avoidance - h.accuracy - 25)) {
combat_text->addMessage(msg->get("miss"), stats.pos, COMBAT_MESSAGE_MISS, false);
return false;
}
// calculate base damage
- int dmg;
- if (h.dmg_max > h.dmg_min) dmg = rand() % (h.dmg_max - h.dmg_min + 1) + h.dmg_min;
- else dmg = h.dmg_min;
+ int dmg = randBetween(h.dmg_min, h.dmg_max);
// apply elemental resistance
int vulnerable;
- for (unsigned int i=0; i<stats.vulnerable.size(); i++) {
- if (h.trait_elemental == (signed)i) {
- if (MAX_RESIST < stats.vulnerable[i] && stats.vulnerable[i] < 100) vulnerable = MAX_RESIST;
- else vulnerable = stats.vulnerable[i];
- dmg = (dmg * vulnerable) / 100;
- }
+ if (h.trait_elemental >= 0 && unsigned(h.trait_elemental) < stats.vulnerable.size()) {
+ unsigned i = h.trait_elemental;
+ if (MAX_RESIST < stats.vulnerable[i] && stats.vulnerable[i] < 100) vulnerable = MAX_RESIST;
+ else vulnerable = stats.vulnerable[i];
+ dmg = (dmg * vulnerable) / 100;
}
if (!h.trait_armor_penetration) { // armor penetration ignores all absorption
- int absorption; // substract absorption from armor
- if (stats.absorb_min == stats.absorb_max) absorption = stats.absorb_min;
- else absorption = stats.absorb_min + (rand() % (stats.absorb_max - stats.absorb_min + 1));
+ // substract absorption from armor
+ int absorption = randBetween(stats.absorb_min, stats.absorb_max);
if (absorption > 0) {
if ((dmg*100)/absorption > MAX_ABSORB)
absorption = (absorption * MAX_ABSORB) / 100;
@@ -212,7 +209,7 @@ bool Enemy::takeHit(const Hazard &h) {
if (stats.effects.stun || stats.effects.speed < 100)
true_crit_chance += h.trait_crits_impaired;
- bool crit = (rand() % 100) < true_crit_chance;
+ bool crit = percentChance(true_crit_chance);
if (crit) {
dmg = dmg + h.dmg_max;
map->shaky_cam_ticks = MAX_FRAMES_PER_SEC/2;
@@ -249,14 +246,14 @@ bool Enemy::takeHit(const Hazard &h) {
if (heal_amt == 0 && dmg > 0) heal_amt = 1;
combat_text->addMessage(msg->get("+%d HP",heal_amt), h.src_stats->pos, COMBAT_MESSAGE_BUFF, true);
h.src_stats->hp += heal_amt;
- if (h.src_stats->hp > h.src_stats->maxhp) h.src_stats->hp = h.src_stats->maxhp;
+ clampCeil(h.src_stats->hp, h.src_stats->maxhp);
}
if (h.mp_steal != 0) {
int heal_amt = (dmg * h.mp_steal) / 100;
if (heal_amt == 0 && dmg > 0) heal_amt = 1;
combat_text->addMessage(msg->get("+%d MP",heal_amt), h.src_stats->pos, COMBAT_MESSAGE_BUFF, true);
h.src_stats->mp += heal_amt;
- if (h.src_stats->mp > h.src_stats->maxmp) h.src_stats->mp = h.src_stats->maxmp;
+ clampCeil(h.src_stats->mp, h.src_stats->maxmp);
}
// post effect power
@@ -285,7 +282,7 @@ bool Enemy::takeHit(const Hazard &h) {
else if (!stats.effects.stun) {
stats.cur_state = ENEMY_HIT;
// roll to see if the enemy's ON_HIT power is casted
- if ((rand() % 100) < stats.power_chance[ON_HIT]) {
+ if (percentChance(stats.power_chance[ON_HIT])) {
powers->activate(stats.power_index[ON_HIT], &stats, stats.pos);
}
}
View
3 src/EnemyGroupManager.h
@@ -27,7 +27,8 @@ FLARE. If not, see http://www.gnu.org/licenses/
#include <iostream>
-struct Enemy_Level {
+class Enemy_Level {
+public:
std::string type;
int level;
std::string rarity;
View
3 src/FontEngine.h
@@ -39,7 +39,8 @@ const int JUSTIFY_CENTER = 2;
const SDL_Color FONT_WHITE = {255,255,255,0};
const SDL_Color FONT_BLACK = {0,0,0,0};
-struct FontStyle {
+class FontStyle {
+public:
std::string name;
std::string path;
int ptsize;
View
6 src/GameStatePlay.cpp
@@ -676,6 +676,12 @@ void GameStatePlay::logic() {
}
+ // close menus when the player dies, but still allow them to be reopened
+ if (pc->close_menus) {
+ pc->close_menus = false;
+ menu->closeAll(false);
+ }
+
// these actions occur whether the game is paused or not.
checkNotifications();
checkLootDrop();
View
3 src/GameStatePlay.h
@@ -50,7 +50,8 @@ class PowerManager;
class QuestLog;
class WidgetLabel;
-struct Title{
+class Title{
+public:
std::string title;
int level;
int power;
View
95 src/ItemManager.cpp
@@ -30,13 +30,41 @@ FLARE. If not, see http://www.gnu.org/licenses/
#include "UtilsParsing.h"
#include "WidgetLabel.h"
-#include <sstream>
-#include <fstream>
-#include <cstring>
+#include <cassert>
#include <climits>
+#include <cstring>
+#include <fstream>
+#include <sstream>
using namespace std;
+/**
+ * Resizes vector vec, so it can fit index id.
+ */
+template <typename Ty_>
+static inline void ensureFitsId(vector<Ty_>& vec, int id)
+{
+ // id's are always greater or equal 1;
+ if (id < 1) return;
+
+ typedef typename vector<Ty_>::size_type VecSz;
+
+ if (vec.size() <= VecSz(id+1))
+ vec.resize(id+1);
+}
+
+/**
+ * Trims vector allocated memory to its size.
+ *
+ * Emulates C++2011 vector::shrink_to_fit().
+ * It is sometimes also called "swap trick".
+ */
+template <typename Ty_>
+static inline void shrinkVecToFit(std::vector<Ty_>& vec)
+{
+ if (vec.capacity() != vec.size())
+ std::vector<Ty_>(vec).swap(vec);
+}
ItemManager::ItemManager()
: color_normal(font->getColor("item_normal"))
@@ -47,8 +75,11 @@ ItemManager::ItemManager()
, color_penalty(font->getColor("item_penalty"))
, color_requirements_not_met(font->getColor("requirements_not_met"))
, color_flavor(font->getColor("item_flavor"))
- , items(vector<Item>())
{
+ // NB: 20 is arbitrary picked number, but it looks like good start.
+ items.reserve(20);
+ item_sets.reserve(5);
+
loadAll();
loadSounds();
loadIcons();
@@ -66,7 +97,6 @@ void ItemManager::loadAll() {
if (fileExists(test_path)) {
this->load(test_path);
- if (!items.empty()) shrinkItems();
}
test_path = PATH_DATA + "mods/" + mods->mod_list[i] + "/items/types.txt";
@@ -79,9 +109,22 @@ void ItemManager::loadAll() {
if (fileExists(test_path)) {
this->loadSets(test_path);
- if (!item_sets.empty()) shrinkItemSets();
}
}
+
+ /*
+ * Shrinks the items vector to the absolute needed size.
+ *
+ * While loading the items, the item vector grows dynamically. To have
+ * no much time overhead for reallocating the vector, a new reallocation
+ * is twice as large as the needed item id, which means in the worst case
+ * the item vector was reallocated for loading the last element, so the
+ * vector is twice as large as needed. This memory is definitly not used,
+ * so we can free it.
+ */
+ shrinkVecToFit(items);
+ shrinkVecToFit(item_sets);
+
if (items.empty()) fprintf(stderr, "No items were found.\n");
if (item_sets.empty()) printf("No item sets were found.\n");
}
@@ -104,10 +147,7 @@ void ItemManager::load(const string& filename) {
if (infile.key == "id") {
id_line = true;
id = toInt(infile.val);
- if (id > 0 && id >= (int)items.size()) {
- // *2 to amortize the resizing to O(log(n)).
- items.resize((2*id) + 1);
- }
+ ensureFitsId(items, id+1);
} else id_line = false;
if (id < 1) {
@@ -116,6 +156,8 @@ void ItemManager::load(const string& filename) {
}
if (id_line) continue;
+ assert(items.size() > std::size_t(id));
+
if (infile.key == "name")
items[id].name = msg->get(infile.val);
else if (infile.key == "flavor")
@@ -299,10 +341,7 @@ void ItemManager::loadSets(const string& filename) {
if (infile.key == "id") {
id_line = true;
id = toInt(infile.val);
- if (id > 0 && id >= (int)item_sets.size()) {
- // *2 to amortize the resizing to O(log(n)).
- item_sets.resize((2*id) + 1);
- }
+ ensureFitsId(item_sets, id+1);
} else id_line = false;
if (id < 1) {
@@ -311,6 +350,8 @@ void ItemManager::loadSets(const string& filename) {
}
if (id_line) continue;
+ assert(item_sets.size() > std::size_t(id));
+
if (infile.key == "name") {
item_sets[id].name = msg->get(infile.val);
}
@@ -382,32 +423,6 @@ void ItemManager::loadIcons() {
}
/**
- * Shrinks the items vector to the absolute needed size.
- *
- * While loading the items, the item vector grows dynamically. To have
- * no much time overhead for reallocating the vector, a new reallocation
- * is twice as large as the needed item id, which means in the worst case
- * the item vector was reallocated for loading the last element, so the
- * vector is twice as large as needed. This memory is definitly not used,
- * so we can free it.
- */
-void ItemManager::shrinkItems() {
- unsigned i = items.size() - 1;
- while (items[i].name == "")
- i--;
-
- items.resize(i + 1);
-}
-
-void ItemManager::shrinkItemSets() {
- unsigned i = item_sets.size() - 1;
- while (item_sets[i].name == "")
- i--;
-
- item_sets.resize(i + 1);
-}
-
-/**
* Renders icons at small size or large size
* Also display the stack size
*/
View
7 src/ItemManager.h
@@ -68,7 +68,8 @@ const int ITEM_QUALITY_EPIC = 3;
const int ITEM_MAX_BONUSES = 8;
-struct Set_bonus {
+class Set_bonus {
+public:
int requirement;
std::string bonus_stat;
int bonus_val;
@@ -197,8 +198,6 @@ class ItemManager {
void loadAll();
void loadSounds();
void loadIcons();
- void shrinkItems();
- void shrinkItemSets();
SDL_Color color_normal;
SDL_Color color_low;
@@ -208,7 +207,7 @@ class ItemManager {
SDL_Color color_penalty;
SDL_Color color_requirements_not_met;
SDL_Color color_flavor;
-
+
public:
ItemManager();
~ItemManager();
View
3 src/LootManager.h
@@ -46,7 +46,8 @@ class MapRenderer;
class MenuInventory;
class WidgetTooltip;
-struct CurrencyRange {
+class CurrencyRange {
+public:
std::string filename;
int low;
int high;
View
3 src/MapRenderer.cpp
@@ -24,6 +24,7 @@ FLARE. If not, see http://www.gnu.org/licenses/
#include "PowerManager.h"
#include "StatBlock.h"
#include "UtilsFileSystem.h"
+#include "UtilsMath.h"
#include "UtilsParsing.h"
#include <stdint.h>
@@ -102,7 +103,7 @@ void MapRenderer::push_enemy_group(Map_Group g) {
// actual places, so have an upper bound of tries.
// random number of enemies
- int enemies_to_spawn = g.numbermin + rand() % (g.numbermax + 1 - g.numbermin);
+ int enemies_to_spawn = randBetween(g.numbermin, g.numbermax);
// pick an upper bound, which is definitely larger than threetimes the enemy number to spawn.
int allowed_misses = 3 * g.numbermax;
View
2 src/MenuCharacter.cpp
@@ -470,7 +470,7 @@ void MenuCharacter::logic() {
int spent = stats->physical_character + stats->mental_character + stats->offense_character + stats->defense_character -4;
skill_points = (stats->level * stats->stat_points_per_level) - spent;
- if (spent < (stats->level * stats->stat_points_per_level) && spent < stats->max_spendable_stat_points) {
+ if (stats->hp > 0 && spent < (stats->level * stats->stat_points_per_level) && spent < stats->max_spendable_stat_points) {
if (stats->physical_character < stats->max_points_per_stat && show_upgrade[0]) upgradeButton[0]->enabled = true;
if (stats->mental_character < stats->max_points_per_stat && show_upgrade[1]) upgradeButton[1]->enabled = true;
if (stats->offense_character < stats->max_points_per_stat && show_upgrade[2]) upgradeButton[2]->enabled = true;
View
3 src/MenuCharacter.h
@@ -47,7 +47,8 @@ const int CSTAT_OFFENSE = 4;
const int CSTAT_DEFENSE = 5;
const int CSTAT_COUNT = 6;
-struct CharStat {
+class CharStat {
+public:
WidgetLabel *label;
WidgetLabel *value;
SDL_Rect hover;
View
10 src/MenuLog.cpp
@@ -125,20 +125,12 @@ void MenuLog::logic() {
visible = false;
}
+ tabControl->logic();
int active_log = tabControl->getActiveTab();
msg_buffer[active_log]->logic();
}
/**
- * Run the logic for the tabs control.
- */
-void MenuLog::tabsLogic()
-{
- tabControl->logic();
-}
-
-
-/**
* Render graphics for this frame when the menu is open
*/
void MenuLog::render() {
View
1 src/MenuLog.h
@@ -74,7 +74,6 @@ class MenuLog : public Menu {
void update();
void logic();
- void tabsLogic();
void render();
void refresh(int log_type);
void add(const std::string& s, int log_type);
View
2 src/MenuManager.cpp
@@ -452,7 +452,6 @@ void MenuManager::logic() {
if (log->visible && isWithin(log->window_area,inpt->mouse)) {
inpt->lock[MAIN1] = true;
- log->tabsLogic();
}
// pick up an inventory item
@@ -667,7 +666,6 @@ void MenuManager::logic() {
drag_src = -1;
dragging = false;
}
- closeAll(false);
}
// handle equipment changes affecting hero stats
View
3 src/MenuPowers.h
@@ -41,7 +41,8 @@ class PowerManager;
class StatBlock;
class TooltipData;
-struct Power_Menu_Cell {
+class Power_Menu_Cell {
+public:
short id;
short tab;
Point pos;
View
7 src/PowerManager.cpp
@@ -33,6 +33,7 @@ FLARE. If not, see http://www.gnu.org/licenses/
#include "StatBlock.h"
#include "MapCollision.h"
#include "UtilsFileSystem.h"
+#include "UtilsMath.h"
#include "UtilsParsing.h"
#include <cmath>
@@ -683,10 +684,8 @@ bool PowerManager::effect(StatBlock *src_stats, int power_index) {
// heal for ment weapon damage * damage multiplier
int heal_max = (int)ceil(src_stats->dmg_ment_max * powers[power_index].damage_multiplier / 100.0) + (src_stats->get_mental()*src_stats->bonus_per_mental);
int heal_min = (int)ceil(src_stats->dmg_ment_min * powers[power_index].damage_multiplier / 100.0) + (src_stats->get_mental()*src_stats->bonus_per_mental);
- if (heal_max > heal_min)
- magnitude = rand() % (heal_max - heal_min) + heal_min;
- else // avoid div by 0
- magnitude = heal_min;
+ magnitude = randBetween(heal_min, heal_max-1);
+
comb->addMessage(msg->get("+%d HP",magnitude), src_stats->pos, COMBAT_MESSAGE_BUFF, src_stats->hero);
src_stats->hp += magnitude;
if (src_stats->hp > src_stats->maxhp) src_stats->hp = src_stats->maxhp;
View
3 src/PowerManager.h
@@ -79,7 +79,8 @@ const int TRIGGER_HALFDEATH = 2;
const int TRIGGER_JOINCOMBAT = 3;
const int TRIGGER_DEATH = 4;
-struct PostEffect {
+class PostEffect {
+public:
int id;
int magnitude;
int duration;
View
3 src/Settings.cpp
@@ -39,8 +39,9 @@ using namespace std;
#define log2(x) logf(x)/logf(2)
#endif
-struct ConfigEntry
+class ConfigEntry
{
+public:
const char * name;
const type_info * type;
const char * default_val;
View
1 src/StatBlock.cpp
@@ -397,7 +397,6 @@ void StatBlock::recalc_alt() {
if (hero) {
// calculate primary stats
- offense_additional = defense_additional = physical_additional = mental_additional = 0;
offense_additional = effects.bonus_offense;
defense_additional = effects.bonus_defense;
physical_additional = effects.bonus_physical;
View
3 src/StatBlock.h
@@ -69,7 +69,8 @@ const int ENEMY_POWER = 15; // enemy performing a power. anim/sfx based on power
const int MAX_CHARACTER_LEVEL = 32;
-struct EnemyLoot {
+class EnemyLoot {
+public:
int id;
int chance;
View
6 src/TileSet.h
@@ -40,7 +40,8 @@ FLARE. If not, see http://www.gnu.org/licenses/
* The offset is measured from upper left corner to the logical midpoint
* of the tile at groundlevel.
*/
-struct Tile_Def {
+class Tile_Def {
+public:
SDL_Rect src;
Point offset;
Tile_Def() {
@@ -49,7 +50,8 @@ struct Tile_Def {
}
};
-struct Tile_Anim {
+class Tile_Anim {
+public:
// Number of frames in this animation. if 0 no animation.
// 1 makes no sense as it would produce astatic animation.
unsigned short frames;
View
9 src/Utils.h
@@ -33,18 +33,21 @@ FLARE. If not, see http://www.gnu.org/licenses/
#include <string>
#include <stdint.h>
-struct Point {
+class Point {
+public:
int x,y;
Point() : x(0), y(0) {}
Point(int _x, int _y) : x(_x), y(_y) {}
};
-struct FPoint {
+class FPoint {
+public:
float x,y;
};
// message passing struct for various sprites rendered map inline
-struct Renderable {
+class Renderable {
+public:
SDL_Surface *sprite; // image to be used
SDL_Rect src; // location on the sprite in pixel coordinates.
View
84 src/UtilsMath.h
@@ -0,0 +1,84 @@
+/*
+Copyright © 2012 Piotr Rak
+
+This file is part of FLARE.
+
+FLARE is free software: you can redistribute it and/or modify it under the terms
+of the GNU General Public License as published by the Free Software Foundation,
+either version 3 of the License, or (at your option) any later version.
+
+FLARE is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+FLARE. If not, see http://www.gnu.org/licenses/
+*/
+
+#pragma once
+#ifndef UTILS_MATH_H
+#define UTILS_MATH_H 1
+
+#include <cassert>
+#include <cstdlib>
+#include <algorithm> // for std::min()/std::max()
+
+/**
+ * Clamps value to floor.
+ *
+ * Postcondition: value >= floor
+ */
+template <typename Ty1_, typename Ty2_>
+inline void clampFloor(Ty1_& value, Ty2_ floor) {
+ value = std::max<Ty1_>(value, floor);
+}
+
+/**
+ * Clamps value to ceiling.
+ *
+ * Postcondition: value <= ceiling
+ */
+template <typename Ty1_, typename Ty2_>
+inline void clampCeil(Ty1_& value, Ty2_ ceiling) {
+ value = std::min<Ty1_>(value, ceiling);
+}
+
+/**
+ * Clamps value.
+ *
+ * Postcondition: floor <= value <= ceiling
+ */
+template <typename Ty1_, typename Ty2_>
+inline void clamp(Ty1_& value, Ty2_ floor, Ty2_ ceiling) {
+ clampFloor(value, floor);
+ clampCeil(value, ceiling);
+}
+
+/**
+ * Returns sign of value.
+ */
+template <typename Ty_>
+inline Ty_ signum(Ty_ value)
+{
+ return (Ty_(0) < value) - (value < Ty_(0));
+}
+
+/**
+ * Returns random number between minVal and maxVal.
+ */
+inline int randBetween(int minVal, int maxVal)
+{
+ if (minVal == maxVal) return minVal;
+ int d = maxVal - minVal;
+ return minVal + (rand() % (d + signum(d)));
+}
+
+/**
+ * Returns true with random percent chance.
+ */
+inline bool percentChance(int percent)
+{
+ return rand() % 100 < percent;
+}
+
+#endif // UTILS_MATH_H
View
3 src/WidgetLabel.h
@@ -35,7 +35,8 @@ const int VALIGN_CENTER = 0;
const int VALIGN_TOP = 1;
const int VALIGN_BOTTOM = 2;
-struct LabelInfo {
+class LabelInfo {
+public:
int x,y;
int justify,valign;
bool hidden;

0 comments on commit 26f62d5

Please sign in to comment.
Something went wrong with that request. Please try again.