Skip to content

Commit e9a9ad0

Browse files
author
Snowy
committed
ToonTown: Add DNA and Suit package
1 parent 1c7199f commit e9a9ad0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+21449
-0
lines changed

makepanda/installer.nsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ var READABLE
153153
File /nonfatal /r "${BUILT}\panda3d\skel${EXT_SUFFIX}"
154154
File /nonfatal /r "${BUILT}\panda3d\vision${EXT_SUFFIX}"
155155
File /nonfatal /r "${BUILT}\panda3d\vrpn${EXT_SUFFIX}"
156+
File /nonfatal /r "${BUILT}\panda3d\toontown${EXT_SUFFIX}"
156157

157158
!ifdef HAVE_BULLET
158159
SectionGetFlags ${SecBullet} $R0

makepanda/makepanda.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
"CONTRIB", # Experimental
103103
"SSE2", "NEON", # Compiler features
104104
"MIMALLOC", # Memory allocators
105+
"TOONTOWN", # ToonTown DNA, Suits etc
105106
])
106107

107108
CheckPandaSourceTree()
@@ -2953,6 +2954,8 @@ def CreatePandaVersionFiles():
29532954
panda_modules.append('ode')
29542955
if not PkgSkip("VRPN"):
29552956
panda_modules.append('vrpn')
2957+
if not PkgSkip("TOONTOWN"):
2958+
panda_modules.append('toontown')
29562959

29572960
panda_modules_code = """
29582961
"This module is deprecated. Import from panda3d.core and other panda3d.* modules instead."
@@ -3426,6 +3429,11 @@ def get_config_express():
34263429
CopyAllHeaders('panda/metalibs/pandaphysics')
34273430
CopyAllHeaders('panda/src/testbed')
34283431

3432+
if not PkgSkip("TOONTOWN"):
3433+
CopyAllHeaders('panda/src/toontown/dna')
3434+
CopyAllHeaders('panda/src/toontown/suit')
3435+
CopyAllHeaders('panda/src/toontown/toontownbase')
3436+
34293437
if not PkgSkip("BULLET"):
34303438
CopyAllHeaders('panda/src/bullet')
34313439
CopyAllHeaders('panda/metalibs/pandabullet')
@@ -5210,6 +5218,53 @@ def get_config_express():
52105218
TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_ztriangle_table.obj')
52115219
TargetAdd('libp3tinydisplay.dll', input=COMMON_PANDA_LIBS)
52125220

5221+
#
5222+
# DIRECTORY: panda/src/toontown/*
5223+
#
5224+
if not PkgSkip("TOONTOWN"):
5225+
# DNA
5226+
OPTS=['DIR:panda/src/toontown/dna', 'BUILDING:TOONTOWN']
5227+
TargetAdd('p3dna_composite1.obj', opts=OPTS, input='dnaLoader_composite1.cxx')
5228+
TargetAdd('p3dna_composite2.obj', opts=OPTS, input='dnaLoader_composite2.cxx')
5229+
5230+
OPTS=['DIR:panda/src/toontown/dna', 'BUILDING:TOONTOWN', 'BISONPREFIX_dnayy', 'FLEXDASHI']
5231+
CreateFile(GetOutputDir()+"/include/dnaParser.h")
5232+
TargetAdd('p3dna_dnaParser.obj', opts=OPTS, input='dnaParser.yxx')
5233+
TargetAdd('dnaParser.h', input='p3dna_dnaParser.obj', opts=['DEPENDENCYONLY'])
5234+
TargetAdd('p3dna_dnaLexer.obj', opts=OPTS, input='dnaLexer.lxx')
5235+
5236+
OPTS=['DIR:panda/src/toontown/dna']
5237+
IGATEFILES=GetDirectoryContents('panda/src/toontown/dna', ["*.h", "*_composite*.cxx"])
5238+
if "dnaParser.h" in IGATEFILES: IGATEFILES.remove("dnaParser.h")
5239+
TargetAdd('libp3dna.in', opts=OPTS, input=IGATEFILES)
5240+
TargetAdd('libp3dna.in', opts=['IMOD:panda3d.toontown', 'ILIB:libp3dna', 'SRCDIR:panda/src/toontown/dna'])
5241+
5242+
# SUIT
5243+
OPTS=['DIR:panda/src/toontown/suit', 'BUILDING:TOONTOWN']
5244+
TargetAdd('p3suit_composite1.obj', opts=OPTS, input='suit_composite1.cxx')
5245+
5246+
OPTS=['DIR:panda/src/toontown/suit']
5247+
IGATEFILES=GetDirectoryContents('panda/src/toontown/suit', ["*.h", "*_composite*.cxx"])
5248+
TargetAdd('libp3suit.in', opts=OPTS, input=IGATEFILES)
5249+
TargetAdd('libp3suit.in', opts=['IMOD:panda3d.toontown', 'ILIB:libp3suit', 'SRCDIR:panda/src/toontown/suit'])
5250+
5251+
# DNA + SUIT
5252+
TargetAdd('libp3toontown.dll', input='p3dna_composite1.obj')
5253+
TargetAdd('libp3toontown.dll', input='p3dna_composite2.obj')
5254+
TargetAdd('libp3toontown.dll', input='p3dna_dnaParser.obj')
5255+
TargetAdd('libp3toontown.dll', input='p3dna_dnaLexer.obj')
5256+
TargetAdd('libp3toontown.dll', input='p3suit_composite1.obj')
5257+
TargetAdd('libp3toontown.dll', input=COMMON_PANDA_LIBS)
5258+
PyTargetAdd('toontown_module.obj', input='libp3dna.in')
5259+
PyTargetAdd('toontown_module.obj', input='libp3suit.in')
5260+
PyTargetAdd('toontown_module.obj', opts=['IMOD:panda3d.toontown', 'ILIB:toontown', 'IMPORT:panda3d.core'])
5261+
PyTargetAdd('toontown.pyd', input='toontown_module.obj')
5262+
PyTargetAdd('toontown.pyd', input='libp3dna_igate.obj')
5263+
PyTargetAdd('toontown.pyd', input='libp3suit_igate.obj')
5264+
PyTargetAdd('toontown.pyd', input='libp3toontown.dll')
5265+
PyTargetAdd('toontown.pyd', input='libp3interrogatedb.dll')
5266+
PyTargetAdd('toontown.pyd', input=COMMON_PANDA_LIBS)
5267+
52135268
#
52145269
# DIRECTORY: direct/src/directbase/
52155270
#
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// Filename: config_dna.cxx
2+
// Created by: shochet (26Jun00)
3+
//
4+
////////////////////////////////////////////////////////////////////
5+
6+
#include "config_dna.h"
7+
#include "dnaGroup.h"
8+
#include "dnaVisGroup.h"
9+
#include "dnaBuildings.h"
10+
#include "dnaWindow.h"
11+
#include "dnaStreet.h"
12+
#include "dnaCornice.h"
13+
#include "dnaProp.h"
14+
#include "dnaAnimProp.h"
15+
#include "dnaInteractiveProp.h"
16+
#include "dnaAnimBuilding.h"
17+
#include "dnaData.h"
18+
#include "dnaNode.h"
19+
#include "dnaDoor.h"
20+
#include "dnaSign.h"
21+
#include "dnaSignBaseline.h"
22+
#include "dnaSignGraphic.h"
23+
#include "dnaSignText.h"
24+
#include "dnaSuitPoint.h"
25+
#include "dnaSuitEdge.h"
26+
#include "dnaSuitPath.h"
27+
#include "dnaBattleCell.h"
28+
#include "loaderFileTypeDNA.h"
29+
30+
#include "dconfig.h"
31+
#include "loaderFileTypeRegistry.h"
32+
33+
#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_TOONTOWN)
34+
#error Buildsystem error: BUILDING_TOONTOWN not defined
35+
#endif
36+
37+
Configure(config_dna);
38+
NotifyCategoryDef(dna, "");
39+
40+
ConfigVariableList dna_preload
41+
("dna-preload");
42+
43+
ConfigVariableSearchPath dna_path
44+
("dna-path");
45+
46+
ConfigureFn(config_dna) {
47+
DNAGroup::init_type();
48+
DNAVisGroup::init_type();
49+
DNAData::init_type();
50+
DNANode::init_type();
51+
DNAWindows::init_type();
52+
DNAStreet::init_type();
53+
DNAWall::init_type();
54+
DNAFlatBuilding::init_type();
55+
DNALandmarkBuilding::init_type();
56+
DNACornice::init_type();
57+
DNAProp::init_type();
58+
DNAAnimProp::init_type();
59+
DNAInteractiveProp::init_type();
60+
DNAAnimBuilding::init_type();
61+
DNADoor::init_type();
62+
DNAFlatDoor::init_type();
63+
DNASign::init_type();
64+
DNASignBaseline::init_type();
65+
DNASignGraphic::init_type();
66+
DNASignText::init_type();
67+
DNASuitPoint::init_type();
68+
DNASuitEdge::init_type();
69+
DNASuitPath::init_type();
70+
DNABattleCell::init_type();
71+
LoaderFileTypeDNA::init_type();
72+
73+
LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_global_ptr();
74+
reg->register_type(new LoaderFileTypeDNA);
75+
}
76+
77+
const ConfigVariableSearchPath &
78+
get_dna_path() {
79+
return dna_path;
80+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Filename: config_dna.h
2+
// Created by: shochet (26Jun00)
3+
//
4+
////////////////////////////////////////////////////////////////////
5+
6+
#ifndef CONFIG_DNA_H
7+
#define CONFIG_DNA_H
8+
9+
#include "toontownbase.h"
10+
11+
#include "notifyCategoryProxy.h"
12+
#include "dconfig.h"
13+
#include "configVariableList.h"
14+
#include "configVariableSearchPath.h"
15+
16+
class DSearchPath;
17+
18+
NotifyCategoryDecl(dna, EXPCL_TOONTOWN, EXPTP_TOONTOWN);
19+
20+
extern ConfigVariableList dna_preload;
21+
extern ConfigVariableSearchPath dna_path;
22+
23+
BEGIN_PUBLISH
24+
EXPCL_TOONTOWN const ConfigVariableSearchPath &get_dna_path();
25+
END_PUBLISH
26+
27+
#endif
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Filename: dnaAnimBuilding.I
2+
// Created by: gjeon (12Nov09)
3+
//
4+
////////////////////////////////////////////////////////////////////
5+
6+
7+
////////////////////////////////////////////////////////////////////
8+
// Function: DNAAnimBuilding::set_anim
9+
// Access: Public
10+
// Description:
11+
////////////////////////////////////////////////////////////////////
12+
INLINE void DNAAnimBuilding::set_anim(std::string anim) {
13+
_anim = anim;
14+
}
15+
16+
17+
////////////////////////////////////////////////////////////////////
18+
// Function: DNAAnimBuilding::get_anim
19+
// Access: Public
20+
// Description:
21+
////////////////////////////////////////////////////////////////////
22+
INLINE std::string DNAAnimBuilding::get_anim() const {
23+
return _anim;
24+
}
25+
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
// Filename: dnaAnimBuilding.cxx
2+
// Created by: gjeon (12Nov09)
3+
//
4+
////////////////////////////////////////////////////////////////////
5+
6+
#include "dnaAnimBuilding.h"
7+
#include "sceneGraphReducer.h"
8+
#include "modelNode.h"
9+
#include "config_linmath.h"
10+
11+
////////////////////////////////////////////////////////////////////
12+
// Static variables
13+
////////////////////////////////////////////////////////////////////
14+
TypeHandle DNAAnimBuilding::_type_handle;
15+
16+
17+
////////////////////////////////////////////////////////////////////
18+
// Function: DNAAnimBuilding::Constructor
19+
// Access: Public
20+
// Description:
21+
////////////////////////////////////////////////////////////////////
22+
DNAAnimBuilding::DNAAnimBuilding(const std::string &initial_name) :
23+
DNALandmarkBuilding(initial_name)
24+
{
25+
_anim = "";
26+
}
27+
28+
////////////////////////////////////////////////////////////////////
29+
// Function: DNAAnimBuilding::Copy Constructor
30+
// Access: Public
31+
// Description:
32+
////////////////////////////////////////////////////////////////////
33+
DNAAnimBuilding::DNAAnimBuilding(const DNAAnimBuilding &anim_building) :
34+
DNALandmarkBuilding(anim_building)
35+
{
36+
_code = anim_building.get_code();
37+
_building_type = anim_building.get_building_type();
38+
_wall_color = anim_building.get_wall_color();
39+
_title = anim_building.get_title();
40+
_article = anim_building.get_article();
41+
_anim = anim_building.get_anim();
42+
}
43+
44+
45+
////////////////////////////////////////////////////////////////////
46+
// Function: DNAAnimBuilding::traverse
47+
// Access: Public
48+
// Description:
49+
////////////////////////////////////////////////////////////////////
50+
NodePath DNAAnimBuilding::traverse(NodePath &parent, DNAStorage *store, int editing) {
51+
// Try to find this building in the node map
52+
NodePath building_node_path = (store->find_node(_code)).copy_to(parent);
53+
54+
// Retain the name from the dna
55+
building_node_path.node()->set_name(get_name());
56+
57+
// Do not set the color until we can blend
58+
// Actually we can blend now, but nobody is using color now
59+
// building_walls_node_path.set_color(_wall_color);
60+
61+
// Set the building position
62+
building_node_path.set_pos_hpr_scale(_pos, _hpr, _scale);
63+
building_node_path.set_tag("DNAAnim", _anim);
64+
65+
// Remember the article and title of the building, for later:
66+
std::string block=store->get_block(get_name());
67+
store->store_block_title(block, _title);
68+
store->store_block_article(block, _article);
69+
70+
// Copy the suit building origin to the parent:
71+
// our type is animbldg,we must have this
72+
setup_suit_building_origin(parent, building_node_path);
73+
74+
// Traverse each node in our vector
75+
pvector<PT(DNAGroup)>::iterator i = _group_vector.begin();
76+
for(; i != _group_vector.end(); ++i) {
77+
PT(DNAGroup) group = *i;
78+
group->traverse(building_node_path, store, editing);
79+
}
80+
81+
if (editing) {
82+
// Remember that this nodepath is associated with this dna group
83+
store->store_DNAGroup(building_node_path.node(), this);
84+
}
85+
else {
86+
SceneGraphReducer gr;
87+
// Get rid of the transitions
88+
gr.apply_attribs(building_node_path.node());
89+
gr.flatten(building_node_path.node(), ~0);
90+
91+
// We do not have dna doors too
92+
// HQs need the door_origins around because they do not have dnaDoors
93+
//if (get_building_type() != string("hq")) {
94+
// Get rid of these placement origins since we do not need them anymore
95+
// NodePath door_origin = building_node_path.find("**/*door_origin");
96+
// if (!door_origin.is_empty()) {
97+
// door_origin.remove_node();
98+
// }
99+
//}
100+
// We need the sign_origin locator too
101+
//NodePath sign_origin = building_node_path.find("**/*sign_origin");
102+
//if (!sign_origin.is_empty()) {
103+
// sign_origin.remove_node();
104+
//}
105+
}
106+
return building_node_path;
107+
}
108+
109+
110+
////////////////////////////////////////////////////////////////////
111+
// Function: DNAAnimBuilding::write
112+
// Access: Public
113+
// Description: Writes the group and all children to output
114+
////////////////////////////////////////////////////////////////////
115+
void DNAAnimBuilding::write(std::ostream &out, DNAStorage *store, int indent_level) const {
116+
indent(out, indent_level) << "anim_building ";
117+
out << '"' << get_name() << '"' << " [\n";
118+
119+
// Write out all properties
120+
indent(out, indent_level + 1) << "code [ " <<
121+
'"' << _code << '"' << " ]\n";
122+
if (!get_building_type().empty()) {
123+
indent(out, indent_level + 1) << "building_type [ " << '"' << get_building_type() << '"' << " ]\n";
124+
}
125+
126+
// Whoops, the titles were entered as iso8859 and we need to convert them to utf8
127+
// We only want to run this when we need to fix an improper encoding
128+
// Note - you need to change the indent function below too
129+
// string utf8title = TextNode::reencode_text(_title, TextNode::E_iso8859, TextNode::E_utf8);
130+
if (!_article.empty()) {
131+
indent(out, indent_level + 1) << "article [ " << '"' <<
132+
_article << '"' << " ]\n";
133+
}
134+
indent(out, indent_level + 1) << "title [ " << '"' <<
135+
_title << '"' << " ]\n";
136+
indent(out, indent_level + 1) << "anim [ " <<
137+
'"' << _anim << '"' << " ]\n";
138+
indent(out, indent_level + 1) << "pos [ " <<
139+
_pos[0] << " " << _pos[1] << " " << _pos[2] << " ]\n";
140+
if (temp_hpr_fix) {
141+
indent(out, indent_level + 1) << "nhpr [ " <<
142+
_hpr[0] << " " << _hpr[1] << " " << _hpr[2] << " ]\n";
143+
} else {
144+
indent(out, indent_level + 1) << "hpr [ " <<
145+
_hpr[0] << " " << _hpr[1] << " " << _hpr[2] << " ]\n";
146+
}
147+
148+
// Do not write out color if it is white to save work
149+
if (!_wall_color.almost_equal(LVecBase4f(1.0, 1.0, 1.0, 1.0))) {
150+
indent(out, indent_level + 1) << "color [ " <<
151+
_wall_color[0] << " " << _wall_color[1] << " " << _wall_color[2] << " " << _wall_color[3] <<
152+
" ]\n";
153+
}
154+
// Write all the children
155+
pvector<PT(DNAGroup)>::const_iterator i = _group_vector.begin();
156+
for(; i != _group_vector.end(); ++i) {
157+
// Traverse each node in our vector
158+
PT(DNAGroup) group = *i;
159+
group->write(out, store, indent_level + 1);
160+
}
161+
indent(out, indent_level) << "]\n";
162+
}
163+
164+
165+
////////////////////////////////////////////////////////////////////
166+
// Function: DNAAnimBuilding::make_copy
167+
// Access: Public
168+
// Description: Copies all the children into our own vector
169+
////////////////////////////////////////////////////////////////////
170+
DNAGroup* DNAAnimBuilding::make_copy() {
171+
return new DNAAnimBuilding(*this);
172+
}

0 commit comments

Comments
 (0)