|
1
|
#include "d2waypoints.h"
|
|
2
|
#include "d2char.h"
|
|
3
|
|
|
4
5
6
7
8
9
10
11
12
13
|
#include <stdio.h>
const char* getWaypointName(D2S_WAYPOINT waypoint) {
if(waypoint > D2S_WAYPOINTSDATA_NUMWAYPOINTS) {
fprintf(stderr,"libd2char error: waypoint %d doesn't exist\n",waypoint);
return NULL;
}
return waypoints[waypoint];
}
|
|
14
|
int isWaypointActivated(D2WaypointsData* d, D2S_WAYPOINT waypoint, D2S_DIFFICULTY difficulty) {
|
|
15
|
if(waypoint > D2S_WAYPOINTSDATA_NUMWAYPOINTS) {
|
|
16
17
18
19
20
21
22
|
fprintf(stderr,"libd2char error: waypoint %d doesn't exist\n",waypoint);
return -1;
}
if(difficulty != D2S_DIFFICULTY_NORMAL ||
difficulty != D2S_DIFFICULTY_NIGHTMARE ||
difficulty != D2S_DIFFICULTY_HELL) {
fprintf(stderr,"libd2char error: difficulty %d doesn't exist\n",difficulty);
|
|
23
24
25
26
27
28
29
|
return -1;
}
unsigned int byte = waypoint / 8;
unsigned int offset = waypoint % 8;
return (d->waypoints[difficulty].waypointData[byte] & (1 << offset)) >> offset;
}
|
|
30
|
int setWaypointActivated(D2WaypointsData* d, D2S_WAYPOINT waypoint, D2S_DIFFICULTY difficulty, int activated) {
|
|
31
|
if(waypoint > D2S_WAYPOINTSDATA_NUMWAYPOINTS) {
|
|
32
33
34
35
36
37
38
39
|
fprintf(stderr,"libd2char error: waypoint %d doesn't exist\n",waypoint);
return -1;
}
if(difficulty != D2S_DIFFICULTY_NORMAL ||
difficulty != D2S_DIFFICULTY_NIGHTMARE ||
difficulty != D2S_DIFFICULTY_HELL) {
fprintf(stderr,"libd2char error: difficulty %d doesn't exist\n",difficulty);
return -1;
|
|
40
41
42
43
|
}
unsigned int byte = waypoint / 8;
unsigned int offset = waypoint % 8;
d->waypoints[difficulty].waypointData[byte] |= (1 << offset);
|
|
44
|
return 0;
|
|
45
|
}
|