Forum

> > CS2D > General > Can't get CS2D running in Blitz3D
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Can't get CS2D running in Blitz3D

2 replies
To the start Previous 1 Next To the start

old Can't get CS2D running in Blitz3D

GeoB99
Moderator Off Offline

Quote
Hi,

I have installed Blitz3D and got the source code from Developers page as well as the game files, CS2D 0.1.0.4 Beta, because I couldn't find the 0.1.0.0 files of it. As I've heard the later one is much slightly similar to 0.1.0.0 as the directory structure is still the same.

I did all the steps including the userlib part however I ran into a problem. Just prior to launching, the game crashes and prints "Memory access violation". I enabled the Debug mode and seems the culprit is
rgb=ReadPixelFast(x,y)
from functions.bb file. The whole piece of code is this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
;--------------------Bild Prüfen
Function scanimage(image$,mr=0,mg=0,mb=0)
	Local r=0,g=0,b=0,x,y,h,w,rgb,cim
	cim=LoadImage(image$)
	h=ImageHeight(cim)
	w=ImageWidth(cim)
	SetBuffer ImageBuffer(cim)
	LockBuffer ImageBuffer(cim)
		For x=0 To w
			For y=0 To h
				rgb=ReadPixelFast(x,y)
				r=r+((rgb And $FF0000)/$10000)
				g=g+((rgb And $FF00)/$100)
				b=b+(rgb And $FF)
			Next
		Next
	UnlockBuffer ImageBuffer(cim)
	SetBuffer BackBuffer()
	FreeImage(cim)
	r=r/(x*y)
	g=g/(x*y)
	b=b/(x*y)
	If (mr+mg+mb)>0 Then
		modified=0
		If Abs(r-mr)>10 Then modified=1
		If Abs(g-mg)>10 Then modified=1
		If Abs(b-mb)>10 Then modified=1
		If modified Then RuntimeError("Modified Image detected!")
	EndIf
End Function
I don't really get this. At least it shows me where does it happen but it doesn't say why. I'd like if user DC answers this. I apologise if the problem seems too easy to fix, I am new to Blitz and stuff.

old Re: Can't get CS2D running in Blitz3D

DC
Admin Off Offline

Quote
This is probably a missing image. Debug the code and find out which value
image$
has to see which image it tries to check when it breaks.

You can also comment out the entire content of the function as it is just a check which is not crucial for the game to work. But it will probably break in another place then.

old Re: Can't get CS2D running in Blitz3D

GeoB99
Moderator Off Offline

Quote
I debugged the code and the
image$
variable is looking for "bots/dat2.us". This is weird because that texture is actually there. Probably this isn't the right texture the game is looking for or it's corrupt which I highly doubt.

Guess I'll either search for the right "dat2.us" file or just comment the whole
scanimage
function and its code with semicolons. Thank you for an answer first of.
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview