Blame view

d2waypoints.h 3.14 KB
1
2
3
#ifndef D2WAYPOINTS_H
#define D2WAYPOINTS_H
4
5
6
// Forward declaration
typedef enum D2S_DIFFICULTY D2S_DIFFICULTY;
7
8
9
10
11
12
13
14
#include <stdint.h>

#include "d2strings.h"

#define D2S_WAYPOINTSDATA_HEADER_LENGTH 2
#define D2S_WAYPOINTSDATA_LENGTH 5
#define D2S_WAYPOINTSDATA_NUMWAYPOINTS 39
15
typedef enum D2S_WAYPOINT {
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
    D2S_WAYPOINT_UNKNOWN = -1,
    D2S_WAYPOINT_ROGUE_ENCAMPMENT = 0,
    D2S_WAYPOINT_COLD_PLAINS,
    D2S_WAYPOINT_STONY_FIELD,
    D2S_WAYPOINT_DARK_WOOD,
    D2S_WAYPOINT_BLACK_MARSH,
    D2S_WAYPOINT_OUTER_CLOISTER,
    D2S_WAYPOINT_JAIL,
    D2S_WAYPOINT_INNER_CLOISTER,
    D2S_WAYPOINT_CATACOMBS,
    D2S_WAYPOINT_LUT_GHOLEIN,
    D2S_WAYPOINT_SEWERS,
    D2S_WAYPOINT_DRY_HILLS,
    D2S_WAYPOINT_HALLS_OF_THE_DEAD,
    D2S_WAYPOINT_FAR_OASIS,
    D2S_WAYPOINT_LOST_CITY,
    D2S_WAYPOINT_PALACE_CELLAR,
    D2S_WAYPOINT_ARCANE_SANCTUARY,
    D2S_WAYPOINT_CANYON_OF_THE_MAGI,
    D2S_WAYPOINT_KURAST_DOCS,
    D2S_WAYPOINT_SPIDER_FOREST,
    D2S_WAYPOINT_GREAT_MARSH,
    D2S_WAYPOINT_FLAYER_JUNGLE,
    D2S_WAYPOINT_LOWER_KURAST,
    D2S_WAYPOINT_KURAST_BAZAAR,
    D2S_WAYPOINT_UPPER_KURAST,
    D2S_WAYPOINT_TRAVINCAL,
    D2S_WAYPOINT_DURANCE_OF_HATE,
    D2S_WAYPOINT_PANDEMONIUM_FORTRESS,
    D2S_WAYPOINT_CITY_OF_THE_DAMNED,
    D2S_WAYPOINT_RIVER_OF_FLAMES,
    D2S_WAYPOINT_HARROGATH,
    D2S_WAYPOINT_FRIGID_HIGHLANDS,
    D2S_WAYPOINT_ARREAT_PLATEAU,
    D2S_WAYPOINT_CRYSTALLINE_PASSAGE,
    D2S_WAYPOINT_HALLS_OF_PAIN,
    D2S_WAYPOINT_GLACIAL_TRAIL,
    D2S_WAYPOINT_FROZEN_TUNDRA,
    D2S_WAYPOINT_ANCIENTS_WAY,
    D2S_WAYPOINT_WORLDSTONE_KEEP
56
57
} D2S_WAYPOINT;
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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;
113
114
// Returns static string from library memory, no need to free
const char* getWaypointName(D2S_WAYPOINT waypoint);
115
int isWaypointActivated(D2WaypointsData* d, D2S_WAYPOINT waypoint, D2S_DIFFICULTY difficulty);
116
int setWaypointActivated(D2WaypointsData* d, D2S_WAYPOINT waypoint, D2S_DIFFICULTY difficulty, int activated);
117
118

#endif