V8 beta

Previous topic - Next topic

MrTAToad

Interesting :)

Any chance of having a SPACE$ (or PADSTRING command - create a string of a defined character, x many times) ?  A intergrated decimal to hex (and vice versa).




MrTAToad

SPRITE2MEM memory problem seems to be fixed, which is good!

MrTAToad

Compound ?IFDEF statements not only execute the code within the ?IFDEF statement, but also any non-valid ones.

For example, :

Code (glbasic) Select
?IFDEF WIN32
?WARNING "Windows"
?ELSE
?IFDEF OSXUNI
?WARNING "Mac"
?ELSE
?WARNING "Here too!"
?ENDIF
?ENDIF


Displays both Windows and Here too!


MrTAToad

#153
I notice that if you call a function in an extended type, unless you add self. to it, the compiler generates a

Quotecall to undefined function

error.

However, if you define a standard function (with the same name), the compiler somehow finds the function in the type and calls it (and you dont need to use self to do it).  I presume thats a little buggette :)

And of course, called functions in a type dont turn blue.

This is the code I'm testing it with :

Code (glbasic) Select
TYPE Ta
FUNCTION moo%:
go()
ENDFUNCTION

FUNCTION go%:
DEBUG "Type function\n"
ENDFUNCTION
ENDTYPE

LOCAL a AS Ta

a.moo()
END

FUNCTION go%:
DEBUG "Standard function\n"
ENDFUNCTION


I notice that the  "warning : note : TYPE xxx is not declared" message is still displayed...

Quentin

did anyone realize that with version 8.064 is't now possible to use the same function name in different types ?
Yeah!

Schranz0r

have do update today :P

WOHOOO ;)
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

MrTAToad

Its coming along very nicely...

bigsofty

Good enough to use on a commercial project yet?

Cheers,


Ian
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

Well, IMO better than V7 already.

bigsofty

Thanks Gernot, time to update I suppose!


Cheers,


Ian
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

MrTAToad

#160
There is a slight problem with SELECT and values return from functions in extended type - the only problem is I cant get a small example to do the same :(

For some reason this code :

Code (glbasic) Select
CONSTANT GAMESTATE_ERROR% = -1
CONSTANT GAMESTATE_INITIALISELEVEL% = 1
CONSTANT GAMESTATE_LOADLEVEL% = 2
CONSTANT GAMESTATE_INITIALISEPLAYERS%= 3
CONSTANT GAMESTATE_INITIALISEGAME% = 4
CONSTANT GAMESTATE_MAINLOOP% = 5
CONSTANT GAMESTATE_PAUSELOOP% = 6
CONSTANT GAMESTATE_DOMOVEMENT% = 7


Code (glbasic) Select
SELECT players[currentPlayer%].DisplayPointer(level,mouseBuffer)
CASE STATE_MENUSELECTED% // Selected ingame menu
gameState%=GAMESTATE_PAUSELOOP%
DEBUG "hdhd\n"

CASE STATE_DOMOVE% // Do movement
DEBUG "Do Move\n"
gameState%=GAMESTATE_DOMOVEMENT%

DEFAULT
DEBUG "Error should be : "+players[currentPlayer%].DisplayPointer(level,mouseBuffer)+"\n"
ENDSELECT


Always displays the Error should be message.

The code it calls is :

Code (glbasic) Select
FUNCTION DisplayPointer%:level AS TLevel,mouseBuffer AS TMouseBuffer
LOCAL result%,x%,y%,destX%,destY%
LOCAL windowWidth% = 310
LOCAL windowHeight% = 80
LOCAL moveType$

setup.DrawSpr_Scale(SPRITE_PLAYERSPOINTERS%,self.pointer.imageIndex%,self.pointer.x%,self.pointer.y%,0.0,1.0)
mouseBuffer.mouseProcess(self.pointer.x%,self.pointer.y%,self.pointer.b1%,self.pointer.b2%)
IF self.pointer.b1%
SELECT self.state%
CASE STATE_WAITINGFORPRESS%
// First press
// Now we check to see if we are over one of the players shapes
IF level.isOverPlayerShape(self.playerIndex%,self.pointer.x%,self.pointer.y%, _
self.selectedPos.x%,self.selectedPos.y%)
// Yes, its a valid shape, so we get all valid move positions (if any)
self.selectedPos.spotIndex%=self.findSelectedSpotIndex(self.selectedPos.x%,self.selectedPos.y%)
IF self.selectedPos.spotIndex%>=0
IF level.collectValidPositions(self.selectedPos.x%,self.selectedPos.y%,self.playerIndex%)>0
self.state%=STATE_WAITINGFORSELECTION%
ENDIF
ELSE
ENDIF
ELSE
IF self.isOverStatusArea(self.pointer.x%,self.pointer.y%)
// Yes, active pause window
x%=(self.screenWidth%-windowWidth%)/2
y%=(self.screenHeight%-windowHeight%)/2
DDgui_pushdialog(x%,y%,windowWidth%,windowHeight%)
DDgui_set("","TEXT","Game Paused")
DDgui_widget("w","What do you want to do now ?",windowWidth%)
DDgui_button(BUTTON_SKIPTURN$,BUTTON_SKIPTURN$,0,0)
DDgui_button(BUTTON_ABANDONGAME$,BUTTON_ABANDONGAME$,0,0)
DDgui_button(BUTTON_CLOSEWINDOW$,BUTTON_CLOSEWINDOW$,0,0)
RETURN STATE_MENUSELECTED%
ENDIF
ENDIF

CASE STATE_WAITINGFORSELECTION%
result%=level.isOverValidPosition(self.pointer.x%,self.pointer.y%,self.playerIndex%,moveType$,destX%,destY%)
SELECT result%
CASE SELECT_ORIGINALSHAPE% // Clicked over the original shape, so we reset the selection state
self.state%=STATE_WAITINGFORPRESS%
self.selectedPos.spotIndex%=INVALID%

CASE SELECT_MOVEPOSITION% // Selected a place to move to
DEBUG "Moving : "+moveType$+"\n"
IF moveType$=COPY_MOVE$ OR moveType$=MOVE_MOVE$
self.prepareSpotMove(moveType$,destX%,destY%)
DEBUG "HERE\n"
RETURN STATE_DOMOVE%
DEBUG "HHH\n"
KEYWAIT
ELSE
self.setup.seriousError("Unknown move type : "+moveType$)
ENDIF
ENDSELECT
ENDSELECT
ENDIF

RETURN STATE_NOTHINGPROCESSED%
ENDFUNCTION


As soon as the value is put in a variable, all is okay...

currentplayer is always 0, and the players array is defined.

Slydog

QuoteAs soon as the value is put in a variable, all is okay...

By that, are you saying that this works?:

Code (glbasic) Select
LOCAL state%
state% = players[currentPlayer%].DisplayPointer(level,mouseBuffer)

SELECT state%
...
ENDSELECT
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

MrTAToad

#162
Thats right.    :)

Whats annoying is that a small example doesn't exhibit the same behaviour which must mean a memory/stack error somewhere...   :glare:

MrTAToad

One other thing - you cant use calculations in an extended type array :

Code (glbasic) Select
TYPE TTest
FUNCTION moo%:
RETURN 12
ENDFUNCTION
ENDTYPE

LOCAL test[] AS TTest
DIM test[4]

LOCAL index%

index%=1

DEBUG test[index%-1].moo()


produces : error : call to undefined function : TTest

Kitty Hello

oh dear. Try an alias so far.