Allegro.cc - Online Community

Allegro.cc Forums » The Depot » Alex4, source code available

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Alex4, source code available
Johan Peitz
Member #9
April 2000
avatar

Yes it is, get it here.
Have fun!

--
johan peitz :: things I made

X-G
Member #856
December 2000
avatar

Yay! First order of business: Port it to Linux.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

kazzmir
Member #1,786
December 2001
avatar

Can you make the data easy to download to? It compiled fine on linux, except for the DIGI_DIRECTX stuff, but I dont want to have to boot into windows to get the data.

Matthew Leverton
Supreme Loser
January 1999
avatar

Yeah, the .exe installer isn't Zip compatable (some are), so getting the data on a linux platform requires Windows access. :)

But yeah, it compiles and runs fine, if the window specific DIGI_ drivers are removed, and the .ini is changed to use the DIGI_AUTODETECT option.

Evert
Member #794
November 2000
avatar

My patch to make Alex 4 compile in UNIX is attached. It will map the sound_device=2/3 from the ini file to OSS and ALSA respectively, while retaining the ability to compile the source for Windows.
Tested under SuSE Linux 8.0.

The game itself seems to run properly (though I've only played it briefly), but sometimes segfaults on exit. GDB traces the crash to allegro_exit(). I haven't investigated further yet.

EDIT: I'm dumb!! I posted at the same time Matthew did, which looks somewhat funny. ;D

Johan Peitz
Member #9
April 2000
avatar

Allright, I've included the data in the download now.

Thanks.

--
johan peitz :: things I made

Rafael Santos Coelho
Member #2,858
October 2002
avatar

Hey Johan,

Do you use DJGPP ?

"No one is someone in life alone".
Joseph Nicodemos

X-G
Member #856
December 2000
avatar

Last time I checked he used MSVC. There's no excuse for using DJGPP in Windows, and Peitz knows this. :P

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Johan Peitz
Member #9
April 2000
avatar

I haven't used DJGPP for ages. I've been using MSVC for the last few years at least. (But! I'm about to move to mingw soon.)

--
johan peitz :: things I made

X-G
Member #856
December 2000
avatar

What? I thought you said you were NOT going to move to MinGW. :P

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Johan Peitz
Member #9
April 2000
avatar

I'm allowed to change my mind, am I not? :) I got it working last night, with windres and all. Now I just need to learn how to make makefiles.

--
johan peitz :: things I made

Evert
Member #794
November 2000
avatar

Cool! 8-)
If you want, I could whip up a makefile for Alex 4 that allows it to compile for DOS, Windows (MinGW) and Linux simultaneously as an example...?

Johan Peitz
Member #9
April 2000
avatar

Yes please. :D

--
johan peitz :: things I made

Ender Wiggin
Member #3,062
December 2002
avatar

Quote:

I haven't used DJGPP for ages. I've been using MSVC for the last few years at least. (But! I'm about to move to mingw soon.)

Excellent choise, really. I use it too :).
MSVC is too heavy and messy for me :-[
DJGPP is for DOS - that says it all. I stopped using it as soon as I found out about MinGW :).

Quote:

Now I just need to learn how to make makefiles.

I just use a compile.bat file, and I run it through EditPlus from which I edit the code and manage the project and run everything. It's almost like an IDE. The output is easy to handle too :).

What I would want you to fix in this source is the warnings that I always get from MinGW :(.
I already told you in the FLD forum, I think:

: main.c:1292: warning: suggest parentheses around && within ||
(if ((mode == 1 && (keypressed() || is_fire(&ctrl) || is_jump(&ctrl))) || my_counter > 200) {
: main.c:2152: warning: type defaults to `int' in declaration of `camera_type'
(I.E. use static int, not static)
: map.c:412:57: warning: multi-line comment
(// 45 degree slope \)
: shooter.c:376: warning: int format, long unsigned int arg (arg 3)
((int)(s_var.show_score))
And plenty more "No newline at end of file"s.

And that whole slopes code should either be fixed or removed. I would prefer if it was fixed :D

Oh, well, I understand you're done working on it :'(.

Bruce Perry
Member #270
April 2000

Quote:

: shooter.c:376: warning: int format, long unsigned int arg (arg 3)
((int)(s_var.show_score))

Better idea: change the "%d" or "%i" or whatever it is to "%lu".

goes off to download it

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

Matthew Leverton
Supreme Loser
January 1999
avatar

Johan said:

Allright, I've included the data in the download now.

Bruce Perry
Member #270
April 2000

Umm ... I have a confession to make. I changed the meaning of dumb_resampling_quality for DUMB v0.9.2. So the information in the config file isn't quite accurate. :-[

It's not a real problem though. The variable now ranges from 0 to 2, and if you set it higher it'll just act as if you'd set it to 2. :)

Very nice game. It should keep me occupied for a while :)

[EDIT] Psst, Matthew, delete your post since I edited out the stuff it was in reply to. Then I'll have two posts together! jÄää~ ;D

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

Ender Wiggin
Member #3,062
December 2002
avatar

Bruce said:

Better idea: change the "%d" or "%i" or whatever it is to "%lu".

Ah, that's smart :D.

Say, how does the compiler recognizes what I want, after all, the rest of the varialbes are passed to the argument list - it's not supposed to be of a certain format. It doesn't know what is expected unless it checks what I passed in the char *format.

X-G
Member #856
December 2000
avatar

Quote:

unless it checks what I passed in the char *format

It does. It's a GCC extension.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Bruce Perry
Member #270
April 2000

And if you want GCC to check calls to your own printf or scanf-style functions, you can. Look up 'function attributes' in the GCC docs.

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

X-G
Member #856
December 2000
avatar

int xgl_printf2d(FONT *font, int x, int y, float r, float g, float b, char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(__printf__, 7, 8)))
#endif
;

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Peter Hull
Member #1,136
March 2001

Johan, I'm going to try and compile it for Mac OSX (lillo rules :D). If I manage it, will you have space on your website?

Pete

lillo
Member #303
April 2000
avatar

Peter: already done, with some little endianess-related fixes to the code 8-)

Now if only Johan could ungarble the packfile password he used for datafiles (cool idea to use a garbled password in the code, so it's not so easy to spot it by quickly analyzing the exe), I'd easily extract the egg sprite and use it as program icon...

--
Angelo Mottola
lillo AT users DOT sourceforge DOT net
Enhanced Creations++

Ender Wiggin
Member #3,062
December 2002
avatar

Sorry for spoiling the fun, most of you probably want to get the passwords themselves (it's a challenge :D), but I will anyway...
Ungarble the password? It's easy, find packfile_password, you see the parameter it recieves is init_string.
init_string is defined to be "[YhJPJKUSY`0-'\"7 ", but it's ungarbled using the function garble_string:

// garbles a string using a key
void garble_string(char *str, int key) {
  int i;
  int len_i = strlen(str);
  for(i = 0; i < len_i; i ++) {
    str<i> ^= (key+i);
  }
}

And it is called by: garble_string(init_string, 53);

So just run this proggy and it'll be fine:

1#include <allegro.h>
2 
3// garbles a string using a key
4void garble_string(char *str, int key) {
5 int i;
6 int len_i = strlen(str);
7 for(i = 0; i < len_i; i ++) {
8 str<i> ^= (key+i);
9 }
10}
11 
12int main()
13{
14 char init_string[] = "[YhJPJKUSY`0-'\"7 ";
15 allegro_init();
16 garble_string(init_string, 53);
17 allegro_message("%s", init_string);
18 allegro_exit();
19 return 0;
20}
21END_OF_MAIN();

Johan Peitz
Member #9
April 2000
avatar

peter said:

Johan, I'm going to try and compile it for Mac OSX (lillo rules ). If I manage it, will you have space on your website?

Yes I will, alex is hosted on sourceforge, no problemo.

lillo said:

already done, with some little endianess-related fixes to the code

Did you manage to get it to work? I thought it would be near impossible since I saved the struct right off the bat.

I have attached an egg for you to boot. :)

wiggin said:

Sorry for spoiling the fun..

How did I know you would? :D No worries though, the password says it all. ;)

If anyone has any other ports that works I'll gladly accept them.

--
johan peitz :: things I made

 1   2 


Go to: