void main(){
void ent = NULL(); // Target entity pointer.
int ent_count = 0; // Entity count.
int i = 0; // Loop counter.
// Get entity count.
ent_count = openborvariant("ent_max");
// Loop over each entity index.
for(i=0; i<ent_count; i++)
{
// Get entity pointer.
ent = getentity(i);
// Execute tint effect on entity.
tint_effect(ent);
}
// Execute zoom function.
if(getglobalvar("zoomentity"))
{
zoom();
}
}
void tint_effect(void ent)
{
// tint_effect
// Caskey, Damon V.
// 2015-05-04
//
// Apply color tint for hit effects.
float time_percentage = 0.0;
int time_effect = 0;
float time_remaining = 0.0;
float time_current = 0.0;
float time_initial = 0.0;
// Verify entity or exit.
if(typeof(ent) != openborconstant("VT_PTR")) return;
if(!getentityproperty(ent, "exists")) return;
time_current += openborvariant("elapsed_time");
time_initial += getentityvar(ent, "effect_time_initial");
// If entity is frozen, apply a freeze tint.
if(getentityproperty(ent, "aiflag", "frozen") == 1)
{
// First we need to know how long the entity is meant to be frozen.
time_effect = getentityproperty(ent, "freezetime");
// Now let's see if we have a time when the freeze took place.
// If not, this, entity was just frozen, so let's
// record the time to an entity var.
if(!time_initial)
{
time_initial = time_effect - time_current;
setentityvar(ent, "effect_time_initial", time_initial);
}
// how much time is left before freeze effect is set to expire?
time_remaining = time_effect - time_current;
// Now let's find out want to know what % of the orginal
// freeze time is left.
time_percentage = (time_remaining) / (time_initial);
// Set transparency mode for tint, and apply blue intensity based
// on % of initial freeze time is left.
changedrawmethod(ent, "tintmode", 1);
changedrawmethod(ent, "tintcolor", rgbcolor(0,0, 255 * time_percentage));
// No reason to do anything else, so exit the function.
return;
}
///////
// if you want to add other tint effects, like burning, put them here.
///////
// If we got this far without exiting, there was no effect to apply.
// Clear any previous tints and entity vars..
changedrawmethod(ent, "reset", 1);
setentityvar(ent, "effect_time_initial", NULL());
}
void zoom()
{
void vscreen = openborvariant("vscreen");
int maxz=openborvariant("PLAYER_MAX_Z")+1000;
int zoom_value=getglobalvar("zoomvalue");
int zoom_x=getglobalvar("zoomx");
int zoom_y=getglobalvar("zoomy");
void ent=getglobalvar("zoomentity");
int px=getentityproperty(ent,"x") + zoom_x - openborvariant("xpos");
int py=getentityproperty(ent,"z") + zoom_y - openborvariant("ypos") - getentityproperty(ent,"a");
void zoom_scr = getglobalvar("zoomscreen");
if(!zoom_scr){
zoom_scr = allocscreen(openborvariant("hResolution"),openborvariant("vResolution"));
setglobalvar("zoomscreen",zoom_scr);
}
clearscreen(zoom_scr);
//draw what we need
drawspriteq(zoom_scr,0,openborconstant("MIN_INT"),maxz,0,0);
//setup drawMethod
changedrawmethod(NULL(),"reset",1);
changedrawmethod(NULL(),"enabled",1);
changedrawmethod(NULL(),"scalex",zoom_value);
changedrawmethod(NULL(),"scaley",zoom_value);
changedrawmethod(NULL(),"centerx",px);
changedrawmethod(NULL(),"centery",py);
//Draw the resized customized screen to main screen.
drawscreen(zoom_scr,px,py, maxz+1);
changedrawmethod(NULL(),"enabled", 0);
drawspriteq(vscreen, 0, maxz+1,maxz+1, 0, 0);
drawspriteq(vscreen, 0, maxz+2,openborconstant("MAX_INT"), 0, 0);
clearspriteq();
}