1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | ### File Specific |
---|
12 | main-programmer: Patrick Boenzli patrick@orxonox.net |
---|
13 | co-programmer: |
---|
14 | */ |
---|
15 | |
---|
16 | #include "resource_oif.h" |
---|
17 | |
---|
18 | #include "substring.h" |
---|
19 | #include "multi_type.h" |
---|
20 | #include "debug.h" |
---|
21 | |
---|
22 | |
---|
23 | ResourceOIF::ResourceOIF(const std::string& fileName, const Resources::KeepLevel& keepLevel) |
---|
24 | : Resource(&ResourceOIF::type) |
---|
25 | { |
---|
26 | Resources::StorePointer* ptr = this->acquireResource(fileName); |
---|
27 | |
---|
28 | if (ptr) |
---|
29 | { |
---|
30 | PRINTF(0)("FOUND OIF: %s\n", fileName.c_str()); |
---|
31 | //this->acquireData(static_cast<ResourceOIF::OIFResourcePointer*>(ptr)->ptr()); |
---|
32 | } |
---|
33 | else |
---|
34 | { |
---|
35 | PRINTF(4)("NOT FOUND OIF: %s\n", fileName.c_str()); |
---|
36 | // std::string modelFileName = this->Resource::locateFile(modelName); |
---|
37 | // //std::string skinFileName = this->Resource::locateFile(skinName); |
---|
38 | // this->MD2Model::load(modelFileName, skinName, scale); |
---|
39 | // this->Resource::addResource(new ResourceOIF::OIFResourcePointer(loadString(modelName, skinName, scale), keepLevel, this->MD2Model::dataPointer())); |
---|
40 | } |
---|
41 | |
---|
42 | } |
---|
43 | |
---|
44 | ResourceOIF ResourceOIF::createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel) |
---|
45 | { |
---|
46 | SubString loadValues(loadString, ','); |
---|
47 | std::string fileName; |
---|
48 | if (loadValues.size() > 0) |
---|
49 | fileName = loadValues[0]; |
---|
50 | |
---|
51 | return ResourceOIF(fileName); |
---|
52 | } |
---|
53 | |
---|
54 | |
---|
55 | |
---|
56 | Resources::tType<ResourceOIF> ResourceOIF::type("OIF"); |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | |
---|
62 | ResourceOIF::OIFResourcePointer::OIFResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const OIFData::Pointer& data) |
---|
63 | : Resources::StorePointer(loadString, keepLevel) , pointer(data) |
---|
64 | {} |
---|
65 | |
---|
66 | |
---|