Blame view

d2waypoints.h 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef D2WAYPOINTS_H
#define D2WAYPOINTS_H

#include <stdint.h>

#include "d2strings.h"

#define D2S_WAYPOINTSDATA_HEADER_LENGTH 2
#define D2S_WAYPOINTSDATA_LENGTH 5
#define D2S_WAYPOINTSDATA_NUMWAYPOINTS 39

const char* const waypoints[] = {
    D2S_WAYPOINT_0,
    D2S_WAYPOINT_1,
    D2S_WAYPOINT_2,
    D2S_WAYPOINT_3,
    D2S_WAYPOINT_4,
    D2S_WAYPOINT_5,
    D2S_WAYPOINT_6,
    D2S_WAYPOINT_7,
    D2S_WAYPOINT_8,
    D2S_WAYPOINT_9,
    D2S_WAYPOINT_10,
    D2S_WAYPOINT_11,
    D2S_WAYPOINT_12,
    D2S_WAYPOINT_13,
    D2S_WAYPOINT_14,
    D2S_WAYPOINT_15,
    D2S_WAYPOINT_16,
    D2S_WAYPOINT_17,
    D2S_WAYPOINT_18,
    D2S_WAYPOINT_19,
    D2S_WAYPOINT_20,
    D2S_WAYPOINT_21,
    D2S_WAYPOINT_22,
    D2S_WAYPOINT_23,
    D2S_WAYPOINT_24,
    D2S_WAYPOINT_25,
    D2S_WAYPOINT_26,
    D2S_WAYPOINT_27,
    D2S_WAYPOINT_28,
    D2S_WAYPOINT_29,
    D2S_WAYPOINT_30,
    D2S_WAYPOINT_31,
    D2S_WAYPOINT_32,
    D2S_WAYPOINT_33,
    D2S_WAYPOINT_34,
    D2S_WAYPOINT_35,
    D2S_WAYPOINT_36,
    D2S_WAYPOINT_37,
    D2S_WAYPOINT_38
};

typedef struct __attribute__((packed)) {
    uint16_t unknown1; // Apparently, always 0x0201
    uint8_t waypointData[D2S_WAYPOINTSDATA_LENGTH];
    uint8_t unknown2[17];
} D2Waypoints;

typedef struct __attribute__((packed)) {
    const char* header[D2S_WAYPOINTSDATA_HEADER_LENGTH]; // WS
    uint32_t unknown1; // This is likely version data
    uint16_t size; // in bytes
    D2Waypoints waypoints[3]; // 1 set for each difficulty
} D2WaypointsData;

int isWaypointActivated(D2WaypointsData* d, unsigned int waypoint, unsigned int difficulty);
void setWaypointActivated(D2WaypointsData* d, unsigned int waypoint, unsigned int difficulty, int activated);

#endif