|
Re: Compass-Minimap same as Call of Duty 2
[Re: Dooley]
#473640
07/31/18 09:24
07/31/18 09:24
|
Joined: Oct 2008
Posts: 681 Germany
Ayumi
User
|
User
Joined: Oct 2008
Posts: 681
Germany
|
First i would try make a Bitmap as BMP with a black cycle and only Text "N, S,W,E" (North, South, West, East) to test. Than create a Panel with your Position and add this Bitmap to your Panel. Your Bitmap Needs same size in x and y or you Need to set Panel Center_x/Center_y.
PANEL* PanCompass =
{
bmap = bmap_create("Compass.bmp");
pos_x = 0;
pos_y = 0;
flags |= SHOW;
}
Put your Player in WED to any place. In a while, you only Need to set "pan" from Player to your Panel.
while(1)
{
PanCompass.angle = player.pan - 90; // test it...i only guess
wait(1);
}
Think about, Panel.angle isn t same as players pan. That means, if Players pan is North, the Degree is 90, not 0. The second part is calculate the position from Player. If i have time, i will build an example.
|
|
|
Re: Compass-Minimap same as Call of Duty 2
[Re: Ladlass]
#473651
08/01/18 19:10
08/01/18 19:10
|
Joined: Oct 2008
Posts: 681 Germany
Ayumi
User
|
User
Joined: Oct 2008
Posts: 681
Germany
|
Here you are. Give your Entitys in WED skill 1 a counter (1,2,3...) This example works with C_Scan, but you also can do it with vec_dist or c_trace in another while. C_scan is slow but easy to use. Paint a Bitmap with 256 x 256 Pixel + Alpha Channel. This will be the Compass. Paint a Bitmap with 256 x 256 Pixel + Alpha Channel (only Alpha). This will be your second Panel for your Entitys. The second Panel is need, because maybe you later want rotate the pan of your Enemys too. In the first Panel it s not possible, because you also rotate this Panel. I also need this Code, so later i will code a newer version without c_scan. So far.
// EntGroups
#define EntGroup skill1
#define TypeEnemy 1
#define EntGroupType skill2
#define Machine 1
#define People 2
var EntsPan[3];
PANEL* PanCompass =
{
bmap = "Compass.dds";
pos_x = 10;
pos_y = 10;
layer = 1;
}
PANEL* PanCompassEnemys =
{
bmap = "CompassEnemy.dds";
needle(22,22, "Enemy.pcx",8,8,0,0,360, EntsPan[0]);
needle(22,22, "Enemy.pcx",8,8,0,0,360, EntsPan[1]);
needle(22,22, "Enemy.pcx",8,8,0,0,360, EntsPan[2]);
pos_x = 10;
pos_y = 10;
layer = 2;
}
action Enemy()
{
my.emask |= ENABLE_SCAN;
}
void ScanEvent()
{
if(event_type == EVENT_DETECT)
{
if(you != NULL)
{
// 5000 Quants Scanbereich
// 256 Pixel beträgt die Bitmap
var x = player.x - you.x;
var y = player.y - you.y;
var newX = 0;
var newY = 0;
newX = abs(x);
newY = abs(y)* -1;
if(player.x > you.x)
{
newX = abs(x) * -1;
}
if(player.y > you.y)
{
newY = abs(y) ;
}
var rangeX = (newX * 128) / 5000;
var rangeY = (newY * 128) / 5000;
//
// printf("%f %f", (double)x, (double)y);
pan_setpos(PanCompassEnemys, 6, you.EntGroup, vector(rangeX +128, rangeY+128, 0));
}
}
}
void RotateCompassPan()
{
while(player)
{
PanCompass.angle = player.pan -90;
wait(1);
}
}
void RotateCompass()
{
while(player == NULL) wait(10);
my = player;
my.emask |= ENABLE_DETECT;
my.event = ScanEvent;
RotateCompassPan();
wait(-2);
while(player)
{
c_scan(camera.x,camera.pan, vector(360,0,10000), IGNORE_ME | SCAN_ENTS | SCAN_LIMIT);
wait(-0.5);
}
}
void InitializeMinimap()
{
PanCompass.flags = SHOW|TRANSLUCENT;
PanCompass.center_x = PanCompass.size_x * 0.5;
PanCompass.center_y = PanCompass.size_y * 0.5;
PanCompassEnemys.flags = SHOW|TRANSLUCENT;
RotateCompass();
}
|
|
|
|