New engine features

Top  Previous  Next

terrain_setpixel / terrain_getpixel

 

These two new functions can paints a terrain texture pixel at the given world position using a given color or can return the color of a terrain texture at the given world position.

 

#include <level.c> // make sure to include this file - it contains the two needed functions

 

ENTITY* terrain1;

 

function paint_terrain_startup()

{

       var i;

       wait (-5);

       beep(); // let the player know that the terrain painting has started

       // paint red dots around the x = 200, y = 300 area on the first skin of this terrain using a red color

       for (i = 0; i < 100; i++)

               terrain_setpixel(terrain1, 220 - random(40), 330 - random(60), NULL, vector(0, 0, 255));

}

 

action my_terrain() // we will paint a pixel on this terrain entity;

{

       terrain1 = my;        

}

 

aum98_beta1

 

 

ent_createterrain

 

This new instruction creates a chunked terrain entity without using an external HMP file.

 

#include <level.c> // make sure to include this file - it contains the needed terrain_set_z function

 

function create_terrain_startup()

{

       var i;

       wait (-5); // wait until the level is loaded

       // create a terrain at xyz = 0, 0, 0 with 128x128 terrain cells, each one of them having 10 x 10 quants

       ENTITY* newterrain = ent_createterrain(bmap_create("terrainskin.pcx"), vector(0, 0, 0), 128, 128, 10);

       for (i = 0; i < 16384; i++) // go through all the terrain cells

               terrain_set_z(newterrain, i, random(100)); // and give each vertex a random height (0... 100 quants)

}

 

aum98_beta2

 

 

ent_create improvements

 

The ent_create instruction can now directly load model files in single-texture obj format.

 

aum98_beta3