Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | /* |
2 | * Portions of this file are copyright Rebirth contributors and licensed as |
||
3 | * described in COPYING.txt. |
||
4 | * Portions of this file are copyright Parallax Software and licensed |
||
5 | * according to the Parallax license below. |
||
6 | * See COPYING.txt for license details. |
||
7 | |||
8 | THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX |
||
9 | SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO |
||
10 | END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A |
||
11 | ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS |
||
12 | IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS |
||
13 | SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE |
||
14 | FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE |
||
15 | CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS |
||
16 | AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. |
||
17 | COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. |
||
18 | */ |
||
19 | |||
20 | /* |
||
21 | * |
||
22 | * Header for morph.c |
||
23 | * |
||
24 | */ |
||
25 | |||
26 | #pragma once |
||
27 | |||
28 | #ifdef __cplusplus |
||
29 | #include <cstdint> |
||
30 | #include "dxxsconf.h" |
||
31 | #include "vecmat.h" |
||
32 | #include "pack.h" |
||
33 | #include "polyobj.h" |
||
34 | #include "dsx-ns.h" |
||
35 | |||
36 | #ifdef dsx |
||
37 | #include "compiler-span.h" |
||
38 | #include "fwd-object.h" |
||
39 | #include "physics_info.h" |
||
40 | #include <array> |
||
41 | #include <memory> |
||
42 | |||
43 | namespace dcx { |
||
44 | |||
45 | struct morph_data : prohibit_void_ptr<morph_data> |
||
46 | { |
||
47 | using ptr = std::unique_ptr<morph_data>; |
||
48 | enum |
||
49 | { |
||
50 | MAX_VECS = 5000u, |
||
51 | }; |
||
52 | struct max_vectors |
||
53 | { |
||
54 | std::size_t count; |
||
55 | explicit max_vectors(std::size_t c) : count(c) |
||
56 | { |
||
57 | } |
||
58 | }; |
||
59 | struct polymodel_idx |
||
60 | { |
||
61 | std::size_t idx; |
||
62 | explicit polymodel_idx(std::size_t i) : idx(i) |
||
63 | { |
||
64 | } |
||
65 | }; |
||
66 | static void *operator new(std::size_t bytes) = delete; /* require caller to use placement-form to specify the number of vectors to allocate */ |
||
67 | static void operator delete(void *p) |
||
68 | { |
||
69 | ::operator delete(p); |
||
70 | } |
||
71 | static void operator delete(void *p, max_vectors) |
||
72 | { |
||
73 | ::operator delete(p); |
||
74 | } |
||
75 | enum class submodel_state : uint8_t |
||
76 | { |
||
77 | invisible, |
||
78 | animating, |
||
79 | visible, |
||
80 | }; |
||
81 | object_base *const obj; // object which is morphing |
||
82 | const object_signature_t Morph_sig; |
||
83 | uint8_t morph_save_control_type; |
||
84 | uint8_t morph_save_movement_type; |
||
85 | uint8_t n_submodels_active; |
||
86 | std::array<submodel_state, MAX_SUBMODELS> submodel_active; // which submodels are active |
||
87 | const max_vectors max_vecs; |
||
88 | physics_info morph_save_phys_info; |
||
89 | std::array<int, MAX_SUBMODELS> |
||
90 | n_morphing_points, // how many active points in each part |
||
91 | submodel_startpoints; // first point for each submodel |
||
92 | static ptr create(object_base &, const polymodel &, polymodel_idx); |
||
93 | span<fix> get_morph_times(); |
||
94 | span<vms_vector> get_morph_vecs(); |
||
95 | span<vms_vector> get_morph_deltas(); |
||
96 | private: |
||
97 | static void *operator new(std::size_t bytes, max_vectors); |
||
98 | explicit morph_data(object_base &o, max_vectors); |
||
99 | }; |
||
100 | |||
101 | struct d_level_unique_morph_object_state; |
||
102 | |||
103 | morph_data::ptr *find_morph_data(d_level_unique_morph_object_state &LevelUniqueMorphObjectState, object_base &obj); |
||
104 | } |
||
105 | |||
106 | void morph_start(d_level_unique_morph_object_state &, d_level_shared_polygon_model_state &, object_base &obj); |
||
107 | |||
108 | //process the morphing object for one frame |
||
109 | void do_morph_frame(object &obj); |
||
110 | |||
111 | //called at the start of a level |
||
112 | void init_morphs(); |
||
113 | #endif |
||
114 | |||
115 | #endif |