So that would prevent me hitting clashes like this? Cool, I'll give it a go.
MysticalMachineGun
Creator of
Recent community posts
Man, I don't want this to turn into "MMG's help with coding corner" but I have an odd issue that just doesn't make sense to me from a coding standpoint.
I'm currently working on my vertical slice demo, where you interact with the priest, so everything is priest.c, priest2.c, etc, you get the idea.
In priest.c I play a bit of an intro animation and then some lip flaps:
priest.c:
int priestStart(void) {
...
install_int(priestIntro, 9999);
install_int(priestTalk, 9999);
/*character intro sequence*/
play_midi(priestData[PRIESTMID].dat, 0);
while (priest_x > 250)
{
while (priest_y < 100)
{
clear_to_color(priestBuffer, makecol(0,0,0));
blit(priestData[CHURCH].dat, priestBuffer, 0, 0, 5, 5, 630, 280);
priestIntro();
...
blit(priestBuffer, screen, 0, 0, 0, 0, priestBuffer->w, priestBuffer->h);
clear_bitmap(priestBuffer);
}
}
remove_int(priestIntro);
//do the talking
while (priestAnim < 20)
{
clear_to_color(priestBuffer, makecol(0,0,0));
blit(priestData[CHURCH].dat, priestBuffer, 0, 0, 5, 5, 630, 280);
textprintf_ex(priestBuffer, font, 0, 80, makecol(255, 255, 0), -1, "PRIESTANIM %d", priestAnim);
textout_ex(priestBuffer, npcFont, priestSays, 30, 290, makecol(83, 255, 93), -1);
priestTalk();
blit(priestBuffer, screen, 0, 0, 0, 0, priestBuffer->w, priestBuffer->h);
clear_bitmap(priestBuffer);
}
remove_int(priestTalk);
...
}
void priestTalk() {
rest(99);
//play some animation here
if (priestAnim % 2)
{
blit(priestData[PRIESTCHAR2].dat, priestBuffer, 0, 0, priest_x, priest_y, 100, 150);
} else {
blit(priestData[PRIESTCHAR].dat, priestBuffer, 0, 0, priest_x, priest_y, 100, 150);
}
++priestAnim;
}
I have the rest(99) and timer(9999) in there so the animation doesn't fly by in a fraction of a second. What's weird though is that I tried to recreate the same behaviour once you proceed to priest2 but it hangs on the rest command (if it's not set to 0):
priest2.c:
int priestPhaseTwo(int selection) {
...
install_int(priest2Talk, 10);
priest2Anim = 0;
...
while (priest2Anim < 20)
{
clear_to_color(priestBuffer, makecol(0,0,0));
blit(priestData[CHURCH].dat, priestBuffer, 0, 0, 5, 5, 630, 280);
textout_ex(priestBuffer, npcFont, priestSays, 30, 290, makecol(83, 255, 93), -1);
priest2Talk();
blit(priestBuffer, screen, 0, 0, 0, 0, priestBuffer->w, priestBuffer->h);
clear_bitmap(priestBuffer);
}
remove_int(priest2Talk);
...
}
void priest2Talk() {
//play some animation here
rest(99);
if (priest2Anim % 2)
{
blit(priestData[PRIESTCHAR2].dat, priestBuffer, 0, 0, priest_x, priest_y, 100, 150);
} else {
blit(priestData[PRIESTCHAR].dat, priestBuffer, 0, 0, priest_x, priest_y, 100, 150);
}
++priest2Anim;
}
It's weird, as I'm not getting any SIGSEGV faults, it's just if it's set to rest(0) it works (and the animation plays before a human eye can see it) or if rest is set to anything other than 0 it hangs.
Is there some form of memory cleanup or processing I'm missing here? I admit this part of my coding skill is pretty threadbare, didn't have to worry about wait times and sleeps when coding websites in C#.
I've almost done what you could call "animation" - all two frames of it. I had an issue with my entrance animation (the x direction worked fine but would the y part would just jump due to a logic issue) and I wanted to implement the lip flaps you get in LOTW1 as the NPC "says" the top line on the screen.
Took a bit of doing and messing around with timers and rest() commands, but it looks alright:
So I lifted and shifted that lip flap stuff into the next method so when you select an option it does the same thing but now for some reason it's hanging on the rest() command.
I'm working on a kind of "dream sequel" to Law of the West from the C64/NES, like what if there was a DOS sequel in the late 80s/early 90s.
I've had a lot of help from various sources already, and not having written any code for like 8 odd years I'm really chuffed that I have stuff on the screen and moving. I've got a lot of work to go of course, but I'm trying to make one character scene "work" as a demo and then I can build the other scenes off of that.
Hey folks, I'm working with:
- Allegro 4
- 640x480 resolution
- 16-bit colour depth
- GIMP for image editing
I'm able to display PCX files and move them around, but can't get any sort of transparency working - I've added areas to my images with RGB set to 255, 0, 255 but I'm guessing when GIMP exports to PCX it's not the right colour setting?
Does anyone know the right GIMP settings or potentially even another program to help edit these images and included DOS friendly transparency?
