From 45333c33d5d73a8b3179554b521b3bc9d88dcba1 Mon Sep 17 00:00:00 2001 From: Allanis Date: Sun, 2 Feb 2014 19:49:56 +0000 Subject: [PATCH] [Add] Actually use the new loading graphics. --- bin/Makefile | 1 + scripts/ai/empire.lua | 3 +-- scripts/ai/pirate.lua | 8 +++----- src/lephisto.c | 17 +++++++++++++---- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/bin/Makefile b/bin/Makefile index 79d8123..2678524 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -74,6 +74,7 @@ DATA_AI := $(wildcard ../scripts/ai/*.lua \ ../scripts/ai/include/*.lua \ ../scripts/ai/tpl/*.lua) DATA_GFX := $(wildcard ../gfx/*.png \ + ../gfx/loading/*.png \ ../gfx/gui/*.png \ ../gfx/logo/*.png \ ../gfx/outfit/space/*.png \ diff --git a/scripts/ai/empire.lua b/scripts/ai/empire.lua index 5778c97..e58911b 100644 --- a/scripts/ai/empire.lua +++ b/scripts/ai/empire.lua @@ -13,8 +13,7 @@ function create() if rnd.int() > 0.7 then mem.bribe = math.sqrt(ai.shipmass())*(500. * rnd.int() + 1750.) - mem.bribe_prompt = string.format("\"For some %d credits I could forget \ - about seeing you.\"", mem.bribe) + mem.bribe_prompt = string.format("\"For some %d credits I could forget about seeing you.\"", mem.bribe) mem.bribe_paid = "\"Now, scram, before I change my mind.\"" else if rnd.int() > 0.5 then diff --git a/scripts/ai/pirate.lua b/scripts/ai/pirate.lua index bf19721..2d98249 100644 --- a/scripts/ai/pirate.lua +++ b/scripts/ai/pirate.lua @@ -12,16 +12,14 @@ function create() -- Deal with bribeability. if rnd.int() < 0.05 then - mem.bribe_no = = "\"You won't be able to slide out of this one!\"" + mem.bribe_no = "\"You won't be able to slide out of this one!\"" else mem.bribe = math.sqrt(ai.shipmass()) * (300. * rnd.int() + 850.) if rnd.int() > 0.5 then - mem.bribe_prompt = string.format("\"It'll cost you %d credits for me to ifnore your pile \ - of rubbish.\"", mem.bribe) + mem.bribe_prompt = string.format("\"It'll cost you %d credits for me to ifnore your pile of rubbish.\"", mem.bribe) mem.bribe_paid = "\"You're lucky I'm so kind.\"" else - mem.bribe_prompt = string.format("\"I'm in a good mood so I'll let you go for \ - %d credits.\"", mem.bribe) + mem.bribe_prompt = string.format("\"I'm in a good mood so I'll let you go for %d credits.\"", mem.bribe) mem.bribe_paid = "\"Life doesn't get easier then this.\"" end end diff --git a/src/lephisto.c b/src/lephisto.c index d02cf03..d8fac06 100644 --- a/src/lephisto.c +++ b/src/lephisto.c @@ -279,6 +279,7 @@ int main(int argc, char** argv) { void loadscreen_load(void) { int i; char file_path[PATH_MAX]; + char** loadscreens; char** files; uint32_t nfiles; size_t len; @@ -286,12 +287,15 @@ void loadscreen_load(void) { /* Count the loading screens. */ files = pack_listfiles(data, &nfiles); - len = strlen("../gfx/loading"); + len = strlen("../gfx/loading/"); nload = 0; + loadscreens = malloc(sizeof(char*) * nfiles); for(i = 0; i < (int)nfiles; i++) { - if(strncmp(files[i], "../gfx/loading", len)==0) + if(strncmp(files[i], "../gfx/loading/", len)==0) { + loadscreens[nload] = files[i]; nload++; - free(files[i]); + } else + free(files[i]); } /* Must have loading screens. */ @@ -301,8 +305,13 @@ void loadscreen_load(void) { } /* Load the texture. */ - snprintf(file_path, PATH_MAX, "../gfx/loading%03d.png", RNG(0, nload-1)); + snprintf(file_path, PATH_MAX, loadscreens[RNG(0, nload-1)]); loading = gl_newImage(file_path); + + /* Clean up. */ + for(i = 0; i < nload; i++) + free(loadscreens[i]); + free(loadscreens); } /**