OnlineCop / kq-fork

Fork of KQ r910. Just for fun.
GNU General Public License v2.0
15 stars 9 forks source link

Update to the splash screen credits #122

Closed OnlineCop closed 2 years ago

OnlineCop commented 2 years ago

I did not rearrange the existing credits, although I was sorely tempted to do so.

Also @teamterradactyl: Do you want your real name in there, or do you want to leave your pseudonym as-is?

pedro-w commented 2 years ago

Do you want to re-arrange the credits? I don't particularly want to go 'first' (after JB of course)

OnlineCop commented 2 years ago

I have no idea how the original ordering came about. Maybe by order of contributions to the original source code or help provided in the Allegro forums? Maybe some kind of early alphabetical order that fell into disuse?

I could do alphabetical by first or last name (*cough* @TeamTerradactyl *cough*), or some other sort method.

pedro-w commented 2 years ago

Possibly could randomize them with something like:

commit aed8fecaeb736be070da0c5a19b76c990eebebcf
Author: Peter Hull <peterhull90@gmail.com>
Date:   Mon Jul 25 21:49:10 2022 +0100

    Randomize the credits

diff --git a/src/credits.cpp b/src/credits.cpp
index 64d2b98..644a55b 100644
--- a/src/credits.cpp
+++ b/src/credits.cpp
@@ -34,2 +34,3 @@
 #include "gfx.h"
+#include "random.h"

@@ -40,2 +41,4 @@

+using std::swap;
+
 std::vector<std::string> credits { "Josh Bolduc",
@@ -76,2 +79,8 @@ void KCredits::allocate_credits()
 {
+    // Randomize the credits from item 5 to the end
+    for (int rounds = 0; rounds < credits.size(); ++rounds)
+    {
+        int index = kqrandom->random_range_exclusive(6, credits.size());
+        swap(credits[5], credits[index]);
+    }
     if (wk == nullptr)
diff --git a/src/kq.cpp b/src/kq.cpp
index d0df459..8ee2786 100644
--- a/src/kq.cpp
+++ b/src/kq.cpp
@@ -335,3 +335,3 @@ int main(int argc, char* argv[])
     game_on = 1;
-    kqrandom = new KQRandom();
+
     /* While KQ is running (playing or at startup menu) */
@@ -672,2 +672,3 @@ void KGame::allocate_stuff()
 #endif
+    kqrandom = new KQRandom();
     Credits.allocate_credits();

It turns out I added the first version of credits.c (in 2003) and therefore it was me putting my own name first. What a cheek!

OnlineCop commented 2 years ago

I like the name randomization idea. Added (with a minor tweak to the range).