🔒 Locked
Free Code 4 u
Advertisement
Original Post
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
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!
...bump...
the link doesnt seem to work...
Wow...what''s up with this ugly tidbit of your code:
Beware the evil goto...when a while loop works wonders...
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...
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]
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]
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]
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]
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.
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.
[edited by - UfoZ on September 6, 2003 1:59:25 PM]
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]
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]\
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement