Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3 4

Author Topic: Modding questions  (Read 9112 times)

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: Modding questions
« Reply #15 on: January 03, 2014, 11:05:45 pm »

You can find the site mode player start location in sitemode.cpp, the mode_site() function places the player. You'll see two major situations, one in which there's no siege (player is given the coordinates (1,1,0) (in x,y,z)), and one in which there is one. In the siege case, the game gives you a random location somewhere on the bottom side of the map; look for the block of code immediately following the comment that talks about a bug involving degenerate spawn locations.
Logged

mosshadow

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #16 on: February 02, 2014, 11:46:21 am »

Where are the .cpp files located? I cant find them in the art folder or after decompressing the game file.
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #17 on: February 02, 2014, 02:10:53 pm »

The .cpp files are in the src folder (and in folders within the src folder).
Logged

mosshadow

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #18 on: February 02, 2014, 03:01:37 pm »

The .cpp files are in the src folder (and in folders within the src folder).

oh nvm im stupid. I had the full version not the source code. I spent a bunch of time trying to open those files with VB to realize i didnt have the source!
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #19 on: February 07, 2014, 04:09:54 pm »

Had a question: how do I add new .cpp files (containing new subroutines) to the game? I tried editing the makefile, but my knowledge of C++ is apparently insufficient (I'm running on what I know from ansi-C and carrying it over).
Logged

Carlos Gustavos

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #20 on: February 09, 2014, 08:16:56 am »

Makefile.am in the src directory contains a list of all files to compile.
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #21 on: February 09, 2014, 12:52:16 pm »

Ah, so there it is. Great, thank you so much! I was looking in the Makefile (where it is for my other source that I've written), and it wasn't there!

Thanks again!  :D
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #22 on: February 28, 2014, 12:39:37 pm »

Nevermind - figured it out! :)
« Last Edit: February 28, 2014, 05:15:42 pm by SlatersQuest »
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #23 on: March 06, 2014, 01:11:58 pm »

All right, I'm stuck.

I have a function that has the following format:

Quote
int FunctionName(Creature *Subject, char *String1, int int1, int int2, int int3, char *String2, int int4, char *String3, char *String4)
{
     int attributelist[ATTNUM];
     int i, juicemodifier, otherstuff;

     ...
}


The moment I enter this function, the values of int2 and int3 get clobbered and turned into huge integers (they look like addresses or converted character strings). What the heck is going on?

Edit: The values of int2 and int3 don't get clobbered until after i and the other integers in the function are initialized. What could be overwriting them?

Edit part II: Something even stranger is going on. When I return from the subroutine, the changes to Subject reflect the original, correct values, even though the Subject itself isn't.
« Last Edit: March 06, 2014, 02:58:06 pm by SlatersQuest »
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #24 on: March 06, 2014, 06:58:37 pm »

Update:

Apparently, if I enter a subroutine passing an argument of type Creature*, the contents of the creature gets scrambled as I enter the subroutine.

How do I reference a creature inside of a subroutine??
Logged

Carlos Gustavos

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #25 on: March 14, 2014, 10:09:27 am »

I can't see anything wrong with what you're showing and passing a Creature* is nothing special. How does your calling code look?
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #26 on: March 14, 2014, 10:29:39 am »

Well, after testing it extensively, I think the problem is a bug inside of gdb, rather than inside of LCS. If I use fprintf() to stderr, it prints the right values from the creature going in, but the debugger itself can't access the data. Weird.
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #27 on: July 12, 2014, 10:50:02 am »

Hi

I need help.

I've gotten access to a Windows operating system and have downloaded a free Windows C++ compiler to compile the Terra Vitae mod for Windows. However, because LCS has multiple source files, simply directing the compiler to compile any one of them fails. I know that there are people on this board who have compiled the whole thing because the Windows and Unix source files are up on Curses - but how do I compile my Unix source on Windows?

Thank you.
Logged

Liberal Elitist

  • Bay Watcher
  • I'm more liberal than you are!
    • View Profile
    • The Liberal Crime Squad wiki
Re: Modding questions
« Reply #28 on: August 07, 2014, 04:00:18 am »

Hi

I need help.

I've gotten access to a Windows operating system and have downloaded a free Windows C++ compiler to compile the Terra Vitae mod for Windows. However, because LCS has multiple source files, simply directing the compiler to compile any one of them fails. I know that there are people on this board who have compiled the whole thing because the Windows and Unix source files are up on Curses - but how do I compile my Unix source on Windows?

Thank you.

Use the Code::Blocks IDE with the TDM-GCC compiler (choose codeblocks-13.12mingw-setup-TDM-GCC-481.exe as the download, at least with the current version... the filename will be different with the next version obviously). That is free software, as in freedom. Or use Microsoft Visual C++ 2010 Express as both your IDE and compiler. It's proprietary but free as in beer.

Visual C++ 2012 and later by default produce executables that require Windows Vista (I'm on Windows XP) and require CPUs that support SSE2 (mine supports SSE but not SSE2). You can change that default behavior of Visual C++ 2012 and later to make executables that work on Windows XP and have different CPU requirements, but that's a hassle, best to avoid MS Visual C++ 2012 and later unless you want to go through all that hassle.

Personally I just use Code::Blocks with TDM-GCC. Works great for compiling on Windows. Plus GCC is probably what you use on UNIX so it should be something you're used to. But I wouldn't say that there is "UNIX source", the source code is the same for all operating systems, it just uses defines to properly integrate with whatever the operating system and compiler APIs and libraries support. The only difference is the line endings... if you download it from SVN on Unix you'll have Unix-style line endings, while if you download it from SVN on Windows you'll have Windows-style line endings. That doesn't matter for compilation, it just makes things look correct in text editors. It's fairly easy to compile a project in an IDE, that's the way I always do it. There are also makefiles but that's not something I'm any good with.
Logged
The Liberal Crime Squad wiki is your friend.

Quote from: Lielac
Edit: Figured it out via a little bit of trial and error and oH MY GOD WHAT IS THIS MUSIC WHAT IS THIS MUSIC WHAT THE HECK IS IT SPACEBALLS MUSIC? WHATEVER IT IS IT IS MAGICAL

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #29 on: August 26, 2014, 06:46:57 pm »

Hello, I need help with a bug.

I've added three new weapons to the game. They all blow up (cause a segmentation fault in Unix lingo) when the following line of code is run:

Code: [Select]
weapontype[getweapontype(itemtypename())]->get_name(subtype)
The part that is crashing is the getweapontype(itemtypename()) part. getweapontype(const string) has the following code:

Code: [Select]
/* transforms a weapon type name into the index of that weapon type in the global vector */
int getweapontype(const string &idname)
{
   
   
    for(int i=0;i<(int)weapontype.size();i++)
    {
       
        if(weapontype[i]->get_idname()==idname)
        {
            return i;
        }
    }
       
   return -1;
}

The segmentation fault happens upon the return of the function. I have put test statements (consisting of getch() and fprintf statements to stderr) all through this, so I know that getweapontype() works properly up until the moment of returning i, at which point it crashes. I also tried creating a local variable in Weapon::get_name() and setting getweapontype() equal to that before looking up the weapontype[] vector. getweapontype() crashes on returning i, irrespective of whether it is used as an element of weapon type[] or if it is simply returning an int to a local value, and it crashes for all three of my new weapon types - this despite that getweapontype() can see the new weapon types within itself.

Can anybody please help tell me what is going on and how to fix it?

Thanks!
Logged
Pages: 1 [2] 3 4