Keen: Modding Forum Index Keen: Modding
All the modding info you'll ever need
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mysterious C++/SDL error

 
Post new topic   Reply to topic    Keen: Modding Forum Index -> Keen:Coding
View previous topic :: View next topic  
Author Message
Draik



Joined: 26 Jul 2008
Posts: 71

PostPosted: Fri Dec 18, 2009 6:05 am    Post subject: Mysterious C++/SDL error Reply with quote

Right, so I'm writing a Crystal Caves level editor, and it's written in C++ using SDL (Win32 with MinGW, in case it helps). And for some reason it won't compile this perfectly reasonable line of code:
Code:
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE)

I'm using the latest version of SDL. It comes out with
Code:
D:\Stuff\ccleved\main.cpp:17: error: expected primary-expression before '=' token
D:\Stuff\ccleved\main.cpp:17: error: expected primary-expression before ',' token

about 3 times, finishing with
Code:
D:\Stuff\ccleved\main.cpp:17: error: expected `;' before ')' token


That's the offending line of code above. I haven't missed any closing brackets or semicolons on previous lines, and screen is a pointer to an SDL_Surface. What the heck is wrong?
Back to top
View user's profile Send private message
CommanderSpleen



Joined: 31 Aug 2003
Posts: 898
Location: The Land of Sparkly Things

PostPosted: Fri Dec 18, 2009 7:41 am    Post subject: Reply with quote

How is that screen variable defined? I deal with Allegro, so SDL is outside of my experience.

You are missing a semicolon at the end of the statement. But the rest looks fine. The screen part at the beginning seems to be the problem. Are you sure you need to apply the return value of SDL_SetVideoMode to it?
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Draik



Joined: 26 Jul 2008
Posts: 71

PostPosted: Fri Dec 18, 2009 8:13 am    Post subject: Reply with quote

Well, it's not the semicolon. But yes, SDL_SetVideoMode returns a pointer to an SDL_Surface. I'll just rewrite the code from scratch, and see if that fixes it. :P
Back to top
View user's profile Send private message
levellass



Joined: 11 Oct 2006
Posts: 1404
Location: Ngaruawahia New Zealand

PostPosted: Fri Dec 18, 2009 12:13 pm    Post subject: Reply with quote

Interesting. I take it you found the level data. However, since it's in the executable, does this mean all the levels cannot be larger in size than the originals, or did you find a way around this?
Back to top
View user's profile Send private message
KeenRush
Patch Maker


Joined: 31 Aug 2003
Posts: 2036
Location: Sand Yego

PostPosted: Fri Dec 18, 2009 9:47 pm    Post subject: Reply with quote

I think every level in CC has the exactly same size -- I don't think the dimensions even can be changed.

By the way, it's about time there'll be an editor for this game, definitely going to use it. :)
Back to top
View user's profile Send private message Visit poster's website
Draik



Joined: 26 Jul 2008
Posts: 71

PostPosted: Fri Dec 18, 2009 10:15 pm    Post subject: Reply with quote

lemm found it, the discussion page for CC at the ModdingWiki has his findings. And yeah, the dimensions are fixed (as in, unchangeable, not hacked so we can change level size).
Back to top
View user's profile Send private message
levellass



Joined: 11 Oct 2006
Posts: 1404
Location: Ngaruawahia New Zealand

PostPosted: Tue Dec 22, 2009 4:23 am    Post subject: Reply with quote

Aaah, I see now. So the levels are uncompressed and of a fixed size, which would make editing easier. I was worried they would be compressed or of variable size, which would mean there was a 'limit' you couldn't exceed.

I would be interested in the progress of this project. I have coded a small program to edit the fullscreen images, which I haven't seen anywhere else if you want to add that to your editor code (The modding wiki has the PCX format now.) which should allow full graphical modding now.
Back to top
View user's profile Send private message
gerstrong



Joined: 25 Jan 2009
Posts: 51

PostPosted: Sat Jul 31, 2010 4:17 pm    Post subject: Re: Mysterious C++/SDL error Reply with quote

Draik wrote:
Right, so I'm writing a Crystal Caves level editor, and it's written in C++ using SDL (Win32 with MinGW, in case it helps). And for some reason it won't compile this perfectly reasonable line of code:
Code:
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE)

I'm using the latest version of SDL. It comes out with
Code:
D:\Stuff\ccleved\main.cpp:17: error: expected primary-expression before '=' token
D:\Stuff\ccleved\main.cpp:17: error: expected primary-expression before ',' token

about 3 times, finishing with
Code:
D:\Stuff\ccleved\main.cpp:17: error: expected `;' before ')' token


That's the offending line of code above. I haven't missed any closing brackets or semicolons on previous lines, and screen is a pointer to an SDL_Surface. What the heck is wrong?


Guess I come too late with that, but if you ask me, it's the missing semicolon at the end. Maybe you can show me the source code. I have good knowledge about SDL.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Keen: Modding Forum Index -> Keen:Coding All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group