Hi zabnik
You are right with the object IDs. Check the numbers given to the model objects in ObjIDs.inc, since the number 1 is given to ?Primer?. I suggest to begin using numbers above 10000 to be completely sure they aren?t used twice.
About the inheritance, I think you get the idea. There is an interesting aspect in it, called polymorphism. It is also shown in Demo1.
I?m not sure what you mean with the mini problem or what you want to do. Can you explain it?

I take some more time into the code and found that you are using the global variable ?g_hInstance?. The OOP_Init.inc file defines a variable called hInstance used in all model objects. I suggest using it in place of g_hInstance, if you want to use the provided objects.

Take also a look at the string stuff of the model. Now you are writing something like this:

.if $invoke(MessageBox,0,$str("Would you like to run in fullscreen mode ?"),offset appname,MB_YESNO or MB_ICONQUESTION) == IDNO

This can be written as

.if $invoke(MessageBox,0, "Would you like to run in fullscreen mode ?",offset appname,MB_YESNO or MB_ICONQUESTION) == IDNO


OCall hFont::Font.PrintGL,$str("m_bCollided == ^1FALSE^7"),50,5,65,0


OCall hFont::Font.PrintGL,"m_bCollided == ^1FALSE^7",50,5,65,0

The only case were this automation doesn?t work is with the pure invoke command. For this case you can use the @invoke macro.


Posted on 2004-12-19 00:52:01 by Biterider
The string trick works!
The mini problem: I created a object: mov hQuake3Bsp,$New(Quake3Bsp,Init)
Now, that object got a variable defined: DefineVariable g_bLightmaps,dd,1
How to use, read, or change it outside of object, where it was created?

And anothe problem: "Method Quake3Bsp.Done,uses edi esi ebx"
Done is called triple times, I just put a MsgBox in there, after I destroy object:
OCall hQuake3Bsp::Quake3Bsp.Done

Destroy hQuake3Bsp

I get a msgbox three times
Posted on 2004-12-19 04:54:40 by zabnik
Hi zabnik
To use and change a method variable you have to reference it through the instance pointer, in your example hQuake3Bsp.

mov ecx, hQuake3Bsp

mov [ecx]. Quake3Bsp.g_bLightmaps, 25


mov ecx, hQuake3Bsp

mov (Quake3Bsp ptr [ecx]).g_bLightmaps, 25

Both are valid forms.

About the destructor problem, you must be aware that the Destroy macro calls Done automatically! You don?t have to call it manually.
From the code you showed me, I can not see where the 3 call was done. Trace to app to check it.


Posted on 2004-12-19 13:29:55 by Biterider
I found a macro:
mov [$asm(mov eax,hQuake3Bsp)].Quake3Bsp.g_bLightmaps,25

After I removed: OCall hQuake3Bsp::Quake3Bsp.Done
Done is still called 2 times
Posted on 2004-12-19 14:22:56 by zabnik
Method Quake3Bsp.Done,uses edi esi ebx

SetObject edi,Quake3Bsp
Destroy [edi].hImage
Destroy [edi].hlstr

; Free memory
DeAllocate [edi].hMemBSP,[edi].pMemBSP
DeAllocate [edi].hFacesDrawn,[edi].pFacesDrawn


STRANGE! When I comment this:
	Destroy [edi].hImage

Then second invoke disappears.
Posted on 2004-12-19 14:38:51 by zabnik
Hi zabnik
All is working right! You have derived your Image object from Quake3Bsp, so when it is destroyed, his done destructor is called. This destructor is inherited from its parent, the Quake3Bsp.done method. By this way, the Quake3Bsp.done is called twice, the first time when you destroy the hImage instance and the second time when you destroy the h Quake3Bsp instance.
I think that your problem is the inheritance tree. I?m not sure if you are right descending Image from Quake3Bsp, Frustum from Camera and Quaternions from Camera, since the ancestors have nothing in common with their descendants. I think that in your case, all have to derive from Primer.
To clarify to inheritance concept, take a look at the first Demo. There you have 3 objects. The common parent is Shape and its descendants are Triangle and Rectangle. The common variables the width (dbase) and height (dHeight) and all methods defined in Primer plus ?GetArea? and ?Private? methods. The ?Init? method was only redefined! As you can see in the Triangle object definition, it doesn?t add anything; it simply redefines the behaviour of GetArea. It has all the members inherited from its parent! Rectangle does the same redefining its own ?GetArea? method and it adds 2 new methods.

I hope this helps to clarify it a little bit. :)


Posted on 2004-12-20 00:48:19 by Biterider