DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

?? Anyone know how to make wolf read .txt files ??
Page 1 of 1
DieHard Wolfers Forum Index -> Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
jamez
I am Death Incarnate
I am Death Incarnate


Joined: 16 Mar 2003
Last Visit: 17 Jan 2019

Topics: 13
Posts: 186
Location: Yorkshire, UK
uk.gif

PostPosted: Thu Dec 09, 2004 11:19 am
   Subject: ?? Anyone know how to make wolf read .txt files ??
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

I kinda want wolf to read a file (say info.wl6) and if the top line is:

fullammo = 1

then wolfenstein can read that in and set a variable off in the engine somewhere (which is easy enough)

just wonderin if anyone could help

thanks!

_________________
~ James
Dugtrio17
Code Master
Code Master


Joined: 11 Mar 2003
Last Visit: 03 Oct 2013

Topics: 49
Posts: 901
Location: Seattle
usa.gif

PostPosted: Thu Dec 09, 2004 11:56 am
   Subject: Re: ?? Anyone know how to make wolf read .txt files ??
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

You could do what I did with Wolf17 and just make it read variables. Then it's as simple as making a small utility that reads the file and can write to it. For instance, directly from Wolf17:
(WL_MAIN.C)
::: CODE :::
unsigned int   weapframe1;
unsigned int   weapframe2;
unsigned int   weapframe3;
unsigned int   weapframe4;
unsigned int   weapframe5;
unsigned int   weapframe6;
unsigned int   weapframe7;
unsigned int   weapframe8;
unsigned int   weapframe9;
unsigned int   weapframe10;
unsigned int   weapframe11;
unsigned int   weapframe12;
unsigned int   weapframe13;
unsigned int   weapframe14;
unsigned int   weapframe15;
unsigned int   weapframe16; // could of course be confined to one line
(...) // the rest of the variables

Chars could've been used, but I had some trouble with the utility reading them. If you can get them to work, then by all means, use them.
(...)
::: CODE :::
char   configname[13]="CONFIG.";
char   gamename[13]="GAME.WL6"; // I added this, of course

(...)
::: CODE :::
/*
====================
=
= ReadGame
=
====================
*/

void ReadGame(void)
{
   int                     file;


   if ( (file = open(gamename,O_BINARY | O_RDONLY)) != -1)
   {
   //
   // valid game control file
   //
      read(file,&weapframe1,sizeof(weapframe1));
      read(file,&weapframe2,sizeof(weapframe2));
      read(file,&weapframe3,sizeof(weapframe3));
      read(file,&weapframe4,sizeof(weapframe4));
      read(file,&weapframe5,sizeof(weapframe5));
      read(file,&weapframe6,sizeof(weapframe6));
      read(file,&weapframe7,sizeof(weapframe7));
      read(file,&weapframe8,sizeof(weapframe8));
      read(file,&weapframe9,sizeof(weapframe9));
      read(file,&weapframe10,sizeof(weapframe10));
      read(file,&weapframe11,sizeof(weapframe11));
      read(file,&weapframe12,sizeof(weapframe12));
      read(file,&weapframe13,sizeof(weapframe13));
      read(file,&weapframe14,sizeof(weapframe14));
      read(file,&weapframe15,sizeof(weapframe15));
      read(file,&weapframe16,sizeof(weapframe16));
      (...) // reads the rest of the stuff

      close(file);

   }
   else
   {
   //
   // no control file, so generate to original wolf
   //
      weapframe1 = weapframe2 = weapframe3 = weapframe4 =
      weapframe5 = weapframe6 = weapframe7 = weapframe8 =
      weapframe9 = weapframe10 = weapframe11 = weapframe12 =
      weapframe13 = weapframe14 = weapframe15 = weapframe16 = 6;

      weap1power = weap2power = weap3power = weap4power = 100;

      (...) // writes the rest of the variables

      file = open(gamename,O_CREAT | O_BINARY | O_WRONLY,
            S_IREAD | S_IWRITE | S_IFREG);

      if (file != -1)
      {
      write(file,&weapframe1,sizeof(weapframe1));
      write(file,&weapframe2,sizeof(weapframe2));
      write(file,&weapframe3,sizeof(weapframe3));
      write(file,&weapframe4,sizeof(weapframe4));
      write(file,&weapframe5,sizeof(weapframe5));
      write(file,&weapframe6,sizeof(weapframe6));
      write(file,&weapframe7,sizeof(weapframe7));
      write(file,&weapframe8,sizeof(weapframe8));
      write(file,&weapframe9,sizeof(weapframe9));
      write(file,&weapframe10,sizeof(weapframe10));
      write(file,&weapframe11,sizeof(weapframe11));
      write(file,&weapframe12,sizeof(weapframe12));
      write(file,&weapframe13,sizeof(weapframe13));
      write(file,&weapframe14,sizeof(weapframe14));
      write(file,&weapframe15,sizeof(weapframe15));
      write(file,&weapframe16,sizeof(weapframe16));
      (...) // the rest of the variables

      close(file);
      }
   }
}

(...)
::: CODE :::
//
// build some tables
//
   InitDigiMap ();

   for (i=0;i<MAPSIZE;i++)
   {
      nearmapylookup[i] = &tilemap[0][0]+MAPSIZE*i;
      farmapylookup[i] = i*64;
   }

   for (i=0;i<PORTTILESHIGH;i++)
      uwidthtable[i] = UPDATEWIDE*i;

   blockstart = &blockstarts[0];
   for (y=0;y<UPDATEHIGH;y++)
      for (x=0;x<UPDATEWIDE;x++)
         *blockstart++ = SCREENWIDTH*16*y+x*TILEWIDTH;

   updateptr = &update[0];

   bufferofs = 0;
   displayofs = 0;
   ReadConfig ();
   ReadGame (); // added that line so the file is read at startup

And of course the variables are in the memory at that point, so you can call them at any time, so long as they are defined as externs in WL_DEF.H (or you may want to define them there to start with). It's all a bit sloppy and could be optimized a bit, but as it is, it works.
Then just create a utility that can read and write these variables; basically just a copy of the ReadGame function above. Or you could just hex edit it, if you know where everything is at.
I've looked into a text file for certain things and I couldn't get anywhere with it, though I suppose it'd be more intuitive and wouldn't require any special utilities. I'd suggest looking at the DeHacked source or maybe the source of any Doom port that can read DeHacked files.

_________________
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 30 Nov 2017

Topics: 24
Posts: 506

blank.gif

PostPosted: Thu Dec 09, 2004 2:52 pm
   Subject: Re: ?? Anyone know how to make wolf read .txt files ??
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

What? What an extraordinary coincidence... I was going to ask about external text reading, too. I guess "great minds think alike" or whatever...

But I was thinking about this because I'm hoping to create something like the "MAPINFO" file used in Hexen and ZDoom.
Zombie_Plan
DieHard Wolfer
DieHard Wolfer


Joined: 12 Oct 2004
Last Visit: 8:10 ago.

Topics: 110
Posts: 1734
Location: A hole in the wall
australia.gif

PostPosted: Tue May 30, 2006 1:29 am
   Subject: Re: ?? Anyone know how to make wolf read .txt files ??
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

So.. how would u make wolf WRITE to a text file. without I/O stream?

_________________
WolfSource - Your news source since the beginning of time (2019)
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts [Help] Setting RocketLauncher: Explosive Range...?
Author: KyleRTCW
17 7374 Thu Jun 03, 2004 3:21 am
Codetech84 View latest post
No new posts [Info] Tricks - Dogs that shoot - Modifying Behaviour
Author: Guest
19 288 Sat Mar 20, 2004 7:31 am
Dugtrio17 View latest post
No new posts [Info] Alarm Sounding in game?? WSJ...??
Author: Guest
7 311 Tue Jun 17, 2003 10:04 pm
Reivax44 View latest post
No new posts [Info] Silent Gun? - Adding a Silencer
Author: Guest
4 194 Fri Apr 18, 2003 8:34 am
BrotherTank View latest post
No new posts [Info] Adding Locked Doors
Author: Guest
3 244 Thu Apr 17, 2003 6:30 am
Ripper View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group