New engine features

Top  Previous  Next

hit.texname

 

Gets the name of the model, sprite or block texture that was hit by a c_trace instruction.

 

STRING* name_str = "                      ";

 

function fire_bullets() // use a weapon that fires bullets using c_trace with SCAN_TEXTURE

{

       while (mouse_left)

       {

               c_trace(camera.x, trace_coords.x, IGNORE_ME | IGNORE_PASSABLE | SCAN_TEXTURE | ACTIVATE_SHOOT);

               str_cpy(name_str, hit.texname);

               if (!you) // hit a wall?

               {

                       ent_create (hithole_tga, target.x, display_hithole); // then create a bullet hit hole

               }

               snd_play (bullet_wav, 100, 0); // play the bullet sound at a volume of 100

               ent_create("muzzle+20.tga", nullvector, attach_muzzle);

               wait (-0.16); // fire 6 bullets per second (6 * 0.16 ~= 1 second)

       }

}

 

TEXT* texture_txt =

{

       layer = 10;

       pos_x = 20;

       pos_y = 20;

       string(name_str);                

       flags = VISIBLE;

}

 

aum77_hot1

 

 

exec_wait (name, options)

 

Starts the program with the given name and then suspends the execution of the current function or action until the started program is terminated.

 

function notepad_startup() // copy notepad.exe inside this project's folder

{

       wait (-1); // wait until the entire level is loaded

       exec_wait ("notepad.exe", NULL); // launch notepad.exe

       beep(); beep(); // these beeps will be heard only after you close notepad

       wait (-3); // the execution of the code is resumed here

       sys_exit(NULL); // but we'll simply shut down the engine

}

 

 

Improved debugging

 

Crashes in lite-C now always give the name of the crashed function.

 

aum77_hot2