Skip to main content
gamedev.net
🔒 Locked

Free Code 4 u

Started by beaton_john Aug 27, 2003 at 5:56 AM 19 replies 3.1k views
Original Post
beaton_john
beaton_john
I can''t be stuffed doing any more game project [too much homework] so i''m posting my code on the net. No data files are included - only code ESQUARED ENGINE ======== ====== - QuakeIII Map Loader - Loads config files - Overbrightening - Roq video playing - sound - Kernel [was multithreaded, but i had to remove the multithreading as it was buggy] - 80-90% of shaders support - + much more the link http://thecproject.tripod.com/esquared.zip
beaton_john
beaton_john
Yeah go for it! The source is FREE [not open, except for the bits i did not write] so steal as much of it as you can use!
sSimontis
sSimontis
I will take soom soon. Thanks.

Scott Simontis
e-mail:ageofscott@comcast.net
AIM:ssimontis
Scott SimontisMy political blog
starboarder
starboarder
the link doesnt seem to work...
-www.Vision-Software.org
mikeyrb
mikeyrb
Wow...what''s up with this ugly tidbit of your code:


void CWindow::TaskMain() {
//Message

MSG msg;

_getmsg:
//Get the message from the queue

if (PeekMessage(&msg, m_hWnd, 0,0,PM_REMOVE))
{
//Translate the message

TranslateMessage(&msg);
//Send it to the window

DispatchMessage(&msg);

//There could be more messages

goto _getmsg;
}

//Set it to think next time the kernel runs

SetNextThink();
};


Beware the evil goto...when a while loop works wonders...
beaton_john
beaton_john
Touche...

PS A loop IS a goto in asm, c compiles into asm, so a loop is the same thing. Yes, a loop would have looked nicer, but in essence, it does the SAME FUCKING THING. big deal. Anyway, it gets an OK fps 4 what it does...

[edited by - beaton_john on September 6, 2003 3:44:53 AM]
Naku
Naku
The while would have been shorter code though, replace the if with a while and remove the label and the goto statement, shorter code without an evil goto.

[edited by - Naku on September 6, 2003 4:11:26 AM]
Oxygenium
Oxygenium
The evil goto... Why, the hell, it is evil? I think it is 'evil' because it makes your code unreadable - this code is readable (at least for me) so THIS goto is not evil. Of course, that if you'll use only gotos and no loops then the goto will be evil, but if you use it only sometimes it's not an evil.

EDIT: And - if you'll just replace the if with while the program will shutdown some time after it will start up - exactly - at the moment when the PeekMessage returns false (there's no message).

Oxygenium

[edited by - oxygenium on September 6, 2003 7:12:05 AM]
---Unreadable code is code written on a piece of paper, but not the one, in which its programmer is using a space in place you don't.
Raloth
Raloth
Goto is not evil when used properly. In this case it is not used properly. Never use a goto when you use a while(true) statement instead. It''s just good coding practice...
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
Naku
Naku
quote:
Original post by Oxygenium
EDIT: And - if you''ll just replace the if with while the program will shutdown some time after it will start up - exactly - at the moment when the PeekMessage returns false (there''s no message).

Oxygenium

[edited by - oxygenium on September 6, 2003 7:12:05 AM]


Oops, good point, don''t know how I made that mistake, I''ll put it down to it being early in the morning.
UfoZ
UfoZ
Actually, the modification you suggested is correct, since the if will exit too when PeekMesage returns false.

As for the goto... the while and the goto assemble into the same instructions. There's no point in this stupid petty attempt at optimization, it will only make your code unreadable.


mylabel:

if (i<10) {
00411A05 cmp dword ptr [i],0Ah
00411A09 jge mylabel+11h (411A16h)
i++;
00411A0B mov eax,dword ptr [i]
00411A0E add eax,1
00411A11 mov dword ptr [i],eax
goto mylabel;
00411A14 jmp mylabel (411A05h)
}

i=0;
00411A16 mov dword ptr [i],0

while (i<10) i++;
00411A1D cmp dword ptr [i],0Ah
00411A21 jge mylabel+29h (411A2Eh)
00411A23 mov eax,dword ptr [i]
00411A26 add eax,1
00411A29 mov dword ptr [i],eax
00411A2C jmp mylabel+18h (411A1Dh)


[edited by - UfoZ on September 6, 2003 1:59:25 PM]
Sneftel
Sneftel
quote:
Original post by UfoZ
stupid petty attempt at optimization

Now, now. Let''s all be polite, ladies.




How appropriate. You fight like a cow.
beaton_john
beaton_john
Get over it... look at some of the better bits of the code instead of bitchin'' about where i stuffed up chrissake im only 16 dammint]\
Vanz
Vanz
Hey beaton_john,

I can''t seem to get to compile properly. I am loading E2ENGINE.dsw into VC++6 but it it looking for 2 files. AL.dsp and base.dsp do these need to come from the original game or can I get elsewhere. Thanks.

rhuala

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.