2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
16 * Texture map key bindings.
31 // Assign CurrentTexture to Curside in *Cursegp
32 int AssignTexture(void)
34 autosave_mine( mine_filename );
35 strcpy(undo_status[Autosave_count], "Assign Texture UNDONE.");
37 Cursegp->sides[Curside].tmap_num = CurrentTexture;
39 New_segment.sides[Curside].tmap_num = CurrentTexture;
41 // propagate_light_intensity(Cursegp, Curside, CurrentTexture, 0);
43 Update_flags |= UF_WORLD_CHANGED;
48 // Assign CurrentTexture to Curside in *Cursegp
49 int AssignTexture2(void)
51 int texnum, orient, ctexnum, newtexnum;
53 autosave_mine( mine_filename );
54 strcpy(undo_status[Autosave_count], "Assign Texture 2 UNDONE.");
56 texnum = Cursegp->sides[Curside].tmap_num2 & 0x3FFF;
57 orient = ((Cursegp->sides[Curside].tmap_num2 & 0xC000) >> 14) & 3;
58 ctexnum = CurrentTexture;
60 if ( ctexnum == texnum ) {
61 orient = (orient+1) & 3;
62 newtexnum = (orient<<14) | texnum;
67 Cursegp->sides[Curside].tmap_num2 = newtexnum;
68 New_segment.sides[Curside].tmap_num2 = newtexnum;
70 Update_flags |= UF_WORLD_CHANGED;
75 int ClearTexture2(void)
77 autosave_mine( mine_filename );
78 strcpy(undo_status[Autosave_count], "Clear Texture 2 UNDONE.");
80 Cursegp->sides[Curside].tmap_num2 = 0;
82 New_segment.sides[Curside].tmap_num2 = 0;
84 Update_flags |= UF_WORLD_CHANGED;
90 // --------------------------------------------------------------------------------------------------
91 // Propagate textures from Cursegp through Curside.
92 // If uv_flag !0, then only propagate uv coordinates (if 0, then propagate textures as well)
93 // If move_flag !0, then move forward to new segment after propagation, else don't
94 int propagate_textures_common(int uv_flag, int move_flag)
96 autosave_mine( mine_filename );
97 strcpy(undo_status[Autosave_count], "Propogate Textures UNDONE.");
99 if (IS_CHILD(Cursegp->children[Curside]))
100 med_propagate_tmaps_to_segments(Cursegp, &Segments[Cursegp->children[Curside]], uv_flag);
103 SelectCurrentSegForward();
105 Update_flags |= UF_WORLD_CHANGED;
110 // Propagate texture maps from current segment, through current side
111 int PropagateTextures(void)
113 return propagate_textures_common(0, 0);
116 // Propagate texture maps from current segment, through current side
117 int PropagateTexturesUVs(void)
119 return propagate_textures_common(-1, 0);
122 // Propagate texture maps from current segment, through current side
123 // And move to that segment.
124 int PropagateTexturesMove(void)
126 return propagate_textures_common(0, 1);
129 // Propagate uv coordinate from current segment, through current side
130 // And move to that segment.
131 int PropagateTexturesMoveUVs(void)
133 return propagate_textures_common(-1, 1);
137 // -------------------------------------------------------------------------------------
138 int is_selected_segment(int segnum)
142 for (i=0; i<N_selected_segs; i++)
143 if (Selected_segs[i] == segnum)
150 // -------------------------------------------------------------------------------------
151 // Auxiliary function for PropagateTexturesSelected.
153 void pts_aux(segment *sp)
157 Been_visited[SEGMENT_NUMBER(sp)] = 1;
159 for (side=0; side<MAX_SIDES_PER_SEGMENT; side++) {
160 if (IS_CHILD(sp->children[side])) {
161 while ((!Been_visited[sp->children[side]]) && is_selected_segment(sp->children[side])) {
162 med_propagate_tmaps_to_segments(sp,&Segments[sp->children[side]],0);
163 pts_aux(&Segments[sp->children[side]]);
169 // -------------------------------------------------------------------------------------
170 // Propagate texture maps from current segment recursively exploring all children, to all segments in Selected_list
171 // until a segment not in Selected_list is reached.
172 int PropagateTexturesSelected(void)
176 autosave_mine( mine_filename );
177 strcpy(undo_status[Autosave_count], "Propogate Textures Selected UNDONE.");
179 for (i=0; i<MAX_SEGMENTS; i++) Been_visited[i] = 0; //clear visited list
180 Been_visited[SEGMENT_NUMBER(Cursegp)] = 1;
184 Update_flags |= UF_WORLD_CHANGED;