Code:
#include <natives.h>
#include <common.h>
#include <strings.h>
#include <types.h>
#include <consts.h>
#include "Functions.c"
/********************** PS3 CONTROLLER BUTTON MAP **********************/
#define L1 0x4
#define L2 0x5
#define R1 0x6
#define R2 0x7
#define DPAD_UP 0x8
#define DPAD_DOWN 0x9
#define DPAD_LEFT 0xA
#define DPAD_RIGHT 0xB
#define START 0xC
#define SELECT 0xD
#define SQUARE 0xE
#define TRIANGLE 0xF
#define X 0x10
#define CIRCLE 0x11
#define STICK_L 0x12 //L3
#define STICK_R 0x13 //R3
/************************************************** *********************/
uint rA=200, rB=255,
gA= 0, gB=0,
bA= 0, bB=0,
aA=110, aB=0, a=110,
ptfxmode=1; // 1=tweak variables mode, 2=gameplay mode
float pos_xA=0.06000000, pos_xB=0.05000000,
width = 0.30000000, height = 0.30000000,
x,y,z,h, //coords and heading
Pxoff = 0.1, Pyoff = 0.1, Pzoff = 0.0, //player ptfx coord offsets
Pyaw = 0.0, Ppitch = 0.0, Proll = 0.0, //player ptfx rotational offsets
Pscale = 4.0, //player ptfx scale/intensity
Vxoff = 0.0, Vyoff = 0.0, Vzoff = 0.0, //vehicle ptfx coord offsets
Vyaw = 0.0, Vpitch = 0.0, Vroll = 0.0, //vehicle ptfx rotational offsets
Vscale = 5.0, //vehicle ptfx scale/intensity
pos_yA=0.29000000, pos_yB=0.32000000, pos_yC=0.35000000,
pos_yD=0.38000000, pos_yE=0.41000000, pos_yF=0.44000000,
pos_yG=0.47000000, pos_yH=0.53000000, pos_yI=0.56000000,
pos_yJ=0.59000000, pos_yK=0.62000000, pos_yL=0.65000000,
pos_yM=0.68000000, pos_yN=0.71000000, pos_yO=0.74000000,
markerpos = 0.0, markerposY = 0.29000000;
int Pptfx = 0, Vptfx = 0, //player ptfx and vehicle ptfx pointers
carptr = 0; //players car pointer
void NumberDisplayLoop(void)
{
set_up_draw(0, width, height, rB, gB, bB, a); draw_text("STRING", pos_xB, markerposY, ">");
set_up_draw(2, width, height, rA, gA, bA, aA); draw_float("NUMBR", pos_xA, pos_yA, Pxoff);
set_up_draw(2, width, height, rA, gA, bA, aA); draw_float("NUMBR", pos_xA, pos_yB, Pyoff);
set_up_draw(2, width, height, rA, gA, bA, aA); draw_float("NUMBR", pos_xA, pos_yC, Pzoff);
set_up_draw(2, width, height, rA, gA, bA, aA); draw_float("NUMBR", pos_xA, pos_yD, Pyaw);
set_up_draw(2, width, height, rA, gA, bA, aA); draw_float("NUMBR", pos_xA, pos_yE, Ppitch);
set_up_draw(2, width, height, rA, gA, bA, aA); draw_float("NUMBR", pos_xA, pos_yF, Proll);
set_up_draw(2, width, height, rA, gA, bA, aA); draw_float("NUMBR", pos_xA, pos_yG, Pscale);
set_up_draw(2, width, height, rA, gA, bA, aA); draw_float("NUMBR", pos_xA, pos_yH, Vxoff);
set_up_draw(2, width, height, rA, gA, bA, aA); draw_float("NUMBR", pos_xA, pos_yI, Vyoff);
set_up_draw(2, width, height, rA, gA, bA, aA); draw_float("NUMBR", pos_xA, pos_yJ, Vzoff);
set_up_draw(2, width, height, rA, gA, bA, aA); draw_float("NUMBR", pos_xA, pos_yK, Vyaw);
set_up_draw(2, width, height, rA, gA, bA, aA); draw_float("NUMBR", pos_xA, pos_yL, Vpitch);
set_up_draw(2, width, height, rA, gA, bA, aA); draw_float("NUMBR", pos_xA, pos_yM, Vroll);
set_up_draw(2, width, height, rA, gA, bA, aA); draw_float("NUMBR", pos_xA, pos_yN, Vscale);
set_up_draw(2, width, height, rA, gA, bA, aA);
if (ptfxmode==1) { draw_text("STRING", pos_xB, pos_yO, "tweak"); }
else if (ptfxmode==2) { draw_text("STRING", pos_xB, pos_yO, "play"); }
}
void movemarker(void)
{
if (markerpos==0.0) { markerposY = pos_yA; } else if (markerpos==1.0) { markerposY = pos_yB; }
else if (markerpos==2.0) { markerposY = pos_yC; } else if (markerpos==3.0) { markerposY = pos_yD; }
else if (markerpos==4.0) { markerposY = pos_yE; } else if (markerpos==5.0) { markerposY = pos_yF; }
else if (markerpos==6.0) { markerposY = pos_yG; } else if (markerpos==7.0) { markerposY = pos_yH; }
else if (markerpos==8.0) { markerposY = pos_yI; } else if (markerpos==9.0) { markerposY = pos_yJ; }
else if (markerpos==10.0) { markerposY = pos_yK; } else if (markerpos==11.0) { markerposY = pos_yL; }
else if (markerpos==12.0) { markerposY = pos_yM; } else if (markerpos==13.0) { markerposY = pos_yN; }
}
void changeoffsets(void)
{
/*buttons used: DPAD_UP DPAD_DOWN DPAD_LEFT DPAD_RIGHT
markerpos values and relative value types
coord offsets: 0,1,2,7,8,9
rotational offsets: 3,4,5,10,11,12
ptfx scale: 6,13
0/7 1/8 2/9 3/10 4/11 5/12 6/13
Pxoff Pyoff Pzoff Pyaw Ppitch Proll Pscale
Vxoff Vyoff Vzoff Vyaw Vpitch Vroll Vscale
*/
if (ptfxmode==1)
{
if (IS_BUTTON_JUST_PRESSED(0,DPAD_DOWN))
{
if (markerpos==13.0) { markerpos = 0.0; }
else { markerpos = markerpos+1.0; }
movemarker();
}
if (IS_BUTTON_JUST_PRESSED(0,DPAD_UP))
{
if (markerpos==0.0) { markerpos = 13.0; }
else { markerpos = markerpos-1.0; }
movemarker();
}
if (IS_BUTTON_PRESSED(0,DPAD_RIGHT))
{
if (markerpos==0.0) { Pxoff = Pxoff+0.1; } else if (markerpos==1.0) { Pyoff = Pyoff+0.1; }
else if (markerpos==2.0) { Pzoff = Pzoff+0.1; } else if (markerpos==7.0) { Vxoff = Vxoff+0.1; }
else if (markerpos==8.0) { Vyoff = Vyoff+0.1; } else if (markerpos==9.0) { Vzoff = Vzoff+0.1; }
else if (markerpos==3.0) { if (Pyaw>=359.9) { Pyaw = 0.0; } else { Pyaw = Pyaw+0.1; } }
else if (markerpos==4.0) { if (Ppitch>=359.9) { Ppitch = 0.0; } else { Ppitch = Ppitch+0.1; } }
else if (markerpos==5.0) { if (Proll>=359.9) { Proll = 0.0; } else { Proll = Proll+0.1; } }
else if (markerpos==10.0) { if (Vyaw>=359.9) { Vyaw = 0.0; } else { Vyaw = Vyaw+0.1; } }
else if (markerpos==11.0) { if (Vpitch>=359.9) { Vpitch = 0.0; } else { Vpitch = Vpitch+0.1; } }
else if (markerpos==12.0) { if (Vroll>=359.9) { Vroll = 0.0; } else { Vroll = Vroll+0.1; } }
else if (markerpos==6.0) { if (Pscale>=5.0) { Pscale = 0.1; } else { Pscale = Pscale+0.1; } }
else if (markerpos==13.0) { if (Vscale>=5.0) { Vscale = 0.1; } else { Vscale = Vscale+0.1; } }
WAIT(5);
}
if (IS_BUTTON_PRESSED(0,DPAD_LEFT))
{
if (markerpos==0.0) { Pxoff = Pxoff-0.1; } else if (markerpos==1.0) { Pyoff = Pyoff-0.1; }
else if (markerpos==2.0) { Pzoff = Pzoff-0.1; } else if (markerpos==7.0) { Vxoff = Vxoff-0.1; }
else if (markerpos==8.0) { Vyoff = Vyoff-0.1; } else if (markerpos==9.0) { Vzoff = Vzoff-0.1; }
else if (markerpos==3.0) { if (Pyaw<=0.0) { Pyaw = 359.9; } else { Pyaw = Pyaw-0.1; } }
else if (markerpos==4.0) { if (Ppitch<=0.0) { Ppitch = 359.9; } else { Ppitch = Ppitch-0.1; } }
else if (markerpos==5.0) { if (Proll<=0.0) { Proll = 359.9; } else { Proll = Proll-0.1; } }
else if (markerpos==10.0) { if (Vyaw<=0.0) { Vyaw = 359.9; } else { Vyaw = Vyaw-0.1; } }
else if (markerpos==11.0) { if (Vpitch<=0.0) { Vpitch = 359.9; } else { Vpitch = Vpitch-0.1; } }
else if (markerpos==12.0) { if (Vroll<=0.0) { Vroll = 359.9; } else { Vroll = Vroll-0.1; } }
else if (markerpos==6.0) { if (Pscale<=0.1) { Pscale = 5.0; } else { Pscale = Pscale-0.1; } }
else if (markerpos==13.0) { if (Vscale<=0.1) { Vscale = 5.0; } else { Vscale = Vscale-0.1; } }
WAIT(5);
}
}
}
void applyoffsets(void)
{
if (ptfxmode==1)
{
if (IS_BUTTON_JUST_PRESSED(0,STICK_R))
{
/* i don't think these 2 lines work but if you want to try them here they are
if (Vptfx!=0) { UPDATE_PTFX_OFFSETS(Vptfx,Vxoff,Vyoff,Vzoff,Vyaw,V pitch,Vroll); }
if (Pptfx!=0) { UPDATE_PTFX_OFFSETS(Pptfx,Pxoff,Pyoff,Pzoff,Pyaw,P pitch,Proll); }
//*/
// since burn() automatically sets you and the vehicle on fire resetting the
// particle effects pointers should reset the effects with adjusted variables
Vptfx=0;
Pptfx=0;
REMOVE_PTFX_FROM_PED(GetPlayerPed());
}
}
}
void changemode(void)
{
// 1=tweak variables mode, 2=gameplay mode
if (IS_BUTTON_JUST_PRESSED(0,STICK_L))
{
if (ptfxmode==2)
{
ptfxmode=1;
a=aA;
}
else
{
ptfxmode=ptfxmode+1;
if (ptfxmode==2) { a=aB; }
else { a=aA; }
}
}
}
void burn(void)
{
if (!IS_CHAR_SITTING_IN_ANY_CAR(GetPlayerPed()))
{
if (Vptfx!=0)
{
REMOVE_PTFX_FROM_VEHICLE(carptr);
Vptfx = 0;
}
}
else if (IS_CHAR_SITTING_IN_ANY_CAR(GetPlayerPed()))
{
GET_CAR_CHAR_IS_USING(GetPlayerPed(), &carptr);
if (Vptfx==0)
{
if (DOES_VEHICLE_EXIST(carptr))
{
Vptfx = START_PTFX_ON_VEH("ambient_fire_generic", carptr, Vxoff, Vyoff, Vzoff, Vyaw, Vpitch, Vroll, Vscale);
}
}
}
if (Pptfx==0)
{
//Pptfx = START_PTFX_ON_PED("fire_gas_burner", GetPlayerPed(), Pxoff, Pyoff, Pzoff, Pyaw, Ppitch, Proll, Pscale); // set the whole of niko on fire
Pptfx = START_PTFX_ON_PED_BONE("ambient_fire_generic", GetPlayerPed(), Pxoff, Pyoff, Pzoff, Pyaw, Ppitch, Proll, 1205, Pscale); //set nikos head on fire
SET_CHAR_PROOFS(GetPlayerPed(), 1, 1, 1, 1, 1);
SET_CHAR_MOVE_ANIM_SPEED_MULTIPLIER(GetPlayerPed() ,3);
SET_CHAR_SHOOT_RATE(GetPlayerPed(),99);
SET_CHAR_ACCURACY(GetPlayerPed(),99);
SET_CHAR_CANT_BE_DRAGGED_OUT(GetPlayerPed(), true);
}
}
void main(void)
{
while(true)
{
WAIT(0);
burn();
changeoffsets();
changemode();
applyoffsets();
NumberDisplayLoop();
}
}
Until we can get UPDATE_PTFX_TINT(uint ptfx, float r, float g, float b, float a); working.