![]() |
#1 |
Knight
Join Date: Jan 2009
Posts: 657
![]() |
Roguelike development practice
I've attempted (and mostly failed ;-) to gain experience with C++ and the *band builds in various ways and here I go again.
This time I'm going to keep it simple (if I can) - just produce code to add one feature to the latest Angband code. Code:
^T Talk Attempt to strike up conversation with an adjacent monster. (Monster will reply with single line based on its type) ![]() |
![]() |
![]() |
![]() |
#2 |
Administrator
|
Ogres need to have a line 'Heee did it.'
__________________
See the elves and everything! http://angband.oook.cz |
![]() |
![]() |
![]() |
#3 |
Knight
Join Date: Dec 2008
Posts: 625
![]() |
|
![]() |
![]() |
![]() |
#4 |
Knight
Join Date: Jan 2009
Posts: 657
![]() |
Well, I got close this time, but it looks like no cigar for me.
![]() I thought I'd added everything I needed for an extra parameter in the monster text, but now it is no longer recognizing the D: line! (Which I don't think I've touched) Error at line 121 of 'monster.txt'. Record 1 contains a 'undefined directive' error. Parsing 'D:He looks squalid and thoroughly revolting.'. Code:
/* Process 'D' for "Description" */ if (buf[0] == 'D') { /* Store the text */ if (!add_text(&(r_ptr->text), head, buf+2)) return (PARSE_ERROR_OUT_OF_MEMORY); } /* Process 'T' for "Talk" */ if (buf[0] == 'T') { /* Store the line of speech */ if (!add_text(&(r_ptr->talk), head, buf+2)) return (PARSE_ERROR_OUT_OF_MEMORY); } |
![]() |
![]() |
![]() |
#5 | |
Veteran
Join Date: Apr 2007
Posts: 1,947
Donated: $40
![]() |
Quote:
__________________
takkaria whispers something about options. -more- |
|
![]() |
![]() |
![]() |
#6 |
Knight
Join Date: Jan 2009
Posts: 657
![]() |
|
![]() |
![]() |
![]() |
#7 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,913
Donated: $40
![]() |
@paul --
Do you have a working debugger? I assume from what you are saying, that you are using MSDEV. Even the free version has a line-by-line stepping debugger/IDE. You can put "breakpoints" in and stop the program at any point, then step from there. It can be very useful. (It can also be a huge time-waster.) |
![]() |
![]() |
![]() |
#8 | |
Knight
Join Date: Jan 2009
Posts: 657
![]() |
Presumably.
![]() I haven't actually tried it yet though. Basically it's been decades since I sort-of-knew what I was doing with this stuff and I'm very slowly getting back up to speed. Quote:
![]() What I did so far required changes to: cmd0.c cmds.h cmd3.c monster.txt init1.c init2.c init.h and monster/types.h Everything seems to be spread out to heck and gone. |
|
![]() |
![]() |
![]() |
#9 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,913
Donated: $40
![]() |
Debugging with a C compiler isn't any harder. The tough part is setting up the compile environment from scratch :/
And your changes aren't really spread out "to heck and gone." I could have told you what files would need modifying. For the record: Adding a new command: cmds.h to add the new command declaration * [ED: this is broken, since some of them are also in externs.h] cmd0.c, to add a new command to the command m enus & list. * [pre-3.0.8: was dungeon.c, and was that ever a lousy place!] cmd[1-3].c to add the new command implementation, depending on what type it is. (This depends on which menu in cmd0.c) (cmd4.c is for meta-commands like options and knowledge) To change the behavior of individual monsters: (NOT by monster "genus", like 'T', 'o', 'D', etc.) monster.txt: to add the new flag/descriptor to the individual monster data field. monster/types.h to add the new field in the basic monster type. init1.c to add to the tokens (string constants) tables for initialization. Also, the spoken strings may go here too. init2.c to add to the monster.txt parser. init.h to add the appropriate #defines for token_ids. |
![]() |
![]() |
![]() |
#10 |
Knight
Join Date: Jan 2009
Posts: 657
![]() |
In other words somebody who already knows where to go can find stuff. For somebody coming to the whole thing from scratch working out which bit does what is rather more of an uphill struggle.
Last edited by PaulBlay; February 19, 2009 at 20:05. |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
My variant development journal | CJNyfalt | Variants | 107 | June 6, 2009 08:25 |
Noob's development journal | PaulBlay | ToME | 8 | February 12, 2009 19:16 |
[FA] FAangband development | Nick | Variants | 174 | May 30, 2008 03:02 |
more fun with the development branch of 3.1.0 | pesachyonah | Vanilla | 6 | May 17, 2008 18:13 |
Roguelike development diary | andrewdoull | Variants | 0 | May 14, 2007 12:35 |