From 6b48d670ac0adb5e4c01437454a3b7e4ff68e421 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sun, 18 Jul 2010 15:48:58 +0000 Subject: [PATCH] fopen mode 4 = whole file (fgets doesn't stop on new lines) git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3561 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/common/pr_bgcmd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/common/pr_bgcmd.c b/engine/common/pr_bgcmd.c index a04c97640..3064b14d9 100644 --- a/engine/common/pr_bgcmd.c +++ b/engine/common/pr_bgcmd.c @@ -523,6 +523,7 @@ void PF_fopen (progfuncs_t *prinst, struct globalvars_s *pr_globals) switch (fmode) { case 0: //read + case 4: //read whole file pf_fopen_files[i].data = FS_LoadMallocFile(pf_fopen_files[i].name); if (!pf_fopen_files[i].data) { @@ -590,6 +591,7 @@ void PF_fclose_i (int fnum) switch(pf_fopen_files[fnum].accessmode) { case 0: + case 4: BZ_Free(pf_fopen_files[fnum].data); break; case 1: @@ -657,9 +659,9 @@ void PF_fgets (progfuncs_t *prinst, struct globalvars_s *pr_globals) while(s < eof) { c = *s++; - if (c == '\n') + if (c == '\n' && pf_fopen_files[fnum].accessmode != 4) break; - if (c == '\r') + if (c == '\r' && pf_fopen_files[fnum].accessmode != 4) continue; if (o == max)