Yes, I may have overseen the necessity to define before use (literally the manual says "Previously defined functions and bitmaps must be given, non-initialized pointers won't do" for buttons), but I have run some tests and that still make no sense?! or even contradict.

I'll bring on an easy way to test this anomaly with some comments, to anyone who will test and bring some light on this behavior.

Throw this bit of code in Workshop06 folder from the liteC workshop together with the tap.wav from work folder.


Code:

////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
////////////////////////////////////////////////////////////////////
// run in workshop06 folder and add tap.wav from work folder here too

PANEL* first_pan =
{
digits(200,550,"hit P for panel",*,0,0);
digits(700,2,"memory used kb",*,0,0);
digits(700,20,"bmp%6.0f",*,1,d3d_texbmaps);
flags = VISIBLE;
}

BMAP* mouse_pcx = "mouse.pcx";
SOUND* beep_sound = "tap.wav"; // earthball.c sound

BMAP* Back_bmp = "main.pcx"; // Panel background
BMAP* bQ_c = "quitclicked.pcx"; // Button selected
BMAP* bQ_n = "quitnormal.pcx"; // Button normal
BMAP* bQ_o = "quitover.pcx"; // Button highlighted (pointer over)

function quit_program() { while (key_any) {wait (1);} sys_exit(NULL); } // Quit

function ConPan() {quit_program(); } // Prototype
function GamPan(); // Prototype


PANEL* onfly = {
bmap= Back_bmp;
digits = 40,35 ,"initial PANEL creation level",*,0,0;
button =250,134,bQ_c,bQ_n,bQ_o,quit_program,NULL,NULL;
button = 10,50 ,bQ_c,bQ_n,bQ_o,GamPan1,NULL,NULL; // Notice that PANEL* create don't accept your empty prototype if you remove 1 from GamPan
digits = 5,80 ,"Jump GamPan()",*,0,0;
button =200,50 ,bQ_c,bQ_n,bQ_o,ConPan,NULL,NULL; // But it gladly accept the ugly ConPan proto..
digits =190,80 ,"Jump ConPan()",*,0,0;
digits =45,160 ,"Tappsound",*,0,0;
button =10,134 ,bQ_c,bQ_n,bQ_o,TappS,NULL,NULL; // Tapp sound
pos_x = 250;
pos_y = 200;
}

//PANEL* onfly; // Since this startup with an empty won't bring buttons definitions to work at all I abandoned that path

///////////////////////////////////////////////////////////////////////////

function TappS(){ snd_play(beep_sound,100,0);
}

function ConPan1() {
TappS();
pan_remove (onfly);
wait(1);
onfly = pan_create("bmap= Back_bmp;
digits = 10,35 ,\"You ran ConPan1() \",*,0,0;
button(250,134,bQ_c,bQ_n,bQ_o,quit_program,NULL,NULL);
button = 10,50 ,bQ_c,bQ_n,bQ_o,GamPan,NULL,NULL; // No matter how you got here, it won't work
digits = 5,85 ,\"Jump GamPan()\",*,0,0;
button =200,50 ,bQ_c,bQ_n,bQ_o,ConPan,NULL,NULL; //If hard jumped by I key, this will quit if you hit ConPan button
digits =190,85 ,\"Jump ConPan()\",*,0,0;
digits = 45,160,\"Tappsound\",*,0,0;
button =10,134 ,bQ_c,bQ_n,bQ_o,TappS,NULL,NULL; // Tapp sound
",1);
onfly.flags = OVERLAY | VISIBLE;
onfly.pos_x = 250;
onfly.pos_y = 200;
}

function GamPan1() {
TappS();
pan_remove (onfly);
wait(3);
onfly = pan_create("bmap= Back_bmp;
digits = 10,35 ,\"You ran GamPan1() \",*,0,0;
button =250,134,bQ_c,bQ_n,bQ_o,quit_program,NULL,NULL;
button = 10,50 ,bQ_c,bQ_n,bQ_o,GamPan,NULL,NULL;
digits = 5,85 ,\"Jump GamPan()\",*,0,0;
button =200,50 ,bQ_c,bQ_n,bQ_o,ConPan1,NULL,NULL; // Will not run unregarded that you defined ConPan1 function before this
digits =190,85 ,\"Jump ConPan()\",*,0,0;
digits = 45,160,\"Tappsound\",*,0,0;
button =10,134 ,bQ_c,bQ_n,bQ_o,TappS,NULL,NULL; // Tapp sound
",1);
onfly.flags = OVERLAY | VISIBLE;
onfly.pos_x = 250;
onfly.pos_y = 200;
}

function FirstPan() {
TappS();
pan_remove(onfly);
onfly = pan_create("bmap= Back_bmp;
digits = 10,35 ,\"You ran FirstPan() with by P-key \",*,0,0;
button =250,134,bQ_c,bQ_n,bQ_o,quit_program,NULL,NULL;
button = 10,50 ,bQ_c,bQ_n,bQ_o,GamPan,NULL,NULL; // You think it will run GamPan(GamPan1) but it will not!
digits = 5,85 ,\"Jump GamPan()\",*,0,0;
button =200,50 ,bQ_c,bQ_n,bQ_o,ConPan1,NULL,NULL; // Now we call a previously defined function but it will not!
digits =190,85 ,\"Jump ConPan()\",*,0,0;
button =110,50 ,bQ_c,bQ_n,bQ_o,GamPan1,NULL,NULL; // This work since it's new and call GamPan1()!?, GamPan() call will not run!
digits =100,85 ,\"Jump GamPan()\",*,0,0;
digits = 45,160,\"Tappsound\",*,0,0;
button =10,134 ,bQ_c,bQ_n,bQ_o,TappS,NULL,NULL; // Tapp sound
",1);
onfly.flags = OVERLAY | VISIBLE;
onfly.pos_x = 250;
onfly.pos_y = 200;
}

function Dinky()
{
snd_play(beep_sound,100,0);
snd_play(beep_sound,100,0);
onfly.flags = OVERLAY | VISIBLE;
}

///////////////////////////////////////////////////////////////
function main()
{
ConPan = ConPan1; // Repoint function
GamPan = GamPan1; // Repoint function

video_mode = 7; // 800x600 screen
shadow_stencil = 1;
sound_vol = 100;
master_vol = 100;
screen_color.blue = 200;
mouse_map = mouse_pcx;
mouse_mode = 2;

on_p = FirstPan; // Put upp panel
on_o = Dinky; // Bring up wathever in onfly structure
on_i = ConPan; // Hard jump to ConPan

while (1) { // MAJOR LOOP
if (mouse_mode != 0) {
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
}
wait(1);
}
}




Whoever has the gold makes the rules.