Skip to content

Instantly share code, notes, and snippets.

@i30817
Created November 4, 2019 19:30
Show Gist options
  • Save i30817/381a6cc582eb1075aa54ab3c7d45b308 to your computer and use it in GitHub Desktop.
Save i30817/381a6cc582eb1075aa54ab3c7d45b308 to your computer and use it in GitHub Desktop.
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 472d69a..8225075 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -332,7 +332,22 @@ void ARX_Player_Rune_Add(RuneFlag _ulRune)
}
}
+ unsigned int v = player.rune_flags; // count the number of runes
+ unsigned int c;
+ unsigned int c2;
+ for (c = 0; v; v >>= 1)
+ {
+ c += v & 1;
+ }
player.rune_flags |= _ulRune;
+ for (c2 = 0; v; v >>= 1)
+ {
+ c2 += v & 1;
+ }
+ if (c2 > c) {
+ if(c2 == 5 || c2 == 10 || c2 == 20)
+ ARX_INTERFACE_NoteOpen(Note::Notice, "Spell slot added");
+ }
for(size_t i = 0; i < SPELL_TYPES_COUNT; i++) {
if(!spellicons[i].bSecret) {
@@ -997,8 +1012,8 @@ void ARX_PLAYER_FrameCheck(PlatformDuration delta) {
if(!BLOCK_PLAYER_CONTROLS) {
if(player.hunger < 0.f)
player.lifePool.current -= inc * 0.5f;
- else
- player.lifePool.current += inc;
+// else
+// player.lifePool.current += inc;
}
// Natural MANA recovery
@@ -2142,8 +2157,8 @@ static void PlayerMovementIterate(float DeltaTime) {
player.jumpstarttime = g_platformTime.frameStart();
}
- const float jump_up_time = 200.f;
- const float jump_up_height = 130.f;
+ const float jump_up_time = 250.f;
+ const float jump_up_height = 150.f;
const PlatformInstant now = g_platformTime.frameStart();
const float elapsed = toMs(now - player.jumpstarttime);
float position = glm::clamp(elapsed / jump_up_time, 0.f, 1.f);
diff --git a/src/game/magic/Precast.cpp b/src/game/magic/Precast.cpp
index c4ee0a7..087e464 100644
--- a/src/game/magic/Precast.cpp
+++ b/src/game/magic/Precast.cpp
@@ -31,8 +31,6 @@
#include "gui/Speech.h"
#include "scene/GameSound.h"
-const size_t MAX_PRECAST = 3;
-
GameInstant LAST_PRECAST_TIME = 0;
std::vector<PRECAST_STRUCT> Precast;
@@ -43,6 +41,22 @@ void ARX_SPELLS_Precast_Reset() {
}
void ARX_SPELLS_Precast_Add(SpellType typ, long _level, SpellcastFlags flags, GameDuration duration) {
+
+ unsigned int v = player.rune_flags; // count the number of runes
+ unsigned int c;
+ for (c = 0; v; v >>= 1)
+ {
+ c += v & 1;
+ }
+
+ size_t MAX_PRECAST = 2;
+ if(c >= 5 && c < 10) {
+ MAX_PRECAST = 3;
+ } else if(c >= 10 && c < 20) {
+ MAX_PRECAST = 4;
+ } else if (c == 20){
+ MAX_PRECAST = 5;
+ }
if(Precast.size() >= MAX_PRECAST) {
Precast.erase(Precast.begin());
diff --git a/src/scene/SaveFormat.h b/src/scene/SaveFormat.h
index 5017f4b..5a48231 100644
--- a/src/scene/SaveFormat.h
+++ b/src/scene/SaveFormat.h
@@ -287,7 +287,7 @@ struct SavedMiniMap {
};
-const size_t SAVED_MAX_PRECAST = 3;
+const size_t SAVED_MAX_PRECAST = 5;
struct SavedPrecast {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment