Regenerating Mana
Moderator: Ameena
Forum rules
Please read the Forum rules and policies before posting. You may
to help finance the hosting costs of this forum.
Please read the Forum rules and policies before posting. You may

Regenerating Mana
I took a (long) look at the source code.
I don't know whether you already know it, but it is new to me:
How the mana regeneration during sleep functions:
The more wizard/priest levels and the more wisdom you have, the longer are those 'mana pushes'. That means, the lower your (levels+wisdom) are the longer are the breaks between those 'mana pushes'.
And during the 'mana pushes' you loose a certain amount of stamina, though this is handled kinda weird :P
There is a timer which is counted up (down?) and as long it is below your (levels+wisdom), you get (max_mana/40) mana and loose (timer) stamina.
Giving your poor Tiggy 200 Wisdom, she will die instantly during sleep :P.
(by loosing ~250 stamina per tick)
By the way, who again disassembled the code?
I don't know whether you already know it, but it is new to me:
How the mana regeneration during sleep functions:
The more wizard/priest levels and the more wisdom you have, the longer are those 'mana pushes'. That means, the lower your (levels+wisdom) are the longer are the breaks between those 'mana pushes'.
And during the 'mana pushes' you loose a certain amount of stamina, though this is handled kinda weird :P
There is a timer which is counted up (down?) and as long it is below your (levels+wisdom), you get (max_mana/40) mana and loose (timer) stamina.
Giving your poor Tiggy 200 Wisdom, she will die instantly during sleep :P.
(by loosing ~250 stamina per tick)
By the way, who again disassembled the code?
- ChristopheF
- Encyclopedist
- Posts: 1603
- Joined: Sun Oct 24, 1999 2:36 pm
- Location: France
- Contact:
Re: Regenerating Mana
Paul Stevens did, the author of Chaos Strikes Back for Windows, available on the Clones page.
Christophe - Dungeon Master Encyclopaedia
Re: Regenerating Mana
What source code is this that you're talking about? The Dungeon Master source or Chaos Strikes Back for Windows source code. I've got the CSB hacked source code and it's incredibly difficult to follow. I wish that guy Paul Stevens would clean up the code to make it more readable and add a lot more comments so you can tell what's going on. What do you think are the chances of the source code for the Amiga version of Dungeon Master being released? That would be awesome. I can't see what FTL (do they still exist) would lose from releasing the source for their games. Id are always releasing the source code to their games. The community would gain much from it though. I'd love to play with the source and tweak Dungeon Master by adding new weapons and things. That would be great.
- Paul Stevens
- CSBwin Guru
- Posts: 4322
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
Re: Regenerating Mana
Hi there, Steve,
"Clean up the code....lot more comments"
You are a funny man! But you need to put one of those
'smiley-faces' after such subtle jokes. ;-)
PAul
P.S. The truth is that I put comments wherever **I** could figure
out what was happening! I have been hoping that someone else
could figure out a bit more and help me. You may be he!
"Clean up the code....lot more comments"
You are a funny man! But you need to put one of those
'smiley-faces' after such subtle jokes. ;-)
PAul
P.S. The truth is that I put comments wherever **I** could figure
out what was happening! I have been hoping that someone else
could figure out a bit more and help me. You may be he!
Re: Regenerating Mana
""Clean up the code....lot more comments"
You are a funny man! But you need to put one of those
'smiley-faces' after such subtle jokes. ;-)"
*G*
Well, I could help you a bit.
I already found an error (? not sure, but it looks like one)
=> w_4 = sw(D1W + 1); (TAG01605a, AdjustSkills() in magic.cpp)
The D1W variable is not initialized. Well, or it is at least not initialized in this code segment and would therefore depend on the last spell you cast(as far as I backtraced it) ...
(mmmh... or maybe I just didn't understand the code ;-) )
d1w is later used on increasing wisdom for example.
You are a funny man! But you need to put one of those
'smiley-faces' after such subtle jokes. ;-)"
*G*
Well, I could help you a bit.
I already found an error (? not sure, but it looks like one)
=> w_4 = sw(D1W + 1); (TAG01605a, AdjustSkills() in magic.cpp)
The D1W variable is not initialized. Well, or it is at least not initialized in this code segment and would therefore depend on the last spell you cast(as far as I backtraced it) ...
(mmmh... or maybe I just didn't understand the code ;-) )
d1w is later used on increasing wisdom for example.
Re: Regenerating Mana
Hi there, Paul,
"Clean up the code....lot more comments"
"You are a funny man! But you need to put one of those
'smiley-faces' after such subtle jokes."
:)
It wasn't a subtle joke but I get your point anyway. I only had a quick 20 minute flick through the source but I just didn't know where the hell to start. It's just extremely confusing. I've been programming in C for about 3 years now but I still can't make head nor tail of it. Anyway what would help me to help you clean up the code would be maybe a text file added to the source which explains clearly what each .c or .h file is "supposed" to do. I got hopelessly lost with all the .c files with non-descript names. Anyway that would help a lot. :D
PS. What about hacking the Dungeon Master source code for your next challenge. :)
"Clean up the code....lot more comments"
"You are a funny man! But you need to put one of those
'smiley-faces' after such subtle jokes."
:)
It wasn't a subtle joke but I get your point anyway. I only had a quick 20 minute flick through the source but I just didn't know where the hell to start. It's just extremely confusing. I've been programming in C for about 3 years now but I still can't make head nor tail of it. Anyway what would help me to help you clean up the code would be maybe a text file added to the source which explains clearly what each .c or .h file is "supposed" to do. I got hopelessly lost with all the .c files with non-descript names. Anyway that would help a lot. :D
PS. What about hacking the Dungeon Master source code for your next challenge. :)
- Paul Stevens
- CSBwin Guru
- Posts: 4322
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
Re: Regenerating Mana
Hi again, Steve,
"what would help me to help you clean up the code would be maybe
a text file added to the source which explains clearly what
each .c or .h file is "supposed" to do."
Heh.....if I had this information I could do it myself. I really was
hoping that someone a bit more clever than me could spend a
few hours making sense of the thing. Twenty minutes
would certainly not be enough for me to get any grasp of the program.
After 50 hours things might get a little bit clearer for someone who
is an expert programmer. 1000 hours was not enough for me but
then my background is in hardware, not software, which probably
explains my inability to understand it.
I can make the machine lanugage for Dungeon Master available for
anyone who would like to produce a clean, professional,
well-documented conversion to Windows.
PAul
"what would help me to help you clean up the code would be maybe
a text file added to the source which explains clearly what
each .c or .h file is "supposed" to do."
Heh.....if I had this information I could do it myself. I really was
hoping that someone a bit more clever than me could spend a
few hours making sense of the thing. Twenty minutes
would certainly not be enough for me to get any grasp of the program.
After 50 hours things might get a little bit clearer for someone who
is an expert programmer. 1000 hours was not enough for me but
then my background is in hardware, not software, which probably
explains my inability to understand it.
I can make the machine lanugage for Dungeon Master available for
anyone who would like to produce a clean, professional,
well-documented conversion to Windows.
PAul
Re: Regenerating Mana
Hi Paul
Cool. Is that the PC or Amiga Dungeon Master Assembly code you have. I'm in the middle of learning Amiga assembler at the moment. Anyway I'd love to see it. Is it the original source?
Cool. Is that the PC or Amiga Dungeon Master Assembly code you have. I'm in the middle of learning Amiga assembler at the moment. Anyway I'd love to see it. Is it the original source?
- Paul Stevens
- CSBwin Guru
- Posts: 4322
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
Re: Regenerating Mana
Thank you , Mr. (Ms ??) Claw,
This really belongs in the CSB for Windows forum but I guess
one little post here won't disturb the Universe unduly.
I appreciate your comment. I checked it out and the code is
right and you are wrong (if I am looking at the right place).
And the problem with your understanding is rather basic.
That line of code:
w_4 = sw(D1W + 1);
is preceeded by a line that sets D1L = Random();
The Atari hardware had 8 'data' registers. One could reference
the entire register with DnL or the lower 16 bits with DnW.
So the code you see gets a random number, puts it into the
32-bit register and then puts the lower 16 bits into a variable
called w_4. In the C++ code, the registers are implemented
as unions and the label (for example) D1W is defined as
union dReg
{
i8 B[4];
ui8 UB[4];
i16 W[2];
ui16 UW[2];
i32 L[1];
ui32 UL[1];
};
#define loWord 0
#define D1W (D1.W[loWord])
dReg D1;
It is exactly analogous to the Intel hardware's AL, AX, and EAX.
If this explanation is not sufficient or you still think the code
has an error, write me directly or post to
CSB for Windows. I have plenty of time for this sort of thing.
PAul
prsteven@facstaff.wisc.edu
This really belongs in the CSB for Windows forum but I guess
one little post here won't disturb the Universe unduly.
I appreciate your comment. I checked it out and the code is
right and you are wrong (if I am looking at the right place).
And the problem with your understanding is rather basic.
That line of code:
w_4 = sw(D1W + 1);
is preceeded by a line that sets D1L = Random();
The Atari hardware had 8 'data' registers. One could reference
the entire register with DnL or the lower 16 bits with DnW.
So the code you see gets a random number, puts it into the
32-bit register and then puts the lower 16 bits into a variable
called w_4. In the C++ code, the registers are implemented
as unions and the label (for example) D1W is defined as
union dReg
{
i8 B[4];
ui8 UB[4];
i16 W[2];
ui16 UW[2];
i32 L[1];
ui32 UL[1];
};
#define loWord 0
#define D1W (D1.W[loWord])
dReg D1;
It is exactly analogous to the Intel hardware's AL, AX, and EAX.
If this explanation is not sufficient or you still think the code
has an error, write me directly or post to
CSB for Windows. I have plenty of time for this sort of thing.
PAul
prsteven@facstaff.wisc.edu
- Paul Stevens
- CSBwin Guru
- Posts: 4322
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
Re: Regenerating Mana
Hi again, Steve,
"PC or Amiga Dungeon Master Assembly code you have."
No. no, no. Sorry if I caused some confusion here.
I never said "Assembly"! Please read it again. I said
"machine language". Here are 6 lines (of about 120,000) as
an example.
defc 000a
486c 0038
2f3c 004c 000d
3f3c 0069
4ead 00f0
defc 000a
Disassembling this is the first step in the translation and it is not
trivial because data is mixed in with the code, variable length
instructions cause the disassembly to get out of sync, etc.
But I can provide the crude dissassembler I used for the 68000
code, thereby saving you the effort of writing a disassembler.
I can provide Amiga, Atari, or PC machine language for Dungeon
Master. Whichever one you think is easiest for you. It is far from
the original source.....It is the result of compiling and linking. I
would like to have the original source but I do not know where to
get it.
PAul
"PC or Amiga Dungeon Master Assembly code you have."
No. no, no. Sorry if I caused some confusion here.
I never said "Assembly"! Please read it again. I said
"machine language". Here are 6 lines (of about 120,000) as
an example.
defc 000a
486c 0038
2f3c 004c 000d
3f3c 0069
4ead 00f0
defc 000a
Disassembling this is the first step in the translation and it is not
trivial because data is mixed in with the code, variable length
instructions cause the disassembly to get out of sync, etc.
But I can provide the crude dissassembler I used for the 68000
code, thereby saving you the effort of writing a disassembler.
I can provide Amiga, Atari, or PC machine language for Dungeon
Master. Whichever one you think is easiest for you. It is far from
the original source.....It is the result of compiling and linking. I
would like to have the original source but I do not know where to
get it.
PAul
Re: Regenerating Mana
Ermmm
Damn it.
I got my wires crossed! :P
I thought you was talking about Assembly when you said machine language.
I didn't realise you meant proper machine language. Doh!!
I wouldn't even know where to begin with machine language. :)
Oh well. I'll stick with the C source for now.
Damn it.
I got my wires crossed! :P
I thought you was talking about Assembly when you said machine language.
I didn't realise you meant proper machine language. Doh!!
I wouldn't even know where to begin with machine language. :)
Oh well. I'll stick with the C source for now.
- Paul Stevens
- CSBwin Guru
- Posts: 4322
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
Re: Regenerating Mana
Hi again, Steve,
I spent a good part of my life pushing programs into
computers with one pushbutton for each bit in an
instruction. We called it octal but in reality it was binary.
It does not frighten me but it certainly is tedious.
You are most welcome to use my C++ source as you please.
Take my name off and put your name on if it makes you happy.
I'm happy to hear that you find it useful.
If you have any questions or spot any (even possible) errors,
please let me know. Same goes for anyone else examining
the code. I have a feeling that the DM code is nearly identical
to the CSB code.
PAul
I spent a good part of my life pushing programs into
computers with one pushbutton for each bit in an
instruction. We called it octal but in reality it was binary.
It does not frighten me but it certainly is tedious.
You are most welcome to use my C++ source as you please.
Take my name off and put your name on if it makes you happy.
I'm happy to hear that you find it useful.
If you have any questions or spot any (even possible) errors,
please let me know. Same goes for anyone else examining
the code. I have a feeling that the DM code is nearly identical
to the CSB code.
PAul
Re: Regenerating Mana / Fire shield
>>Thank you , Mr. (Ms ??) Claw,
Mr. :P
ah, now things are getting more clear :B
It was kinda confusing (especially with the time variable), I thought d1w is just another variable dependand on d1l.
The Atari hardware had 8 'data' registers. One could reference
the entire register with DnL or the lower 16 bits with DnW.
So the code you see gets a random number, puts it into the
32-bit register and then puts the lower 16 bits into a variable
called w_4. In the C++ code, the registers are implemented
as unions and the label (for example) D1W is defined as.
The atari already had eight 32bit registers? cool :)
Well, I think I'm going a bit deeper into the code, some parts (movement, certain spells etc.) are very interesting :)
By the way (totally off-topic ;) ): (I think it's a bug) Fire Shield is cumulative.
Casting it 3 times (maximum power) and for example lord order at the entrance has some problems killing you, as the fireballs do only ~20 damage per tick :D.
Mr. :P
ah, now things are getting more clear :B
It was kinda confusing (especially with the time variable), I thought d1w is just another variable dependand on d1l.
The Atari hardware had 8 'data' registers. One could reference
the entire register with DnL or the lower 16 bits with DnW.
So the code you see gets a random number, puts it into the
32-bit register and then puts the lower 16 bits into a variable
called w_4. In the C++ code, the registers are implemented
as unions and the label (for example) D1W is defined as.
The atari already had eight 32bit registers? cool :)
Well, I think I'm going a bit deeper into the code, some parts (movement, certain spells etc.) are very interesting :)
By the way (totally off-topic ;) ): (I think it's a bug) Fire Shield is cumulative.
Casting it 3 times (maximum power) and for example lord order at the entrance has some problems killing you, as the fireballs do only ~20 damage per tick :D.
- Paul Stevens
- CSBwin Guru
- Posts: 4322
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
Re: Regenerating Mana
Good luck, Mr. Claw, and see my offer in the CSB for
Windows forum.
Actually the Atari had eight 32-bit data registers and
eight 32-bit address registers. The address registers
held 32-bit numbers but only 24 of the bits were actually
connected to memory in the 68000. Sometimes people
would cheat and keep a byte of data in bits 24 through 31.
Then their programs stopped working on the 68020.
The 68000 was rather powerful in its day but it suffered
from a rather asymmetrical instruction set, IMHO.
PAul
Windows forum.
Actually the Atari had eight 32-bit data registers and
eight 32-bit address registers. The address registers
held 32-bit numbers but only 24 of the bits were actually
connected to memory in the 68000. Sometimes people
would cheat and keep a byte of data in bits 24 through 31.
Then their programs stopped working on the 68020.
The 68000 was rather powerful in its day but it suffered
from a rather asymmetrical instruction set, IMHO.
PAul
Re: Regenerating Mana
I already tried to shield me against Lord Librasulus in FTL-DM1 for MS-DOS but it does not work!
Parting is all we know from Heaven, and all we need of hell.
Re: Regenerating Mana
how often did you cast fire-shield?
You die anyways because you can't flee...
(well I opened the two walls in the first level and cheated a character to 200 Anti Fire ;-)
You die anyways because you can't flee...
(well I opened the two walls in the first level and cheated a character to 200 Anti Fire ;-)
Re: Regenerating Mana
You have the opportunity to flee from the Fulya pit room, even when fireballs are cast, don't you?
Thread-Trouble
Blame me :P
"By the way (totally off-topic ;) ): (I think it's a bug) Fire Shield is cumulative."
I caused that thread-trouble *g*
"By the way (totally off-topic ;) ): (I think it's a bug) Fire Shield is cumulative."
I caused that thread-trouble *g*