Bug: stamina cost when throwing objects

Discuss Chaos Strikes Back for Windows and Linux, an unofficial port of Chaos Strikes Back to PC by Paul Stevens, as well as CSBuild, an associated dungeon editor.

Moderator: Zyx

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
ChristopheF
Encyclopedist
Posts: 1538
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Bug: stamina cost when throwing objects

Post by ChristopheF »

I think I have found a bug in CSBwin.
When a champion throws an object, his stamina is decreased by an amount computed in the function named TAG016382 (in file mouse.cpp).
There is a mistake in the C code of this function when compared to the original assembly source code. The line
D6W = sw(D7W / 2);
should be replaced by
D6W += sw(D7W / 2);

For example, with the current implementation:
Throwing an object weighting 1.0 Kg (weight value = 10) will decrease stamina by 5.
Throwing an object weighting 3.2 Kg (weight value = 32) will decrease stamina by 3. Less stamina lost for a heavier object!
The correct value for a 3.2 Kg object should be 13.

Paul, can you check and confirm this?
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Re: Bug: stamina cost when throwing objects

Post by Paul Stevens »

No doubt about it. I have fixed this
error. It is posted at:
http://dianneandpaul.net/CSBwin/CSBwin11_024.zip

The advantages of open source!

You do have the old code with the assembly
language as comments, do you not?

I assume so....since you found this error.
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Bug: stamina cost when throwing objects

Post by Sophia »

Oh, this makes sense. I'll fix it in DSB too. :D

Good find. I remember noticing this but I wasn't sure what to make of it. DSB has the following comment:

Code: Select all

-- DM did something nonsensical with the value here.
:mrgreen:
User avatar
ChristopheF
Encyclopedist
Posts: 1538
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Re: Bug: stamina cost when throwing objects

Post by ChristopheF »

I do have the older CSBwin source with the assembly language (for versions 0.7 and 9.3).
However I discovered this bug while studying my own disassembly of the original CSB 2.0 game that I made using TTDigger. I did that in order to study the game, learn assembly and Atari ST stuff, with one main objective to fully understand the copy protection with every possible detail. This is obviously not possible with CSBwin that is based on a cracked version of the game. I will someday write a document to describe my findings. What I have found yet shows a fiendishly clever protection scheme whose code and data is mixed in normal game code and data in order to make it as difficult to find/crack as possible.
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

Re: Bug: stamina cost when throwing objects

Post by Bit »

try that 2.1-disassembly-version - or check my thread about the 2.0/2.1-clone in the developer's section. there's all inside including my source that 'logs' all changes from the beginning of both sources to simple clones that seems to work. you will also find all differences of both versions - and how the four-button-load/save-box is included. i made the clones one time manually and the 2nd time this automated way - and checked them against each others. should be pretty fine now. ofc you'd need MSVC 6.0 as compiler, but if you don't own it and need some files that are built 'on the way', i certainly help.
perhaps our results together can make the 'basic source' more safe, because i am not sure if i delete too much or did forget something. at least the 'developer'-source can point you on some things.

Also, not all is 'protection' stuff what looks like. There are some interrupt mechanism for the hardware and that part that seems to allow to put executable code into the datafiles. Ofc you can't use that for a pc-version that way. that's what DSA is good for ;)
User avatar
ChristopheF
Encyclopedist
Posts: 1538
Joined: Sun Oct 24, 1999 2:36 pm
Location: France
Contact:

Re: Bug: stamina cost when throwing objects

Post by ChristopheF »

I downloaded all of your works, Bit. The result (working clones) is impressive, but I must say I don't understand what exactly you have done, how you did it. I'm sure your work could benefit me, but I don't know how to get started. I would need more documentation about how you did what.
User avatar
Bit
Arch Master
Posts: 1064
Joined: Mon Mar 03, 2008 10:53 am
Location: Nuts trees

Re: Bug: stamina cost when throwing objects

Post by Bit »

I sent two pm's.
Post Reply

Return to “Chaos Strikes Back for Windows & Linux (CSBWin) / CSBuild”