From: litmusdragon AT mailcity DOT com (Litmus Dragon) Newsgroups: comp.os.msdos.djgpp Subject: Couple of problems using DJGPP/Allegro Date: Tue, 18 Apr 2000 01:46:52 GMT Organization: Posted via Supernews, http://www.supernews.com Lines: 56 Message-ID: <8F19D63AAmehomenet@207.126.101.100> X-Complaints-To: newsabuse AT supernews DOT com User-Agent: Xnews/03.03.12 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I'm having two problems in DJGPP+Allegro WIP version. The first is with a program that I've made called Dragon Engine. It's both a role playing game engine and an editor. About three months ago I added a VERY large set of arrays to the program (defined as int roomtile[5000][13][13], int roomtile[5000][13][13], and some more). The program compiled and ran fine, everything seemed to be ok, but soon I saw that variables were not holding their values. Variables which were NOT zero, were returning 0 as their value. Memory seemed to have been corrupted. I removed the enormous arrays and the problems went away. Since then, however, with the addition of variables here and there, I'm close to that upper limit again. If I add too many variables to the program, I get the same problems, where variables are not holding their values. At this point I should mention that I am self-taught. Never taken a C class, learned in the context of "I'm having this problem, what is causing it?" or "I want to do this, how do I do it?" and reading documentation I've obtained from the web. I think that somehow I need to tell the program to give me more memory to work with, but I don't know how to do that. I think that malloc is somehow relevant, but I'm unclear on how to take a set of variables that I am using and convert that into a number of bytes to pass to malloc. Or maybe I am on the wrong track. The second problem is in high resolutions with allegro and DJGPP. This program is in 800x600, and has a series of menus. Everytime you switch to another menu, I have a routine which loads a random background and pastes it behind the menus. Eventually, the program crashes. Sometimes when the first background is loaded, sometimes after 10 have loaded successfully. Here is the relevant code (I hope): void randm(int x) { rdm=(random()%x)+1; } void randombak() { char temp[40]; randm(10); show_mouse(NULL); clear(screen); sprintf(temp, "backs\\backrd%d.pcx", rdm); scrn=load_pcx(temp, temp_palette); blit(scrn, screen, 0, 0, 0, 0, 320, 200); show_mouse(screen); } Can somebody please help. I'm driven to frustration by these roadblocks. :) -- /_itmus /)ragon -=UDIC=- email: litmusdragon AT mailcity DOT com The Dragon Engine Homepage: http://www4.50megs.com/litmus/de.html