blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
201
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
7
100
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
260 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
11.4k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
80 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
8
9.86M
extension
stringclasses
52 values
content
stringlengths
8
9.86M
authors
listlengths
1
1
author
stringlengths
0
119
3c76507cf55d6fa7a40b5e08003130172dd67238
6d34fa23c708320b2e42d120d107f187106302e3
/orca/gporca/libgpopt/include/gpopt/operators/CScalarBoolOp.h
76413a45514a646e507642fac628050c3408794b
[ "Apache-2.0" ]
permissive
joe2hpimn/dg16.oss
a38ca233ba5c9f803f9caa99016a4c7560da9f08
2c4275c832b3e4b715b7475726db6757b127030c
refs/heads/master
2021-08-23T19:11:49.831210
2017-12-06T05:23:22
2017-12-06T05:23:22
113,322,478
2
1
null
2017-12-06T13:50:44
2017-12-06T13:50:44
null
UTF-8
C++
false
false
2,895
h
//--------------------------------------------------------------------------- // Greenplum Database // Copyright (C) 2011 EMC Corp. // // @filename: // CScalarBoolOp.h // // @doc: // Base class for all scalar boolean operators // // @owner: // // // @test: // // //--------------------------------------------------------------------------- #ifndef GPOPT_CScalarBoolOp_H #define GPOPT_CScalarBoolOp_H #include "gpos/base.h" #include "gpopt/operators/CScalar.h" #include "gpopt/base/CDrvdProp.h" namespace gpopt { using namespace gpos; //--------------------------------------------------------------------------- // @class: // CScalarBoolOp // // @doc: // Scalar boolean operator // //--------------------------------------------------------------------------- class CScalarBoolOp : public CScalar { public: // enum of boolean operators enum EBoolOperator { EboolopAnd, // AND EboolopOr, // OR EboolopNot, // NOT EboolopSentinel }; private: static const WCHAR m_rgwszBool[EboolopSentinel][30]; // boolean operator EBoolOperator m_eboolop; // private copy ctor CScalarBoolOp(const CScalarBoolOp &); public: // ctor CScalarBoolOp ( IMemoryPool *pmp, EBoolOperator eboolop ) : CScalar(pmp), m_eboolop(eboolop) { GPOS_ASSERT(0 <= eboolop && EboolopSentinel > eboolop); } // dtor virtual ~CScalarBoolOp() {} // ident accessors virtual EOperatorId Eopid() const { return EopScalarBoolOp; } // return a string for operator name virtual const CHAR *SzId() const { return "CScalarBoolOp"; } // accessor EBoolOperator Eboolop() const { return m_eboolop; } // operator specific hash function ULONG UlHash() const; // match function BOOL FMatch(COperator *) const; // sensitivity to order of inputs BOOL FInputOrderSensitive() const { return !FCommutative(Eboolop()); } // return a copy of the operator with remapped columns virtual COperator *PopCopyWithRemappedColumns ( IMemoryPool *, //pmp, HMUlCr *, //phmulcr, BOOL //fMustExist ) { return PopCopyDefault(); } // conversion function static CScalarBoolOp *PopConvert ( COperator *pop ) { GPOS_ASSERT(NULL != pop); GPOS_ASSERT(EopScalarBoolOp == pop->Eopid()); return reinterpret_cast<CScalarBoolOp*>(pop); } // boolean expression evaluation virtual EBoolEvalResult Eber(DrgPul *pdrgpulChildren) const; // decide boolean operator commutativity static BOOL FCommutative(EBoolOperator eboolop); // the type of the scalar expression virtual IMDId *PmdidType() const; // print virtual IOstream &OsPrint(IOstream &os) const; }; // class CScalarBoolOp } #endif // !GPOPT_CScalarBoolOp_H // EOF
[ "fengttt@gmail.com" ]
fengttt@gmail.com
b5f00ea95c228343214ca683b6ed89e91929b9fa
5c6762f71e21c428ba1eae345fb1394577e78ef3
/arduino/ros_sensor/ros_sensor.ino
628db5ab2ece4e10c671835f9a657e70984341b9
[]
no_license
meitiever/movebase
8cb72662fe257f4fc73a35681110ca2bf6cb6aee
a671f099823fc1f204403d258825abfa251bb913
refs/heads/master
2021-01-22T03:40:13.198102
2017-04-20T02:54:33
2017-04-20T02:54:33
81,450,179
0
0
null
null
null
null
UTF-8
C++
false
false
2,459
ino
#include <Wire.h> #include <FreeSixIMU.h> #include <FIMU_ADXL345.h> #include <FIMU_ITG3200.h> #include <HMC5883L.h> #include <ros.h> #include <std_msgs/String.h> //#include <nav_msgs/Odometry.h> //#include <geometry_msgs/TwistStamped.h> //#include <sensor_msgs/Imu.h> //#include "ros/time.h" /*********************************************************************************/ std_msgs::String Imu; //sensor_msgs::Imu Imu; std_msgs::String Vel; //nav_msgs::Odometry odom; ros::Publisher pub_imu("IMU", &Imu); ros::Publisher pub_vel("VEL", &Vel); //ros::Publisher pub_vel("VEL", &odom); ros::NodeHandle nh; long publisher_timer; long speed_timer; /*********************************************************************************/ /*********************************************************************************/ float angles[6]; float ypr[3]; // yaw pitch roll //float heading; char frame_id[] = "IMU"; //float temperature = 0; //float pressure = 0; //float altitude = 0; // Set the FreeSixIMU object FreeSixIMU sixDOF = FreeSixIMU(); //HMC5883L compass; // Record any errors that may occur in the compass. //int error = 0; /*********************************************************************************/ /*********************************************************************************/ int count1 = 0; int count2 = 0; float vx, vy, vth, x, y, th; //tf::TransformBroadcaster odom_broadcaster; unsigned long l_time = 0, r_time = 0; /*********************************************************************************/ void setup() { Wire.begin(); nh.getHardware()->setBaud(115200); nh.initNode(); //odom_broadcaster.init(nh); nh.advertise(pub_imu); nh.advertise(pub_vel); // Init Encoder EncoderInit(); //init IMU sixDOF.init(); //init the Acc and Gyro //compass = HMC5883L(); // init HMC5883 //error = compass.SetScale(1.3); // Set the scale of the compass. //error = compass.SetMeasurementMode(Measurement_Continuous); // Set the measurement mode to Continuous //if(error != 0) // If there is an error, print it out. // Serial.println(compass.GetErrorText(error)); //bmp085Calibration(); // init barometric pressure sensor } void loop() { if(millis() > publisher_timer) { processIMU(); pub_imu.publish(&Imu); wheelSpeed(); pub_vel.publish(&Vel); //pub_vel.publish(&odom); publisher_timer = millis() + 500; //printData(); } //delay(200); nh.spinOnce(); }
[ "meitiever@gmail.com" ]
meitiever@gmail.com
1ecf2420d218196ed2cb69837ff87f416e3a270d
99b4e49d44b7c978e7802c655846e9d1d52bf474
/OOP Projekat/FinalniProjekat/questioncb.h
b32d63eb839d03a309ee78e844cdad7b485e1fd1
[]
no_license
Mcraellhs/QT-c-Quiz-with-DB
3af5b49bf4530b642693aa9cfe5595cbde5a20ba
06b7a9419ca0f01b847b21deaec0d7f447c17890
refs/heads/master
2022-11-16T07:08:07.839896
2020-07-10T10:15:58
2020-07-10T10:15:58
278,603,509
0
0
null
null
null
null
UTF-8
C++
false
false
526
h
#ifndef QUESTIONCB_H #define QUESTIONCB_H #include <QDialog> #include <QtSql> #include <QtSql/QSqlDatabase> #include <QDebug> namespace Ui { class questioncb; } class questioncb : public QDialog { Q_OBJECT public: explicit questioncb(QWidget *parent = nullptr); ~questioncb(); questioncb(QString strcb); static QString tacodg; signals: void questioncbsignal(); private slots: void on_pushButton_clicked(); private: Ui::questioncb *ui; QSqlDatabase mydbcb; }; #endif // QUESTIONCB_H
[ "sakicahmedyahoo.com" ]
sakicahmedyahoo.com
007457c6180a43de36b1c5a0832c4f8cb1f0aada
4cda6b04304f3f008fa87cdae5abb6edfd1d8d27
/guitartunermodule/guitartuner.cpp
49e155c1d1e6168d4fd42ca2c33b5d0f1b8a7e29
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
NicholasShatokhin/Qt4-GuitarTuner
9432b54cd22f9765b44985a88c486b7cc55be6b7
bb15b0b2a8c01b4070bb0815e252cef63024396f
refs/heads/master
2021-01-22T23:48:07.999188
2013-04-07T18:54:04
2013-04-07T18:54:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
14,019
cpp
/** * Copyright (c) 2011-2012 Nokia Corporation. */ #include "guitartuner.h" #include <QtCore/QDebug> #include <QtCore/qmath.h> #include <QtMultimediaKit/QAudioDeviceInfo> #include <QtMultimediaKit/QAudioInput> #include <QtMultimediaKit/QAudioOutput> #include "constants.h" #include "voiceanalyzer.h" #include "voicegenerator.h" // Constants const qreal StringInterval(2.5f); const QString IsInputKey("isInput"); const QString IsMutedKey("isMuted"); const QString AutoModeEnabledKey("autoModeEnabled"); const QString SensitivityKey("sensitivity"); const QString VolumeKey("volume"); const QString StringKey("string"); /*! \class GuitarTuner \brief Implements the main interface of the plugin. */ /*! Constructor. */ GuitarTuner::GuitarTuner(QDeclarativeItem *parent) : QDeclarativeItem(parent), m_voiceAnalyzer(0), m_voiceGenerator(0), m_audioInput(0), m_audioOutput(0), m_isInput(true), m_isMuted(false), m_autoModeEnabled(false), m_sensitivity(0.5f), m_volume(0.5f), m_string(StringE), m_autoDetectedString(StringE) { // Initialize audio output and input. initAudioOutput(); initAudioInput(); // Connect the signals of the voice analyzer. connect(m_voiceAnalyzer, SIGNAL(lowVoice()), this, SIGNAL(lowVoice())); connect(m_voiceAnalyzer, SIGNAL(correctFrequency()), this, SIGNAL(correctFrequency())); connect(m_voiceAnalyzer, SIGNAL(voiceDifferenceChanged(qreal)), this, SIGNAL(voiceDifferenceChanged(qreal))); setIsInput(true); } /*! Destructor. */ GuitarTuner::~GuitarTuner() { // No implementation required. } /*! Constructs and returns a variant map containing the current settings of this engine. */ QVariant GuitarTuner::settings() const { QVariantMap retval; retval.insert(IsInputKey, m_isInput); retval.insert(IsMutedKey, m_isMuted); retval.insert(AutoModeEnabledKey, m_autoModeEnabled); retval.insert(SensitivityKey, m_sensitivity); retval.insert(VolumeKey, m_volume); retval.insert(StringKey, QVariant::fromValue((int)m_string)); qDebug() << "GuitarTuner::settings():" << retval; return QVariant::fromValue(retval); } /*! Suspends the audio output, if \a state is ActiveState and the voice is muted. */ void GuitarTuner::setOutputState(QAudio::State state) { if (QAudio::ActiveState == state && m_isMuted) { // If the voice is muted, suspend the voice. m_audioOutput->suspend(); } } /*! Restores and applies \a settings. \a settings should have been received from GuitarTuner::settings(). The boolean parameter of the signal is set to true if the restoration was successful. */ void GuitarTuner::restoreSettings(QVariant settings) { if (!settings.isValid() || !settings.canConvert<QVariantMap>()) { qDebug() << "GuitarTuner::restoreSettings(): Invalid argument, skipping..."; emit settingsRestored(false); return; } QVariantMap map = settings.toMap(); if (map.isEmpty()) { qDebug() << "GuitarTuner::restoreSettings(): Empty map received, skipping..."; emit settingsRestored(false); return; } qDebug() << "GuitarTuner::restoreSettings():" << map; setString((String)map.value(StringKey).toInt()); // This needs to be set first! setIsInput(map.value(IsInputKey).toBool()); setIsMuted(map.value(IsMutedKey).toBool()); setAutoModeEnabled(map.value(AutoModeEnabledKey).toBool()); setSensitivity(map.value(SensitivityKey).toReal()); setVolume(map.value(VolumeKey).toReal()); emit settingsRestored(true); } /*! Stops all the ongoing activities of this engine. Restart the activities by applying the settings or by calling GuitarTuner::setIsInput(). */ void GuitarTuner::suspend() { qDebug() << "GuitarTuner::suspend()"; if (m_isInput) { // Stop audio input and audio analyzer. m_audioInput->stop(); m_voiceAnalyzer->stop(); } else { // Stop audio output and audio generator. m_audioOutput->stop(); m_voiceGenerator->stop(); } } /*! Returns true if the tuner is in the input mode, false otherwise. */ bool GuitarTuner::isInput() const { return m_isInput; } /*! Sets the input mode to \a isInput. */ void GuitarTuner::setIsInput(bool isInput) { qDebug() << "GuitarTuner::setIsInput():" << isInput; // Stop audio input/output depending on the previous state. suspend(); m_isInput = isInput; if (m_isInput) { // Start the audio analyzer and then the audio input. m_voiceAnalyzer->start(stringToFrequency(m_string)); m_audioInput->start(m_voiceAnalyzer); } else { // Set up the audio output. // If the current frequency of voice generator // is not the same as the target frequency selected in the UI, // update voice generator's frequency. if (m_voiceGenerator->frequency() != stringToFrequency(m_string)) { m_voiceGenerator->setFrequency(stringToFrequency(m_string)); } // Start the voice generator and then the audio output. m_voiceGenerator->start(); if (!m_isMuted) { m_audioOutput->start(m_voiceGenerator); } } emit isInputChanged(m_isInput); } /*! Returns true if the tuner is muted, false otherwise. */ bool GuitarTuner::isMuted() const { return m_isMuted; } /*! Sets the mute to \a muted. */ void GuitarTuner::setIsMuted(bool isMuted) { if (m_isMuted == isMuted) { return; } m_isMuted = isMuted; if (m_isMuted) { m_audioOutput->suspend(); } else { if (m_audioOutput->state() == QAudio::SuspendedState) { m_audioOutput->resume(); } else { m_audioOutput->start(m_voiceGenerator); } } emit isMutedChanged(m_isMuted); } /*! Returns true if the auto mode is enabled, false otherwise. */ bool GuitarTuner::autoModeEnabled() const { return m_autoModeEnabled; } /*! Enables auto mode if \a autoModeEnabled is true. Note that auto mode only has effect if the input mode is on. */ void GuitarTuner::setAutoModeEnabled(bool autoModeEnabled) { if (m_autoModeEnabled != autoModeEnabled) { m_autoModeEnabled = autoModeEnabled; if (m_autoModeEnabled) { m_autoDetectedString = m_string; // Start listening analyzer for automatic detection connect(m_voiceAnalyzer, SIGNAL(voiceDifferenceChanged(qreal)), this, SLOT(autoDetectTargetFrequency(qreal))); } else { // Restore the original setting because that might have changed // during the automatic detection setString(m_string); // Disconnect the signal-slot connection disconnect(m_voiceAnalyzer, SIGNAL(voiceDifferenceChanged(qreal)), this, SLOT(autoDetectTargetFrequency(qreal))); } emit autoModeEnabledChanged(m_autoModeEnabled); } } /*! Returns the set sensitivity level of the microphone. */ qreal GuitarTuner::sensitivity() const { return m_sensitivity; } /*! Sets the sensitivity level to \a sensitivity. */ void GuitarTuner::setSensitivity(qreal sensitivity) { if (sensitivity < 0 || sensitivity > 1.0) { return; } m_sensitivity = sensitivity; qreal temp = m_sensitivity; temp = temp / 2 + 0.5; // No point of being below 0.5 temp = 1 - temp; m_voiceAnalyzer->setCutOffPercentage(temp); emit sensitivityChanged(m_sensitivity); } /*! Returns the set volume level. */ qreal GuitarTuner::volume() const { return m_volume; } /*! Sets the volume level to \a volume. */ void GuitarTuner::setVolume(qreal volume) { if (m_volume == volume || volume < 0 || volume > 1.0) { return; } m_volume = volume; m_voiceGenerator->setAmplitude(m_volume); emit volumeChanged(m_volume); } /*! Returns the current string whose frequency is being analyzed of generated. */ int GuitarTuner::string() const { return (int)m_string; } /*! Sets the string, whose frequency is being analyzed or generated, to \a string. */ void GuitarTuner::setString(int string) { Q_ASSERT(string >= 0 && string < 6); m_string = (String)string; if (m_isInput) { // Stop the audio input and voice analyzer. m_audioInput->stop(); m_voiceAnalyzer->stop(); // Start the voice analyzer with new frequency and audio input. m_voiceAnalyzer->start(stringToFrequency(m_string)); m_audioInput->start(m_voiceAnalyzer); } else { // Stop the audio output and voice generator. m_audioOutput->stop(); m_voiceGenerator->stop(); // Set the voice generator's frequency to the target frequency. m_voiceGenerator->setFrequency(stringToFrequency(m_string)); // Start the voice generator and audio output. m_voiceGenerator->start(); if (!m_isMuted) { m_audioOutput->start(m_voiceGenerator); } } emit stringChanged((int)m_string); } /*! Initializes the audio input. */ void GuitarTuner::initAudioInput() { // Set up the input format. m_formatInput.setFrequency(DataFrequencyHzInput); m_formatInput.setCodec("audio/pcm"); m_formatInput.setSampleSize(16); m_formatInput.setChannels(1); m_formatInput.setByteOrder(QAudioFormat::LittleEndian); m_formatInput.setSampleType(QAudioFormat::SignedInt); // Obtain a default input device, and if the format is not // supported, find the nearest format available. QAudioDeviceInfo inputDeviceInfo(QAudioDeviceInfo::defaultInputDevice()); if (!inputDeviceInfo.isFormatSupported(m_formatInput)) { m_formatInput = inputDeviceInfo.nearestFormat(m_formatInput); } // Create new QAudioInput and VoiceAnalyzer instances, and store them in // m_audioInput and m_voiceAnalyzer, respectively. Remember to set the cut-off // percentage for voice analyzer. m_audioInput = new QAudioInput(inputDeviceInfo, m_formatInput, this); m_voiceAnalyzer = new VoiceAnalyzer(m_formatInput, this); setSensitivity(m_sensitivity); } /*! Initializes the audio output. */ void GuitarTuner::initAudioOutput() { // Set up the output format. m_formatOutput.setFrequency(DataFrequencyHzOutput); m_formatOutput.setCodec("audio/pcm"); m_formatOutput.setSampleSize(16); m_formatOutput.setChannels(1); m_formatOutput.setByteOrder(QAudioFormat::LittleEndian); m_formatOutput.setSampleType(QAudioFormat::SignedInt); // Obtain a default output device, and if the format is not supported, // find the nearest format available. QAudioDeviceInfo outputDeviceInfo(QAudioDeviceInfo::defaultOutputDevice()); if (!outputDeviceInfo.isFormatSupported(m_formatOutput)) { m_formatOutput = outputDeviceInfo.nearestFormat(m_formatOutput); } // Create new QAudioOutput and VoiceGenerator instances, and store // them in m_audioOutput and m_voiceGenerator, respectively. m_audioOutput = new QAudioOutput(outputDeviceInfo, m_formatOutput, this); m_voiceGenerator = new VoiceGenerator(m_formatOutput, stringToFrequency(m_string), m_volume, this); // Connect m_audioOutput stateChanged signal to outputStateChanged. connect(m_audioOutput, SIGNAL(stateChanged(QAudio::State)), SIGNAL(outputStateChanged(QAudio::State))); } /*! Maps \a string to correct frequency and returns the frequency value. */ qreal GuitarTuner::stringToFrequency(String string) const { switch (string) { case StringE: return FrequencyE; case StringA: return FrequencyA; case StringD: return FrequencyD; case StringG: return FrequencyG; case StringB: return FrequencyB; case Stringe: return Frequencye; } return 1; } /*! Detects the nearest target frequency (string) based on \a voiceDifference and emits GuitarTuner::autoDetectedStringChanged() signal. */ void GuitarTuner::autoDetectTargetFrequency(qreal voiceDifference) { qreal tempDifference = abs(voiceDifference); qreal tempIndex = (qreal)m_autoDetectedString; qreal tempInterval(StringInterval); if ((qRound(tempIndex) - (voiceDifference < 0)) == (int)Stringe) { tempInterval = 5000; } while (!(voiceDifference < 0 && tempIndex == 0) && tempDifference >= tempInterval) { tempDifference -= tempInterval; tempIndex += voiceDifference / abs(voiceDifference); if ((qRound(tempIndex) - (voiceDifference < 0)) == (int)Stringe) { tempInterval = 5000; } else { tempInterval = StringInterval; } } int tempString = qRound(tempIndex); if (tempString != (int)m_autoDetectedString && tempString >= (int)StringE && tempString <= (int)Stringe) { m_autoDetectedString = (String)tempString; qDebug() << "GuitarTuner::autoDetectTargetFrequency(): Detected string with index" << m_autoDetectedString; m_voiceAnalyzer->setFrequency(stringToFrequency(m_autoDetectedString)); emit autoDetectedStringChanged(m_autoDetectedString); } } QML_DECLARE_TYPE(GuitarTuner)
[ "robotex@robotex-laptop.(none)" ]
robotex@robotex-laptop.(none)
93f47a60826c91335d4a0f73649851d26833a3b4
2f87c6e0b94f32fe2b92b1f98ae79c51fe6ef4f6
/Multithreading 3/task.h
2156c3e935ba6d2bfe830dad25b39ce50c3fddc6
[]
no_license
Edacth/ComplexGameSystems
101b558f6f17ec55031557cc0c82643c0556b76e
8e151e86eaf55cb6073b7380d04b2e1d93e752fe
refs/heads/master
2020-09-06T07:34:48.895328
2019-11-21T23:10:03
2019-11-21T23:10:03
220,365,329
0
0
null
null
null
null
UTF-8
C++
false
false
2,609
h
/* @brief task.h Task simulates a single game engine sub-system. Holds and tracks imposter data for simulating processing time taken by a task on a thread. @note This will only work in debug mode as the optimise notices the delay loop does nothing computationally and removes it. */ #pragma once #ifndef TASK_H #define TASK_H #include <chrono> // To measure time #include <string> // For names /* @brief Type alias for timestamp short hand */ using time_point = std::chrono::high_resolution_clock::time_point; class task { public: /* @brief Default constructor explicityly unavailable. @note what would be a default task? */ task() = delete; /* @brief Our only constructor for task creation @param Task/system name @param How long this task takes to execute in seconds @param The chance of this task executing on any given frame as a ratio */ task(const std::string& a_task_name, float a_execution_time, float a_execution_chance = 1.0f); /* @brief Runs a loop blocking the thread for the task's duration. Updates internals. */ void execute(); /* @brief Outputs frame time to console */ void display_average_frame_time() const; /* @brief Outputs frame rate to console */ void display_average_frame_rate() const; /* @brief Read access to frame time in seconds @return frame time in seconds */ float get_frame_time() const; /* @brief Read access to average frame time in seconds @return average frame time in seconds */ float get_average_frame_time() const; /* @brief Read access to current frames per second @return current frames per second */ float get_frame_rate() const; /* @brief Read access to average frames per second @return average frames per second */ float get_average_frame_rate() const; private: /* @brief The name of this system / task */ std::string m_task_name; /* @brief How long this task takes to execute in seconds */ float m_execute_time; /* @brief Frequency of this task's execution as a ratio */ float m_execute_chance; /* @brief Current measure of how long it takes to process a frame on this task's thread */ float m_frame_time; /* @brief Current measure of this task's thread's average frame time */ float m_average_frame_time; /* @brief Measures to a second, acts as a marker to caluclate averages */ float m_cumulative_frame_time; /* @brief Accumulates frame count for the last second. */ int m_cumulative_frame_count; /* @brief Time stamp for the last time this task started */ time_point m_last_executed; }; #endif // !TASK_H
[ "cadeanderson99@gmail.com" ]
cadeanderson99@gmail.com
f243388eab842f4e62ae7527963d43b70ef7f3a8
f00c5e6ce16e0fba1675704754f09aa71914ec0d
/Framework_2020/Framework/TimeManager.h
9fed87ef23852ee3557813d39f87109951cc50bc
[]
no_license
cometj03/CCTI_Game
2ae10dced0ae26de7439818e995c68ff51209e6d
549aec23441aaba6105388f37ba3e24095d83eec
refs/heads/master
2023-01-23T03:04:39.682262
2020-12-04T16:16:20
2020-12-04T16:16:20
null
0
0
null
null
null
null
UHC
C++
false
false
301
h
#pragma once //시간을 계산하기 위한 클래스입니다. //Framework 클래스에서 사용합니다. class TimeManager { friend class Framework; public: TimeManager(); ~TimeManager(); private: static float deltaTime; static void UpdateTime(); public: static float GetDeltaTime(); };
[ "48352078+XxCtrlZxX@users.noreply.github.com" ]
48352078+XxCtrlZxX@users.noreply.github.com
64a1bde7f1afcfc7b3bdf840ead8cb44a8bc329a
0ecf2d067e8fe6cdec12b79bfd68fe79ec222ffd
/chrome/browser/supervised_user/supervised_user_service.cc
6f7791f3231a7db443db99b4641bf123890dd3d2
[ "BSD-3-Clause" ]
permissive
yachtcaptain23/browser-android-tabs
e5144cee9141890590d6d6faeb1bdc5d58a6cbf1
a016aade8f8333c822d00d62738a922671a52b85
refs/heads/master
2021-04-28T17:07:06.955483
2018-09-26T06:22:11
2018-09-26T06:22:11
122,005,560
0
0
NOASSERTION
2019-05-17T19:37:59
2018-02-19T01:00:10
null
UTF-8
C++
false
false
39,837
cc
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/supervised_user/supervised_user_service.h" #include <utility> #include "base/feature_list.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/memory/ref_counted.h" #include "base/metrics/user_metrics.h" #include "base/path_service.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/task_scheduler/post_task.h" #include "base/version.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" #include "chrome/browser/supervised_user/experimental/supervised_user_filtering_switches.h" #include "chrome/browser/supervised_user/permission_request_creator.h" #include "chrome/browser/supervised_user/supervised_user_constants.h" #include "chrome/browser/supervised_user/supervised_user_features.h" #include "chrome/browser/supervised_user/supervised_user_service_factory.h" #include "chrome/browser/supervised_user/supervised_user_service_observer.h" #include "chrome/browser/supervised_user/supervised_user_settings_service.h" #include "chrome/browser/supervised_user/supervised_user_settings_service_factory.h" #include "chrome/browser/supervised_user/supervised_user_site_list.h" #include "chrome/browser/supervised_user/supervised_user_whitelist_service.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" #include "components/browser_sync/profile_sync_service.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h" #include "components/signin/core/browser/profile_oauth2_token_service.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/storage_partition.h" #include "extensions/buildflags/buildflags.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "services/network/public/cpp/shared_url_loader_factory.h" #include "ui/base/l10n/l10n_util.h" #if !defined(OS_ANDROID) #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service_factory.h" #endif #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" #include "components/user_manager/user_manager.h" #endif #if BUILDFLAG(ENABLE_EXTENSIONS) #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_util.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #endif using base::UserMetricsAction; #if BUILDFLAG(ENABLE_EXTENSIONS) using extensions::Extension; using extensions::ExtensionPrefs; using extensions::ExtensionRegistry; using extensions::ExtensionSystem; #endif #if BUILDFLAG(ENABLE_EXTENSIONS) using extensions::ExtensionPrefs; #endif namespace { // The URL from which to download a host blacklist if no local one exists yet. const char kBlacklistURL[] = "https://www.gstatic.com/chrome/supervised_user/blacklist-20141001-1k.bin"; // The filename under which we'll store the blacklist (in the user data dir). const char kBlacklistFilename[] = "su-blacklist.bin"; const char* const kCustodianInfoPrefs[] = { prefs::kSupervisedUserCustodianName, prefs::kSupervisedUserCustodianEmail, prefs::kSupervisedUserCustodianProfileImageURL, prefs::kSupervisedUserCustodianProfileURL, prefs::kSupervisedUserSecondCustodianName, prefs::kSupervisedUserSecondCustodianEmail, prefs::kSupervisedUserSecondCustodianProfileImageURL, prefs::kSupervisedUserSecondCustodianProfileURL, }; void CreateURLAccessRequest(const GURL& url, PermissionRequestCreator* creator, SupervisedUserService::SuccessCallback callback) { creator->CreateURLAccessRequest(url, std::move(callback)); } void CreateExtensionInstallRequest( const std::string& id, PermissionRequestCreator* creator, SupervisedUserService::SuccessCallback callback) { creator->CreateExtensionInstallRequest(id, std::move(callback)); } void CreateExtensionUpdateRequest( const std::string& id, PermissionRequestCreator* creator, SupervisedUserService::SuccessCallback callback) { creator->CreateExtensionUpdateRequest(id, std::move(callback)); } // Default callback for AddExtensionInstallRequest. void ExtensionInstallRequestSent(const std::string& id, bool success) { VLOG_IF(1, !success) << "Failed sending install request for " << id; } // Default callback for AddExtensionUpdateRequest. void ExtensionUpdateRequestSent(const std::string& id, bool success) { VLOG_IF(1, !success) << "Failed sending update request for " << id; } base::FilePath GetBlacklistPath() { base::FilePath blacklist_dir; base::PathService::Get(chrome::DIR_USER_DATA, &blacklist_dir); return blacklist_dir.AppendASCII(kBlacklistFilename); } } // namespace SupervisedUserService::~SupervisedUserService() { DCHECK(!did_init_ || did_shutdown_); url_filter_.RemoveObserver(this); } // static void SupervisedUserService::RegisterProfilePrefs( user_prefs::PrefRegistrySyncable* registry) { registry->RegisterDictionaryPref(prefs::kSupervisedUserApprovedExtensions); registry->RegisterDictionaryPref(prefs::kSupervisedUserManualHosts); registry->RegisterDictionaryPref(prefs::kSupervisedUserManualURLs); registry->RegisterIntegerPref(prefs::kDefaultSupervisedUserFilteringBehavior, SupervisedUserURLFilter::ALLOW); registry->RegisterBooleanPref(prefs::kSupervisedUserCreationAllowed, true); registry->RegisterBooleanPref(prefs::kSupervisedUserSafeSites, true); for (const char* pref : kCustodianInfoPrefs) { registry->RegisterStringPref(pref, std::string()); } } void SupervisedUserService::Init() { DCHECK(!did_init_); did_init_ = true; DCHECK(GetSettingsService()->IsReady()); pref_change_registrar_.Init(profile_->GetPrefs()); pref_change_registrar_.Add( prefs::kSupervisedUserId, base::Bind(&SupervisedUserService::OnSupervisedUserIdChanged, base::Unretained(this))); pref_change_registrar_.Add( prefs::kForceSessionSync, base::Bind(&SupervisedUserService::OnForceSessionSyncChanged, base::Unretained(this))); browser_sync::ProfileSyncService* sync_service = ProfileSyncServiceFactory::GetForProfile(profile_); // Can be null in tests. if (sync_service) sync_service->AddPreferenceProvider(this); std::string client_id = component_updater::SupervisedUserWhitelistInstaller:: ClientIdForProfilePath(profile_->GetPath()); whitelist_service_.reset(new SupervisedUserWhitelistService( profile_->GetPrefs(), g_browser_process->supervised_user_whitelist_installer(), client_id)); whitelist_service_->AddSiteListsChangedCallback( base::Bind(&SupervisedUserService::OnSiteListsChanged, weak_ptr_factory_.GetWeakPtr())); SetActive(ProfileIsSupervised()); } void SupervisedUserService::SetDelegate(Delegate* delegate) { if (delegate) { // Changing delegates isn't allowed. DCHECK(!delegate_); } else { // If the delegate is removed, deactivate first to give the old delegate a // chance to clean up. SetActive(false); } delegate_ = delegate; } SupervisedUserURLFilter* SupervisedUserService::GetURLFilter() { return &url_filter_; } SupervisedUserWhitelistService* SupervisedUserService::GetWhitelistService() { return whitelist_service_.get(); } bool SupervisedUserService::AccessRequestsEnabled() { return FindEnabledPermissionRequestCreator(0) < permissions_creators_.size(); } void SupervisedUserService::AddURLAccessRequest(const GURL& url, SuccessCallback callback) { GURL effective_url = url_filter_.GetEmbeddedURL(url); if (!effective_url.is_valid()) effective_url = url; AddPermissionRequestInternal( base::BindRepeating(CreateURLAccessRequest, SupervisedUserURLFilter::Normalize(effective_url)), std::move(callback), 0); } void SupervisedUserService::ReportURL(const GURL& url, SuccessCallback callback) { if (url_reporter_) url_reporter_->ReportUrl(url, std::move(callback)); else std::move(callback).Run(false); } void SupervisedUserService::AddExtensionInstallRequest( const std::string& extension_id, const base::Version& version, SuccessCallback callback) { std::string id = GetExtensionRequestId(extension_id, version); AddPermissionRequestInternal( base::BindRepeating(CreateExtensionInstallRequest, id), std::move(callback), 0); } void SupervisedUserService::AddExtensionInstallRequest( const std::string& extension_id, const base::Version& version) { std::string id = GetExtensionRequestId(extension_id, version); AddExtensionInstallRequest(extension_id, version, base::BindOnce(ExtensionInstallRequestSent, id)); } void SupervisedUserService::AddExtensionUpdateRequest( const std::string& extension_id, const base::Version& version, SuccessCallback callback) { std::string id = GetExtensionRequestId(extension_id, version); AddPermissionRequestInternal( base::BindRepeating(CreateExtensionUpdateRequest, id), std::move(callback), 0); } void SupervisedUserService::AddExtensionUpdateRequest( const std::string& extension_id, const base::Version& version) { std::string id = GetExtensionRequestId(extension_id, version); AddExtensionUpdateRequest(extension_id, version, base::BindOnce(ExtensionUpdateRequestSent, id)); } // static std::string SupervisedUserService::GetExtensionRequestId( const std::string& extension_id, const base::Version& version) { return base::StringPrintf("%s:%s", extension_id.c_str(), version.GetString().c_str()); } std::string SupervisedUserService::GetCustodianEmailAddress() const { std::string email = profile_->GetPrefs()->GetString( prefs::kSupervisedUserCustodianEmail); #if defined(OS_CHROMEOS) // |GetActiveUser()| can return null in unit tests. if (email.empty() && !!user_manager::UserManager::Get()->GetActiveUser()) { email = chromeos::ChromeUserManager::Get() ->GetSupervisedUserManager() ->GetManagerDisplayEmail(user_manager::UserManager::Get() ->GetActiveUser() ->GetAccountId() .GetUserEmail()); } #endif return email; } std::string SupervisedUserService::GetCustodianName() const { std::string name = profile_->GetPrefs()->GetString( prefs::kSupervisedUserCustodianName); #if defined(OS_CHROMEOS) // |GetActiveUser()| can return null in unit tests. if (name.empty() && !!user_manager::UserManager::Get()->GetActiveUser()) { name = base::UTF16ToUTF8( chromeos::ChromeUserManager::Get() ->GetSupervisedUserManager() ->GetManagerDisplayName(user_manager::UserManager::Get() ->GetActiveUser() ->GetAccountId() .GetUserEmail())); } #endif return name.empty() ? GetCustodianEmailAddress() : name; } std::string SupervisedUserService::GetSecondCustodianEmailAddress() const { return profile_->GetPrefs()->GetString( prefs::kSupervisedUserSecondCustodianEmail); } std::string SupervisedUserService::GetSecondCustodianName() const { std::string name = profile_->GetPrefs()->GetString( prefs::kSupervisedUserSecondCustodianName); return name.empty() ? GetSecondCustodianEmailAddress() : name; } base::string16 SupervisedUserService::GetExtensionsLockedMessage() const { return l10n_util::GetStringFUTF16(IDS_EXTENSIONS_LOCKED_SUPERVISED_USER, base::UTF8ToUTF16(GetCustodianName())); } #if !defined(OS_ANDROID) void SupervisedUserService::InitSync(const std::string& refresh_token) { ProfileOAuth2TokenService* token_service = ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); token_service->UpdateCredentials(supervised_users::kSupervisedUserPseudoEmail, refresh_token); } #endif // !defined(OS_ANDROID) void SupervisedUserService::AddNavigationBlockedCallback( const NavigationBlockedCallback& callback) { navigation_blocked_callbacks_.push_back(callback); } void SupervisedUserService::DidBlockNavigation( content::WebContents* web_contents) { for (const auto& callback : navigation_blocked_callbacks_) callback.Run(web_contents); } void SupervisedUserService::AddObserver( SupervisedUserServiceObserver* observer) { observer_list_.AddObserver(observer); } void SupervisedUserService::RemoveObserver( SupervisedUserServiceObserver* observer) { observer_list_.RemoveObserver(observer); } void SupervisedUserService::AddPermissionRequestCreator( std::unique_ptr<PermissionRequestCreator> creator) { permissions_creators_.push_back(std::move(creator)); } void SupervisedUserService::SetSafeSearchURLReporter( std::unique_ptr<SafeSearchURLReporter> reporter) { url_reporter_ = std::move(reporter); } bool SupervisedUserService::IncludesSyncSessionsType() const { return includes_sync_sessions_type_; } SupervisedUserService::SupervisedUserService(Profile* profile) : includes_sync_sessions_type_(true), profile_(profile), active_(false), delegate_(NULL), is_profile_active_(false), did_init_(false), did_shutdown_(false), blacklist_state_(BlacklistLoadState::NOT_LOADED), #if BUILDFLAG(ENABLE_EXTENSIONS) registry_observer_(this), #endif weak_ptr_factory_(this) { url_filter_.AddObserver(this); #if BUILDFLAG(ENABLE_EXTENSIONS) registry_observer_.Add(extensions::ExtensionRegistry::Get(profile)); #endif } void SupervisedUserService::SetActive(bool active) { if (active_ == active) return; active_ = active; if (!delegate_ || !delegate_->SetActive(active_)) { if (active_) { #if !defined(OS_ANDROID) ProfileOAuth2TokenService* token_service = ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); token_service->LoadCredentials( supervised_users::kSupervisedUserPseudoEmail); #else NOTREACHED(); #endif } } // Now activate/deactivate anything not handled by the delegate yet. #if !defined(OS_ANDROID) // Re-set the default theme to turn the SU theme on/off. ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile_); if (theme_service->UsingDefaultTheme() || theme_service->UsingSystemTheme()) theme_service->UseDefaultTheme(); #endif browser_sync::ProfileSyncService* sync_service = ProfileSyncServiceFactory::GetForProfile(profile_); sync_service->SetEncryptEverythingAllowed(!active_); GetSettingsService()->SetActive(active_); #if BUILDFLAG(ENABLE_EXTENSIONS) SetExtensionsActive(); #endif if (active_) { pref_change_registrar_.Add( prefs::kDefaultSupervisedUserFilteringBehavior, base::BindRepeating( &SupervisedUserService::OnDefaultFilteringBehaviorChanged, base::Unretained(this))); #if BUILDFLAG(ENABLE_EXTENSIONS) pref_change_registrar_.Add( prefs::kSupervisedUserApprovedExtensions, base::BindRepeating(&SupervisedUserService::UpdateApprovedExtensions, base::Unretained(this))); #endif pref_change_registrar_.Add( prefs::kSupervisedUserSafeSites, base::BindRepeating(&SupervisedUserService::OnSafeSitesSettingChanged, base::Unretained(this))); pref_change_registrar_.Add( prefs::kSupervisedUserManualHosts, base::BindRepeating(&SupervisedUserService::UpdateManualHosts, base::Unretained(this))); pref_change_registrar_.Add( prefs::kSupervisedUserManualURLs, base::BindRepeating(&SupervisedUserService::UpdateManualURLs, base::Unretained(this))); for (const char* pref : kCustodianInfoPrefs) { pref_change_registrar_.Add( pref, base::BindRepeating(&SupervisedUserService::OnCustodianInfoChanged, base::Unretained(this))); } // Initialize the filter. OnDefaultFilteringBehaviorChanged(); OnSafeSitesSettingChanged(); whitelist_service_->Init(); UpdateManualHosts(); UpdateManualURLs(); #if BUILDFLAG(ENABLE_EXTENSIONS) UpdateApprovedExtensions(); #endif #if !defined(OS_ANDROID) // TODO(bauerb): Get rid of the platform-specific #ifdef here. // http://crbug.com/313377 BrowserList::AddObserver(this); #endif } else { permissions_creators_.clear(); url_reporter_.reset(); pref_change_registrar_.Remove( prefs::kDefaultSupervisedUserFilteringBehavior); #if BUILDFLAG(ENABLE_EXTENSIONS) pref_change_registrar_.Remove(prefs::kSupervisedUserApprovedExtensions); #endif pref_change_registrar_.Remove(prefs::kSupervisedUserManualHosts); pref_change_registrar_.Remove(prefs::kSupervisedUserManualURLs); for (const char* pref : kCustodianInfoPrefs) { pref_change_registrar_.Remove(pref); } url_filter_.Clear(); for (SupervisedUserServiceObserver& observer : observer_list_) observer.OnURLFilterChanged(); #if !defined(OS_ANDROID) // TODO(bauerb): Get rid of the platform-specific #ifdef here. // http://crbug.com/313377 BrowserList::RemoveObserver(this); #endif } } bool SupervisedUserService::ProfileIsSupervised() const { return profile_->IsSupervised(); } void SupervisedUserService::OnCustodianInfoChanged() { for (SupervisedUserServiceObserver& observer : observer_list_) observer.OnCustodianInfoChanged(); } SupervisedUserSettingsService* SupervisedUserService::GetSettingsService() { return SupervisedUserSettingsServiceFactory::GetForProfile(profile_); } size_t SupervisedUserService::FindEnabledPermissionRequestCreator( size_t start) { for (size_t i = start; i < permissions_creators_.size(); ++i) { if (permissions_creators_[i]->IsEnabled()) return i; } return permissions_creators_.size(); } void SupervisedUserService::AddPermissionRequestInternal( const CreatePermissionRequestCallback& create_request, SuccessCallback callback, size_t index) { // Find a permission request creator that is enabled. size_t next_index = FindEnabledPermissionRequestCreator(index); if (next_index >= permissions_creators_.size()) { std::move(callback).Run(false); return; } create_request.Run( permissions_creators_[next_index].get(), base::BindOnce(&SupervisedUserService::OnPermissionRequestIssued, weak_ptr_factory_.GetWeakPtr(), create_request, std::move(callback), next_index)); } void SupervisedUserService::OnPermissionRequestIssued( const CreatePermissionRequestCallback& create_request, SuccessCallback callback, size_t index, bool success) { if (success) { std::move(callback).Run(true); return; } AddPermissionRequestInternal(create_request, std::move(callback), index + 1); } void SupervisedUserService::OnSupervisedUserIdChanged() { SetActive(ProfileIsSupervised()); } void SupervisedUserService::OnDefaultFilteringBehaviorChanged() { int behavior_value = profile_->GetPrefs()->GetInteger( prefs::kDefaultSupervisedUserFilteringBehavior); SupervisedUserURLFilter::FilteringBehavior behavior = SupervisedUserURLFilter::BehaviorFromInt(behavior_value); url_filter_.SetDefaultFilteringBehavior(behavior); for (SupervisedUserServiceObserver& observer : observer_list_) observer.OnURLFilterChanged(); } void SupervisedUserService::OnSafeSitesSettingChanged() { bool use_blacklist = supervised_users::IsSafeSitesBlacklistEnabled(profile_); if (use_blacklist != url_filter_.HasBlacklist()) { if (use_blacklist && blacklist_state_ == BlacklistLoadState::NOT_LOADED) { LoadBlacklist(GetBlacklistPath(), GURL(kBlacklistURL)); } else if (!use_blacklist || blacklist_state_ == BlacklistLoadState::LOADED) { // Either the blacklist was turned off, or it was turned on but has // already been loaded previously. Just update the setting. UpdateBlacklist(); } // Else: The blacklist was enabled, but the load is already in progress. // Do nothing - we'll check the setting again when the load finishes. } bool use_online_check = supervised_users::IsSafeSitesOnlineCheckEnabled(profile_); if (use_online_check != url_filter_.HasAsyncURLChecker()) { if (use_online_check) url_filter_.InitAsyncURLChecker( content::BrowserContext::GetDefaultStoragePartition(profile_) ->GetURLLoaderFactoryForBrowserProcess()); else url_filter_.ClearAsyncURLChecker(); } } void SupervisedUserService::OnSiteListsChanged( const std::vector<scoped_refptr<SupervisedUserSiteList> >& site_lists) { whitelists_ = site_lists; url_filter_.LoadWhitelists(site_lists); } void SupervisedUserService::LoadBlacklist(const base::FilePath& path, const GURL& url) { DCHECK(blacklist_state_ == BlacklistLoadState::NOT_LOADED); blacklist_state_ = BlacklistLoadState::LOAD_STARTED; base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND, base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, base::BindOnce(&base::PathExists, path), base::BindOnce(&SupervisedUserService::OnBlacklistFileChecked, weak_ptr_factory_.GetWeakPtr(), path, url)); } void SupervisedUserService::OnBlacklistFileChecked(const base::FilePath& path, const GURL& url, bool file_exists) { DCHECK(blacklist_state_ == BlacklistLoadState::LOAD_STARTED); if (file_exists) { LoadBlacklistFromFile(path); return; } DCHECK(!blacklist_downloader_); // Create traffic annotation tag. net::NetworkTrafficAnnotationTag traffic_annotation = net::DefineNetworkTrafficAnnotation("supervised_users_blacklist", R"( semantics { sender: "Supervised Users" description: "Downloads a static blacklist consisting of hostname hashes of " "common inappropriate websites. This is only enabled for child " "accounts and only if the corresponding setting is enabled by the " "parent." trigger: "The file is downloaded on demand if the child account profile is " "created and the setting is enabled." data: "No additional data is sent to the server beyond the request " "itself." destination: GOOGLE_OWNED_SERVICE } policy { cookies_allowed: NO setting: "The feature can be remotely enabled or disabled by the parent. In " "addition, if sign-in is restricted to accounts from a managed " "domain, those accounts are not going to be child accounts." chrome_policy { RestrictSigninToPattern { policy_options {mode: MANDATORY} RestrictSigninToPattern: "*@manageddomain.com" } } })"); auto factory = content::BrowserContext::GetDefaultStoragePartition(profile_) ->GetURLLoaderFactoryForBrowserProcess(); blacklist_downloader_.reset(new FileDownloader( url, path, false, std::move(factory), base::BindOnce(&SupervisedUserService::OnBlacklistDownloadDone, base::Unretained(this), path), traffic_annotation)); } void SupervisedUserService::LoadBlacklistFromFile(const base::FilePath& path) { DCHECK(blacklist_state_ == BlacklistLoadState::LOAD_STARTED); blacklist_.ReadFromFile( path, base::Bind(&SupervisedUserService::OnBlacklistLoaded, base::Unretained(this))); } void SupervisedUserService::OnBlacklistDownloadDone( const base::FilePath& path, FileDownloader::Result result) { DCHECK(blacklist_state_ == BlacklistLoadState::LOAD_STARTED); if (FileDownloader::IsSuccess(result)) { LoadBlacklistFromFile(path); } else { LOG(WARNING) << "Blacklist download failed"; // TODO(treib): Retry downloading after some time? } blacklist_downloader_.reset(); } void SupervisedUserService::OnBlacklistLoaded() { DCHECK(blacklist_state_ == BlacklistLoadState::LOAD_STARTED); blacklist_state_ = BlacklistLoadState::LOADED; UpdateBlacklist(); } void SupervisedUserService::UpdateBlacklist() { bool use_blacklist = supervised_users::IsSafeSitesBlacklistEnabled(profile_); url_filter_.SetBlacklist(use_blacklist ? &blacklist_ : nullptr); for (SupervisedUserServiceObserver& observer : observer_list_) observer.OnURLFilterChanged(); } void SupervisedUserService::UpdateManualHosts() { const base::DictionaryValue* dict = profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUserManualHosts); std::map<std::string, bool> host_map; for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { bool allow = false; bool result = it.value().GetAsBoolean(&allow); DCHECK(result); host_map[it.key()] = allow; } url_filter_.SetManualHosts(std::move(host_map)); for (SupervisedUserServiceObserver& observer : observer_list_) observer.OnURLFilterChanged(); } void SupervisedUserService::UpdateManualURLs() { const base::DictionaryValue* dict = profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUserManualURLs); std::map<GURL, bool> url_map; for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { bool allow = false; bool result = it.value().GetAsBoolean(&allow); DCHECK(result); url_map[GURL(it.key())] = allow; } url_filter_.SetManualURLs(std::move(url_map)); for (SupervisedUserServiceObserver& observer : observer_list_) observer.OnURLFilterChanged(); } std::string SupervisedUserService::GetSupervisedUserName() const { #if defined(OS_CHROMEOS) // The active user can be NULL in unit tests. if (user_manager::UserManager::Get()->GetActiveUser()) { return base::UTF16ToUTF8( user_manager::UserManager::Get()->GetUserDisplayName( user_manager::UserManager::Get()->GetActiveUser()->GetAccountId())); } return std::string(); #else return profile_->GetPrefs()->GetString(prefs::kProfileName); #endif } void SupervisedUserService::OnForceSessionSyncChanged() { includes_sync_sessions_type_ = profile_->GetPrefs()->GetBoolean(prefs::kForceSessionSync); ProfileSyncServiceFactory::GetForProfile(profile_) ->ReconfigureDatatypeManager(); } void SupervisedUserService::Shutdown() { if (!did_init_) return; DCHECK(!did_shutdown_); did_shutdown_ = true; if (ProfileIsSupervised()) { base::RecordAction(UserMetricsAction("ManagedUsers_QuitBrowser")); } SetActive(false); browser_sync::ProfileSyncService* sync_service = ProfileSyncServiceFactory::GetForProfile(profile_); // Can be null in tests. if (sync_service) sync_service->RemovePreferenceProvider(this); } #if BUILDFLAG(ENABLE_EXTENSIONS) SupervisedUserService::ExtensionState SupervisedUserService::GetExtensionState( const Extension& extension) const { bool was_installed_by_default = extension.was_installed_by_default(); #if defined(OS_CHROMEOS) // On Chrome OS all external sources are controlled by us so it means that // they are "default". Method was_installed_by_default returns false because // extensions creation flags are ignored in case of default extensions with // update URL(the flags aren't passed to OnExternalExtensionUpdateUrlFound). // TODO(dpolukhin): remove this Chrome OS specific code as soon as creation // flags are not ignored. was_installed_by_default = extensions::Manifest::IsExternalLocation(extension.location()); #endif // Note: Component extensions are protected from modification/uninstallation // anyway, so there's no need to enforce them again for supervised users. // Also, leave policy-installed extensions alone - they have their own // management; in particular we don't want to override the force-install list. if (extensions::Manifest::IsComponentLocation(extension.location()) || extensions::Manifest::IsPolicyLocation(extension.location()) || extension.is_theme() || extension.from_bookmark() || extension.is_shared_module() || was_installed_by_default) { return ExtensionState::ALLOWED; } if (extensions::util::WasInstalledByCustodian(extension.id(), profile_)) return ExtensionState::FORCED; if (!base::FeatureList::IsEnabled( supervised_users::kSupervisedUserInitiatedExtensionInstall)) { return ExtensionState::BLOCKED; } auto extension_it = approved_extensions_map_.find(extension.id()); // If the installed version is approved, then the extension is allowed, // otherwise, it requires approval. if (extension_it != approved_extensions_map_.end() && extension_it->second == extension.version()) { return ExtensionState::ALLOWED; } return ExtensionState::REQUIRE_APPROVAL; } std::string SupervisedUserService::GetDebugPolicyProviderName() const { // Save the string space in official builds. #if DCHECK_IS_ON() return "Supervised User Service"; #else IMMEDIATE_CRASH(); #endif } bool SupervisedUserService::UserMayLoad(const Extension* extension, base::string16* error) const { DCHECK(ProfileIsSupervised()); ExtensionState result = GetExtensionState(*extension); bool may_load = result != ExtensionState::BLOCKED; if (!may_load && error) *error = GetExtensionsLockedMessage(); return may_load; } bool SupervisedUserService::UserMayModifySettings(const Extension* extension, base::string16* error) const { DCHECK(ProfileIsSupervised()); ExtensionState result = GetExtensionState(*extension); // While the following check allows the supervised user to modify the settings // and enable or disable the extension, MustRemainDisabled properly takes care // of keeping an extension disabled when required. // For custodian-installed extensions, the state is always FORCED, even if // it's waiting for an update approval. bool may_modify = result != ExtensionState::FORCED; if (!may_modify && error) *error = GetExtensionsLockedMessage(); return may_modify; } // Note: Having MustRemainInstalled always say "true" for custodian-installed // extensions does NOT prevent remote uninstalls (which is a bit unexpected, but // exactly what we want). bool SupervisedUserService::MustRemainInstalled(const Extension* extension, base::string16* error) const { DCHECK(ProfileIsSupervised()); ExtensionState result = GetExtensionState(*extension); bool may_not_uninstall = result == ExtensionState::FORCED; if (may_not_uninstall && error) *error = GetExtensionsLockedMessage(); return may_not_uninstall; } bool SupervisedUserService::MustRemainDisabled( const Extension* extension, extensions::disable_reason::DisableReason* reason, base::string16* error) const { DCHECK(ProfileIsSupervised()); ExtensionState state = GetExtensionState(*extension); // Only extensions that require approval should be disabled. // Blocked extensions should be not loaded at all, and are taken care of // at UserMayLoad. bool must_remain_disabled = state == ExtensionState::REQUIRE_APPROVAL; if (must_remain_disabled) { if (error) *error = GetExtensionsLockedMessage(); // If the extension must remain disabled due to permission increase, // then the update request has been already sent at update time. // We do nothing and we don't add an extra disable reason. ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile_); if (extension_prefs->HasDisableReason( extension->id(), extensions::disable_reason::DISABLE_PERMISSIONS_INCREASE)) { if (reason) *reason = extensions::disable_reason::DISABLE_PERMISSIONS_INCREASE; return true; } if (reason) *reason = extensions::disable_reason::DISABLE_CUSTODIAN_APPROVAL_REQUIRED; if (base::FeatureList::IsEnabled( supervised_users::kSupervisedUserInitiatedExtensionInstall)) { // If the Extension isn't pending a custodian approval already, send // an approval request. if (!extension_prefs->HasDisableReason( extension->id(), extensions::disable_reason:: DISABLE_CUSTODIAN_APPROVAL_REQUIRED)) { // MustRemainDisabled is a const method and hence cannot call // AddExtensionInstallRequest directly. SupervisedUserService* supervised_user_service = SupervisedUserServiceFactory::GetForProfile(profile_); supervised_user_service->AddExtensionInstallRequest( extension->id(), extension->version()); } } } return must_remain_disabled; } void SupervisedUserService::OnExtensionInstalled( content::BrowserContext* browser_context, const extensions::Extension* extension, bool is_update) { // This callback method is responsible for updating extension state and // approved_extensions_map_ upon extension updates. if (!is_update) return; ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile_); const std::string& id = extension->id(); const base::Version& version = extension->version(); // If an already approved extension is updated without requiring // new permissions, we update the approved_version. if (!extension_prefs->HasDisableReason( id, extensions::disable_reason::DISABLE_PERMISSIONS_INCREASE) && approved_extensions_map_.count(id) > 0 && approved_extensions_map_[id] < version) { approved_extensions_map_[id] = version; std::string key = SupervisedUserSettingsService::MakeSplitSettingKey( supervised_users::kApprovedExtensions, id); std::unique_ptr<base::Value> version_value( new base::Value(version.GetString())); GetSettingsService()->UpdateSetting(key, std::move(version_value)); } // Upon extension update, the approved version may (or may not) match the // installed one. Therefore, a change in extension state might be required. ChangeExtensionStateIfNecessary(id); } void SupervisedUserService::UpdateApprovedExtensions() { const base::DictionaryValue* dict = profile_->GetPrefs()->GetDictionary( prefs::kSupervisedUserApprovedExtensions); // Keep track of currently approved extensions. We may need to disable them if // they are not in the approved map anymore. std::set<std::string> extensions_to_be_checked; for (const auto& extension : approved_extensions_map_) extensions_to_be_checked.insert(extension.first); approved_extensions_map_.clear(); for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { std::string version_str; bool result = it.value().GetAsString(&version_str); DCHECK(result); base::Version version(version_str); if (version.IsValid()) { approved_extensions_map_[it.key()] = version; extensions_to_be_checked.insert(it.key()); } else { LOG(WARNING) << "Invalid version number " << version_str; } } for (const auto& extension_id : extensions_to_be_checked) { ChangeExtensionStateIfNecessary(extension_id); } } void SupervisedUserService::ChangeExtensionStateIfNecessary( const std::string& extension_id) { ExtensionRegistry* registry = ExtensionRegistry::Get(profile_); const Extension* extension = registry->GetInstalledExtension(extension_id); // If the extension is not installed (yet), do nothing. // Things will be handled after installation. if (!extension) return; ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile_); extensions::ExtensionService* service = ExtensionSystem::Get(profile_)->extension_service(); ExtensionState state = GetExtensionState(*extension); switch (state) { // BLOCKED/FORCED extensions should be already disabled/enabled // and we don't need to change their state here. case ExtensionState::BLOCKED: case ExtensionState::FORCED: break; case ExtensionState::REQUIRE_APPROVAL: service->DisableExtension( extension_id, extensions::disable_reason::DISABLE_CUSTODIAN_APPROVAL_REQUIRED); break; case ExtensionState::ALLOWED: extension_prefs->RemoveDisableReason( extension_id, extensions::disable_reason::DISABLE_CUSTODIAN_APPROVAL_REQUIRED); extension_prefs->RemoveDisableReason( extension_id, extensions::disable_reason::DISABLE_PERMISSIONS_INCREASE); // If not disabled for other reasons, enable it. if (extension_prefs->GetDisableReasons(extension_id) == extensions::disable_reason::DISABLE_NONE) { service->EnableExtension(extension_id); } break; } } void SupervisedUserService::SetExtensionsActive() { extensions::ExtensionSystem* extension_system = extensions::ExtensionSystem::Get(profile_); extensions::ManagementPolicy* management_policy = extension_system->management_policy(); if (management_policy) { if (active_) management_policy->RegisterProvider(this); else management_policy->UnregisterProvider(this); // Re-check the policy to make sure any new settings get applied. extension_system->extension_service()->CheckManagementPolicy(); } } #endif // BUILDFLAG(ENABLE_EXTENSIONS) syncer::ModelTypeSet SupervisedUserService::GetPreferredDataTypes() const { if (!ProfileIsSupervised()) return syncer::ModelTypeSet(); syncer::ModelTypeSet result; if (IncludesSyncSessionsType()) result.Put(syncer::SESSIONS); result.Put(syncer::EXTENSIONS); result.Put(syncer::EXTENSION_SETTINGS); result.Put(syncer::APPS); result.Put(syncer::APP_SETTINGS); result.Put(syncer::APP_NOTIFICATIONS); result.Put(syncer::APP_LIST); return result; } #if !defined(OS_ANDROID) void SupervisedUserService::OnBrowserSetLastActive(Browser* browser) { bool profile_became_active = profile_->IsSameProfile(browser->profile()); if (!is_profile_active_ && profile_became_active) base::RecordAction(UserMetricsAction("ManagedUsers_OpenProfile")); else if (is_profile_active_ && !profile_became_active) base::RecordAction(UserMetricsAction("ManagedUsers_SwitchProfile")); is_profile_active_ = profile_became_active; } #endif // !defined(OS_ANDROID) void SupervisedUserService::OnSiteListUpdated() { for (SupervisedUserServiceObserver& observer : observer_list_) observer.OnURLFilterChanged(); }
[ "artem@brave.com" ]
artem@brave.com
add0c8c48078fb06be09511450fdecdf00f528f5
a76fc4b155b155bb59a14a82b5939a30a9f74eca
/Atelier Courrier/CreusetExt/Creuset/ATPResultHypo_C1.cpp
5d9d2d04910eb74aefddb213afadd360f6f1de48
[]
no_license
isliulin/JFC-Tools
aade33337153d7cc1b5cfcd33744d89fe2d56b79
98b715b78ae5c01472ef595b1faa5531f356e794
refs/heads/master
2023-06-01T12:10:51.383944
2021-06-17T14:41:07
2021-06-17T14:41:07
null
0
0
null
null
null
null
ISO-8859-1
C++
false
false
3,132
cpp
// on inclut les définitions nécessaires #include "stdafx.h" #include "ATPResultHypo_Metriques.h" #include "ATPResult_Grandeurs.h" #include "ATPResultHypo_C1.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ////////////////// // le constructeur CATPResultHypo_C1::CATPResultHypo_C1() { // on initialise le document m_pATPDocCreuset = 0; } /////////////////////////////////////// // la fonction pour définir le document JVoid CATPResultHypo_C1::SetDocument(JATPDocCreuset* pATPDocCreuset) { // on mémorise le document m_pATPDocCreuset = pATPDocCreuset; // on met à jour le composant this->OnUpdate(); } ////////////////////////////////////////////// // la fonction pour mettre à jour le composant JVoid CATPResultHypo_C1::Update() { // on met à jour le composant this->OnUpdate(); } ///////////////// // le destructeur CATPResultHypo_C1::~CATPResultHypo_C1() { // on ne fait rien } BEGIN_MESSAGE_MAP(CATPResultHypo_C1, JFCGrid) //{{AFX_MSG_MAP(CATPResultHypo_C1) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////// // la fonction pour dessiner l'intérieur des cellules JVoid CATPResultHypo_C1::OnDrawCell(CDC & dc, RECT & rect, LONG i, LONG j, CBrush & BrushA, CBrush & BrushB, CBrush & BrushC, CBrush & BrushD) { // on calcule le rectangle RECT Rect; Rect.left = rect.left - 3; Rect.right = rect.right + 3; Rect.top = rect.top - 2; Rect.bottom = rect.bottom + 1; // on dessine le fond de la cellule CString TxtHeaderCol; TxtHeaderCol.FormatMessage(IDS_CR_PM); if (m_pATPDocCreuset->m_AFFContribution_New.IsVisible()) { TxtHeaderCol.FormatMessage(IDS_CR_GRANDEUR); } // on crée le pinceau pour les insertions en arrière plan CBrush BrushG; BrushG.CreateSolidBrush(CATPColors::GetColorMedium(CATPColors::COLORCREUSET)); // dc.FillRect(&Rect, &BrushB); static COLORREF clr_degrad[CATPColors::m_NbGrad]; CATPColors::GetColorDarkGraduation(CATPColors::COLORCREUSET, clr_degrad, CATPColors::m_NbGrad); CATPColors::FillRectGraduateWithSurround(dc, Rect, clr_degrad, CATPColors::m_NbGrad,CATPColors::STYLE_DEGRAD::FROM_TOP_DEGRAD, CATPColors::COLORCREUSET); LONG OldCol = dc.SetTextColor(CATPColors::GetColorSuperDark(CATPColors::COLORCREUSET)); dc.DrawText(_T(TxtHeaderCol), &rect, DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE); dc.SetTextColor(OldCol); } ////////////////////////////////////////////// // la fonction pour appliquer les mises à jour JVoid CATPResultHypo_C1::OnUpdate() { // on initialise le nombre d'éléments LONG xHyp = 1; LONG yGrandeur = 1; // on met à jour le composant this->SetHorzCount(xHyp, FALSE); this->SetVertCount(yGrandeur, TRUE); } /////////////////////////////////////// // CATPResultHypo_C1 message handlers void CATPResultHypo_C1::PreSubclassWindow() { // on appelle le gestionnaire de base this->JFCGrid::PreSubclassWindow(); // on initialise la taille des cellules this->SetHorzItemSize(CATPResultHypo_Metriques::CX_Bx(), TRUE, FALSE); this->SetVertItemSize(2*CATPResultHypo_Metriques::CY_x1(), TRUE, FALSE); }
[ "alain.chambard@kantarmedia.com" ]
alain.chambard@kantarmedia.com
e9373785de559795f5ebab478ad005106034e151
a673387437f57c45a1673170ce7cad9de9bc7f9c
/Classes/RankBirdLayer.h
811b0f39c74c52a19fce38fe09206d89d275100b
[]
no_license
icsfy/cocos2d-x_FruitandBird
cba1507065c4e766c29599c59c162f6450f41f1a
9b49ac1c351383fed3dfd81833940bed83acc9f9
refs/heads/master
2020-12-31T07:41:28.345523
2017-04-02T08:42:32
2017-04-02T08:42:32
86,539,470
5
3
null
null
null
null
UTF-8
C++
false
false
634
h
#ifndef _RankBirdLayer_H_ #define _RankBirdLayer_H_ #include "cocos2d.h" #include "GameSceneManager.h" using namespace cocos2d; class RankBirdLayer : public Layer { public: std::string scoreBird[5]; // 记录分数的字符串数组 Label* labels; // 显示分数的文本 GameSceneManager* sceneManager; // 场景管理器 public: virtual bool init(); // 初始化布景 void save(int); // 记录分数 void load(); // 读取分数 void menuCallBack0(Ref* pSender); // 切换到主菜单场景 void menuCallBack1(Ref* pSender); // 切换到下一个排行榜场景 CREATE_FUNC(RankBirdLayer); }; #endif
[ "1294433495@qq.com" ]
1294433495@qq.com
fcaba27a40ff92d5e8b05342dfcd1c387f9c9584
1286c5b3d37b0785e99073c8234b44df47561f5a
/2020/0615_ABC170/past/F2.cpp
b3e56ad615ebf36d72fecd51a3c52ec4c2c63dc5
[ "MIT" ]
permissive
kazunetakahashi/atcoder
930cb5a0f4378914cc643de2f0596a5de7e4a417
16ce65829ccc180260b19316e276c2fcf6606c53
refs/heads/master
2022-02-15T19:12:10.224368
2022-01-29T06:38:42
2022-01-29T06:38:42
26,685,318
7
1
null
null
null
null
UTF-8
C++
false
false
7,736
cpp
#define DEBUG 1 /** * File : F2.cpp * Author : Kazune Takahashi * Created : 6/15/2020, 11:46:33 PM * Powered by Visual Studio Code */ #include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <chrono> #include <climits> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <cstdlib> #include <functional> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> #include <vector> // ----- boost ----- #include <boost/rational.hpp> #include <boost/multiprecision/cpp_int.hpp> // ----- using directives and manipulations ----- using namespace std; using boost::rational; using boost::multiprecision::cpp_int; using ll = long long; using ld = long double; template <typename T> using max_heap = priority_queue<T>; template <typename T> using min_heap = priority_queue<T, vector<T>, greater<T>>; // ----- constexpr for Mint and Combination ----- constexpr ll MOD{1'000'000'007LL}; // constexpr ll MOD{998'244'353LL}; // be careful constexpr ll MAX_SIZE{3'000'010LL}; // constexpr ll MAX_SIZE{30'000'010LL}; // if 10^7 is needed // ----- ch_max and ch_min ----- template <typename T> bool ch_max(T &left, T right) { if (left < right) { left = right; return true; } return false; } template <typename T> bool ch_min(T &left, T right) { if (left > right) { left = right; return true; } return false; } // ----- Mint ----- template <ll MOD = MOD> class Mint { public: ll x; Mint() : x{0LL} {} Mint(ll x) : x{(x % MOD + MOD) % MOD} {} Mint operator-() const { return x ? MOD - x : 0; } Mint &operator+=(Mint const &a) { if ((x += a.x) >= MOD) { x -= MOD; } return *this; } Mint &operator-=(Mint const &a) { return *this += -a; } Mint &operator++() { return *this += 1; } Mint operator++(int) { Mint tmp{*this}; ++*this; return tmp; } Mint &operator--() { return *this -= 1; } Mint operator--(int) { Mint tmp{*this}; --*this; return tmp; } Mint &operator*=(Mint const &a) { (x *= a.x) %= MOD; return *this; } Mint &operator/=(Mint const &a) { Mint b{a}; return *this *= b.power(MOD - 2); } Mint operator+(Mint const &a) const { return Mint(*this) += a; } Mint operator-(Mint const &a) const { return Mint(*this) -= a; } Mint operator*(Mint const &a) const { return Mint(*this) *= a; } Mint operator/(Mint const &a) const { return Mint(*this) /= a; } bool operator<(Mint const &a) const { return x < a.x; } bool operator<=(Mint const &a) const { return x <= a.x; } bool operator>(Mint const &a) const { return x > a.x; } bool operator>=(Mint const &a) const { return x >= a.x; } bool operator==(Mint const &a) const { return x == a.x; } bool operator!=(Mint const &a) const { return !(*this == a); } Mint power(ll N) const { if (N == 0) { return 1; } else if (N % 2 == 1) { return *this * power(N - 1); } else { Mint half = power(N / 2); return half * half; } } }; template <ll MOD> Mint<MOD> operator+(ll lhs, Mint<MOD> const &rhs) { return rhs + lhs; } template <ll MOD> Mint<MOD> operator-(ll lhs, Mint<MOD> const &rhs) { return -rhs + lhs; } template <ll MOD> Mint<MOD> operator*(ll lhs, Mint<MOD> const &rhs) { return rhs * lhs; } template <ll MOD> Mint<MOD> operator/(ll lhs, Mint<MOD> const &rhs) { return Mint<MOD>{lhs} / rhs; } template <ll MOD> istream &operator>>(istream &stream, Mint<MOD> &a) { return stream >> a.x; } template <ll MOD> ostream &operator<<(ostream &stream, Mint<MOD> const &a) { return stream << a.x; } // ----- Combination ----- template <ll MOD = MOD, ll MAX_SIZE = MAX_SIZE> class Combination { public: vector<Mint<MOD>> inv, fact, factinv; Combination() : inv(MAX_SIZE), fact(MAX_SIZE), factinv(MAX_SIZE) { inv[1] = 1; for (auto i{2LL}; i < MAX_SIZE; i++) { inv[i] = (-inv[MOD % i]) * (MOD / i); } fact[0] = factinv[0] = 1; for (auto i{1LL}; i < MAX_SIZE; i++) { fact[i] = Mint<MOD>(i) * fact[i - 1]; factinv[i] = inv[i] * factinv[i - 1]; } } Mint<MOD> operator()(int n, int k) { if (n >= 0 && k >= 0 && n - k >= 0) { return fact[n] * factinv[k] * factinv[n - k]; } return 0; } Mint<MOD> catalan(int x, int y) { return (*this)(x + y, y) - (*this)(x + y, y - 1); } }; // ----- for C++14 ----- using mint = Mint<MOD>; using combination = Combination<MOD, MAX_SIZE>; template <typename T> T gcd(T x, T y) { return y ? gcd(y, x % y) : x; } template <typename T> T lcm(T x, T y) { return x / gcd(x, y) * y; } // ----- for C++17 ----- template <typename T> int popcount(T x) // C++20 { int ans{0}; while (x != 0) { ans += x & 1; x >>= 1; } return ans; } // ----- Infty ----- template <typename T> constexpr T Infty() { return numeric_limits<T>::max(); } template <typename T> constexpr T mInfty() { return numeric_limits<T>::min(); } // ----- frequently used constexpr ----- // constexpr double epsilon{1e-10}; // constexpr ll infty{1'000'000'000'000'010LL}; // or // constexpr int infty{1'000'000'010}; constexpr int dx[4] = {1, 0, -1, 0}; constexpr int dy[4] = {0, 1, 0, -1}; // ----- Yes() and No() ----- void Yes() { cout << "Yes" << endl; exit(0); } void No() { cout << "No" << endl; exit(0); } // ----- 2D, 3D, 4D vectors ----- // Referring to ymatsux-san's source code: https://atcoder.jp/contests/abc138/submissions/7018300 template <typename T> vector<vector<T>> Make2DVector(size_t d0, size_t d1, T v = T{}) { return vector<vector<T>>(d0, vector<T>(d1, v)); } template <typename T> vector<vector<vector<T>>> Make3DVector(size_t d0, size_t d1, size_t d2, T v = T{}) { return vector<vector<vector<T>>>(d0, Make2DVector(d1, d2, v)); } template <typename T> vector<vector<vector<vector<T>>>> Make4DVector(size_t d0, size_t d1, size_t d2, size_t d3, T v = T{}) { return vector<vector<vector<vector<T>>>>(d0, Make3DVector(d1, d2, d3, v)); } // ----- Solve ----- using Point = tuple<int, int>; class Solve { int H, W, K; vector<vector<int>> V; int sx, sy, gx, gy; public: Solve(int H, int W) : H{H}, W{W}, V{Make2DVector(H, W, Infty<int>())} { cin >> K; cin >> sx >> sy >> gx >> gy; --sx; --sy; --gx; --gy; for (auto i{0}; i < H; ++i) { for (auto j{0}; j < W; ++j) { char c; cin >> c; if (c == '@') { V[i][j] = -1; } } } } void flush() { queue<Point> Q; Q.push(Point{sx, sy}); V[sx][sy] = 0; while (!Q.empty()) { auto p{Q.front()}; auto [x, y] = p; Q.pop(); for (auto k{0}; k < 4; ++k) { for (auto i{1}; i <= K; ++i) { auto nx{x + dx[k] * i}; auto ny{y + dy[k] * i}; if (!valid(nx, ny)) { break; } else if (V[nx][ny] == Infty<int>()) { V[nx][ny] = V[x][y] + 1; Q.push(Point{nx, ny}); } else if (V[nx][ny] == V[x][y] + 1) { continue; } else { break; } } } } auto ans{V[gx][gy]}; if (ans == Infty<int>()) { cout << -1 << endl; } else { cout << ans << endl; } } private: bool valid(int x, int y) { return 0 <= x && x < H && 0 <= y && y < W && V[x][y] != -1; } }; // ----- main() ----- int main() { int H, W; cin >> H >> W; Solve solve(H, W); solve.flush(); }
[ "kazunetakahashi@gmail.com" ]
kazunetakahashi@gmail.com
f315506c4879ea9cf8f30611d0308f004adafc02
337f830cdc233ad239a5cc2f52c6562fbb671ea8
/case5cells/5.1/gradTz
69238e3c5e4f438e9e98adead0cae477fe1d4175
[]
no_license
j-avdeev/laplacianFoamF
dba31d0941c061b2435532cdfbd5a5b337e6ffe9
6e1504dc84780dc86076145c18862f1882078da5
refs/heads/master
2021-06-25T23:52:36.435909
2017-02-05T17:28:45
2017-02-05T17:28:45
26,997,393
0
0
null
null
null
null
UTF-8
C++
false
false
2,602
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "5.1"; object gradTz; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 -1 0 1 0 0 0]; internalField nonuniform List<scalar> 64 ( -0.0396715 -0.0396715 -0.0396715 -0.0396715 5 5 5 5 -1.22203e-08 -0.0396748 -0.0399959 -1.2167e-08 -1.22198e-08 -1.21675e-08 -0.0399991 -1.22203e-08 -0.0396748 -0.0399959 -1.2167e-08 -1.22198e-08 -1.21675e-08 -0.0399991 -1.22203e-08 -0.0399959 -0.0396748 -1.2167e-08 -1.21675e-08 -1.22198e-08 -0.0399991 -1.22203e-08 -0.0399959 -0.0396748 -1.2167e-08 -1.21675e-08 -1.22198e-08 -0.0399991 1.628e-06 1.628e-06 5 5 1.628e-06 1.628e-06 5 1.628e-06 1.628e-06 5 5 1.628e-06 1.628e-06 5 1.628e-06 1.628e-06 5 5 1.628e-06 1.628e-06 5 1.628e-06 1.628e-06 5 5 1.628e-06 1.628e-06 5 ) ; boundaryField { walls { type calculated; value nonuniform List<scalar> 64 ( -0.0396715 -0.0396715 -0.0396715 -0.0396715 5 5 -0.0396715 5 5 -0.0396715 -0.0396715 5 5 -0.0396715 5 5 -1.2167e-08 -1.21675e-08 -0.0396748 -1.2167e-08 -1.22198e-08 -0.0399959 -0.0399959 -1.22198e-08 -1.2167e-08 -0.0396748 -1.21675e-08 -1.2167e-08 5 1.628e-06 1.628e-06 1.628e-06 1.628e-06 5 -0.0396748 -1.21675e-08 -1.2167e-08 5 1.628e-06 1.628e-06 1.628e-06 1.628e-06 5 -0.0399959 -1.22198e-08 -1.2167e-08 -1.2167e-08 -1.22198e-08 -0.0399959 5 1.628e-06 1.628e-06 1.628e-06 1.628e-06 5 -1.2167e-08 -1.21675e-08 -0.0396748 5 1.628e-06 1.628e-06 1.628e-06 1.628e-06 5 ) ; } inlet { type calculated; value nonuniform List<scalar> 16 ( -0.079343 -0.079343 -0.079343 -0.079343 -0.0799917 -0.0799982 -0.0793495 -0.0793495 -0.0799982 -0.0799917 -0.0799917 -0.0799982 -0.0793495 -0.0793495 -0.0799982 -0.0799917 ) ; } outlet { type calculated; value uniform 10; } } // ************************************************************************* //
[ "j-avdeev@ya.ru" ]
j-avdeev@ya.ru
eb2a47d896694f3e002823a1a0d8672ae18858fc
70ad0fa3c3d5113fdd0ac1a1c1148749d8ac3510
/h1/13.cpp
747fab7a893e5392f2d637ca549215814a16f847
[]
no_license
SlightRemorse/VaskosBox
c15f2b77489a6f602c762daf8da8583e3074e45a
93e9646b6e37a84a0ba06f25d673438c044d34f0
refs/heads/master
2021-01-10T23:36:30.861521
2012-12-03T23:51:29
2012-12-03T23:51:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
527
cpp
//Vasil Bozhurski XIa #include <iostream> using namespace std; int x,y; void xnt() { do { cout << "Enter X [0<X<10]: "; cin >> x; }while((x<1) || (x>9)); } void zad13() { xnt(); int arr[10]; int sum; for(int i=0; i<10; i++) { sum=0; for(int b=0; b<=1000; b++) if(b%(x*(i+1))==0) sum+=b; arr[i]=sum; cout << "Arr[" << i << "]= " << arr[i] << endl; } return; } int main() { zad13(); system("PAUSE"); }
[ "slightremorse@gmail.com" ]
slightremorse@gmail.com
62d698fa6644ed8d97e6a96b5ae55c9260190552
351f6a4274ad800b0ac37815839f24222117ca91
/Typhoon/Intermediate/Build/Win64/UE4Editor/Inc/Typhoon/TyphoonCharacter.gen.cpp
9a833a4a17a1a59fe2c67f9e59c7d11e2326748c
[]
no_license
dynamiquel/Typhoon
aa1d8a2fa314f2b220e28163e81274e7632a6a1d
dee58d0214fba5bf13a22881619820b5aafe12d5
refs/heads/main
2023-03-17T02:09:41.930601
2021-03-02T20:18:38
2021-03-02T20:18:38
339,853,621
0
0
null
null
null
null
UTF-8
C++
false
false
10,950
cpp
// Copyright Epic Games, Inc. All Rights Reserved. /*=========================================================================== Generated code exported from UnrealHeaderTool. DO NOT modify this manually! Edit the corresponding .h files instead! ===========================================================================*/ #include "UObject/GeneratedCppIncludes.h" #include "Typhoon/TyphoonCharacter.h" #ifdef _MSC_VER #pragma warning (push) #pragma warning (disable : 4883) #endif PRAGMA_DISABLE_DEPRECATION_WARNINGS void EmptyLinkFunctionForGeneratedCodeTyphoonCharacter() {} // Cross Module References TYPHOON_API UClass* Z_Construct_UClass_ATyphoonCharacter_NoRegister(); TYPHOON_API UClass* Z_Construct_UClass_ATyphoonCharacter(); ENGINE_API UClass* Z_Construct_UClass_ACharacter(); UPackage* Z_Construct_UPackage__Script_Typhoon(); ENGINE_API UClass* Z_Construct_UClass_USpringArmComponent_NoRegister(); ENGINE_API UClass* Z_Construct_UClass_UCameraComponent_NoRegister(); // End Cross Module References DEFINE_FUNCTION(ATyphoonCharacter::execResetSpeed) { P_FINISH; P_NATIVE_BEGIN; P_THIS->ResetSpeed(); P_NATIVE_END; } void ATyphoonCharacter::StaticRegisterNativesATyphoonCharacter() { UClass* Class = ATyphoonCharacter::StaticClass(); static const FNameNativePtrPair Funcs[] = { { "ResetSpeed", &ATyphoonCharacter::execResetSpeed }, }; FNativeFunctionRegistrar::RegisterFunctions(Class, Funcs, UE_ARRAY_COUNT(Funcs)); } struct Z_Construct_UFunction_ATyphoonCharacter_ResetSpeed_Statics { #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_ATyphoonCharacter_ResetSpeed_Statics::Function_MetaDataParams[] = { { "ModuleRelativePath", "TyphoonCharacter.h" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_ATyphoonCharacter_ResetSpeed_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_ATyphoonCharacter, nullptr, "ResetSpeed", nullptr, nullptr, 0, nullptr, 0, RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x04020401, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_ATyphoonCharacter_ResetSpeed_Statics::Function_MetaDataParams, UE_ARRAY_COUNT(Z_Construct_UFunction_ATyphoonCharacter_ResetSpeed_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_ATyphoonCharacter_ResetSpeed() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_ATyphoonCharacter_ResetSpeed_Statics::FuncParams); } return ReturnFunction; } UClass* Z_Construct_UClass_ATyphoonCharacter_NoRegister() { return ATyphoonCharacter::StaticClass(); } struct Z_Construct_UClass_ATyphoonCharacter_Statics { static UObject* (*const DependentSingletons[])(); static const FClassFunctionLinkInfo FuncInfo[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Class_MetaDataParams[]; #endif #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_bReverseControls_MetaData[]; #endif static void NewProp_bReverseControls_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_bReverseControls; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_InitialMaxWalkSpeed_MetaData[]; #endif static const UE4CodeGen_Private::FFloatPropertyParams NewProp_InitialMaxWalkSpeed; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_CameraBoom_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_CameraBoom; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_SideViewCameraComponent_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_SideViewCameraComponent; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; static const FCppClassTypeInfoStatic StaticCppClassTypeInfo; static const UE4CodeGen_Private::FClassParams ClassParams; }; UObject* (*const Z_Construct_UClass_ATyphoonCharacter_Statics::DependentSingletons[])() = { (UObject* (*)())Z_Construct_UClass_ACharacter, (UObject* (*)())Z_Construct_UPackage__Script_Typhoon, }; const FClassFunctionLinkInfo Z_Construct_UClass_ATyphoonCharacter_Statics::FuncInfo[] = { { &Z_Construct_UFunction_ATyphoonCharacter_ResetSpeed, "ResetSpeed" }, // 3961278719 }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_ATyphoonCharacter_Statics::Class_MetaDataParams[] = { { "HideCategories", "Navigation" }, { "IncludePath", "TyphoonCharacter.h" }, { "ModuleRelativePath", "TyphoonCharacter.h" }, }; #endif #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_bReverseControls_MetaData[] = { { "Category", "TyphoonCharacter" }, { "ModuleRelativePath", "TyphoonCharacter.h" }, }; #endif void Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_bReverseControls_SetBit(void* Obj) { ((ATyphoonCharacter*)Obj)->bReverseControls = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_bReverseControls = { "bReverseControls", nullptr, (EPropertyFlags)0x0010000000000005, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(ATyphoonCharacter), &Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_bReverseControls_SetBit, METADATA_PARAMS(Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_bReverseControls_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_bReverseControls_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_InitialMaxWalkSpeed_MetaData[] = { { "Category", "TyphoonCharacter" }, { "Comment", "// Shouldn't be here but lazy.\n" }, { "ModuleRelativePath", "TyphoonCharacter.h" }, { "ToolTip", "Shouldn't be here but lazy." }, }; #endif const UE4CodeGen_Private::FFloatPropertyParams Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_InitialMaxWalkSpeed = { "InitialMaxWalkSpeed", nullptr, (EPropertyFlags)0x0010000000000014, UE4CodeGen_Private::EPropertyGenFlags::Float, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(ATyphoonCharacter, InitialMaxWalkSpeed), METADATA_PARAMS(Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_InitialMaxWalkSpeed_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_InitialMaxWalkSpeed_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_CameraBoom_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "Camera" }, { "Comment", "/** Camera boom positioning the camera beside the character */" }, { "EditInline", "true" }, { "ModuleRelativePath", "TyphoonCharacter.h" }, { "ToolTip", "Camera boom positioning the camera beside the character" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_CameraBoom = { "CameraBoom", nullptr, (EPropertyFlags)0x00400000000a001d, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(ATyphoonCharacter, CameraBoom), Z_Construct_UClass_USpringArmComponent_NoRegister, METADATA_PARAMS(Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_CameraBoom_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_CameraBoom_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_SideViewCameraComponent_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "Camera" }, { "Comment", "/** Side view camera */" }, { "EditInline", "true" }, { "ModuleRelativePath", "TyphoonCharacter.h" }, { "ToolTip", "Side view camera" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_SideViewCameraComponent = { "SideViewCameraComponent", nullptr, (EPropertyFlags)0x00400000000a001d, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(ATyphoonCharacter, SideViewCameraComponent), Z_Construct_UClass_UCameraComponent_NoRegister, METADATA_PARAMS(Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_SideViewCameraComponent_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_SideViewCameraComponent_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UClass_ATyphoonCharacter_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_bReverseControls, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_InitialMaxWalkSpeed, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_CameraBoom, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_ATyphoonCharacter_Statics::NewProp_SideViewCameraComponent, }; const FCppClassTypeInfoStatic Z_Construct_UClass_ATyphoonCharacter_Statics::StaticCppClassTypeInfo = { TCppClassTypeTraits<ATyphoonCharacter>::IsAbstract, }; const UE4CodeGen_Private::FClassParams Z_Construct_UClass_ATyphoonCharacter_Statics::ClassParams = { &ATyphoonCharacter::StaticClass, "Game", &StaticCppClassTypeInfo, DependentSingletons, FuncInfo, Z_Construct_UClass_ATyphoonCharacter_Statics::PropPointers, nullptr, UE_ARRAY_COUNT(DependentSingletons), UE_ARRAY_COUNT(FuncInfo), UE_ARRAY_COUNT(Z_Construct_UClass_ATyphoonCharacter_Statics::PropPointers), 0, 0x008000A4u, METADATA_PARAMS(Z_Construct_UClass_ATyphoonCharacter_Statics::Class_MetaDataParams, UE_ARRAY_COUNT(Z_Construct_UClass_ATyphoonCharacter_Statics::Class_MetaDataParams)) }; UClass* Z_Construct_UClass_ATyphoonCharacter() { static UClass* OuterClass = nullptr; if (!OuterClass) { UE4CodeGen_Private::ConstructUClass(OuterClass, Z_Construct_UClass_ATyphoonCharacter_Statics::ClassParams); } return OuterClass; } IMPLEMENT_CLASS(ATyphoonCharacter, 2183928725); template<> TYPHOON_API UClass* StaticClass<ATyphoonCharacter>() { return ATyphoonCharacter::StaticClass(); } static FCompiledInDefer Z_CompiledInDefer_UClass_ATyphoonCharacter(Z_Construct_UClass_ATyphoonCharacter, &ATyphoonCharacter::StaticClass, TEXT("/Script/Typhoon"), TEXT("ATyphoonCharacter"), false, nullptr, nullptr, nullptr); DEFINE_VTABLE_PTR_HELPER_CTOR(ATyphoonCharacter); PRAGMA_ENABLE_DEPRECATION_WARNINGS #ifdef _MSC_VER #pragma warning (pop) #endif
[ "50085636+dynamiquel@users.noreply.github.com" ]
50085636+dynamiquel@users.noreply.github.com
55111ed7042eed3113b1ad454f9b4c30bf457055
ad52a7268bf0d90c10be2229c6143f8efe7ece99
/C++98_omp/swapview.cpp
681932194a6d8e6a3acd55bc0e62524ac0ab1adc
[]
no_license
chenfengyuan/swapview
ab28cb1f85f391aa4a7b0c91451ef4d329e8ed91
d5a8545df72fabc258550ba72ccd32cb5d5afb70
refs/heads/master
2021-01-14T10:39:22.237851
2015-01-09T07:52:00
2015-01-09T08:01:08
29,006,401
0
0
null
2015-01-09T07:46:33
2015-01-09T07:46:33
null
UTF-8
C++
false
false
3,566
cpp
#include <iostream> #include <string> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <vector> #include <cmath> #include <cctype> #include <sys/types.h> #include <dirent.h> #include <error.h> #include <errno.h> #include <omp.h> using namespace std; // #define TARGET "Size:" // test with Size: when swap is empty #define TARGETLEN 5 #define TARGET "Swap:" ///////////////////////////////////////////////////////////////////////////// void readlines(string path, vector<string> & ret){ ifstream fs(path.c_str()); for(string buf; getline(fs, buf);){ ret.push_back(buf); } } int str2i(string str){ int result; istringstream ssin(str); ssin>>result; return result; } void lsdir(string path, vector<string> & ret){ DIR *dp; struct dirent *dirp; if((dp = opendir(path.c_str())) == NULL) { error(errno, errno, "opening %s \n", path.c_str()); } while ((dirp = readdir(dp)) != NULL) { ret.push_back(string(dirp->d_name)); } closedir(dp); } struct swap_info{ int pid; string comm; double size; int operator< (swap_info& other){ return size < other.size; } }; ///////////////////////////////////////////////////////////////////////////// string filesize(double size){ char units [] = "KMGT"; double left = fabs(size); int unit = -1; while( left > 1100 && unit < 3 ){ left /= 1024; unit++; } ostringstream sout; if(unit == -1){ sout << static_cast<int>(size) << 'B'; }else{ if(size<0){ left = -left; } sout << fixed << setprecision(1) << left << units[unit] << "iB"; } return sout.str(); } swap_info getSwapFor(int pid){ ostringstream cmdline, smaps; cmdline << "/proc/" << pid << "/cmdline"; ifstream fs(cmdline.str().c_str()); string comm((istreambuf_iterator<char>(fs)), istreambuf_iterator<char>()); if(comm.length() > 0){ replace(comm.begin(), comm.end(), '\0' , ' '); comm.erase(comm.end()-1); } double s=0.0; smaps << "/proc/" << pid << "/smaps"; vector<string> lines; readlines(smaps.str(), lines); for(vector<string>::iterator itr=lines.begin(); itr<lines.end(); ++itr ){ if(itr->substr(0, TARGETLEN)==TARGET){ s+=str2i(itr->substr(TARGETLEN)); } } swap_info ret = {pid, comm, s*1024.0}; return ret; } void getSwap(vector<swap_info> & ret){ vector<string> dir; lsdir("/proc", dir); #pragma omp parallel for for(vector<string>::iterator itr=dir.begin(); itr<dir.end(); ++itr){ int pid = str2i(*itr); if(pid > 0) { swap_info item=getSwapFor(pid); if(item.size > 0) #pragma omp critical { ret.push_back(item); } } } sort(ret.begin(), ret.end()); } template<typename T1, typename T2, typename T3> void format_print(T1 pid, T2 swap, T3 command){ cout<<setw(5)<<pid<<' '<<setw(9)<<swap<<' '<<command<<endl; } void format_print(swap_info& swap){ format_print(swap.pid, filesize(swap.size), swap.comm); } int main(int argc, char * argv[]){ omp_set_num_threads(omp_get_num_procs()*4); double t=0.0; vector<swap_info> result; getSwap(result); format_print("PID", "SWAP", "COMMAND"); for(vector<swap_info>::iterator itr= result.begin(); itr<result.end();++itr){ format_print(*itr); t+=itr->size; } cout<<"Total:"<<setw(9)<<filesize(t)<<endl; return 0; }
[ "farseerfc@gmail.com" ]
farseerfc@gmail.com
702c93c0368542398fef57e03f07809d2863e441
efa38f0484f6f164f47a179794561c7355a48381
/src/daemon/HNDaemonLog.h
6a4e3fd64bb7923ff0dc4f98eec9f295548ce900
[ "MIT" ]
permissive
nottberg/hnode2_switch_daemon
29810d40acea5d1002b929f9c4af4e208f404e39
e9c60013b394d71bb25f38f96695b913c3bc6d04
refs/heads/master
2023-05-03T20:28:18.471143
2023-04-22T20:12:06
2023-04-22T20:12:06
252,907,469
0
0
MIT
2023-04-22T20:12:07
2020-04-04T04:21:25
C++
UTF-8
C++
false
false
1,332
h
#ifndef __HN_DAEMON_LOG_H__ #define __HN_DAEMON_LOG_H__ #include <cstdarg> typedef enum HNDaemonLogLevelEnum { HNDL_LOG_LEVEL_ERROR = 0, HNDL_LOG_LEVEL_WARN = 1, HNDL_LOG_LEVEL_INFO = 2, HNDL_LOG_LEVEL_DEBUG = 3, HNDL_LOG_LEVEL_ALL = 4, }HNDL_LOG_LEVEL_T; class HNDaemonLog { private: bool isDaemon; HNDL_LOG_LEVEL_T curLimit; protected: void processMsg( HNDL_LOG_LEVEL_T level, const char *format, va_list args ); public: HNDaemonLog(); ~HNDaemonLog(); void setDaemon( bool value ); void setLevelLimit( HNDL_LOG_LEVEL_T value ); void debug( const char *format, ... ); void info( const char *format, ... ); void warn( const char *format, ... ); void error( const char *format, ... ); friend class HNDaemonLogSrc; }; class HNDaemonLogSrc { private: HNDaemonLog *logPtr; public: HNDaemonLogSrc(); ~HNDaemonLogSrc(); void clearDstLog(); void setDstLog( HNDaemonLog *dstLog ); HNDaemonLog *getDstLog(); void debug( const char *format, ... ); void info( const char *format, ... ); void warn( const char *format, ... ); void error( const char *format, ... ); }; #endif // __HN_DAEMON_LOG_H__
[ "noreply@github.com" ]
noreply@github.com
a2a638cf399b1c70973678ffa184df5e4b0cf9cb
18d5ba86957e3e3bdcf5ee144d6cdce307409949
/blimp/client/feature/compositor/blimp_compositor.cc
3bb910fd64272a2d32560081e3bbc736a4d912ce
[ "BSD-3-Clause" ]
permissive
MichaelMiao/chromium
cf5021e77c7df85905eb9e6a5c5bfa9329c5f4ff
00c406052433085e22fa4f73d990c8e4ff3320b3
refs/heads/master
2023-01-16T06:47:36.223098
2016-03-28T20:00:29
2016-03-28T20:02:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,537
cc
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "blimp/client/feature/compositor/blimp_compositor.h" #include "base/bind_helpers.h" #include "base/command_line.h" #include "base/numerics/safe_conversions.h" #include "base/single_thread_task_runner.h" #include "base/thread_task_runner_handle.h" #include "base/threading/thread.h" #include "base/threading/thread_local.h" #include "base/threading/thread_restrictions.h" #include "blimp/client/feature/compositor/blimp_context_provider.h" #include "blimp/client/feature/compositor/blimp_output_surface.h" #include "cc/layers/layer.h" #include "cc/output/output_surface.h" #include "cc/proto/compositor_message.pb.h" #include "cc/trees/layer_tree_host.h" #include "net/base/net_errors.h" #include "ui/gl/gl_surface.h" namespace blimp { namespace client { BlimpCompositor::BlimpCompositor(int render_widget_id, BlimpCompositorClient* client) : render_widget_id_(render_widget_id), client_(client), window_(gfx::kNullAcceleratedWidget), host_should_be_visible_(false), output_surface_request_pending_(false), remote_proto_channel_receiver_(nullptr) {} BlimpCompositor::~BlimpCompositor() { if (host_) DestroyLayerTreeHost(); } void BlimpCompositor::SetVisible(bool visible) { host_should_be_visible_ = visible; SetVisibleInternal(host_should_be_visible_); } void BlimpCompositor::SetAcceleratedWidget(gfx::AcceleratedWidget widget) { if (widget == window_) return; DCHECK(window_ == gfx::kNullAcceleratedWidget); window_ = widget; // The compositor should not be visible if there is no output surface. DCHECK(!host_ || !host_->visible()); // This will properly set visibility and will build the output surface if // necessary. SetVisibleInternal(host_should_be_visible_); } void BlimpCompositor::ReleaseAcceleratedWidget() { if (window_ == gfx::kNullAcceleratedWidget) return; // Hide the compositor and drop the output surface if necessary. SetVisibleInternal(false); window_ = gfx::kNullAcceleratedWidget; } bool BlimpCompositor::OnTouchEvent(const ui::MotionEvent& motion_event) { if (input_manager_) return input_manager_->OnTouchEvent(motion_event); return false; } void BlimpCompositor::WillBeginMainFrame() {} void BlimpCompositor::DidBeginMainFrame() {} void BlimpCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) {} void BlimpCompositor::BeginMainFrameNotExpectedSoon() {} void BlimpCompositor::UpdateLayerTreeHost() {} void BlimpCompositor::ApplyViewportDeltas( const gfx::Vector2dF& inner_delta, const gfx::Vector2dF& outer_delta, const gfx::Vector2dF& elastic_overscroll_delta, float page_scale, float top_controls_delta) {} void BlimpCompositor::RequestNewOutputSurface() { output_surface_request_pending_ = true; HandlePendingOutputSurfaceRequest(); } void BlimpCompositor::DidInitializeOutputSurface() { } void BlimpCompositor::DidFailToInitializeOutputSurface() {} void BlimpCompositor::WillCommit() {} void BlimpCompositor::DidCommit() {} void BlimpCompositor::DidCommitAndDrawFrame() {} void BlimpCompositor::DidCompleteSwapBuffers() {} void BlimpCompositor::DidCompletePageScaleAnimation() {} void BlimpCompositor::RecordFrameTimingEvents( scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events, scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> main_frame_events) {} void BlimpCompositor::SetProtoReceiver(ProtoReceiver* receiver) { remote_proto_channel_receiver_ = receiver; } void BlimpCompositor::SendCompositorProto( const cc::proto::CompositorMessage& proto) { client_->SendCompositorMessage(render_widget_id_, proto); } void BlimpCompositor::OnCompositorMessageReceived( scoped_ptr<cc::proto::CompositorMessage> message) { DCHECK(message->has_to_impl()); const cc::proto::CompositorMessageToImpl& to_impl_proto = message->to_impl(); DCHECK(to_impl_proto.has_message_type()); switch (to_impl_proto.message_type()) { case cc::proto::CompositorMessageToImpl::UNKNOWN: NOTIMPLEMENTED() << "Ignoring message of UNKNOWN type"; break; case cc::proto::CompositorMessageToImpl::INITIALIZE_IMPL: DCHECK(!host_); DCHECK(to_impl_proto.has_initialize_impl_message()); // Create the remote client LayerTreeHost for the compositor. CreateLayerTreeHost(to_impl_proto.initialize_impl_message()); break; case cc::proto::CompositorMessageToImpl::CLOSE_IMPL: DCHECK(host_); // Destroy the remote client LayerTreeHost for the compositor. DestroyLayerTreeHost(); break; default: // We should have a receiver if we're getting compositor messages that // are not INITIALIZE_IMPL or CLOSE_IMPL. DCHECK(remote_proto_channel_receiver_); remote_proto_channel_receiver_->OnProtoReceived(std::move(message)); } } void BlimpCompositor::SendWebGestureEvent( const blink::WebGestureEvent& gesture_event) { client_->SendWebGestureEvent(render_widget_id_, gesture_event); } void BlimpCompositor::SetVisibleInternal(bool visible) { if (!host_) return; if (visible && window_ != gfx::kNullAcceleratedWidget) { // If we're supposed to be visible and we have a valid // gfx::AcceleratedWidget make our compositor visible. If the compositor // had an outstanding output surface request, trigger the request again so // we build the output surface. host_->SetVisible(true); if (output_surface_request_pending_) HandlePendingOutputSurfaceRequest(); } else if (!visible) { // If not visible, hide the compositor and have it drop it's output // surface. host_->SetVisible(false); if (!host_->output_surface_lost()) { host_->ReleaseOutputSurface(); } } } void BlimpCompositor::CreateLayerTreeHost( const cc::proto::InitializeImpl& initialize_message) { DCHECK(!host_); // Create the LayerTreeHost cc::LayerTreeHost::InitParams params; params.client = this; params.task_graph_runner = client_->GetTaskGraphRunner(); params.gpu_memory_buffer_manager = client_->GetGpuMemoryBufferManager(); params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); params.image_serialization_processor = client_->GetImageSerializationProcessor(); params.settings = client_->GetLayerTreeSettings(); scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = client_->GetCompositorTaskRunner(); host_ = cc::LayerTreeHost::CreateRemoteClient(this /* remote_proto_channel */, compositor_task_runner, &params); // Now that we have a host, set the visiblity on it correctly. SetVisibleInternal(host_should_be_visible_); DCHECK(!input_manager_); input_manager_ = BlimpInputManager::Create(this, base::ThreadTaskRunnerHandle::Get(), compositor_task_runner, host_->GetInputHandler()); } void BlimpCompositor::DestroyLayerTreeHost() { DCHECK(host_); // Tear down the output surface connection with the old LayerTreeHost // instance. SetVisibleInternal(false); // Destroy the old LayerTreeHost state. host_.reset(); // Destroy the old input manager state. // It is important to destroy the LayerTreeHost before destroying the input // manager as it has a reference to the cc::InputHandlerClient owned by the // BlimpInputManager. input_manager_.reset(); // Reset other state. output_surface_request_pending_ = false; // Make sure we don't have a receiver at this point. DCHECK(!remote_proto_channel_receiver_); } void BlimpCompositor::HandlePendingOutputSurfaceRequest() { DCHECK(output_surface_request_pending_); // We might have had a request from a LayerTreeHost that was then // hidden (and hidden means we don't have a native surface). // Also make sure we only handle this once. if (!host_->visible() || window_ == gfx::kNullAcceleratedWidget) return; scoped_refptr<BlimpContextProvider> context_provider = BlimpContextProvider::Create(window_, client_->GetGpuMemoryBufferManager()); host_->SetOutputSurface( make_scoped_ptr(new BlimpOutputSurface(context_provider))); output_surface_request_pending_ = false; } } // namespace client } // namespace blimp
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
b5df62ec366a6c9fd15aebe327bf3af8a1abcf16
efe1131a33ee82e7c46b5af4cf200dcae8eb4add
/samples/MFC16/CTRLTEST/SPIN.H
c5f065eab72200dad3a71ce1aafb18fa094f0f3b
[ "BSL-1.0" ]
permissive
ALEHACKsp/dmc
819398bbb46e8b5a8ef5c344ef2a0f8b4ee8903c
9478d25a677f70dbe4fc0ed317cc5a5e5050ef8b
refs/heads/master
2022-12-28T13:36:57.721262
2020-10-11T07:47:16
2020-10-11T07:47:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,049
h
// spin.h: C++ interface to spin control // // This is a part of the Microsoft Foundation Classes C++ library. // Copyright (C) 1992 Microsoft Corporation // All rights reserved. // // This source code is only intended as a supplement to the // Microsoft Foundation Classes Reference and Microsoft // WinHelp documentation provided with the library. // See these sources for detailed information regarding the // Microsoft Foundation Classes product. #include "muscroll.h" // message based API ///////////////////////////////////////////////////////////////////////////// class CSpinControl : public CWnd { DECLARE_DYNAMIC(CSpinControl) // Constructors public: CSpinControl(); BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID); // Attributes CWnd* GetAssociate(); void SetAssociate(CWnd* pNew); void GetRange(UINT& iMin, UINT& iMax); void SetRange(UINT iMin, UINT iMax); UINT GetCurrentPos(); void SetCurrentPos(UINT iPos); // there are more APIs in 'muscroll.h' not wrapped here // Implementation protected: virtual WNDPROC* GetSuperWndProcAddr(); }; ///////////////////////////////////////////////////////////////////////////// // inlines inline CSpinControl::CSpinControl() { } inline CWnd* CSpinControl::GetAssociate() { return CWnd::FromHandle((HWND)SendMessage(MSM_HWNDASSOCIATEGET)); } inline void CSpinControl::SetAssociate(CWnd* pNew) { SendMessage(MSM_HWNDASSOCIATESET, (UINT)pNew->GetSafeHwnd()); } inline void CSpinControl::GetRange(UINT& iMin, UINT& iMax) { DWORD dw = SendMessage(MSM_DWRANGEGET); iMin = LOWORD(dw); iMax = HIWORD(dw); } inline void CSpinControl::SetRange(UINT iMin, UINT iMax) { SendMessage(MSM_DWRANGESET, 0, MAKELONG(iMin, iMax)); } inline UINT CSpinControl::GetCurrentPos() { return (UINT)SendMessage(MSM_WCURRENTPOSGET); } inline void CSpinControl::SetCurrentPos(UINT iPos) { SendMessage(MSM_WCURRENTPOSSET, iPos); } /////////////////////////////////////////////////////////////////////////////
[ "walter@walterbright.com" ]
walter@walterbright.com
6ddf1f3b0376b23bacbd7d6e78a7bed45f68be3b
1c3d7a1ee2a26166f1c2683d2d962cbac4e06185
/atherton/MainWin.cpp
c3f3182a334c681ed5322c1ac1c8299f4d13ce6a
[]
no_license
emiruner/simge-examples
3866d5ff2a65371dd864635a15714558c6e07b76
dcda01a4e47249e86e42decf95d17d5e53937d73
refs/heads/master
2021-01-11T17:45:19.451575
2017-01-24T03:57:24
2017-01-24T03:57:24
79,835,485
0
0
null
null
null
null
UTF-8
C++
false
false
2,889
cpp
#include "MainWin.hpp" #include <algorithm> #include <simge/util/Utility.hpp> #include <simge/algo/Atherton.hpp> using namespace simge::geom; using namespace simge::glut; using namespace simge::util; using namespace simge::algo; namespace { inline void writeMsg(char const* msg) { glColor3f(1, 0, 0); drawText(GLUT_BITMAP_8_BY_13, point(10, 10), msg); } } // namespace <unnamed> MainWin::MainWin() : Planar("Weiler-Atherton Clipping", GLUT_RGBA | GLUT_DOUBLE), subject_(PolygonType::RightIsInterior()), clip_(PolygonType::LeftIsInterior()), state_(EnteringSubject) { glClearColor(0, 0, 0, 0); glColor3f(1, 0, 0); setSize(620, 460); } void MainWin::paintGL() { glClear(GL_COLOR_BUFFER_BIT); void (*looper)(Polygon<2> const&) = &drawLineLoop; glLineWidth(2); glColor3f(1, 0, 0); drawLineLoop(subject_); glColor3f(0.3, 1, 0.3); drawLineLoop(clip_); switch(state_) { case EnteringSubject: writeMsg("Enter subject polygon clockwise. " "Finish by clicking right mouse button."); break; case EnteringClip: writeMsg("Enter clip polgon clockwise. " "Finish by clicking right mouse button."); break; case Display: glLineWidth(4); glColor3f(0.9, 1, 1); std::for_each(intersections_.begin(), intersections_.end(), looper); writeMsg("Press `n' to start from beginning."); break; } // Status line glLineWidth(3); glColor3f(0.4, 0.7, 0.2); glBegin(GL_LINES); glVertex2i(0, 30); glVertex2i(getWidth(), 30); glEnd(); glLineWidth(1); glFlush(); glutSwapBuffers(); } void MainWin::mouseGL(int button, int state, int x, int y) { if(state == GLUT_DOWN) { if(button == GLUT_LEFT_BUTTON) { if(state_ == EnteringSubject) { subject_.addVertex(windowToGl(x, y)); invalidate(); } else if(state_ == EnteringClip) { clip_.addVertex(windowToGl(x, y)); invalidate(); } } else if(button == GLUT_RIGHT_BUTTON) { if(state_ == EnteringSubject) { state_ = EnteringClip; invalidate(); } else if(state_ == EnteringClip) { state_ = Display; intersections_ = atherton(subject_, clip_); invalidate(); } } } } void MainWin::keyboardGL(unsigned char key, int x, int y) { if(key == 'n' || key == 'N') { if(state_ == Display) { state_ = EnteringSubject; subject_.clear(); clip_.clear(); invalidate(); } } Planar::keyboardGL(key, x, y); }
[ "emir" ]
emir
a0831e43522f78125125a13b92bd7ee813508010
e07e3f41c9774c9684c4700a9772712bf6ac3533
/app/Temp/StagingArea/Data/il2cppOutput/mscorlib_System_Collections_Generic_Dictionary_2_g1403980240.h
2600041da81602573fa5bb433b12b86e5eebd0b3
[]
no_license
gdesmarais-gsn/inprocess-mobile-skill-client
0171a0d4aaed13dbbc9cca248aec646ec5020025
2499d8ab5149a306001995064852353c33208fc3
refs/heads/master
2020-12-03T09:22:52.530033
2017-06-27T22:08:38
2017-06-27T22:08:38
95,603,544
0
0
null
null
null
null
UTF-8
C++
false
false
7,703
h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> // System.Int32[] struct Int32U5BU5D_t3030399641; // System.Collections.Generic.Link[] struct LinkU5BU5D_t62501539; // System.Byte[] struct ByteU5BU5D_t3397334013; // System.String[] struct StringU5BU5D_t1642385972; // System.Collections.Generic.IEqualityComparer`1<System.Byte> struct IEqualityComparer_1_t2895737214; // System.Runtime.Serialization.SerializationInfo struct SerializationInfo_t228987430; // System.Collections.Generic.Dictionary`2/Transform`1<System.Byte,System.String,System.Collections.DictionaryEntry> struct Transform_1_t3588785603; #include "mscorlib_System_Object2689449295.h" #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Collections.Generic.Dictionary`2<System.Byte,System.String> struct Dictionary_2_t1403980240 : public Il2CppObject { public: // System.Int32[] System.Collections.Generic.Dictionary`2::table Int32U5BU5D_t3030399641* ___table_4; // System.Collections.Generic.Link[] System.Collections.Generic.Dictionary`2::linkSlots LinkU5BU5D_t62501539* ___linkSlots_5; // TKey[] System.Collections.Generic.Dictionary`2::keySlots ByteU5BU5D_t3397334013* ___keySlots_6; // TValue[] System.Collections.Generic.Dictionary`2::valueSlots StringU5BU5D_t1642385972* ___valueSlots_7; // System.Int32 System.Collections.Generic.Dictionary`2::touchedSlots int32_t ___touchedSlots_8; // System.Int32 System.Collections.Generic.Dictionary`2::emptySlot int32_t ___emptySlot_9; // System.Int32 System.Collections.Generic.Dictionary`2::count int32_t ___count_10; // System.Int32 System.Collections.Generic.Dictionary`2::threshold int32_t ___threshold_11; // System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::hcp Il2CppObject* ___hcp_12; // System.Runtime.Serialization.SerializationInfo System.Collections.Generic.Dictionary`2::serialization_info SerializationInfo_t228987430 * ___serialization_info_13; // System.Int32 System.Collections.Generic.Dictionary`2::generation int32_t ___generation_14; public: inline static int32_t get_offset_of_table_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t1403980240, ___table_4)); } inline Int32U5BU5D_t3030399641* get_table_4() const { return ___table_4; } inline Int32U5BU5D_t3030399641** get_address_of_table_4() { return &___table_4; } inline void set_table_4(Int32U5BU5D_t3030399641* value) { ___table_4 = value; Il2CppCodeGenWriteBarrier(&___table_4, value); } inline static int32_t get_offset_of_linkSlots_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t1403980240, ___linkSlots_5)); } inline LinkU5BU5D_t62501539* get_linkSlots_5() const { return ___linkSlots_5; } inline LinkU5BU5D_t62501539** get_address_of_linkSlots_5() { return &___linkSlots_5; } inline void set_linkSlots_5(LinkU5BU5D_t62501539* value) { ___linkSlots_5 = value; Il2CppCodeGenWriteBarrier(&___linkSlots_5, value); } inline static int32_t get_offset_of_keySlots_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t1403980240, ___keySlots_6)); } inline ByteU5BU5D_t3397334013* get_keySlots_6() const { return ___keySlots_6; } inline ByteU5BU5D_t3397334013** get_address_of_keySlots_6() { return &___keySlots_6; } inline void set_keySlots_6(ByteU5BU5D_t3397334013* value) { ___keySlots_6 = value; Il2CppCodeGenWriteBarrier(&___keySlots_6, value); } inline static int32_t get_offset_of_valueSlots_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t1403980240, ___valueSlots_7)); } inline StringU5BU5D_t1642385972* get_valueSlots_7() const { return ___valueSlots_7; } inline StringU5BU5D_t1642385972** get_address_of_valueSlots_7() { return &___valueSlots_7; } inline void set_valueSlots_7(StringU5BU5D_t1642385972* value) { ___valueSlots_7 = value; Il2CppCodeGenWriteBarrier(&___valueSlots_7, value); } inline static int32_t get_offset_of_touchedSlots_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t1403980240, ___touchedSlots_8)); } inline int32_t get_touchedSlots_8() const { return ___touchedSlots_8; } inline int32_t* get_address_of_touchedSlots_8() { return &___touchedSlots_8; } inline void set_touchedSlots_8(int32_t value) { ___touchedSlots_8 = value; } inline static int32_t get_offset_of_emptySlot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t1403980240, ___emptySlot_9)); } inline int32_t get_emptySlot_9() const { return ___emptySlot_9; } inline int32_t* get_address_of_emptySlot_9() { return &___emptySlot_9; } inline void set_emptySlot_9(int32_t value) { ___emptySlot_9 = value; } inline static int32_t get_offset_of_count_10() { return static_cast<int32_t>(offsetof(Dictionary_2_t1403980240, ___count_10)); } inline int32_t get_count_10() const { return ___count_10; } inline int32_t* get_address_of_count_10() { return &___count_10; } inline void set_count_10(int32_t value) { ___count_10 = value; } inline static int32_t get_offset_of_threshold_11() { return static_cast<int32_t>(offsetof(Dictionary_2_t1403980240, ___threshold_11)); } inline int32_t get_threshold_11() const { return ___threshold_11; } inline int32_t* get_address_of_threshold_11() { return &___threshold_11; } inline void set_threshold_11(int32_t value) { ___threshold_11 = value; } inline static int32_t get_offset_of_hcp_12() { return static_cast<int32_t>(offsetof(Dictionary_2_t1403980240, ___hcp_12)); } inline Il2CppObject* get_hcp_12() const { return ___hcp_12; } inline Il2CppObject** get_address_of_hcp_12() { return &___hcp_12; } inline void set_hcp_12(Il2CppObject* value) { ___hcp_12 = value; Il2CppCodeGenWriteBarrier(&___hcp_12, value); } inline static int32_t get_offset_of_serialization_info_13() { return static_cast<int32_t>(offsetof(Dictionary_2_t1403980240, ___serialization_info_13)); } inline SerializationInfo_t228987430 * get_serialization_info_13() const { return ___serialization_info_13; } inline SerializationInfo_t228987430 ** get_address_of_serialization_info_13() { return &___serialization_info_13; } inline void set_serialization_info_13(SerializationInfo_t228987430 * value) { ___serialization_info_13 = value; Il2CppCodeGenWriteBarrier(&___serialization_info_13, value); } inline static int32_t get_offset_of_generation_14() { return static_cast<int32_t>(offsetof(Dictionary_2_t1403980240, ___generation_14)); } inline int32_t get_generation_14() const { return ___generation_14; } inline int32_t* get_address_of_generation_14() { return &___generation_14; } inline void set_generation_14(int32_t value) { ___generation_14 = value; } }; struct Dictionary_2_t1403980240_StaticFields { public: // System.Collections.Generic.Dictionary`2/Transform`1<TKey,TValue,System.Collections.DictionaryEntry> System.Collections.Generic.Dictionary`2::<>f__am$cacheB Transform_1_t3588785603 * ___U3CU3Ef__amU24cacheB_15; public: inline static int32_t get_offset_of_U3CU3Ef__amU24cacheB_15() { return static_cast<int32_t>(offsetof(Dictionary_2_t1403980240_StaticFields, ___U3CU3Ef__amU24cacheB_15)); } inline Transform_1_t3588785603 * get_U3CU3Ef__amU24cacheB_15() const { return ___U3CU3Ef__amU24cacheB_15; } inline Transform_1_t3588785603 ** get_address_of_U3CU3Ef__amU24cacheB_15() { return &___U3CU3Ef__amU24cacheB_15; } inline void set_U3CU3Ef__amU24cacheB_15(Transform_1_t3588785603 * value) { ___U3CU3Ef__amU24cacheB_15 = value; Il2CppCodeGenWriteBarrier(&___U3CU3Ef__amU24cacheB_15, value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif
[ "gdesmarais@gsngames.com" ]
gdesmarais@gsngames.com
e88129258657528c06edb629ebec3a42947abb6e
995ecce03cfac9af98a62c317bf0a531bebf3e09
/pymote/algorithms/tinagojak/led_blink.ino
aae8e2a47635bacb8f93f4429f840c535a4f16c6
[]
no_license
VjeraTurk/pymote-algorithms-bootstrapBMO
2cd175b19142cf043637461b0928dafd1cd32744
324956db430570316bc17df51339731ee03bae89
refs/heads/master
2020-03-08T03:24:28.931975
2018-06-30T00:20:06
2018-06-30T00:20:06
127,890,010
0
0
null
null
null
null
UTF-8
C++
false
false
844
ino
#include <JeeLib.h> #include <LocLib.h> // jeenode ports where ledstate is plugged LedStatePlug ledstate(2, 3); MilliTimer timer; int blinkPeriod = 1000; int delta = 500; bool state = true; void setup () { Serial.begin(57600); Serial.println("\n[led_f]"); ledstate.set(2); } void loop () { byte event = ledstate.buttonCheck(); switch (event) { case BlinkPlug::OFF1: blinkPeriod += delta; Serial.println(" Button 1 released"); break; case BlinkPlug::OFF2: if (blinkPeriod > delta) blinkPeriod -= delta; Serial.println(" Button 2 released"); break; } // report these other events only once a second if (timer.poll(blinkPeriod)) { if (state){ ledstate.set(0); state = false; } else { ledstate.set(2); state = true; } } }
[ "vturk@riteh.hr" ]
vturk@riteh.hr
041076235a274d45cc3087f3175f498eed1e419b
b9b6177bd33f8969592575ff01c4f286646fef18
/12.cpp
cc1d7811f327190dae560730cd5e96ee2945145f
[]
no_license
nitinkumar2558/LAB-7
26461f48ced1110abb987cb0be2dd1a0756ef708
8ad2897c398d6e8bcfd4ecec898afb7bdb646144
refs/heads/master
2020-03-31T02:44:42.410159
2018-10-06T13:19:18
2018-10-06T13:19:18
151,838,161
0
0
null
null
null
null
UTF-8
C++
false
false
352
cpp
//program for LCM of two numbers using recurrsion #include<iostream> using namespace std; int foo(int m ,int n) { if (m%n==0) return n; else return foo(n,m%n); } int main() { int a,b; cout<<"enter two no. to find there LCM"<<endl; cin>>a>>b; if(a>b) cout<<"the LCM is "<< (a*b)/foo(a,b); else cout<<"The GCD is "<<(a*b)/foo(b,a); return 0; }
[ "noreply@github.com" ]
noreply@github.com
d35912bad4005a0557d50433542c3d8eb87e1037
b82720bbb4013db0746e05bd47f9d750d9914076
/aizu-online-judge/ALDS1_3_A.cpp
84ade63d1a54833948f86c29d4a7f92ee891f6c0
[]
no_license
shiimaxx/programming-contest
3cc2549cbd0bd6f7aaadb52fc381b6c19d15cb28
6b8c8f5ba52003845aa133fcee31bba6fb1fb2f5
refs/heads/master
2021-01-19T19:09:33.394142
2017-04-23T13:39:50
2017-04-23T13:39:50
88,401,443
0
0
null
null
null
null
UTF-8
C++
false
false
352
cpp
#include <iostream> using namespace std; const int MAX = 100; bool isEmpty(int top) { if ( top == 0 ) { return true; } else { return false; } } bool isFull(int top) { if ( top == MAX ) { return true; } else { return false; } } void push(int S, int top) { if ( isFull(top) ) { } else { } } int main() { int a, b; int top = 0; }
[ "yoshima@shiimaxx.com" ]
yoshima@shiimaxx.com
cf1b370af1ffccb248fb1121294afdb3a0f4c411
65791a76c95a765c7b31c78ce3d8ce7179dfb0be
/art/runtime/parsed_options_test.cc
b58a29c4711bd0d814f6902c48323c97f6207bc3
[ "NCSA", "Apache-2.0" ]
permissive
lamproae/feixue
1def2887c0becbccd6d2e87a439482bfccc7597c
f49184e63cd88e7c5bbb0413a5d80f4564657559
refs/heads/master
2016-09-15T15:54:12.643916
2015-07-25T03:03:16
2015-07-25T03:03:16
39,730,495
0
1
null
null
null
null
UTF-8
C++
false
false
3,415
cc
/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "parsed_options.h" #include <memory> #include "common_runtime_test.h" namespace art { class ParsedOptionsTest : public CommonRuntimeTest {}; TEST_F(ParsedOptionsTest, ParsedOptions) { void* test_vfprintf = reinterpret_cast<void*>(0xa); void* test_abort = reinterpret_cast<void*>(0xb); void* test_exit = reinterpret_cast<void*>(0xc); void* null = reinterpret_cast<void*>(NULL); std::string lib_core(GetLibCoreDexFileName()); std::string boot_class_path; boot_class_path += "-Xbootclasspath:"; boot_class_path += lib_core; Runtime::Options options; options.push_back(std::make_pair(boot_class_path.c_str(), null)); options.push_back(std::make_pair("-classpath", null)); options.push_back(std::make_pair(lib_core.c_str(), null)); options.push_back(std::make_pair("-cp", null)); options.push_back(std::make_pair(lib_core.c_str(), null)); options.push_back(std::make_pair("-Ximage:boot_image", null)); options.push_back(std::make_pair("-Xcheck:jni", null)); options.push_back(std::make_pair("-Xms2048", null)); options.push_back(std::make_pair("-Xmx4k", null)); options.push_back(std::make_pair("-Xss1m", null)); options.push_back(std::make_pair("-XX:HeapTargetUtilization=0.75", null)); options.push_back(std::make_pair("-Dfoo=bar", null)); options.push_back(std::make_pair("-Dbaz=qux", null)); options.push_back(std::make_pair("-verbose:gc,class,jni", null)); options.push_back(std::make_pair("vfprintf", test_vfprintf)); options.push_back(std::make_pair("abort", test_abort)); options.push_back(std::make_pair("exit", test_exit)); std::unique_ptr<ParsedOptions> parsed(ParsedOptions::Create(options, false)); ASSERT_TRUE(parsed.get() != NULL); EXPECT_EQ(lib_core, parsed->boot_class_path_string_); EXPECT_EQ(lib_core, parsed->class_path_string_); EXPECT_EQ(std::string("boot_image"), parsed->image_); EXPECT_EQ(true, parsed->check_jni_); EXPECT_EQ(2048U, parsed->heap_initial_size_); EXPECT_EQ(4 * KB, parsed->heap_maximum_size_); EXPECT_EQ(1 * MB, parsed->stack_size_); EXPECT_EQ(0.75, parsed->heap_target_utilization_); EXPECT_TRUE(test_vfprintf == parsed->hook_vfprintf_); EXPECT_TRUE(test_exit == parsed->hook_exit_); EXPECT_TRUE(test_abort == parsed->hook_abort_); EXPECT_TRUE(VLOG_IS_ON(class_linker)); EXPECT_FALSE(VLOG_IS_ON(compiler)); EXPECT_FALSE(VLOG_IS_ON(heap)); EXPECT_TRUE(VLOG_IS_ON(gc)); EXPECT_FALSE(VLOG_IS_ON(jdwp)); EXPECT_TRUE(VLOG_IS_ON(jni)); EXPECT_FALSE(VLOG_IS_ON(monitor)); EXPECT_FALSE(VLOG_IS_ON(startup)); EXPECT_FALSE(VLOG_IS_ON(third_party_jni)); EXPECT_FALSE(VLOG_IS_ON(threads)); ASSERT_EQ(2U, parsed->properties_.size()); EXPECT_EQ("foo=bar", parsed->properties_[0]); EXPECT_EQ("baz=qux", parsed->properties_[1]); } } // namespace art
[ "ektksc@gmail.com" ]
ektksc@gmail.com
59138b9fbe45d74e082cfa9590c3685c9934f467
dc5aa5d4740a3b26060806a75caa2e192886be99
/robot_node/src/PracticalSocket/PracticalSocket.cpp
7c10934d676839ad2e1d09bb5068f12598417b0b
[]
no_license
mcubelab/abb-ros-catkin
5b9f145ac4022e714cd691a1c9c873af4d733cff
4a9c2d4a2e758b64f808b8086cb5e25bcc6087bb
refs/heads/master
2021-01-19T22:05:05.428756
2017-12-13T11:32:14
2017-12-13T11:32:14
88,748,722
2
4
null
2018-06-10T15:11:59
2017-04-19T13:30:21
C++
UTF-8
C++
false
false
12,433
cpp
/* * C++ sockets on Unix and Windows * Copyright (C) 2002 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "PracticalSocket.h" #include <string.h> #include <stdlib.h> #include <fcntl.h> #ifdef WIN32 #include <winsock.h> // For socket(), connect(), send(), and recv() typedef int socklen_t; typedef char raw_type; // Type used for raw data on this platform #else #include <sys/types.h> // For data types #include <sys/socket.h> // For socket(), connect(), send(), and recv() #include <netdb.h> // For gethostbyname() #include <arpa/inet.h> // For inet_addr() #include <unistd.h> // For close() #include <netinet/in.h> // For sockaddr_in typedef void raw_type; // Type used for raw data on this platform #endif #include <errno.h> // For errno using namespace std; #ifdef WIN32 static bool initialized = false; #endif // SocketException Code SocketException::SocketException(const string &message, bool inclSysMsg) throw() : userMessage(message) { if (inclSysMsg) { userMessage.append(": "); userMessage.append(strerror(errno)); } } SocketException::~SocketException() throw() { } const char *SocketException::what() const throw() { return userMessage.c_str(); } // Function to fill in address structure given an address and port static void fillAddr(const string &address, unsigned short port, sockaddr_in &addr) { memset(&addr, 0, sizeof(addr)); // Zero out address structure addr.sin_family = AF_INET; // Internet address hostent *host; // Resolve name if ((host = gethostbyname(address.c_str())) == NULL) { // strerror() will not work for gethostbyname() and hstrerror() // is supposedly obsolete throw SocketException("Failed to resolve name (gethostbyname())"); } addr.sin_addr.s_addr = *((unsigned long *) host->h_addr_list[0]); addr.sin_port = htons(port); // Assign port in network byte order } // Socket Code Socket::Socket(int type, int protocol) throw(SocketException) { #ifdef WIN32 if (!initialized) { WORD wVersionRequested; WSADATA wsaData; wVersionRequested = MAKEWORD(2, 0); // Request WinSock v2.0 if (WSAStartup(wVersionRequested, &wsaData) != 0) { // Load WinSock DLL throw SocketException("Unable to load WinSock DLL"); } initialized = true; } #endif // Make a new socket if ((sockDesc = socket(PF_INET, type, protocol)) < 0) { throw SocketException("Socket creation failed (socket())", true); } // hack int flags; flags = fcntl(sockDesc,F_GETFL,0); fcntl(sockDesc, F_SETFL, flags | O_NONBLOCK); } Socket::Socket(int sockDesc) { this->sockDesc = sockDesc; } Socket::~Socket() { #ifdef WIN32 ::closesocket(sockDesc); #else ::close(sockDesc); #endif sockDesc = -1; } string Socket::getLocalAddress() throw(SocketException) { sockaddr_in addr; unsigned int addr_len = sizeof(addr); if (getsockname(sockDesc, (sockaddr *) &addr, (socklen_t *) &addr_len) < 0) { throw SocketException("Fetch of local address failed (getsockname())", true); } return inet_ntoa(addr.sin_addr); } unsigned short Socket::getLocalPort() throw(SocketException) { sockaddr_in addr; unsigned int addr_len = sizeof(addr); if (getsockname(sockDesc, (sockaddr *) &addr, (socklen_t *) &addr_len) < 0) { throw SocketException("Fetch of local port failed (getsockname())", true); } return ntohs(addr.sin_port); } void Socket::setLocalPort(unsigned short localPort) throw(SocketException) { // Bind the socket to its port sockaddr_in localAddr; memset(&localAddr, 0, sizeof(localAddr)); localAddr.sin_family = AF_INET; localAddr.sin_addr.s_addr = htonl(INADDR_ANY); localAddr.sin_port = htons(localPort); if (bind(sockDesc, (sockaddr *) &localAddr, sizeof(sockaddr_in)) < 0) { throw SocketException("Set of local port failed (bind())", true); } } void Socket::setLocalAddressAndPort(const string &localAddress, unsigned short localPort) throw(SocketException) { // Get the address of the requested host sockaddr_in localAddr; fillAddr(localAddress, localPort, localAddr); if (bind(sockDesc, (sockaddr *) &localAddr, sizeof(sockaddr_in)) < 0) { throw SocketException("Set of local address and port failed (bind())", true); } } void Socket::cleanUp() throw(SocketException) { #ifdef WIN32 if (WSACleanup() != 0) { throw SocketException("WSACleanup() failed"); } #endif } unsigned short Socket::resolveService(const string &service, const string &protocol) { struct servent *serv; /* Structure containing service information */ if ((serv = getservbyname(service.c_str(), protocol.c_str())) == NULL) return atoi(service.c_str()); /* Service is port number */ else return ntohs(serv->s_port); /* Found port (network byte order) by name */ } // CommunicatingSocket Code CommunicatingSocket::CommunicatingSocket(int type, int protocol) throw(SocketException) : Socket(type, protocol) { } CommunicatingSocket::CommunicatingSocket(int newConnSD) : Socket(newConnSD) { } void CommunicatingSocket::connect(const string &foreignAddress, unsigned short foreignPort) throw(SocketException) { // Get the address of the requested host sockaddr_in destAddr; fillAddr(foreignAddress, foreignPort, destAddr); // Try to connect to the given port if (::connect(sockDesc, (sockaddr *) &destAddr, sizeof(destAddr)) < 0) { throw SocketException("Connect failed (connect())", true); } } void CommunicatingSocket::send(const void *buffer, int bufferLen) throw(SocketException) { if (::send(sockDesc, (raw_type *) buffer, bufferLen, 0) < 0) { throw SocketException("Send failed (send())", true); } } int CommunicatingSocket::recv(void *buffer, int bufferLen) throw(SocketException) { int rtn; if ((rtn = ::recv(sockDesc, (raw_type *) buffer, bufferLen, 0)) < 0) { throw SocketException("Received failed (recv())", true); } return rtn; } string CommunicatingSocket::getForeignAddress() throw(SocketException) { sockaddr_in addr; unsigned int addr_len = sizeof(addr); if (getpeername(sockDesc, (sockaddr *) &addr,(socklen_t *) &addr_len) < 0) { throw SocketException("Fetch of foreign address failed (getpeername())", true); } return inet_ntoa(addr.sin_addr); } unsigned short CommunicatingSocket::getForeignPort() throw(SocketException) { sockaddr_in addr; unsigned int addr_len = sizeof(addr); if (getpeername(sockDesc, (sockaddr *) &addr, (socklen_t *) &addr_len) < 0) { throw SocketException("Fetch of foreign port failed (getpeername())", true); } return ntohs(addr.sin_port); } // TCPSocket Code TCPSocket::TCPSocket() throw(SocketException) : CommunicatingSocket(SOCK_STREAM, IPPROTO_TCP) { } TCPSocket::TCPSocket(const string &foreignAddress, unsigned short foreignPort) throw(SocketException) : CommunicatingSocket(SOCK_STREAM, IPPROTO_TCP) { connect(foreignAddress, foreignPort); } TCPSocket::TCPSocket(int newConnSD) : CommunicatingSocket(newConnSD) { } // TCPServerSocket Code TCPServerSocket::TCPServerSocket(unsigned short localPort, int queueLen) throw(SocketException) : Socket(SOCK_STREAM, IPPROTO_TCP) { setLocalPort(localPort); setListen(queueLen); } TCPServerSocket::TCPServerSocket(const string &localAddress, unsigned short localPort, int queueLen) throw(SocketException) : Socket(SOCK_STREAM, IPPROTO_TCP) { setLocalAddressAndPort(localAddress, localPort); setListen(queueLen); } TCPSocket *TCPServerSocket::accept() throw(SocketException) { int newConnSD; if ((newConnSD = ::accept(sockDesc, NULL, 0)) < 0) { throw SocketException("Accept failed (accept())", true); } return new TCPSocket(newConnSD); } void TCPServerSocket::setListen(int queueLen) throw(SocketException) { if (listen(sockDesc, queueLen) < 0) { throw SocketException("Set listening socket failed (listen())", true); } } // UDPSocket Code UDPSocket::UDPSocket() throw(SocketException) : CommunicatingSocket(SOCK_DGRAM, IPPROTO_UDP) { setBroadcast(); } UDPSocket::UDPSocket(unsigned short localPort) throw(SocketException) : CommunicatingSocket(SOCK_DGRAM, IPPROTO_UDP) { setLocalPort(localPort); setBroadcast(); } UDPSocket::UDPSocket(const string &localAddress, unsigned short localPort) throw(SocketException) : CommunicatingSocket(SOCK_DGRAM, IPPROTO_UDP) { setLocalAddressAndPort(localAddress, localPort); setBroadcast(); } void UDPSocket::setBroadcast() { // If this fails, we'll hear about it when we try to send. This will allow // system that cannot broadcast to continue if they don't plan to broadcast int broadcastPermission = 1; setsockopt(sockDesc, SOL_SOCKET, SO_BROADCAST, (raw_type *) &broadcastPermission, sizeof(broadcastPermission)); } void UDPSocket::disconnect() throw(SocketException) { sockaddr_in nullAddr; memset(&nullAddr, 0, sizeof(nullAddr)); nullAddr.sin_family = AF_UNSPEC; // Try to disconnect if (::connect(sockDesc, (sockaddr *) &nullAddr, sizeof(nullAddr)) < 0) { #ifdef WIN32 if (errno != WSAEAFNOSUPPORT) { #else if (errno != EAFNOSUPPORT) { #endif throw SocketException("Disconnect failed (connect())", true); } } } void UDPSocket::sendTo(const void *buffer, int bufferLen, const string &foreignAddress, unsigned short foreignPort) throw(SocketException) { sockaddr_in destAddr; fillAddr(foreignAddress, foreignPort, destAddr); // Write out the whole buffer as a single message. if (sendto(sockDesc, (raw_type *) buffer, bufferLen, 0, (sockaddr *) &destAddr, sizeof(destAddr)) != bufferLen) { throw SocketException("Send failed (sendto())", true); } } int UDPSocket::recvFrom(void *buffer, int bufferLen, string &sourceAddress, unsigned short &sourcePort) throw(SocketException) { sockaddr_in clntAddr; socklen_t addrLen = sizeof(clntAddr); int rtn; if ((rtn = recvfrom(sockDesc, (raw_type *) buffer, bufferLen, 0, (sockaddr *) &clntAddr, (socklen_t *) &addrLen)) < 0) { throw SocketException("Receive failed (recvfrom())", true); } sourceAddress = inet_ntoa(clntAddr.sin_addr); sourcePort = ntohs(clntAddr.sin_port); return rtn; } void UDPSocket::setMulticastTTL(unsigned char multicastTTL) throw(SocketException) { if (setsockopt(sockDesc, IPPROTO_IP, IP_MULTICAST_TTL, (raw_type *) &multicastTTL, sizeof(multicastTTL)) < 0) { throw SocketException("Multicast TTL set failed (setsockopt())", true); } } void UDPSocket::joinGroup(const string &multicastGroup) throw(SocketException) { struct ip_mreq multicastRequest; multicastRequest.imr_multiaddr.s_addr = inet_addr(multicastGroup.c_str()); multicastRequest.imr_interface.s_addr = htonl(INADDR_ANY); if (setsockopt(sockDesc, IPPROTO_IP, IP_ADD_MEMBERSHIP, (raw_type *) &multicastRequest, sizeof(multicastRequest)) < 0) { throw SocketException("Multicast group join failed (setsockopt())", true); } } void UDPSocket::leaveGroup(const string &multicastGroup) throw(SocketException) { struct ip_mreq multicastRequest; multicastRequest.imr_multiaddr.s_addr = inet_addr(multicastGroup.c_str()); multicastRequest.imr_interface.s_addr = htonl(INADDR_ANY); if (setsockopt(sockDesc, IPPROTO_IP, IP_DROP_MEMBERSHIP, (raw_type *) &multicastRequest, sizeof(multicastRequest)) < 0) { throw SocketException("Multicast group leave failed (setsockopt())", true); } }
[ "peterkty@gmail.com" ]
peterkty@gmail.com
d256bb361f346d9b64c31604ee1e1d8a49014ea2
c55e607f1dc3727aac9efd6636e29315243d4213
/Classes/Tentacle.h
5289e534aa06297c15e5c9d296301b21d119e4c9
[]
no_license
Varun-MS/CultOfTheEye
e08fb05a49fd1b89442fb6a74251594b97fd4b44
9c2881ee97553c04a71b233dff7426b034b3be84
refs/heads/master
2020-04-27T09:13:39.535080
2019-03-06T19:24:14
2019-03-06T19:24:14
174,205,956
0
1
null
null
null
null
UTF-8
C++
false
false
556
h
#pragma once #include "cocos2d.h" #include "Tower.h" #include "Monster.h" #include <map> using namespace cocos2d; class Tentacle : public Monster { int mStage; public: enum Animations { Idle, Attack, Damaged, Retreat, Spawn, Count }; static vector<vector<vector<PhysicsShapePolygon*>>> mShapes; static Tentacle* create(int stage, int quadrant, Vec2 position); Tentacle(int stage, int quadrant, Vec2 position); void createPhysicsBody(); void createSprite(); void attack(); void spawn(); void retreat(); void withdraw(); void idle(); };
[ "reach.varun.ms@gmail.com" ]
reach.varun.ms@gmail.com
0e01fd92c43f9a9a675ae2089a85b3897ad63ef5
59c29cdb0ce237ef70068a676c32742e689a062a
/Analyser/Static/Atari2600/StaticAnalyser.cpp
cd756e59e5a8067a2adca4f055de271b58290915
[ "MIT" ]
permissive
Sakery/CLK
18828596490958532ac79f24b4ab0ea4e4610f4f
8e094598cab18b7ef9e0bc6115719e4871a1df80
refs/heads/master
2020-12-23T13:44:41.137181
2020-01-28T02:54:32
2020-01-28T02:54:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,236
cpp
// // StaticAnalyser.cpp // Clock Signal // // Created by Thomas Harte on 15/09/2016. // Copyright 2016 Thomas Harte. All rights reserved. // #include "StaticAnalyser.hpp" #include "Target.hpp" #include "../Disassembler/6502.hpp" using namespace Analyser::Static::Atari2600; using Target = Analyser::Static::Atari2600::Target; static void DeterminePagingFor2kCartridge(Target &target, const Storage::Cartridge::Cartridge::Segment &segment) { // if this is a 2kb cartridge then it's definitely either unpaged or a CommaVid uint16_t entry_address, break_address; entry_address = (static_cast<uint16_t>(segment.data[0x7fc] | (segment.data[0x7fd] << 8))) & 0x1fff; break_address = (static_cast<uint16_t>(segment.data[0x7fe] | (segment.data[0x7ff] << 8))) & 0x1fff; // a CommaVid start address needs to be outside of its RAM if(entry_address < 0x1800 || break_address < 0x1800) return; std::function<std::size_t(uint16_t address)> high_location_mapper = [](uint16_t address) { address &= 0x1fff; return static_cast<std::size_t>(address - 0x1800); }; Analyser::Static::MOS6502::Disassembly high_location_disassembly = Analyser::Static::MOS6502::Disassemble(segment.data, high_location_mapper, {entry_address, break_address}); // assume that any kind of store that looks likely to be intended for large amounts of memory implies // large amounts of memory bool has_wide_area_store = false; for(std::map<uint16_t, Analyser::Static::MOS6502::Instruction>::value_type &entry : high_location_disassembly.instructions_by_address) { if(entry.second.operation == Analyser::Static::MOS6502::Instruction::STA) { has_wide_area_store |= entry.second.addressing_mode == Analyser::Static::MOS6502::Instruction::Indirect; has_wide_area_store |= entry.second.addressing_mode == Analyser::Static::MOS6502::Instruction::IndexedIndirectX; has_wide_area_store |= entry.second.addressing_mode == Analyser::Static::MOS6502::Instruction::IndirectIndexedY; if(has_wide_area_store) break; } } // conclude that this is a CommaVid if it attempted to write something to the CommaVid RAM locations; // caveat: false positives aren't likely to be problematic; a false positive is a 2KB ROM that always addresses // itself so as to land in ROM even if mapped as a CommaVid and this code is on the fence as to whether it // attempts to modify itself but it probably doesn't if(has_wide_area_store) target.paging_model = Target::PagingModel::CommaVid; } static void DeterminePagingFor8kCartridge(Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const Analyser::Static::MOS6502::Disassembly &disassembly) { // Activision stack titles have their vectors at the top of the low 4k, not the top, and // always list 0xf000 as both vectors; they do not repeat them, and, inexplicably, they all // issue an SEI as their first instruction (maybe some sort of relic of the development environment?) if( segment.data[4095] == 0xf0 && segment.data[4093] == 0xf0 && segment.data[4094] == 0x00 && segment.data[4092] == 0x00 && (segment.data[8191] != 0xf0 || segment.data[8189] != 0xf0 || segment.data[8190] != 0x00 || segment.data[8188] != 0x00) && segment.data[0] == 0x78 ) { target.paging_model = Target::PagingModel::ActivisionStack; return; } // make an assumption that this is the Atari paging model target.paging_model = Target::PagingModel::Atari8k; std::set<uint16_t> internal_accesses; internal_accesses.insert(disassembly.internal_stores.begin(), disassembly.internal_stores.end()); internal_accesses.insert(disassembly.internal_modifies.begin(), disassembly.internal_modifies.end()); internal_accesses.insert(disassembly.internal_loads.begin(), disassembly.internal_loads.end()); int atari_access_count = 0; int parker_access_count = 0; int tigervision_access_count = 0; for(uint16_t address : internal_accesses) { uint16_t masked_address = address & 0x1fff; atari_access_count += masked_address >= 0x1ff8 && masked_address < 0x1ffa; parker_access_count += masked_address >= 0x1fe0 && masked_address < 0x1ff8; } for(uint16_t address: disassembly.external_stores) { uint16_t masked_address = address & 0x1fff; tigervision_access_count += masked_address == 0x3f; } if(parker_access_count > atari_access_count) target.paging_model = Target::PagingModel::ParkerBros; else if(tigervision_access_count > atari_access_count) target.paging_model = Target::PagingModel::Tigervision; } static void DeterminePagingFor16kCartridge(Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const Analyser::Static::MOS6502::Disassembly &disassembly) { // make an assumption that this is the Atari paging model target.paging_model = Target::PagingModel::Atari16k; std::set<uint16_t> internal_accesses; internal_accesses.insert(disassembly.internal_stores.begin(), disassembly.internal_stores.end()); internal_accesses.insert(disassembly.internal_modifies.begin(), disassembly.internal_modifies.end()); internal_accesses.insert(disassembly.internal_loads.begin(), disassembly.internal_loads.end()); int atari_access_count = 0; int mnetwork_access_count = 0; for(uint16_t address : internal_accesses) { uint16_t masked_address = address & 0x1fff; atari_access_count += masked_address >= 0x1ff6 && masked_address < 0x1ffa; mnetwork_access_count += masked_address >= 0x1fe0 && masked_address < 0x1ffb; } if(mnetwork_access_count > atari_access_count) target.paging_model = Target::PagingModel::MNetwork; } static void DeterminePagingFor64kCartridge(Target &target, const Storage::Cartridge::Cartridge::Segment &segment, const Analyser::Static::MOS6502::Disassembly &disassembly) { // make an assumption that this is a Tigervision if there is a write to 3F target.paging_model = (disassembly.external_stores.find(0x3f) != disassembly.external_stores.end()) ? Target::PagingModel::Tigervision : Target::PagingModel::MegaBoy; } static void DeterminePagingForCartridge(Target &target, const Storage::Cartridge::Cartridge::Segment &segment) { if(segment.data.size() == 2048) { DeterminePagingFor2kCartridge(target, segment); return; } uint16_t entry_address, break_address; entry_address = static_cast<uint16_t>(segment.data[segment.data.size() - 4] | (segment.data[segment.data.size() - 3] << 8)); break_address = static_cast<uint16_t>(segment.data[segment.data.size() - 2] | (segment.data[segment.data.size() - 1] << 8)); std::function<std::size_t(uint16_t address)> address_mapper = [](uint16_t address) { if(!(address & 0x1000)) return static_cast<std::size_t>(-1); return static_cast<std::size_t>(address & 0xfff); }; std::vector<uint8_t> final_4k(segment.data.end() - 4096, segment.data.end()); Analyser::Static::MOS6502::Disassembly disassembly = Analyser::Static::MOS6502::Disassemble(final_4k, address_mapper, {entry_address, break_address}); switch(segment.data.size()) { case 8192: DeterminePagingFor8kCartridge(target, segment, disassembly); break; case 10495: target.paging_model = Target::PagingModel::Pitfall2; break; case 12288: target.paging_model = Target::PagingModel::CBSRamPlus; break; case 16384: DeterminePagingFor16kCartridge(target, segment, disassembly); break; case 32768: target.paging_model = Target::PagingModel::Atari32k; break; case 65536: DeterminePagingFor64kCartridge(target, segment, disassembly); break; default: break; } // check for a Super Chip. Atari ROM images [almost] always have the same value stored over RAM // regions; when they don't they at least seem to have the first 128 bytes be the same as the // next 128 bytes. So check for that. if( target.paging_model != Target::PagingModel::CBSRamPlus && target.paging_model != Target::PagingModel::MNetwork) { bool has_superchip = true; for(std::size_t address = 0; address < 128; address++) { if(segment.data[address] != segment.data[address+128]) { has_superchip = false; break; } } target.uses_superchip = has_superchip; } // check for a Tigervision or Tigervision-esque scheme if(target.paging_model == Target::PagingModel::None && segment.data.size() > 4096) { bool looks_like_tigervision = disassembly.external_stores.find(0x3f) != disassembly.external_stores.end(); if(looks_like_tigervision) target.paging_model = Target::PagingModel::Tigervision; } } Analyser::Static::TargetList Analyser::Static::Atari2600::GetTargets(const Media &media, const std::string &file_name, TargetPlatform::IntType potential_platforms) { // TODO: sanity checking; is this image really for an Atari 2600? auto target = std::make_unique<Target>(); target->machine = Machine::Atari2600; target->confidence = 0.5; target->media.cartridges = media.cartridges; target->paging_model = Target::PagingModel::None; target->uses_superchip = false; // try to figure out the paging scheme if(!media.cartridges.empty()) { const auto &segments = media.cartridges.front()->get_segments(); if(segments.size() == 1) { const Storage::Cartridge::Cartridge::Segment &segment = segments.front(); DeterminePagingForCartridge(*target, segment); } } TargetList destinations; destinations.push_back(std::move(target)); return destinations; }
[ "thomas.harte@gmail.com" ]
thomas.harte@gmail.com
e120baf7013b67a3e4b54641118f26cfdd9f95ab
2b219e180c6a4bd1682a562f952fc877e50150fc
/src/rpcrawtransaction.cpp
306b74bcb2acd1d7732aebf3e29ce82b5ef975d8
[ "MIT" ]
permissive
qdBlockChain/LRM-LRMcoin
2c5be45184df79f75e610a38e190818a74a8fa4c
cbe0e8f0df0b899f78cbb1ca1824d0d18309325b
refs/heads/master
2020-03-23T23:37:08.133540
2018-07-25T04:58:07
2018-07-25T04:58:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
19,219
cpp
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <boost/assign/list_of.hpp> #include "base58.h" #include "bitcoinrpc.h" #include "db.h" #include "init.h" #include "main.h" #include "net.h" #include "wallet.h" using namespace std; using namespace boost; using namespace boost::assign; using namespace json_spirit; void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out) { txnouttype type; vector<CTxDestination> addresses; int nRequired; out.push_back(Pair("asm", scriptPubKey.ToString())); out.push_back(Pair("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end()))); if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) { out.push_back(Pair("type", GetTxnOutputType(TX_NONSTANDARD))); return; } out.push_back(Pair("reqSigs", nRequired)); out.push_back(Pair("type", GetTxnOutputType(type))); Array a; BOOST_FOREACH(const CTxDestination& addr, addresses) a.push_back(CBitcoinAddress(addr).ToString()); out.push_back(Pair("addresses", a)); } void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry) { entry.push_back(Pair("txid", tx.GetHash().GetHex())); entry.push_back(Pair("version", tx.nVersion)); entry.push_back(Pair("time", (boost::int64_t)tx.nTime)); entry.push_back(Pair("locktime", (boost::int64_t)tx.nLockTime)); Array vin; BOOST_FOREACH(const CTxIn& txin, tx.vin) { Object in; if (tx.IsCoinBase()) in.push_back(Pair("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); else { in.push_back(Pair("txid", txin.prevout.hash.GetHex())); in.push_back(Pair("vout", (boost::int64_t)txin.prevout.n)); Object o; o.push_back(Pair("asm", txin.scriptSig.ToString())); o.push_back(Pair("hex", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); in.push_back(Pair("scriptSig", o)); } in.push_back(Pair("sequence", (boost::int64_t)txin.nSequence)); vin.push_back(in); } entry.push_back(Pair("vin", vin)); Array vout; for (unsigned int i = 0; i < tx.vout.size(); i++) { const CTxOut& txout = tx.vout[i]; Object out; out.push_back(Pair("value", ValueFromAmount(txout.nValue))); out.push_back(Pair("n", (boost::int64_t)i)); Object o; ScriptPubKeyToJSON(txout.scriptPubKey, o); out.push_back(Pair("scriptPubKey", o)); vout.push_back(out); } entry.push_back(Pair("vout", vout)); if (hashBlock != 0) { entry.push_back(Pair("blockhash", hashBlock.GetHex())); map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock); if (mi != mapBlockIndex.end() && (*mi).second) { CBlockIndex* pindex = (*mi).second; if (pindex->IsInMainChain()) { entry.push_back(Pair("confirmations", 1 + nBestHeight - pindex->nHeight)); entry.push_back(Pair("time", (boost::int64_t)pindex->nTime)); entry.push_back(Pair("blocktime", (boost::int64_t)pindex->nTime)); } else entry.push_back(Pair("confirmations", 0)); } } } Value getrawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "getrawtransaction <txid> [verbose=0]\n" "If verbose=0, returns a string that is\n" "serialized, hex-encoded data for <txid>.\n" "If verbose is non-zero, returns an Object\n" "with information about <txid>."); uint256 hash; hash.SetHex(params[0].get_str()); bool fVerbose = false; if (params.size() > 1) fVerbose = (params[1].get_int() != 0); CTransaction tx; uint256 hashBlock = 0; if (!GetTransaction(hash, tx, hashBlock)) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "No information available about transaction"); CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); ssTx << tx; string strHex = HexStr(ssTx.begin(), ssTx.end()); if (!fVerbose) return strHex; Object result; result.push_back(Pair("hex", strHex)); TxToJSON(tx, hashBlock, result); return result; } Value listunspent(const Array& params, bool fHelp) { if (fHelp || params.size() > 3) throw runtime_error( "listunspent [minconf=1] [maxconf=9999999] [\"address\",...]\n" "Returns array of unspent transaction outputs\n" "with between minconf and maxconf (inclusive) confirmations.\n" "Optionally filtered to only include txouts paid to specified addresses.\n" "Results are an array of Objects, each of which has:\n" "{txid, vout, scriptPubKey, amount, confirmations}"); RPCTypeCheck(params, list_of(int_type)(int_type)(array_type)); int nMinDepth = 1; if (params.size() > 0) nMinDepth = params[0].get_int(); int nMaxDepth = 9999999; if (params.size() > 1) nMaxDepth = params[1].get_int(); set<CBitcoinAddress> setAddress; if (params.size() > 2) { Array inputs = params[2].get_array(); BOOST_FOREACH(Value& input, inputs) { CBitcoinAddress address(input.get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid LRM address: ")+input.get_str()); if (setAddress.count(address)) throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+input.get_str()); setAddress.insert(address); } } Array results; vector<COutput> vecOutputs; pwalletMain->AvailableCoins(vecOutputs, false); BOOST_FOREACH(const COutput& out, vecOutputs) { if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth) continue; if(setAddress.size()) { CTxDestination address; if(!ExtractDestination(out.tx->vout[out.i].scriptPubKey, address)) continue; if (!setAddress.count(address)) continue; } int64 nValue = out.tx->vout[out.i].nValue; const CScript& pk = out.tx->vout[out.i].scriptPubKey; Object entry; entry.push_back(Pair("txid", out.tx->GetHash().GetHex())); entry.push_back(Pair("vout", out.i)); entry.push_back(Pair("scriptPubKey", HexStr(pk.begin(), pk.end()))); entry.push_back(Pair("amount",ValueFromAmount(nValue))); entry.push_back(Pair("confirmations",out.nDepth)); results.push_back(entry); } return results; } Value createrawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() != 2) throw runtime_error( "createrawtransaction [{\"txid\":txid,\"vout\":n},...] {address:amount,...}\n" "Create a transaction spending given inputs\n" "(array of objects containing transaction id and output number),\n" "sending to given address(es).\n" "Returns hex-encoded raw transaction.\n" "Note that the transaction's inputs are not signed, and\n" "it is not stored in the wallet or transmitted to the network."); RPCTypeCheck(params, list_of(array_type)(obj_type)); Array inputs = params[0].get_array(); Object sendTo = params[1].get_obj(); CTransaction rawTx; BOOST_FOREACH(Value& input, inputs) { const Object& o = input.get_obj(); const Value& txid_v = find_value(o, "txid"); if (txid_v.type() != str_type) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing txid key"); string txid = txid_v.get_str(); if (!IsHex(txid)) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected hex txid"); const Value& vout_v = find_value(o, "vout"); if (vout_v.type() != int_type) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing vout key"); int nOutput = vout_v.get_int(); if (nOutput < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive"); CTxIn in(COutPoint(uint256(txid), nOutput)); rawTx.vin.push_back(in); } set<CBitcoinAddress> setAddress; BOOST_FOREACH(const Pair& s, sendTo) { CBitcoinAddress address(s.name_); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid LRM address: ")+s.name_); if (setAddress.count(address)) throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_); setAddress.insert(address); CScript scriptPubKey; scriptPubKey.SetDestination(address.Get()); int64 nAmount = AmountFromValue(s.value_); CTxOut out(nAmount, scriptPubKey); rawTx.vout.push_back(out); } CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss << rawTx; return HexStr(ss.begin(), ss.end()); } Value decoderawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "decoderawtransaction <hex string>\n" "Return a JSON object representing the serialized, hex-encoded transaction."); RPCTypeCheck(params, list_of(str_type)); vector<unsigned char> txData(ParseHex(params[0].get_str())); CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION); CTransaction tx; try { ssData >> tx; } catch (std::exception &e) { throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); } Object result; TxToJSON(tx, 0, result); return result; } Value signrawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 4) throw runtime_error( "signrawtransaction <hex string> [{\"txid\":txid,\"vout\":n,\"scriptPubKey\":hex},...] [<privatekey1>,...] [sighashtype=\"ALL\"]\n" "Sign inputs for raw transaction (serialized, hex-encoded).\n" "Second optional argument (may be null) is an array of previous transaction outputs that\n" "this transaction depends on but may not yet be in the blockchain.\n" "Third optional argument (may be null) is an array of base58-encoded private\n" "keys that, if given, will be the only keys used to sign the transaction.\n" "Fourth optional argument is a string that is one of six values; ALL, NONE, SINGLE or\n" "ALL|ANYONECANPAY, NONE|ANYONECANPAY, SINGLE|ANYONECANPAY.\n" "Returns json object with keys:\n" " hex : raw transaction with signature(s) (hex-encoded string)\n" " complete : 1 if transaction has a complete set of signature (0 if not)" + HelpRequiringPassphrase()); RPCTypeCheck(params, list_of(str_type)(array_type)(array_type)(str_type), true); vector<unsigned char> txData(ParseHex(params[0].get_str())); CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION); vector<CTransaction> txVariants; while (!ssData.empty()) { try { CTransaction tx; ssData >> tx; txVariants.push_back(tx); } catch (std::exception &e) { throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); } } if (txVariants.empty()) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Missing transaction"); // mergedTx will end up with all the signatures; it // starts as a clone of the rawtx: CTransaction mergedTx(txVariants[0]); bool fComplete = true; // Fetch previous transactions (inputs): map<COutPoint, CScript> mapPrevOut; for (unsigned int i = 0; i < mergedTx.vin.size(); i++) { CTransaction tempTx; MapPrevTx mapPrevTx; CTxDB txdb("r"); map<uint256, CTxIndex> unused; bool fInvalid; // FetchInputs aborts on failure, so we go one at a time. tempTx.vin.push_back(mergedTx.vin[i]); tempTx.FetchInputs(txdb, unused, false, false, mapPrevTx, fInvalid); // Copy results into mapPrevOut: BOOST_FOREACH(const CTxIn& txin, tempTx.vin) { const uint256& prevHash = txin.prevout.hash; if (mapPrevTx.count(prevHash) && mapPrevTx[prevHash].second.vout.size()>txin.prevout.n) mapPrevOut[txin.prevout] = mapPrevTx[prevHash].second.vout[txin.prevout.n].scriptPubKey; } } // Add previous txouts given in the RPC call: if (params.size() > 1 && params[1].type() != null_type) { Array prevTxs = params[1].get_array(); BOOST_FOREACH(Value& p, prevTxs) { if (p.type() != obj_type) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "expected object with {\"txid'\",\"vout\",\"scriptPubKey\"}"); Object prevOut = p.get_obj(); RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)); string txidHex = find_value(prevOut, "txid").get_str(); if (!IsHex(txidHex)) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "txid must be hexadecimal"); uint256 txid; txid.SetHex(txidHex); int nOut = find_value(prevOut, "vout").get_int(); if (nOut < 0) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "vout must be positive"); string pkHex = find_value(prevOut, "scriptPubKey").get_str(); if (!IsHex(pkHex)) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "scriptPubKey must be hexadecimal"); vector<unsigned char> pkData(ParseHex(pkHex)); CScript scriptPubKey(pkData.begin(), pkData.end()); COutPoint outpoint(txid, nOut); if (mapPrevOut.count(outpoint)) { // Complain if scriptPubKey doesn't match if (mapPrevOut[outpoint] != scriptPubKey) { string err("Previous output scriptPubKey mismatch:\n"); err = err + mapPrevOut[outpoint].ToString() + "\nvs:\n"+ scriptPubKey.ToString(); throw JSONRPCError(RPC_DESERIALIZATION_ERROR, err); } } else mapPrevOut[outpoint] = scriptPubKey; } } bool fGivenKeys = false; CBasicKeyStore tempKeystore; if (params.size() > 2 && params[2].type() != null_type) { fGivenKeys = true; Array keys = params[2].get_array(); BOOST_FOREACH(Value k, keys) { CBitcoinSecret vchSecret; bool fGood = vchSecret.SetString(k.get_str()); if (!fGood) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY,"Invalid private key"); CKey key; bool fCompressed; CSecret secret = vchSecret.GetSecret(fCompressed); key.SetSecret(secret, fCompressed); tempKeystore.AddKey(key); } } else EnsureWalletIsUnlocked(); const CKeyStore& keystore = (fGivenKeys ? tempKeystore : *pwalletMain); int nHashType = SIGHASH_ALL; if (params.size() > 3 && params[3].type() != null_type) { static map<string, int> mapSigHashValues = boost::assign::map_list_of (string("ALL"), int(SIGHASH_ALL)) (string("ALL|ANYONECANPAY"), int(SIGHASH_ALL|SIGHASH_ANYONECANPAY)) (string("NONE"), int(SIGHASH_NONE)) (string("NONE|ANYONECANPAY"), int(SIGHASH_NONE|SIGHASH_ANYONECANPAY)) (string("SINGLE"), int(SIGHASH_SINGLE)) (string("SINGLE|ANYONECANPAY"), int(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY)) ; string strHashType = params[3].get_str(); if (mapSigHashValues.count(strHashType)) nHashType = mapSigHashValues[strHashType]; else throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid sighash param"); } bool fHashSingle = ((nHashType & ~SIGHASH_ANYONECANPAY) == SIGHASH_SINGLE); // Sign what we can: for (unsigned int i = 0; i < mergedTx.vin.size(); i++) { CTxIn& txin = mergedTx.vin[i]; if (mapPrevOut.count(txin.prevout) == 0) { fComplete = false; continue; } const CScript& prevPubKey = mapPrevOut[txin.prevout]; txin.scriptSig.clear(); // Only sign SIGHASH_SINGLE if there's a corresponding output: if (!fHashSingle || (i < mergedTx.vout.size())) SignSignature(keystore, prevPubKey, mergedTx, i, nHashType); // ... and merge in other signatures: BOOST_FOREACH(const CTransaction& txv, txVariants) { txin.scriptSig = CombineSignatures(prevPubKey, mergedTx, i, txin.scriptSig, txv.vin[i].scriptSig); } if (!VerifyScript(txin.scriptSig, prevPubKey, mergedTx, i, true, 0)) fComplete = false; } Object result; CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); ssTx << mergedTx; result.push_back(Pair("hex", HexStr(ssTx.begin(), ssTx.end()))); result.push_back(Pair("complete", fComplete)); return result; } Value sendrawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 1) throw runtime_error( "sendrawtransaction <hex string>\n" "Submits raw transaction (serialized, hex-encoded) to local node and network."); RPCTypeCheck(params, list_of(str_type)); // parse hex string from parameter vector<unsigned char> txData(ParseHex(params[0].get_str())); CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION); CTransaction tx; // deserialize binary data stream try { ssData >> tx; } catch (std::exception &e) { throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); } uint256 hashTx = tx.GetHash(); // See if the transaction is already in a block // or in the memory pool: CTransaction existingTx; uint256 hashBlock = 0; if (GetTransaction(hashTx, existingTx, hashBlock)) { if (hashBlock != 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("transaction already in block ")+hashBlock.GetHex()); // Not in block, but already in the memory pool; will drop // through to re-relay it. } else { // push to local node CTxDB txdb("r"); if (!tx.AcceptToMemoryPool(txdb)) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected"); SyncWithWallets(tx, NULL, true); } RelayMessage(CInv(MSG_TX, hashTx), tx); return hashTx.GetHex(); }
[ "noreply@github.com" ]
noreply@github.com
80dd2de6c4fef752e286c96243a9a42ad472ab47
250e97666c4a919531bf38f3fd56a6ff93987609
/dataStructureClass/chap2/t4.cpp
748b07201a44bffa8ee27d8815e22bd085cd42f1
[ "WTFPL" ]
permissive
claviering/code
ccec3b642056645f5e3df0e6d02aa74ac73e0281
7019d50ff2e390696bc60358d1e39d9112f332e0
refs/heads/master
2021-07-11T13:44:23.211305
2020-06-21T02:46:09
2020-06-21T02:46:09
50,170,145
1
1
null
null
null
null
UTF-8
C++
false
false
1,558
cpp
void separate(List *head, List *char_list_first, List *int_list_first, List *other_list_first) { if (head == 0) { return; } else { char_tmp = 0; int_tmp = 0; other_tmp = 0; while (head != 0) { if (head -> data == char) { char_tmp = head; if (char_list_first == 0) char_list_first = char_tmp; else { char_tmp -> next = head; char_tmp = head; } } else if (head -> data == int) { int_tmp = head; if (int_list_first == 0) int_list_first = int_tmp; else { int_tmp -> next = head; int_tmp = head; } } else if (head -> data == other) { other_tmp = head; if (other_list_first == 0) other_list_first = other_tmp; else { other_tmp -> next = head; other_tmp = head; } } head = head -> next; } char_tmp = char_list_first; int_tmp = int_list_first; other_tmp = other_list_first; char_tmp = 0; int_tmp = 0; other_tmp = 0; delete char_tmp; delete int_tmp; delete other_tmp; } }
[ "claviering@gmail.com" ]
claviering@gmail.com
94829e5b504132e910e9fa5d04f78a32bd11ad07
0f3bee9c3f6d991a41158300426d7f35868fda99
/include/rtseis/utilities/deconvolution/transfer.hpp
d1d89efc513fa9c87d5c7a9367fb7012cfdc3584
[ "MIT" ]
permissive
yuminzhao91/rtseis
b5a4db14e51141830a224db454c87937f3a11ece
bec376cf6e0038ca820496cd103eb8e2b33c7187
refs/heads/master
2023-01-07T22:47:56.022685
2019-11-12T22:47:44
2019-11-12T22:47:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,575
hpp
#ifndef RTSEIS_UTILITIES_DECONVOLUTION_TRANSFER_HPP #define RTSEIS_UTILITIES_DECONVOLUTION_TRANSFER_HPP 1 #include <memory> using namespace RTSeis::Utilities::Deconvolution { // Forward declaration class InstrumentResponse; /*! * @class Transfer transfer.hpp "rtseis/utilities/deconvolution/transfer.hpp" * @brief Removes and/or adds an instrument response. * @note This is a frequency domain based algorithm. * @copyright Ben Baker (University of Utah) distributed under the MIT license. */ class Transfer { public: /*! @name Constructors * @{ */ /*! * @brief Constructor */ Transfer() /*! @} */ /*! @name Destructors * @{ */ /*! * @brief Destructor */ ~Transfer(); /*! * @brief Releases memory and resets the class. */ void clear() noexcept; /*! @} */ /*! * @brief Initializes the transfer class. This will remove the current * response from the data. * @param[in] npts The number of samples in the signal. * @param[in] samplingRate The sampling rate in Hz. * @param[in] currentResponse The instrument response that will be * deconvolved from the data. */ void initialize(const int npts, const double samplingRate, const InstrumentResponse &currentResponse, const RTSeis::Precision precision = RTSeis::Precision::DOUBLE); /*! * @brief Initializes the transfer class. This will remove the current * response from the data then convolve in the target response. * @param[in] npts The number of samples in the signal. * @param[in] samplingRate The sampling rate in Hz. * @param[in] currentResponse The instrument response that will be * deconvolved from the data. * @param[in] targetResponse The instrument response to be convolved * into the data. */ void initialize(const int npts, const double samplingRate, const InstrumentResponse &currentResponse, const InstrumentResponse &targetResponse, const RTSeis::Precision precision = RTSeis::Precision::DOUBLE); /*! * @brief Determines if the class is initialized. * @param[in] npts The number of points in the signal. */ void apply(const int npts, const double x[], double y[]); private: class TransferImpl; }; } #endif
[ "bakerb845@gmail.com" ]
bakerb845@gmail.com
253e58c72d3215945d2a5decd16295f135063c23
5c985b909feec9484b832e104d712eebb91c4bb6
/TZXTool/TZXFile/TZXBlockTextDescription.cpp
8beee6fd8c3f22c54ac8f72c9ff32e18631c874f
[ "MIT" ]
permissive
MrReeMachine/TzxTool
c9b285073515a6166a00d3ede1f7390fc11c5a67
a0685726b996a244e0f67790165bf7599fa5d535
refs/heads/master
2022-04-19T23:36:57.463316
2020-04-12T10:11:32
2020-04-12T10:11:32
254,926,734
9
2
null
null
null
null
UTF-8
C++
false
false
915
cpp
//#include "stdafx.h" #include "TZXBlockTextDescription.h" #include "TZXFile.h" #include <stdlib.h> #include <stdio.h> TZXBlockTextDescription::TZXBlockTextDescription() { m_nBlockID = TZX_BLOCKID_TEXT_DESCRIPTION; m_szDescription = NULL; } TZXBlockTextDescription::~TZXBlockTextDescription() { if (m_szDescription) free(m_szDescription); } char *TZXBlockTextDescription::GetDescription() { snprintf((char *)m_szToStringDescription, MAX_STRING_LENGTH, "Text Description Block: %s", m_szDescription); return m_szToStringDescription; } void TZXBlockTextDescription::GenerateAudio(TZXAudioGenerator *pAudioGenerator, TZXFile *pTZXFile) { //printf("Block starts at time %0.3f\n", (float)(pAudioGenerator->GetCurrentLength()) / 44100.0f); // Nothing to do but log the audio position in the buffer m_nAudioBufferOffsetLocation = pAudioGenerator->GetCurrentLength(); }
[ "richard.baxter@pdp.com" ]
richard.baxter@pdp.com
8d9a1517bd482a3d1e0287e58722fc44a5ee6ad6
cbea406838397b87d1e92e6f3a73fa7b04e07142
/week4/day2/t09_students_source.cpp
12113e0c037059b0e277ab44d41417828c2cbf7f
[]
no_license
greenfox-zerda-sparta/Oszvaldb
c8d3e71710e66eba59ae0bc38916ee244367c464
69d76fc4947b5e1539d116ea5d379f4d8ff87b70
refs/heads/master
2021-01-12T18:14:57.203584
2016-12-15T13:21:47
2016-12-15T13:21:47
71,351,136
0
0
null
null
null
null
UTF-8
C++
false
false
850
cpp
/* * students_source.cpp * * Created on: Nov 8, 2016 * Author: zoltanszabo */ #include <iostream> #include <string> #include "t09_students_header.h" using namespace std; Student::Student(string name, int grades[], int grade_counter) { this->name = name; this->grade_counter = grade_counter; this->grades[grade_counter] = grades[grade_counter]; }; void add_grade(Student& Student, int grade) { int* temp = new int[Student.grade_counter]; for (int i = 0; i < Student.grade_counter; i++) { temp[i] = Student.grades[i]; } temp[Student.grade_counter] = grade; Student.grade_counter += 1; delete[] Student.grades; Student.grades = temp; } float get_average(Student& Student) { int add = 0; for (int i = 0; i < Student.grade_counter; i++) { add += Student.grades[i]; } return add / Student.grade_counter; }
[ "nagyongonoszi@gmail.com" ]
nagyongonoszi@gmail.com
50b86bc88a7fe0962f54c96f8fc6b6f97823cbde
ab7fa4d8a3b061a488b91b2101c3f3c974322a43
/code/contoh8-8.cpp
01ec464b01f4d2de269972ea777dc1c560a32808
[ "MIT" ]
permissive
yinchuanming/cpp-qt
b9400e538562d140a90ceebf8f3f9f951214348c
6889995826c742bf58820596065ed8ab64c569bf
refs/heads/master
2022-12-13T05:29:31.631942
2020-09-08T17:13:30
2020-09-08T17:13:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
733
cpp
#include <QtCore/QCoreApplication> #include <iostream> using namespace std; class COpArray { private: int *_myArray; int _numElement; public: COpArray(int numElement); ~COpArray(); int& operator[](int index); }; int& COpArray::operator [](int index) { return _myArray[index]; } COpArray::COpArray(int numElement) { _myArray = new int[numElement]; _numElement = numElement; } COpArray::~COpArray() { delete [] _myArray; } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); COpArray arrOp(5); arrOp[0]=23; arrOp[1]=16; arrOp[2]=9; arrOp[3]=20; arrOp[4]=55; cout << "The content array are : " << "{"; for(int i=0;i<5;++i) { cout << arrOp[i] << " "; } cout << "}" << endl; return a.exec(); }
[ "wachid@outlook.com" ]
wachid@outlook.com
c4e3d8523276d2393c3b22604ce089e124f5fdc6
d19330f4599add81cae80a0e96edc40efe924848
/ext/ChaosCore/include/chaoscore/base/clock/ClockOperations.hpp
ae373e45c641532cb2fa857d4d1931bbe910e540
[]
no_license
DavidSaxon/ProtoAlpha
a856d122e64d6a930d33752de839ea9d620fdc16
3631a59f60f39e56fbdea7cb6ac2bc4a23ed2777
refs/heads/master
2021-01-10T18:04:29.019742
2016-02-02T12:48:49
2016-02-02T12:48:49
50,710,092
0
0
null
null
null
null
UTF-8
C++
false
false
1,270
hpp
/*! * \file * \brief Operations for measuring time. * \author David Saxon */ #ifndef CHAOSCORE_BASE_CLOCK_CLOCKOPERATIONS_HPP_ #define CHAOSCORE_BASE_CLOCK_CLOCKOPERATIONS_HPP_ #include "chaoscore/base/Types.hpp" namespace chaos { namespace clock { //------------------------------------------------------------------------------ // ENUMERATORS //------------------------------------------------------------------------------ /*! * \brief The available metrics for measuring time. */ enum TimeMetric { METRIC_NANOSECONDS = 1UL, METRIC_MICROSECONDS = 1000UL, METRIC_MILLISECONDS = 1000000UL, METRIC_SECONDS = 1000000000UL, }; //------------------------------------------------------------------------------ // FUNCTIONS //------------------------------------------------------------------------------ /*! * \brief Returns the time elapsed since Linux Epoch (1st January 1970). * * \param metric Metric the returned value will be measured in. Defaults to * METRIC_MILLISECONDS */ chaos::uint64 get_current_time( TimeMetric metric = METRIC_MILLISECONDS ); } // namespace clock } // namespace chaos #endif
[ "davidesaxon@gmail.com" ]
davidesaxon@gmail.com
0f78bbc58c62989e21206489a6157ba1a2127c45
95a5633880bcba74066f73d3fd19661449a6ba1d
/Cpp/fostgres-fg/fg.call.cpp
b4c7ea9b0a07345b97b6213ae073f04bcfab4e78
[]
no_license
mengwong/fostgres
d3b5b133867558d79f08fb091b3d72a6213e42cb
f302650fad19dca7dac7a60d803326176469e01c
refs/heads/master
2021-05-06T23:13:37.855585
2017-07-22T05:34:30
2017-07-22T05:34:30
112,961,069
0
0
null
2017-12-03T20:27:30
2017-12-03T20:27:30
null
UTF-8
C++
false
false
1,371
cpp
/* Copyright 2016 Felspar Co Ltd. http://support.felspar.com/ Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt */ #include <fostgres/fg/fg.hpp> #include <fost/push_back> fg::json fg::call(frame &stack, const json &sexpr) { if ( not sexpr.isarray() ) { throw fostlib::exceptions::not_implemented(__func__, "Script isn't an array/s-expression", sexpr); } else if ( sexpr.size() == 0 ) { throw fostlib::exceptions::not_implemented(__func__, "The script was empty"); } else { return call(stack, stack.resolve_string(*sexpr.begin()), ++sexpr.begin(), sexpr.end()); } } fg::json fg::call( frame &stack, const fostlib::string &name, json::const_iterator begin, json::const_iterator end ) { try { frame::builtin function(stack.lookup_function(name)); return function(stack, begin, end); } catch ( fostlib::exceptions::exception &e ) { // Built a stack frame fg::json sf; fostlib::push_back(sf, name); for ( auto iter = begin; iter != end; ++iter ) { fostlib::push_back(sf, *iter); } // Add to the back trace fostlib::push_back(e.data(), "fg", "backtrace", sf); throw; } }
[ "k@kirit.com" ]
k@kirit.com
df217bb1696a01945122474d83a8c6a79503bfa7
37b4d3e203a0abb6f5f8c634b15329d86b0fa8c8
/src/obfuscation.h
897949b1383bc359025a1fcc5460846ed17ce2a5
[ "MIT" ]
permissive
iothome-rc/iothome
09b101d4b5bf65d4b22a65f20fbac49a87f4a223
f15992e23dd2dd41a7ff22484ec36da3b1ba67b1
refs/heads/master
2020-04-23T03:09:24.009000
2019-02-15T14:08:54
2019-02-15T14:08:54
170,507,689
0
0
null
null
null
null
UTF-8
C++
false
false
15,961
h
// Copyright (c) 2014-2015 The Dash developers // Copyright (c) 2015-2017 The PIVX developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef OBFUSCATION_H #define OBFUSCATION_H #include "main.h" #include "masternode-payments.h" #include "masternode-sync.h" #include "masternodeman.h" #include "obfuscation-relay.h" #include "sync.h" class CTxIn; class CObfuscationPool; class CObfuScationSigner; class CMasterNodeVote; class CBitcoinAddress; class CObfuscationQueue; class CObfuscationBroadcastTx; class CActiveMasternode; // pool states for mixing #define POOL_STATUS_UNKNOWN 0 // waiting for update #define POOL_STATUS_IDLE 1 // waiting for update #define POOL_STATUS_QUEUE 2 // waiting in a queue #define POOL_STATUS_ACCEPTING_ENTRIES 3 // accepting entries #define POOL_STATUS_FINALIZE_TRANSACTION 4 // master node will broadcast what it accepted #define POOL_STATUS_SIGNING 5 // check inputs/outputs, sign final tx #define POOL_STATUS_TRANSMISSION 6 // transmit transaction #define POOL_STATUS_ERROR 7 // error #define POOL_STATUS_SUCCESS 8 // success // status update message constants #define MASTERNODE_ACCEPTED 1 #define MASTERNODE_REJECTED 0 #define MASTERNODE_RESET -1 #define OBFUSCATION_QUEUE_TIMEOUT 30 #define OBFUSCATION_SIGNING_TIMEOUT 15 // used for anonymous relaying of inputs/outputs/sigs #define OBFUSCATION_RELAY_IN 1 #define OBFUSCATION_RELAY_OUT 2 #define OBFUSCATION_RELAY_SIG 3 static const CAmount OBFUSCATION_COLLATERAL = (10 * COIN); static const CAmount OBFUSCATION_POOL_MAX = (99999.99 * COIN); extern CObfuscationPool obfuScationPool; extern CObfuScationSigner obfuScationSigner; extern std::vector<CObfuscationQueue> vecObfuscationQueue; extern std::string strMasterNodePrivKey; extern map<uint256, CObfuscationBroadcastTx> mapObfuscationBroadcastTxes; extern CActiveMasternode activeMasternode; /** Holds an Obfuscation input */ class CTxDSIn : public CTxIn { public: bool fHasSig; // flag to indicate if signed int nSentTimes; //times we've sent this anonymously CTxDSIn(const CTxIn& in) { prevout = in.prevout; scriptSig = in.scriptSig; prevPubKey = in.prevPubKey; nSequence = in.nSequence; nSentTimes = 0; fHasSig = false; } }; /** Holds an Obfuscation output */ class CTxDSOut : public CTxOut { public: int nSentTimes; //times we've sent this anonymously CTxDSOut(const CTxOut& out) { nValue = out.nValue; nRounds = out.nRounds; scriptPubKey = out.scriptPubKey; nSentTimes = 0; } }; // A clients transaction in the obfuscation pool class CObfuScationEntry { public: bool isSet; std::vector<CTxDSIn> sev; std::vector<CTxDSOut> vout; CAmount amount; CTransaction collateral; CTransaction txSupporting; int64_t addedTime; // time in UTC milliseconds CObfuScationEntry() { isSet = false; collateral = CTransaction(); amount = 0; } /// Add entries to use for Obfuscation bool Add(const std::vector<CTxIn> vinIn, int64_t amountIn, const CTransaction collateralIn, const std::vector<CTxOut> voutIn) { if (isSet) { return false; } BOOST_FOREACH (const CTxIn& in, vinIn) sev.push_back(in); BOOST_FOREACH (const CTxOut& out, voutIn) vout.push_back(out); amount = amountIn; collateral = collateralIn; isSet = true; addedTime = GetTime(); return true; } bool AddSig(const CTxIn& vin) { BOOST_FOREACH (CTxDSIn& s, sev) { if (s.prevout == vin.prevout && s.nSequence == vin.nSequence) { if (s.fHasSig) { return false; } s.scriptSig = vin.scriptSig; s.prevPubKey = vin.prevPubKey; s.fHasSig = true; return true; } } return false; } bool IsExpired() { return (GetTime() - addedTime) > OBFUSCATION_QUEUE_TIMEOUT; // 120 seconds } }; /** * A currently inprogress Obfuscation merge and denomination information */ class CObfuscationQueue { public: CTxIn vin; int64_t time; int nDenom; bool ready; //ready for submit std::vector<unsigned char> vchSig; CObfuscationQueue() { nDenom = 0; vin = CTxIn(); time = 0; vchSig.clear(); ready = false; } ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { READWRITE(nDenom); READWRITE(vin); READWRITE(time); READWRITE(ready); READWRITE(vchSig); } bool GetAddress(CService& addr) { CMasternode* pmn = mnodeman.Find(vin); if (pmn != NULL) { addr = pmn->addr; return true; } return false; } /// Get the protocol version bool GetProtocolVersion(int& protocolVersion) { CMasternode* pmn = mnodeman.Find(vin); if (pmn != NULL) { protocolVersion = pmn->protocolVersion; return true; } return false; } /** Sign this Obfuscation transaction * \return true if all conditions are met: * 1) we have an active Masternode, * 2) we have a valid Masternode private key, * 3) we signed the message successfully, and * 4) we verified the message successfully */ bool Sign(); bool Relay(); /// Is this Obfuscation expired? bool IsExpired() { return (GetTime() - time) > OBFUSCATION_QUEUE_TIMEOUT; // 120 seconds } /// Check if we have a valid Masternode address bool CheckSignature(); }; /** Helper class to store Obfuscation transaction (tx) information. */ class CObfuscationBroadcastTx { public: CTransaction tx; CTxIn vin; vector<unsigned char> vchSig; int64_t sigTime; }; /** Helper object for signing and checking signatures */ class CObfuScationSigner { public: /// Is the inputs associated with this public key? (and there is 50000 IOTH - checking if valid masternode) bool IsVinAssociatedWithPubkey(CTxIn& vin, CPubKey& pubkey); /// Set the private/public key values, returns true if successful bool GetKeysFromSecret(std::string strSecret, CKey& keyRet, CPubKey& pubkeyRet); /// Set the private/public key values, returns true if successful bool SetKey(std::string strSecret, std::string& errorMessage, CKey& key, CPubKey& pubkey); /// Sign the message, returns true if successful bool SignMessage(std::string strMessage, std::string& errorMessage, std::vector<unsigned char>& vchSig, CKey key); /// Verify the message, returns true if succcessful bool VerifyMessage(CPubKey pubkey, std::vector<unsigned char>& vchSig, std::string strMessage, std::string& errorMessage); }; /** Used to keep track of current status of Obfuscation pool */ class CObfuscationPool { private: mutable CCriticalSection cs_obfuscation; std::vector<CObfuScationEntry> entries; // Masternode/clients entries CMutableTransaction finalTransaction; // the finalized transaction ready for signing int64_t lastTimeChanged; // last time the 'state' changed, in UTC milliseconds unsigned int state; // should be one of the POOL_STATUS_XXX values unsigned int entriesCount; unsigned int lastEntryAccepted; unsigned int countEntriesAccepted; std::vector<CTxIn> lockedCoins; std::string lastMessage; bool unitTest; int sessionID; int sessionUsers; //N Users have said they'll join bool sessionFoundMasternode; //If we've found a compatible Masternode std::vector<CTransaction> vecSessionCollateral; int cachedLastSuccess; int minBlockSpacing; //required blocks between mixes CMutableTransaction txCollateral; int64_t lastNewBlock; //debugging data std::string strAutoDenomResult; public: enum messages { ERR_ALREADY_HAVE, ERR_DENOM, ERR_ENTRIES_FULL, ERR_EXISTING_TX, ERR_FEES, ERR_INVALID_COLLATERAL, ERR_INVALID_INPUT, ERR_INVALID_SCRIPT, ERR_INVALID_TX, ERR_MAXIMUM, ERR_MN_LIST, ERR_MODE, ERR_NON_STANDARD_PUBKEY, ERR_NOT_A_MN, ERR_QUEUE_FULL, ERR_RECENT, ERR_SESSION, ERR_MISSING_TX, ERR_VERSION, MSG_NOERR, MSG_SUCCESS, MSG_ENTRIES_ADDED }; // where collateral should be made out to CScript collateralPubKey; CMasternode* pSubmittedToMasternode; int sessionDenom; //Users must submit an denom matching this int cachedNumBlocks; //used for the overview screen CObfuscationPool() { /* Obfuscation uses collateral addresses to trust parties entering the pool to behave themselves. If they don't it takes their money. */ cachedLastSuccess = 0; cachedNumBlocks = std::numeric_limits<int>::max(); unitTest = false; txCollateral = CMutableTransaction(); minBlockSpacing = 0; lastNewBlock = 0; SetNull(); } /** Process a Obfuscation message using the Obfuscation protocol * \param pfrom * \param strCommand lower case command string; valid values are: * Command | Description * -------- | ----------------- * dsa | Obfuscation Acceptable * dsc | Obfuscation Complete * dsf | Obfuscation Final tx * dsi | Obfuscation vIn * dsq | Obfuscation Queue * dss | Obfuscation Signal Final Tx * dssu | Obfuscation status update * dssub | Obfuscation Subscribe To * \param vRecv */ void ProcessMessageObfuscation(CNode* pfrom, std::string& strCommand, CDataStream& vRecv); void InitCollateralAddress() { SetCollateralAddress(Params().ObfuscationPoolDummyAddress()); } void SetMinBlockSpacing(int minBlockSpacingIn) { minBlockSpacing = minBlockSpacingIn; } bool SetCollateralAddress(std::string strAddress); void Reset(); void SetNull(); void UnlockCoins(); bool IsNull() const { return state == POOL_STATUS_ACCEPTING_ENTRIES && entries.empty(); } int GetState() const { return state; } std::string GetStatus(); int GetEntriesCount() const { return entries.size(); } /// Get the time the last entry was accepted (time in UTC milliseconds) int GetLastEntryAccepted() const { return lastEntryAccepted; } /// Get the count of the accepted entries int GetCountEntriesAccepted() const { return countEntriesAccepted; } // Set the 'state' value, with some logging and capturing when the state changed void UpdateState(unsigned int newState) { if (fMasterNode && (newState == POOL_STATUS_ERROR || newState == POOL_STATUS_SUCCESS)) { // LogPrint("obfuscation", "CObfuscationPool::UpdateState() - Can't set state to ERROR or SUCCESS as a Masternode. \n"); return; } // LogPrintf("CObfuscationPool::UpdateState() == %d | %d \n", state, newState); if (state != newState) { lastTimeChanged = GetTimeMillis(); if (fMasterNode) { RelayStatus(obfuScationPool.sessionID, obfuScationPool.GetState(), obfuScationPool.GetEntriesCount(), MASTERNODE_RESET); } } state = newState; } /// Get the maximum number of transactions for the pool int GetMaxPoolTransactions() { return Params().PoolMaxTransactions(); } /// Do we have enough users to take entries? bool IsSessionReady() { return sessionUsers >= GetMaxPoolTransactions(); } /// Are these outputs compatible with other client in the pool? bool IsCompatibleWithEntries(std::vector<CTxOut>& vout); /// Is this amount compatible with other client in the pool? bool IsCompatibleWithSession(CAmount nAmount, CTransaction txCollateral, int& errorID); /// Passively run Obfuscation in the background according to the configuration in settings (only for QT) bool DoAutomaticDenominating(bool fDryRun = false); bool PrepareObfuscationDenominate(); /// Check for process in Obfuscation void Check(); void CheckFinalTransaction(); /// Charge fees to bad actors (Charge clients a fee if they're abusive) void ChargeFees(); /// Rarely charge fees to pay miners void ChargeRandomFees(); void CheckTimeout(); void CheckForCompleteQueue(); /// Check to make sure a signature matches an input in the pool bool SignatureValid(const CScript& newSig, const CTxIn& newVin); /// If the collateral is valid given by a client bool IsCollateralValid(const CTransaction& txCollateral); /// Add a clients entry to the pool bool AddEntry(const std::vector<CTxIn>& newInput, const CAmount& nAmount, const CTransaction& txCollateral, const std::vector<CTxOut>& newOutput, int& errorID); /// Add signature to a vin bool AddScriptSig(const CTxIn& newVin); /// Check that all inputs are signed. (Are all inputs signed?) bool SignaturesComplete(); /// As a client, send a transaction to a Masternode to start the denomination process void SendObfuscationDenominate(std::vector<CTxIn>& vin, std::vector<CTxOut>& vout, CAmount amount); /// Get Masternode updates about the progress of Obfuscation bool StatusUpdate(int newState, int newEntriesCount, int newAccepted, int& errorID, int newSessionID = 0); /// As a client, check and sign the final transaction bool SignFinalTransaction(CTransaction& finalTransactionNew, CNode* node); /// Get the last valid block hash for a given modulus bool GetLastValidBlockHash(uint256& hash, int mod = 1, int nBlockHeight = 0); /// Process a new block void NewBlock(); void CompletedTransaction(bool error, int errorID); void ClearLastMessage(); /// Used for liquidity providers bool SendRandomPaymentToSelf(); /// Split up large inputs or make fee sized inputs bool MakeCollateralAmounts(); bool CreateDenominated(CAmount nTotalValue); /// Get the denominations for a list of outputs (returns a bitshifted integer) int GetDenominations(const std::vector<CTxOut>& vout, bool fSingleRandomDenom = false); int GetDenominations(const std::vector<CTxDSOut>& vout); void GetDenominationsToString(int nDenom, std::string& strDenom); /// Get the denominations for a specific amount of iothome. int GetDenominationsByAmount(CAmount nAmount, int nDenomTarget = 0); // is not used anymore? int GetDenominationsByAmounts(std::vector<CAmount>& vecAmount); std::string GetMessageByID(int messageID); // // Relay Obfuscation Messages // void RelayFinalTransaction(const int sessionID, const CTransaction& txNew); void RelaySignaturesAnon(std::vector<CTxIn>& vin); void RelayInAnon(std::vector<CTxIn>& vin, std::vector<CTxOut>& vout); void RelayIn(const std::vector<CTxDSIn>& vin, const CAmount& nAmount, const CTransaction& txCollateral, const std::vector<CTxDSOut>& vout); void RelayStatus(const int sessionID, const int newState, const int newEntriesCount, const int newAccepted, const int errorID = MSG_NOERR); void RelayCompletedTransaction(const int sessionID, const bool error, const int errorID); }; void ThreadCheckObfuScationPool(); #endif
[ "iothome.dev@gmail.com" ]
iothome.dev@gmail.com
c4f8707193129f8259cb38eaa734744fa1fad64b
b1f52cb0fa6649faae40968a8a0b9c0c510f107d
/WT_20210219/c638.cpp
b11254f72756b648026541d8172590266fbd96f1
[]
no_license
yoyoisaman/winterproject
f53dc34a82e9b4add82bd37a539ffa11b0032eec
dcc9cad9ac24cbea42f56dc4a145e16ce1efd90e
refs/heads/main
2023-07-18T16:05:30.007925
2021-09-14T07:57:19
2021-09-14T07:57:19
327,964,401
0
0
null
2021-06-26T08:02:52
2021-01-08T17:06:48
C++
UTF-8
C++
false
false
891
cpp
#include <bits/stdc++.h> using namespace std; void a(int y){ int y1=y%10; if (y1==0) cout << "庚"; else if (y1==1) cout << "辛"; else if (y1==2) cout << "壬"; else if (y1==4) cout << "甲"; else if (y1==5) cout << "乙"; else if (y1==6) cout << "丙"; else if (y1==7) cout << "丁"; else if (y1==8) cout << "戊"; else if (y1==9) cout << "己"; else cout << "癸"; int y2=y%12; if (y2==0) cout << "申"; else if (y2==1) cout << "酉"; else if (y2==2) cout << "戌"; else if (y2==3) cout << "亥"; else if (y2==4) cout << "子"; else if (y2==5) cout << "丑"; else if (y2==6) cout << "寅"; else if (y2==7) cout << "卯"; else if (y2==8) cout << "辰"; else if (y2==10) cout << "午"; else if (y2==11) cout << "未"; else cout << "巳"; cout << '\n'; return; } int main(){ int y = 0; while(cin >> y){ a(y); } }
[ "noreply@github.com" ]
noreply@github.com
da63e65135e102be76720e9dd7805de36a4d3fce
294493658a0452aa0d32849c1a03ac80e8b508d8
/codechef snackdown/N different palindromes.cpp
657795c593cadb046a3eb7a29b4f47ed3cb2e119
[]
no_license
rMoshiur/contest-code
6f19b340621a9f84840ab2fa0a84455fe26c7dd0
95c9cb040db0e3ed857801ea737213bb37a25069
refs/heads/master
2020-03-15T16:52:27.110364
2017-09-23T17:24:20
2017-09-23T17:24:20
null
0
0
null
null
null
null
UTF-8
C++
false
false
988
cpp
#include <bits/stdc++.h> using namespace std; const double pi = 3.141592653589793; #define xx first #define yy second #define mp make_pair #define intl long long #define filein freopen("input.txt", "r", stdin) #define fileout freopen("output.txt", "w", stdout) #define debug printf("yes \n") #define what_is(x) cout << #x << " is " << x << endl #define pb push_back #define eb emplace_back #define pii pair<int, int> #define piii pair<pii, int> int main() { ios::sync_with_stdio(false); //filein; int t; cin >> t; while(t--) { int n; cin >> n; string s; string c = "aabbcc"; int k = n/9, l; l = n-k*9; for( int i = 0; i < k; i++ ) s += c; char d = 'd'; for( int i = 0; i < l; i++ ) { s += d; d++; } cout << s << endl; } return 0; }
[ "turab2013@gmail.com" ]
turab2013@gmail.com
9975234038a8cbb69e797cb96f9c84efe3a8830f
b22588340d7925b614a735bbbde1b351ad657ffc
/athena/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/IMatcher.h
bc8c4774efd73fbabb90ddd01bee763f914b720f
[]
no_license
rushioda/PIXELVALID_athena
90befe12042c1249cbb3655dde1428bb9b9a42ce
22df23187ef85e9c3120122c8375ea0e7d8ea440
refs/heads/master
2020-12-14T22:01:15.365949
2020-01-19T03:59:35
2020-01-19T03:59:35
234,836,993
1
0
null
null
null
null
UTF-8
C++
false
false
1,154
h
/* Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGHLTJETHYPO_IMATCHER_H #define TRIGHLTJETHYPO_IMATCHER_H /******************************************************************** * * NAME: IMatcher.h * PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo * * AUTHOR: P. Sherwood * CREATED: March 21, 2015 * * * Headers file for visible classes used by TrigHLTJEtHypo *********************************************************************/ #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJet.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/HypoJetDefs.h" #include <string> class IMatcher{ public: // Abstract interface used by a factory function virtual ~IMatcher(){} virtual void match(const HypoJetIter&, const HypoJetIter&) = 0; virtual bool pass() const = 0; virtual const HypoJetVector& passedJets() const noexcept = 0; virtual const HypoJetVector& failedJets() const noexcept = 0; virtual const Conditions& getConditions() const noexcept = 0; virtual std::string toString() const noexcept = 0; }; #endif
[ "rushioda@lxplus754.cern.ch" ]
rushioda@lxplus754.cern.ch
2703b1ef0af8e8f8f24ddafbd6ebccfaa9c07e05
1deccd9718fe2dc701e77498fbcbf746c262150a
/src/morganaDofs/komplex.cpp
a2cf79d857c603d3f12fab23c85a1534040fcae0
[]
no_license
lacrymose/morganaPublic
ce577067102ba626f136c1b5ca4b8181a6f38a71
6422b8d0c6c201fd5a4dfeef81db3c1b214f6ace
refs/heads/master
2022-11-16T01:27:14.401469
2020-07-14T14:54:14
2020-07-14T14:54:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,521
cpp
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% This file is part of Morgana. Author: Andrea Villa, andrea.villa81@fastwebnet.it Morgana is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Morgana is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Morgana. If not, see <http://www.gnu.org/licenses/>. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ #include "komplex.h" #include <cmath> //_________________________________________________________________________________________________ // CONSTRUCTORS AND DESTRUCTORS //------------------------------------------------------------------------------------------------- komplex:: komplex(Real Re, Real Im) { re = Re; im = Im; } komplex:: komplex(const komplex & V) { re = V.re; im = V.im; } komplex:: ~komplex() { } //_________________________________________________________________________________________________ // SET FUNCTIONS //------------------------------------------------------------------------------------------------- void komplex:: set(const Real & Re, const Real & Im) { re = Re; im = Im; } void komplex:: setReal(const Real & Re) { re = Re; } void komplex:: setImag(const Real & Im) { im = Im; } void komplex:: setI(const UInt & i, const Real & val) { assert(i <= 2); assert(i >= 1); if(i == 1) { re = val; } else { im = val; } } //_________________________________________________________________________________________________ // OPERATORS FUNCTIONS //------------------------------------------------------------------------------------------------- Real komplex:: operator()(const UInt & i) { assert(i <= 2); assert(i >= 1); if(i == 1) { return(re); } else { return(im); } } const Real & komplex:: operator()(const UInt & i) const { assert(i <= 2); assert(i >= 1); if(i == 1) { return(re); } else { return(im); } } komplex & komplex:: operator=(const komplex & C) { re = C.re; im = C.im; return *this; } void komplex:: operator+=(const komplex & C) { re += C.re; im += C.im; } void komplex:: operator-=(const komplex & C) { re -= C.re; im -= C.im; } void komplex:: operator*=(const Real & a) { re *= a; im *= a; } void komplex:: operator/=(const Real & a) { re /= a; im /= a; } void komplex:: operator*=(const komplex & C) { Real a = re; Real b = im; re = a * C.re - b * C.im; im = b * C.re + a * C.im; } void komplex:: operator/=(const komplex & C) { Real rhoA = sqrt( re * re + im * im); Real rhoB = sqrt(C.re * C.re + C.im + C.im); Real thetaA = atan2(im,re); Real thetaB = atan2(C.im,C.re); re = (rhoA / rhoB) * cos(thetaA - thetaB); im = (rhoA / rhoB) * sin(thetaA - thetaB); } //_________________________________________________________________________________________________ // ORDINAL FUNCTIONS //------------------------------------------------------------------------------------------------- bool komplex:: operator<(const komplex & C) const { if(re < (C.re - geoToll)) { return(true); } if(re > (C.re + geoToll)) { return(false); } if(im < (C.im - geoToll)) { return(true); } if(im > (C.im + geoToll)) { return(false); } return(false); } bool komplex:: operator!=(const komplex & C) const { bool equalRe, equalIm; equalRe = (re >= (C.re - geoToll)) && (re <= (C.re + geoToll)); equalIm = (im >= (C.im - geoToll)) && (im <= (C.im + geoToll)); return(!(equalRe && equalIm) ); } bool komplex:: operator==(const komplex & C) const { return( !this->operator!=(C) ); } //_________________________________________________________________________________________________ // OTHER FUNCTIONS //------------------------------------------------------------------------------------------------- Real komplex:: norm() const { return(sqrt(re * re + im * im)); } Real komplex:: phase() const { return(atan2(im,re)); } Real komplex:: norm(const komplex & C) { return(sqrt(C.re * C.re + C.im * C.im)); } Real komplex:: phase(const komplex & C) { return(atan2(C.im,C.re)); } Real komplex:: cReal(const komplex & C) { return(C.re); } Real komplex:: cReal(const Real & C) { return(C); } Real komplex:: cImag(const komplex & C) { return(C.im); } Real komplex:: cImag(const Real & C) { return(0.0); } Real komplex:: cComp(const komplex & C, const UInt & i) { assert(i <= 2); assert(i >= 1); if(i == 1) { return(C.re); } else { return(C.im); } } Real komplex:: cComp(const Real & C, const UInt & i) { assert(i <= 2); assert(i >= 1); if(i == 1) { return(C); } else { return(0.0); } } komplex komplex:: iexp(const Real & theta) { return(komplex(cos(theta),sin(theta))); } komplex komplex:: conj(const komplex & C) { return(komplex(C.re,-C.im)); } ostream & operator<<(ostream& f, const komplex & C) { return f << "Real: " << C.re << " Imag: " << C.im << endl; }
[ "andrea.villa81@fastwebnet.it" ]
andrea.villa81@fastwebnet.it
75f59a69bd82b701ff97bfac70cefc73fdaa6430
6ca631c6d14eea31060f06999cee975eda124c7f
/old/editors/ide/sdlbasEditor/scintilla/src/Document.cxx
2b8be0c36ce37f2d757f9dcb194bd8ad68c80388
[ "LicenseRef-scancode-scintilla" ]
permissive
sdlBasic/software
56fb60addfff9ae0856a9702633cd2a8b83e412a
1ed4ef1c165874793fd0dcd2f5e8821e6387f7dc
refs/heads/master
2016-09-08T05:11:31.870593
2015-08-25T06:49:17
2015-08-25T06:49:17
38,472,429
0
0
null
null
null
null
UTF-8
C++
false
false
39,476
cxx
// Scintilla source code edit control /** @file Document.cxx ** Text document that handles notifications, DBCS, styling, words and end of line. **/ // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. #include <stdlib.h> #include <string.h> #include <stdio.h> #include <ctype.h> #include "Platform.h" #include "Scintilla.h" #include "SVector.h" #include "CellBuffer.h" #include "Document.h" #include "RESearch.h" // This is ASCII specific but is safe with chars >= 0x80 static inline bool isspacechar(unsigned char ch) { return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); } static inline bool IsPunctuation(char ch) { return isascii(ch) && ispunct(ch); } static inline bool IsADigit(char ch) { return isascii(ch) && isdigit(ch); } static inline bool IsLowerCase(char ch) { return isascii(ch) && islower(ch); } static inline bool IsUpperCase(char ch) { return isascii(ch) && isupper(ch); } Document::Document() { refCount = 0; #ifdef unix eolMode = SC_EOL_LF; #else eolMode = SC_EOL_CRLF; #endif dbcsCodePage = 0; stylingBits = 5; stylingBitsMask = 0x1F; stylingMask = 0; SetDefaultCharClasses(true); endStyled = 0; styleClock = 0; enteredCount = 0; enteredReadOnlyCount = 0; tabInChars = 8; indentInChars = 0; actualIndentInChars = 8; useTabs = true; tabIndents = true; backspaceUnindents = false; watchers = 0; lenWatchers = 0; matchesValid = false; pre = 0; substituted = 0; } Document::~Document() { for (int i = 0; i < lenWatchers; i++) { watchers[i].watcher->NotifyDeleted(this, watchers[i].userData); } delete []watchers; watchers = 0; lenWatchers = 0; delete pre; pre = 0; delete []substituted; substituted = 0; } // Increase reference count and return its previous value. int Document::AddRef() { return refCount++; } // Decrease reference count and return its previous value. // Delete the document if reference count reaches zero. int Document::Release() { int curRefCount = --refCount; if (curRefCount == 0) delete this; return curRefCount; } void Document::SetSavePoint() { cb.SetSavePoint(); NotifySavePoint(true); } int Document::AddMark(int line, int markerNum) { int prev = cb.AddMark(line, markerNum); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0); NotifyModified(mh); return prev; } void Document::DeleteMark(int line, int markerNum) { cb.DeleteMark(line, markerNum); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0); NotifyModified(mh); } void Document::DeleteMarkFromHandle(int markerHandle) { cb.DeleteMarkFromHandle(markerHandle); DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); NotifyModified(mh); } void Document::DeleteAllMarks(int markerNum) { cb.DeleteAllMarks(markerNum); DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); NotifyModified(mh); } int Document::LineStart(int line) { return cb.LineStart(line); } int Document::LineEnd(int line) { if (line == LinesTotal() - 1) { return LineStart(line + 1); } else { int position = LineStart(line + 1) - 1; // When line terminator is CR+LF, may need to go back one more if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) { position--; } return position; } } int Document::LineFromPosition(int pos) { return cb.LineFromPosition(pos); } int Document::LineEndPosition(int position) { return LineEnd(LineFromPosition(position)); } int Document::VCHomePosition(int position) { int line = LineFromPosition(position); int startPosition = LineStart(line); int endLine = LineStart(line + 1) - 1; int startText = startPosition; while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t' ) ) startText++; if (position == startText) return startPosition; else return startText; } int Document::SetLevel(int line, int level) { int prev = cb.SetLevel(line, level); if (prev != level) { DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0); mh.line = line; mh.foldLevelNow = level; mh.foldLevelPrev = prev; NotifyModified(mh); } return prev; } static bool IsSubordinate(int levelStart, int levelTry) { if (levelTry & SC_FOLDLEVELWHITEFLAG) return true; else return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK); } int Document::GetLastChild(int lineParent, int level) { if (level == -1) level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK; int maxLine = LinesTotal(); int lineMaxSubord = lineParent; while (lineMaxSubord < maxLine - 1) { EnsureStyledTo(LineStart(lineMaxSubord + 2)); if (!IsSubordinate(level, GetLevel(lineMaxSubord + 1))) break; lineMaxSubord++; } if (lineMaxSubord > lineParent) { if (level > (GetLevel(lineMaxSubord + 1) & SC_FOLDLEVELNUMBERMASK)) { // Have chewed up some whitespace that belongs to a parent so seek back if (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG) { lineMaxSubord--; } } } return lineMaxSubord; } int Document::GetFoldParent(int line) { int level = GetLevel(line) & SC_FOLDLEVELNUMBERMASK; int lineLook = line - 1; while ((lineLook > 0) && ( (!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) || ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level)) ) { lineLook--; } if ((GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG) && ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) < level)) { return lineLook; } else { return -1; } } int Document::ClampPositionIntoDocument(int pos) { return Platform::Clamp(pos, 0, Length()); } bool Document::IsCrLf(int pos) { if (pos < 0) return false; if (pos >= (Length() - 1)) return false; return (cb.CharAt(pos) == '\r') && (cb.CharAt(pos + 1) == '\n'); } static const int maxBytesInDBCSCharacter=5; int Document::LenChar(int pos) { if (pos < 0) { return 1; } else if (IsCrLf(pos)) { return 2; } else if (SC_CP_UTF8 == dbcsCodePage) { unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos)); if (ch < 0x80) return 1; int len = 2; if (ch >= (0x80 + 0x40 + 0x20)) len = 3; int lengthDoc = Length(); if ((pos + len) > lengthDoc) return lengthDoc -pos; else return len; } else if (dbcsCodePage) { char mbstr[maxBytesInDBCSCharacter+1]; int i; for (i=0; i<Platform::DBCSCharMaxLength(); i++) { mbstr[i] = cb.CharAt(pos+i); } mbstr[i] = '\0'; return Platform::DBCSCharLength(dbcsCodePage, mbstr); } else { return 1; } } #include <assert.h> // Normalise a position so that it is not halfway through a two byte character. // This can occur in two situations - // When lines are terminated with \r\n pairs which should be treated as one character. // When displaying DBCS text such as Japanese. // If moving, move the position in the indicated direction. int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { //Platform::DebugPrintf("NoCRLF %d %d\n", pos, moveDir); // If out of range, just return minimum/maximum value. if (pos <= 0) return 0; if (pos >= Length()) return Length(); // assert pos > 0 && pos < Length() if (checkLineEnd && IsCrLf(pos - 1)) { if (moveDir > 0) return pos + 1; else return pos - 1; } // Not between CR and LF if (dbcsCodePage) { if (SC_CP_UTF8 == dbcsCodePage) { unsigned char ch = static_cast<unsigned char>(cb.CharAt(pos)); while ((pos > 0) && (pos < Length()) && (ch >= 0x80) && (ch < (0x80 + 0x40))) { // ch is a trail byte if (moveDir > 0) pos++; else pos--; ch = static_cast<unsigned char>(cb.CharAt(pos)); } } else { // Anchor DBCS calculations at start of line because start of line can // not be a DBCS trail byte. int posCheck = LineStart(LineFromPosition(pos)); while (posCheck < pos) { char mbstr[maxBytesInDBCSCharacter+1]; int i; for(i=0;i<Platform::DBCSCharMaxLength();i++) { mbstr[i] = cb.CharAt(posCheck+i); } mbstr[i] = '\0'; int mbsize = Platform::DBCSCharLength(dbcsCodePage, mbstr); if (posCheck + mbsize == pos) { return pos; } else if (posCheck + mbsize > pos) { if (moveDir > 0) { return posCheck + mbsize; } else { return posCheck; } } posCheck += mbsize; } } } return pos; } void Document::ModifiedAt(int pos) { if (endStyled > pos) endStyled = pos; } // Document only modified by gateways DeleteChars, InsertStyledString, Undo, Redo, and SetStyleAt. // SetStyleAt does not change the persistent state of a document // Unlike Undo, Redo, and InsertStyledString, the pos argument is a cell number not a char number bool Document::DeleteChars(int pos, int len) { if (len == 0) return false; if ((pos + len) > Length()) return false; if (cb.IsReadOnly() && enteredReadOnlyCount == 0) { enteredReadOnlyCount++; NotifyModifyAttempt(); enteredReadOnlyCount--; } if (enteredCount != 0) { return false; } else { enteredCount++; if (!cb.IsReadOnly()) { NotifyModified( DocModification( SC_MOD_BEFOREDELETE | SC_PERFORMED_USER, pos, len, 0, 0)); int prevLinesTotal = LinesTotal(); bool startSavePoint = cb.IsSavePoint(); const char *text = cb.DeleteChars(pos * 2, len * 2); if (startSavePoint && cb.IsCollectingUndo()) NotifySavePoint(!startSavePoint); if ((pos < Length()) || (pos == 0)) ModifiedAt(pos); else ModifiedAt(pos-1); NotifyModified( DocModification( SC_MOD_DELETETEXT | SC_PERFORMED_USER, pos, len, LinesTotal() - prevLinesTotal, text)); } enteredCount--; } return !cb.IsReadOnly(); } /** * Insert a styled string (char/style pairs) with a length. */ bool Document::InsertStyledString(int position, char *s, int insertLength) { if (cb.IsReadOnly() && enteredReadOnlyCount == 0) { enteredReadOnlyCount++; NotifyModifyAttempt(); enteredReadOnlyCount--; } if (enteredCount != 0) { return false; } else { enteredCount++; if (!cb.IsReadOnly()) { NotifyModified( DocModification( SC_MOD_BEFOREINSERT | SC_PERFORMED_USER, position / 2, insertLength / 2, 0, s)); int prevLinesTotal = LinesTotal(); bool startSavePoint = cb.IsSavePoint(); const char *text = cb.InsertString(position, s, insertLength); if (startSavePoint && cb.IsCollectingUndo()) NotifySavePoint(!startSavePoint); ModifiedAt(position / 2); NotifyModified( DocModification( SC_MOD_INSERTTEXT | SC_PERFORMED_USER, position / 2, insertLength / 2, LinesTotal() - prevLinesTotal, text)); } enteredCount--; } return !cb.IsReadOnly(); } int Document::Undo() { int newPos = 0; if (enteredCount == 0) { enteredCount++; bool startSavePoint = cb.IsSavePoint(); int steps = cb.StartUndo(); //Platform::DebugPrintf("Steps=%d\n", steps); for (int step = 0; step < steps; step++) { int prevLinesTotal = LinesTotal(); const Action &action = cb.GetUndoStep(); if (action.at == removeAction) { NotifyModified(DocModification( SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action)); } else { NotifyModified(DocModification( SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action)); } cb.PerformUndoStep(); int cellPosition = action.position / 2; ModifiedAt(cellPosition); newPos = cellPosition; int modFlags = SC_PERFORMED_UNDO; // With undo, an insertion action becomes a deletion notification if (action.at == removeAction) { newPos += action.lenData; modFlags |= SC_MOD_INSERTTEXT; } else { modFlags |= SC_MOD_DELETETEXT; } if (step == steps - 1) modFlags |= SC_LASTSTEPINUNDOREDO; NotifyModified(DocModification(modFlags, cellPosition, action.lenData, LinesTotal() - prevLinesTotal, action.data)); } bool endSavePoint = cb.IsSavePoint(); if (startSavePoint != endSavePoint) NotifySavePoint(endSavePoint); enteredCount--; } return newPos; } int Document::Redo() { int newPos = 0; if (enteredCount == 0) { enteredCount++; bool startSavePoint = cb.IsSavePoint(); int steps = cb.StartRedo(); for (int step = 0; step < steps; step++) { int prevLinesTotal = LinesTotal(); const Action &action = cb.GetRedoStep(); if (action.at == insertAction) { NotifyModified(DocModification( SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action)); } else { NotifyModified(DocModification( SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action)); } cb.PerformRedoStep(); ModifiedAt(action.position / 2); newPos = action.position / 2; int modFlags = SC_PERFORMED_REDO; if (action.at == insertAction) { newPos += action.lenData; modFlags |= SC_MOD_INSERTTEXT; } else { modFlags |= SC_MOD_DELETETEXT; } if (step == steps - 1) modFlags |= SC_LASTSTEPINUNDOREDO; NotifyModified( DocModification(modFlags, action.position / 2, action.lenData, LinesTotal() - prevLinesTotal, action.data)); } bool endSavePoint = cb.IsSavePoint(); if (startSavePoint != endSavePoint) NotifySavePoint(endSavePoint); enteredCount--; } return newPos; } /** * Insert a single character. */ bool Document::InsertChar(int pos, char ch) { char chs[2]; chs[0] = ch; chs[1] = 0; return InsertStyledString(pos*2, chs, 2); } /** * Insert a null terminated string. */ bool Document::InsertString(int position, const char *s) { return InsertString(position, s, strlen(s)); } /** * Insert a string with a length. */ bool Document::InsertString(int position, const char *s, size_t insertLength) { bool changed = false; char *sWithStyle = new char[insertLength * 2]; if (sWithStyle) { for (size_t i = 0; i < insertLength; i++) { sWithStyle[i*2] = s[i]; sWithStyle[i*2 + 1] = 0; } changed = InsertStyledString(position*2, sWithStyle, static_cast<int>(insertLength*2)); delete []sWithStyle; } return changed; } void Document::ChangeChar(int pos, char ch) { DeleteChars(pos, 1); InsertChar(pos, ch); } void Document::DelChar(int pos) { DeleteChars(pos, LenChar(pos)); } void Document::DelCharBack(int pos) { if (pos <= 0) { return; } else if (IsCrLf(pos - 2)) { DeleteChars(pos - 2, 2); } else if (dbcsCodePage) { int startChar = MovePositionOutsideChar(pos - 1, -1, false); DeleteChars(startChar, pos - startChar); } else { DeleteChars(pos - 1, 1); } } static bool isindentchar(char ch) { return (ch == ' ') || (ch == '\t'); } static int NextTab(int pos, int tabSize) { return ((pos / tabSize) + 1) * tabSize; } static void CreateIndentation(char *linebuf, int length, int indent, int tabSize, bool insertSpaces) { length--; // ensure space for \0 if (!insertSpaces) { while ((indent >= tabSize) && (length > 0)) { *linebuf++ = '\t'; indent -= tabSize; length--; } } while ((indent > 0) && (length > 0)) { *linebuf++ = ' '; indent--; length--; } *linebuf = '\0'; } int Document::GetLineIndentation(int line) { int indent = 0; if ((line >= 0) && (line < LinesTotal())) { int lineStart = LineStart(line); int length = Length(); for (int i = lineStart;i < length;i++) { char ch = cb.CharAt(i); if (ch == ' ') indent++; else if (ch == '\t') indent = NextTab(indent, tabInChars); else return indent; } } return indent; } void Document::SetLineIndentation(int line, int indent) { int indentOfLine = GetLineIndentation(line); if (indent < 0) indent = 0; if (indent != indentOfLine) { char linebuf[1000]; CreateIndentation(linebuf, sizeof(linebuf), indent, tabInChars, !useTabs); int thisLineStart = LineStart(line); int indentPos = GetLineIndentPosition(line); DeleteChars(thisLineStart, indentPos - thisLineStart); InsertString(thisLineStart, linebuf); } } int Document::GetLineIndentPosition(int line) { if (line < 0) return 0; int pos = LineStart(line); int length = Length(); while ((pos < length) && isindentchar(cb.CharAt(pos))) { pos++; } return pos; } int Document::GetColumn(int pos) { int column = 0; int line = LineFromPosition(pos); if ((line >= 0) && (line < LinesTotal())) { for (int i = LineStart(line);i < pos;) { char ch = cb.CharAt(i); if (ch == '\t') { column = NextTab(column, tabInChars); i++; } else if (ch == '\r') { return column; } else if (ch == '\n') { return column; } else { column++; i = MovePositionOutsideChar(i + 1, 1); } } } return column; } int Document::FindColumn(int line, int column) { int position = LineStart(line); int columnCurrent = 0; if ((line >= 0) && (line < LinesTotal())) { while (columnCurrent < column) { char ch = cb.CharAt(position); if (ch == '\t') { columnCurrent = NextTab(columnCurrent, tabInChars); position++; } else if (ch == '\r') { return position; } else if (ch == '\n') { return position; } else { columnCurrent++; position = MovePositionOutsideChar(position + 1, 1); } } } return position; } void Document::Indent(bool forwards, int lineBottom, int lineTop) { // Dedent - suck white space off the front of the line to dedent by equivalent of a tab for (int line = lineBottom; line >= lineTop; line--) { int indentOfLine = GetLineIndentation(line); if (forwards) SetLineIndentation(line, indentOfLine + IndentSize()); else SetLineIndentation(line, indentOfLine - IndentSize()); } } void Document::ConvertLineEnds(int eolModeSet) { BeginUndoAction(); for (int pos = 0; pos < Length(); pos++) { if (cb.CharAt(pos) == '\r') { if (cb.CharAt(pos + 1) == '\n') { if (eolModeSet != SC_EOL_CRLF) { DeleteChars(pos, 2); if (eolModeSet == SC_EOL_CR) InsertString(pos, "\r", 1); else InsertString(pos, "\n", 1); } else { pos++; } } else { if (eolModeSet != SC_EOL_CR) { DeleteChars(pos, 1); if (eolModeSet == SC_EOL_CRLF) { InsertString(pos, "\r\n", 2); pos++; } else { InsertString(pos, "\n", 1); } } } } else if (cb.CharAt(pos) == '\n') { if (eolModeSet != SC_EOL_LF) { DeleteChars(pos, 1); if (eolModeSet == SC_EOL_CRLF) { InsertString(pos, "\r\n", 2); pos++; } else { InsertString(pos, "\r", 1); } } } } EndUndoAction(); } int Document::ParaDown(int pos) { int line = LineFromPosition(pos); while (line < LinesTotal() && LineStart(line) != LineEnd(line)) { // skip non-empty lines line++; } while (line < LinesTotal() && LineStart(line) == LineEnd(line)) { // skip empty lines line++; } if (line < LinesTotal()) return LineStart(line); else // end of a document return LineEnd(line-1); } int Document::ParaUp(int pos) { int line = LineFromPosition(pos); line--; while (line >= 0 && LineStart(line) == LineEnd(line)) { // skip empty lines line--; } while (line >= 0 && LineStart(line) != LineEnd(line)) { // skip non-empty lines line--; } line++; return LineStart(line); } Document::charClassification Document::WordCharClass(unsigned char ch) { if ((SC_CP_UTF8 == dbcsCodePage) && (ch >= 0x80)) return ccWord; return charClass[ch]; } /** * Used by commmands that want to select whole words. * Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0. */ int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) { charClassification ccStart = ccWord; if (delta < 0) { if (!onlyWordCharacters) ccStart = WordCharClass(cb.CharAt(pos-1)); while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) pos--; } else { if (!onlyWordCharacters) ccStart = WordCharClass(cb.CharAt(pos)); while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) pos++; } return MovePositionOutsideChar(pos, delta); } /** * Find the start of the next word in either a forward (delta >= 0) or backwards direction * (delta < 0). * This is looking for a transition between character classes although there is also some * additional movement to transit white space. * Used by cursor movement by word commands. */ int Document::NextWordStart(int pos, int delta) { if (delta < 0) { while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccSpace)) pos--; if (pos > 0) { charClassification ccStart = WordCharClass(cb.CharAt(pos-1)); while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) { pos--; } } } else { charClassification ccStart = WordCharClass(cb.CharAt(pos)); while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) pos++; while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccSpace)) pos++; } return pos; } /** * Find the end of the next word in either a forward (delta >= 0) or backwards direction * (delta < 0). * This is looking for a transition between character classes although there is also some * additional movement to transit white space. * Used by cursor movement by word commands. */ int Document::NextWordEnd(int pos, int delta) { if (delta < 0) { if (pos > 0) { charClassification ccStart = WordCharClass(cb.CharAt(pos-1)); if (ccStart != ccSpace) { while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccStart) { pos--; } } while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccSpace) { pos--; } } } else { while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccSpace) { pos++; } if (pos < Length()) { charClassification ccStart = WordCharClass(cb.CharAt(pos)); while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccStart) { pos++; } } } return pos; } /** * Check that the character at the given position is a word or punctuation character and that * the previous character is of a different character class. */ bool Document::IsWordStartAt(int pos) { if (pos > 0) { charClassification ccPos = WordCharClass(CharAt(pos)); return (ccPos == ccWord || ccPos == ccPunctuation) && (ccPos != WordCharClass(CharAt(pos - 1))); } return true; } /** * Check that the character at the given position is a word or punctuation character and that * the next character is of a different character class. */ bool Document::IsWordEndAt(int pos) { if (pos < Length() - 1) { charClassification ccPrev = WordCharClass(CharAt(pos-1)); return (ccPrev == ccWord || ccPrev == ccPunctuation) && (ccPrev != WordCharClass(CharAt(pos))); } return true; } /** * Check that the given range is has transitions between character classes at both * ends and where the characters on the inside are word or punctuation characters. */ bool Document::IsWordAt(int start, int end) { return IsWordStartAt(start) && IsWordEndAt(end); } // The comparison and case changing functions here assume ASCII // or extended ASCII such as the normal Windows code page. static inline char MakeUpperCase(char ch) { if (ch < 'a' || ch > 'z') return ch; else return static_cast<char>(ch - 'a' + 'A'); } static inline char MakeLowerCase(char ch) { if (ch < 'A' || ch > 'Z') return ch; else return static_cast<char>(ch - 'A' + 'a'); } // Define a way for the Regular Expression code to access the document class DocumentIndexer : public CharacterIndexer { Document *pdoc; int end; public: DocumentIndexer(Document *pdoc_, int end_) : pdoc(pdoc_), end(end_) { } virtual char CharAt(int index) { if (index < 0 || index >= end) return 0; else return pdoc->CharAt(index); } }; /** * Find text in document, supporting both forward and backward * searches (just pass minPos > maxPos to do a backward search) * Has not been tested with backwards DBCS searches yet. */ long Document::FindText(int minPos, int maxPos, const char *s, bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix, int *length) { if (regExp) { if (!pre) pre = new RESearch(); if (!pre) return -1; int increment = (minPos <= maxPos) ? 1 : -1; int startPos = minPos; int endPos = maxPos; // Range endpoints should not be inside DBCS characters, but just in case, move them. startPos = MovePositionOutsideChar(startPos, 1, false); endPos = MovePositionOutsideChar(endPos, 1, false); const char *errmsg = pre->Compile(s, *length, caseSensitive, posix); if (errmsg) { return -1; } // Find a variable in a property file: \$(\([A-Za-z0-9_.]+\)) // Replace first '.' with '-' in each property file variable reference: // Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\)) // Replace: $(\1-\2) int lineRangeStart = LineFromPosition(startPos); int lineRangeEnd = LineFromPosition(endPos); if ((increment == 1) && (startPos >= LineEnd(lineRangeStart)) && (lineRangeStart < lineRangeEnd)) { // the start position is at end of line or between line end characters. lineRangeStart++; startPos = LineStart(lineRangeStart); } int pos = -1; int lenRet = 0; char searchEnd = s[*length - 1]; int lineRangeBreak = lineRangeEnd + increment; for (int line = lineRangeStart; line != lineRangeBreak; line += increment) { int startOfLine = LineStart(line); int endOfLine = LineEnd(line); if (increment == 1) { if (line == lineRangeStart) { if ((startPos != startOfLine) && (s[0] == '^')) continue; // Can't match start of line if start position after start of line startOfLine = startPos; } if (line == lineRangeEnd) { if ((endPos != endOfLine) && (searchEnd == '$')) continue; // Can't match end of line if end position before end of line endOfLine = endPos; } } else { if (line == lineRangeEnd) { if ((endPos != startOfLine) && (s[0] == '^')) continue; // Can't match start of line if end position after start of line startOfLine = endPos; } if (line == lineRangeStart) { if ((startPos != endOfLine) && (searchEnd == '$')) continue; // Can't match end of line if start position before end of line endOfLine = startPos+1; } } DocumentIndexer di(this, endOfLine); int success = pre->Execute(di, startOfLine, endOfLine); if (success) { pos = pre->bopat[0]; lenRet = pre->eopat[0] - pre->bopat[0]; if (increment == -1) { // Check for the last match on this line. int repetitions = 1000; // Break out of infinite loop while (success && (pre->eopat[0] <= (endOfLine+1)) && (repetitions--)) { success = pre->Execute(di, pos+1, endOfLine+1); if (success) { if (pre->eopat[0] <= (minPos+1)) { pos = pre->bopat[0]; lenRet = pre->eopat[0] - pre->bopat[0]; } else { success = 0; } } } } break; } } *length = lenRet; return pos; } else { bool forward = minPos <= maxPos; int increment = forward ? 1 : -1; // Range endpoints should not be inside DBCS characters, but just in case, move them. int startPos = MovePositionOutsideChar(minPos, increment, false); int endPos = MovePositionOutsideChar(maxPos, increment, false); // Compute actual search ranges needed int lengthFind = *length; if (lengthFind == -1) lengthFind = static_cast<int>(strlen(s)); int endSearch = endPos; if (startPos <= endPos) { endSearch = endPos - lengthFind + 1; } //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind); char firstChar = s[0]; if (!caseSensitive) firstChar = static_cast<char>(MakeUpperCase(firstChar)); int pos = startPos; while (forward ? (pos < endSearch) : (pos >= endSearch)) { char ch = CharAt(pos); if (caseSensitive) { if (ch == firstChar) { bool found = true; for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) { ch = CharAt(pos + posMatch); if (ch != s[posMatch]) found = false; } if (found) { if ((!word && !wordStart) || word && IsWordAt(pos, pos + lengthFind) || wordStart && IsWordStartAt(pos)) return pos; } } } else { if (MakeUpperCase(ch) == firstChar) { bool found = true; for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) { ch = CharAt(pos + posMatch); if (MakeUpperCase(ch) != MakeUpperCase(s[posMatch])) found = false; } if (found) { if ((!word && !wordStart) || word && IsWordAt(pos, pos + lengthFind) || wordStart && IsWordStartAt(pos)) return pos; } } } pos += increment; if (dbcsCodePage && (pos >= 0)) { // Ensure trying to match from start of character pos = MovePositionOutsideChar(pos, increment, false); } } } //Platform::DebugPrintf("Not found\n"); return -1; } const char *Document::SubstituteByPosition(const char *text, int *length) { if (!pre) return 0; delete []substituted; substituted = 0; DocumentIndexer di(this, Length()); if (!pre->GrabMatches(di)) return 0; unsigned int lenResult = 0; for (int i = 0; i < *length; i++) { if (text[i] == '\\') { if (text[i + 1] >= '1' && text[i + 1] <= '9') { unsigned int patNum = text[i + 1] - '0'; lenResult += pre->eopat[patNum] - pre->bopat[patNum]; i++; } else { switch (text[i + 1]) { case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v': i++; } lenResult++; } } else { lenResult++; } } substituted = new char[lenResult + 1]; if (!substituted) return 0; char *o = substituted; for (int j = 0; j < *length; j++) { if (text[j] == '\\') { if (text[j + 1] >= '1' && text[j + 1] <= '9') { unsigned int patNum = text[j + 1] - '0'; unsigned int len = pre->eopat[patNum] - pre->bopat[patNum]; if (pre->pat[patNum]) // Will be null if try for a match that did not occur memcpy(o, pre->pat[patNum], len); o += len; j++; } else { j++; switch (text[j]) { case 'a': *o++ = '\a'; break; case 'b': *o++ = '\b'; break; case 'f': *o++ = '\f'; break; case 'n': *o++ = '\n'; break; case 'r': *o++ = '\r'; break; case 't': *o++ = '\t'; break; case 'v': *o++ = '\v'; break; default: *o++ = '\\'; j--; } } } else { *o++ = text[j]; } } *o = '\0'; *length = lenResult; return substituted; } int Document::LinesTotal() { return cb.Lines(); } void Document::ChangeCase(Range r, bool makeUpperCase) { for (int pos = r.start; pos < r.end; pos++) { int len = LenChar(pos); if (dbcsCodePage && (len > 1)) { pos += len; } else { char ch = CharAt(pos); if (makeUpperCase) { if (IsLowerCase(ch)) { ChangeChar(pos, static_cast<char>(MakeUpperCase(ch))); } } else { if (IsUpperCase(ch)) { ChangeChar(pos, static_cast<char>(MakeLowerCase(ch))); } } } } } void Document::SetDefaultCharClasses(bool includeWordClass) { // Initialize all char classes to default values for (int ch = 0; ch < 256; ch++) { if (ch == '\r' || ch == '\n') charClass[ch] = ccNewLine; else if (ch < 0x20 || ch == ' ') charClass[ch] = ccSpace; else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_')) charClass[ch] = ccWord; else charClass[ch] = ccPunctuation; } } void Document::SetCharClasses(const unsigned char *chars, charClassification newCharClass) { // Apply the newCharClass to the specifed chars if (chars) { while (*chars) { charClass[*chars] = newCharClass; chars++; } } } void Document::SetStylingBits(int bits) { stylingBits = bits; stylingBitsMask = 0; for (int bit = 0; bit < stylingBits; bit++) { stylingBitsMask <<= 1; stylingBitsMask |= 1; } } void Document::StartStyling(int position, char mask) { stylingMask = mask; endStyled = position; } bool Document::SetStyleFor(int length, char style) { if (enteredCount != 0) { return false; } else { enteredCount++; style &= stylingMask; int prevEndStyled = endStyled; if (cb.SetStyleFor(endStyled, length, style, stylingMask)) { DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, prevEndStyled, length); NotifyModified(mh); } endStyled += length; enteredCount--; return true; } } bool Document::SetStyles(int length, char *styles) { if (enteredCount != 0) { return false; } else { enteredCount++; int prevEndStyled = endStyled; bool didChange = false; int lastChange = 0; for (int iPos = 0; iPos < length; iPos++, endStyled++) { PLATFORM_ASSERT(endStyled < Length()); if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) { didChange = true; lastChange = iPos; } } if (didChange) { DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, prevEndStyled, lastChange); NotifyModified(mh); } enteredCount--; return true; } } bool Document::EnsureStyledTo(int pos) { if (pos > GetEndStyled()) { IncrementStyleClock(); // Ask the watchers to style, and stop as soon as one responds. for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) { watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos); } } return pos <= GetEndStyled(); } void Document::IncrementStyleClock() { styleClock++; if (styleClock > 0x100000) { styleClock = 0; } } bool Document::AddWatcher(DocWatcher *watcher, void *userData) { for (int i = 0; i < lenWatchers; i++) { if ((watchers[i].watcher == watcher) && (watchers[i].userData == userData)) return false; } WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers + 1]; if (!pwNew) return false; for (int j = 0; j < lenWatchers; j++) pwNew[j] = watchers[j]; pwNew[lenWatchers].watcher = watcher; pwNew[lenWatchers].userData = userData; delete []watchers; watchers = pwNew; lenWatchers++; return true; } bool Document::RemoveWatcher(DocWatcher *watcher, void *userData) { for (int i = 0; i < lenWatchers; i++) { if ((watchers[i].watcher == watcher) && (watchers[i].userData == userData)) { if (lenWatchers == 1) { delete []watchers; watchers = 0; lenWatchers = 0; } else { WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers]; if (!pwNew) return false; for (int j = 0; j < lenWatchers - 1; j++) { pwNew[j] = (j < i) ? watchers[j] : watchers[j + 1]; } delete []watchers; watchers = pwNew; lenWatchers--; } return true; } } return false; } void Document::NotifyModifyAttempt() { for (int i = 0; i < lenWatchers; i++) { watchers[i].watcher->NotifyModifyAttempt(this, watchers[i].userData); } } void Document::NotifySavePoint(bool atSavePoint) { for (int i = 0; i < lenWatchers; i++) { watchers[i].watcher->NotifySavePoint(this, watchers[i].userData, atSavePoint); } } void Document::NotifyModified(DocModification mh) { for (int i = 0; i < lenWatchers; i++) { watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData); } } bool Document::IsWordPartSeparator(char ch) { return (WordCharClass(ch) == ccWord) && IsPunctuation(ch); } int Document::WordPartLeft(int pos) { if (pos > 0) { --pos; char startChar = cb.CharAt(pos); if (IsWordPartSeparator(startChar)) { while (pos > 0 && IsWordPartSeparator(cb.CharAt(pos))) { --pos; } } if (pos > 0) { startChar = cb.CharAt(pos); --pos; if (IsLowerCase(startChar)) { while (pos > 0 && IsLowerCase(cb.CharAt(pos))) --pos; if (!IsUpperCase(cb.CharAt(pos)) && !IsLowerCase(cb.CharAt(pos))) ++pos; } else if (IsUpperCase(startChar)) { while (pos > 0 && IsUpperCase(cb.CharAt(pos))) --pos; if (!IsUpperCase(cb.CharAt(pos))) ++pos; } else if (IsADigit(startChar)) { while (pos > 0 && IsADigit(cb.CharAt(pos))) --pos; if (!IsADigit(cb.CharAt(pos))) ++pos; } else if (IsPunctuation(startChar)) { while (pos > 0 && IsPunctuation(cb.CharAt(pos))) --pos; if (!IsPunctuation(cb.CharAt(pos))) ++pos; } else if (isspacechar(startChar)) { while (pos > 0 && isspacechar(cb.CharAt(pos))) --pos; if (!isspacechar(cb.CharAt(pos))) ++pos; } else if (!isascii(startChar)) { while (pos > 0 && !isascii(cb.CharAt(pos))) --pos; if (isascii(cb.CharAt(pos))) ++pos; } else { ++pos; } } } return pos; } int Document::WordPartRight(int pos) { char startChar = cb.CharAt(pos); int length = Length(); if (IsWordPartSeparator(startChar)) { while (pos < length && IsWordPartSeparator(cb.CharAt(pos))) ++pos; startChar = cb.CharAt(pos); } if (!isascii(startChar)) { while (pos < length && !isascii(cb.CharAt(pos))) ++pos; } else if (IsLowerCase(startChar)) { while (pos < length && IsLowerCase(cb.CharAt(pos))) ++pos; } else if (IsUpperCase(startChar)) { if (IsLowerCase(cb.CharAt(pos + 1))) { ++pos; while (pos < length && IsLowerCase(cb.CharAt(pos))) ++pos; } else { while (pos < length && IsUpperCase(cb.CharAt(pos))) ++pos; } if (IsLowerCase(cb.CharAt(pos)) && IsUpperCase(cb.CharAt(pos - 1))) --pos; } else if (IsADigit(startChar)) { while (pos < length && IsADigit(cb.CharAt(pos))) ++pos; } else if (IsPunctuation(startChar)) { while (pos < length && IsPunctuation(cb.CharAt(pos))) ++pos; } else if (isspacechar(startChar)) { while (pos < length && isspacechar(cb.CharAt(pos))) ++pos; } else { ++pos; } return pos; } bool IsLineEndChar(char c) { return (c == '\n' || c == '\r'); } int Document::ExtendStyleRange(int pos, int delta, bool singleLine) { int sStart = cb.StyleAt(pos); if (delta < 0) { while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) ) pos--; pos++; } else { while (pos < (Length()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) ) pos++; } return pos; }
[ "vroby.mail@gmail.com" ]
vroby.mail@gmail.com
bbc5d2ae8ed4b76093e4708e5f931e64e5f21a57
76194044c1aac233fe6c9b40e953b815747478a5
/libraries/sparseSolver/ARPACKSolver.cpp
7bc2a64fc4122c3af5f31b2a716978fbfa395c79
[]
no_license
Milliekf/Vega
b97d521af64d118523a64bd4d5e83ccbec5773d8
256fc29e1d1a19bced5ec73bc37cc0d06f620c1a
refs/heads/master
2022-12-27T11:35:20.000544
2020-10-10T02:33:33
2020-10-10T02:33:33
291,040,660
1
0
null
null
null
null
UTF-8
C++
false
false
31,568
cpp
/************************************************************************* * * * Vega FEM Simulation Library Version 4.0 * * * * "Large Modal Deformation Factory", * * a pre-processing utility for model reduction of * * deformable objects undergoing large deformations. * * * * Copyright (C) 2007 CMU, 2009 MIT, 2018 USC * * * * All rights reserved. * * * * Code authors: Jernej Barbic, Hongyi Xu * * http://www.jernejbarbic.com/vega * * * * Research: Jernej Barbic, Hongyi Xu, Yijing Li, * * Danyong Zhao, Bohan Wang, * * Fun Shing Sin, Daniel Schroeder, * * Doug L. James, Jovan Popovic * * * * Funding: National Science Foundation, Link Foundation, * * Singapore-MIT GAMBIT Game Lab, * * Zumberge Research and Innovation Fund at USC, * * Sloan Foundation, Okawa Foundation, * * USC Annenberg Foundation * * * * This utility is free software; you can redistribute it and/or * * modify it under the terms of the BSD-style license that is * * included with this library in the file LICENSE.txt * * * * This utility is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file * * LICENSE.TXT for more details. * * * *************************************************************************/ #include "ARPACKSolver.h" #include "invMKSolver.h" #include "invZTAZSolver.h" #include "invZTAZMSolver.h" #include "ZTAZMultiplicator.h" #include "lapack-headers.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <iostream> using namespace std; //#define SPOOLES #define PARDISO //#define DSAUPD dsaupd_ //#define DSEUPD dseupd_ //#define INTEGER int /* Note: This code is now independent of ARPACK++ and calls ARPACK directly. It has been tested and works fine. Previously, it used ARPACK++, which, while convenient, required installing ARPACK++ (which required editing some of its headers files to bring it up to date wit today's C compilers), and only worked under Windows and Linux. Under Mac, it lead to strange errors inside ARPACK. */ // always keep this undefined //#define USEARPACKPLUSPLUS #ifdef SPOOLES #include "SPOOLESSolver.h" #include "SPOOLESSolverMT.h" #endif #ifdef PARDISO #include "PardisoSolver.h" #endif int ARPACKSolver::SolveGenEigReg(SparseMatrix * KInput, SparseMatrix * MInput, int numEigenvalues, double * eigenvalues, double * eigenvectors, const char * mode, int numLinearSolverThreads, int verbose) { int np = KInput->Getn(); if (np != MInput->Getn()) return -1; if ((strcmp(mode, "SM") != 0) && (strcmp(mode, "LM") != 0)) return -1; bool largestMagnitude = (strcmp(mode, "LM") == 0); SparseMatrix * K; SparseMatrix * M; if (largestMagnitude) { K = KInput; M = MInput; } else { // swap K and M to get the smallest eigenvalues K = MInput; M = KInput; } // solve Kx = lambda Mx with ARPACK // need multiplication with M^{-1} K and with M // create M^{-1} solver LinearSolver * invMSolver = NULL; #ifdef SPOOLES if (numLinearSolverThreads == 0) { if (verbose >= 1) printf("Linear solver: SPOOLES\n"); invMSolver = new SPOOLESSolver(M, verbose); } else { if (verbose >= 1) printf("Linear solver: SPOOLES (%d threads).\n", numLinearSolverThreads); invMSolver = new SPOOLESSolverMT(M, numLinearSolverThreads, verbose); } #endif #ifdef PARDISO if (verbose >= 1) printf("Linear solver: PARDISO (%d threads).\n", (numLinearSolverThreads == 0) ? 1 : numLinearSolverThreads); int directIterative = 0; PardisoSolver * pardisoSolver = new PardisoSolver(M, numLinearSolverThreads, PardisoSolver::REAL_SYM_INDEFINITE, PardisoSolver::NESTED_DISSECTION, directIterative, verbose); pardisoSolver->FactorMatrix(M); invMSolver = pardisoSolver; #endif if (invMSolver == NULL) { printf("Error: no linear solver specified in SolveGenEigReg.\n"); return 1; } // create M^{-1} K solver InvMKSolver invMKSolver(invMSolver, K); #ifdef USEARPACKPLUSPLUS /* ARSymGenEig(int np, int nevp, ARFOP* objOPp, void (ARFOP::* MultOPxp)(ARFLOAT[], ARFLOAT[]), ARFB* objBp, void (ARFB::* MultBxp)(ARFLOAT[], ARFLOAT[]), char* whichp = "LM", int ncvp = 0, ARFLOAT tolp = 0.0, int maxitp = 0, ARFLOAT* residp = NULL, bool ishiftp = true); */ ARSymGenEig<double, InvMKSolver, SparseMatrix> solver (np, numEigenvalues, &invMKSolver, &InvMKSolver::ComputeInvMK, M, (void (SparseMatrix::*)(double*,double*)) &SparseMatrix::MultiplyVector, "LM"); int nconv = solver.EigenValVectors(eigenvectors, eigenvalues); #else const int maxIter = 10000; // call ARPACK INTEGER IDO = 0; char BMAT = 'G'; INTEGER N = np; char WHICH[3] = "LM"; INTEGER NEV = numEigenvalues; double TOL = 0.0; double * RESID = (double*) malloc (sizeof(double) * N); INTEGER NCV = 3 * NEV; if (NCV > N) NCV = N; double * V = (double*) malloc (sizeof(double) * N * NCV); INTEGER LDV = N; INTEGER IPARAM[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; IPARAM[0] = 1; // no user-provided shifts IPARAM[2] = maxIter; IPARAM[3] = 1; //IPARAM[4] = 0; IPARAM[6] = 2; // the mode (regular generalized eigenproblem) INTEGER IPNTR[11]; double * WORKD = (double*) malloc (sizeof(double) * 3 * N); INTEGER LWORKL = 2 * (NCV*NCV + 8*NCV); // at least NCV**2 + 8*NCV; double * WORKL = (double*) malloc (sizeof(double) * LWORKL); INTEGER INFO = 0; double * buffer = (double*) malloc (sizeof(double) * N); do { //printf("Entering dsaupd...\n"); fflush(NULL); DSAUPD(&IDO, &BMAT, &N, WHICH, &NEV, &TOL, RESID, &NCV, V, &LDV, IPARAM, IPNTR, WORKD, WORKL, &LWORKL, &INFO); if (INFO != 0) { printf("Error: DSAUPD returned non-zero exit code %d .\n", (int)INFO); delete(invMSolver); return -1; } //printf("IDO=%d\n", (int)IDO); fflush(NULL); switch(IDO) { case -1: invMKSolver.ComputeInvMK(&WORKD[IPNTR[0]-1], &WORKD[IPNTR[1]-1]); break; case 1: invMKSolver.ComputeInvMK(&WORKD[IPNTR[0]-1], &WORKD[IPNTR[1]-1]); break; case 2: M->MultiplyVector(&WORKD[IPNTR[0]-1], &WORKD[IPNTR[1]-1]); break; case 3: printf("Error: case IDO=3 should have never happened.\n"); delete(invMSolver); return -1; break; case 99: break; default: printf("Error: unknown case.\n"); delete(invMSolver); return -1; break; }; } while (IDO != 99); // obtain the eigenvalues and eigenvectors INTEGER RVEC = 1; char HOWMNY = 'A'; // all eigenvectors INTEGER * SELECT = (INTEGER*) malloc (sizeof(INTEGER) * NCV); double * D = eigenvalues; double * Z = eigenvectors; INTEGER LDZ = N; double * SIGMA = NULL; DSEUPD(&RVEC, &HOWMNY, SELECT, D, Z, &LDZ, SIGMA, &BMAT, &N, WHICH, &NEV, &TOL, RESID, &NCV, V, &LDV, IPARAM, IPNTR, WORKD, WORKL, &LWORKL, &INFO); free(SELECT); free(RESID); free(V); free(WORKD); free(WORKL); free(buffer); int nconv = IPARAM[4]; #endif // normalize results for(int i=0; i<nconv; i++) MInput->NormalizeVector(&eigenvectors[np*i]); //solver.FindEigenvectors(); //nconv = solver.ConvergedEigenvalues(); if (!largestMagnitude) { for(int i=0; i<nconv; i++) eigenvalues[i] = 1.0 / eigenvalues[i]; // reverse eigenvalues (and appropriate eigenvectors) for(int i=0; i< numEigenvalues / 2; i++) { // swap i and numEigenvalues-1-i double temp = eigenvalues[i]; eigenvalues[i] = eigenvalues[numEigenvalues-1-i]; eigenvalues[numEigenvalues-1-i] = temp; for(int j=0; j<np; j++) { temp = eigenvectors[np*i+j]; eigenvectors[np*i+j] = eigenvectors[np*(numEigenvalues-1-i) + j]; eigenvectors[np*(numEigenvalues-1-i) + j] = temp; } } } if (verbose >= 1) { #ifdef USEARPACKPLUSPLUS cout << "Dimension of the system : " << np << endl; cout << "Number of 'requested' eigenvalues : " << solver.GetNev() << endl; cout << "Number of 'converged' eigenvalues : " << nconv << endl; cout << "Number of Arnoldi vectors generated: " << solver.GetNcv() << endl; cout << "Number of iterations taken : " << solver.GetIter() << endl; #else cout << "Dimension of the system : " << np << endl; cout << "Number of 'requested' eigenvalues : " << NEV << endl; cout << "Number of 'converged' eigenvalues : " << nconv << endl; cout << "Number of Arnoldi vectors generated: " << NCV << endl; cout << "Number of iterations taken : " << IPARAM[2] << endl; cout << endl; #endif // Printing eigenvalues. cout << "Eigenvalues:" << endl; //for (int i=numEigenvalues-nconv; i<numEigenvalues; i++) for (int i=0; i<nconv; i++) { cout << " lambda[" << (i+1) << "]: " << eigenvalues[i] << endl; } cout << endl; // Printing the residual norm || A*x - lambda*B*x || // for the nconv accurately computed eigenvectors. double * Ax = new double[np]; double * Bx = new double[np]; double * ResNorm = new double[nconv]; double infinityNormK = KInput->GetInfinityNorm(); double infinityNormM = MInput->GetInfinityNorm(); double infNorm = infinityNormK; if (infinityNormM > infNorm) infNorm = infinityNormM; for (int i=0; i<nconv; i++) { KInput->MultiplyVector(&eigenvectors[np*i],Ax); MInput->MultiplyVector(&eigenvectors[np*i],Bx); for(int j=0; j<np; j++) Ax[j] = Ax[j] - eigenvalues[i] * Bx[j]; //cblas_daxpy(np, -eigenvalues[i], Bx, 1, Ax, 1); ResNorm[i] = 0; for(int j=0; j<np; j++) ResNorm[i] += Ax[j] * Ax[j]; ResNorm[i] = sqrt(ResNorm[i]) / fabs(eigenvalues[i]) / infNorm; //ResNorm[i] = cblas_dnrm2(np, Ax, 1) / fabs(eigenvalues[i]); } /* for (int i=0; i<nconv; i++) { cout << "||A*x(" << (i+1) << ") - lambda(" << (i+1); cout << ")*B*x(" << (i+1) << ")|| / |lambda| / max(||A||,||B||) = " << ResNorm[i] << endl; } cout << endl; */ //printf("Cleaning up ARPACK workspace.\n");fflush(NULL); delete[] Ax; delete[] Bx; delete[] ResNorm; } delete(invMSolver); return nconv; } int ARPACKSolver::SolveGenEigShInv(SparseMatrix * K, SparseMatrix * M, int numEigenvalues, double * eigenvalues, double * eigenvectors, double sigma, int numLinearSolverThreads, int verbose) { int np = K->Getn(); if (np != M->Getn()) return -1; // solve Kx = lambda Mx with ARPACK, shift-invert mode (mode number 3) // need multiplication with (K-sigma*M)^{-1}, (K-sigma*M)^{-1} M, and with M SparseMatrix * KsigmaM = K; if (sigma != 0) { // compute KsigmaM = K - sigma * M KsigmaM = new SparseMatrix(*K); KsigmaM->BuildSubMatrixIndices(*M); KsigmaM->AddSubMatrix(-sigma, *M); } // create (K-sigma*M)^{-1} solver LinearSolver * invKSolver = NULL; #ifdef SPOOLES if (numLinearSolverThreads == 0) { if (verbose >= 1) printf("Linear solver: SPOOLES\n"); invKSolver = new SPOOLESSolver(KsigmaM, verbose); } else { if (verbose >= 1) printf("Linear solver: SPOOLES (%d threads).\n", numLinearSolverThreads); invKSolver = new SPOOLESSolverMT(KsigmaM, numLinearSolverThreads, verbose); } #endif #ifdef PARDISO if (verbose >= 1) printf("Linear solver: PARDISO (%d threads).\n", (numLinearSolverThreads == 0) ? 1 : numLinearSolverThreads); int directIterative = 0; PardisoSolver * pardisoSolver = new PardisoSolver(KsigmaM, numLinearSolverThreads, PardisoSolver::REAL_SYM_INDEFINITE, PardisoSolver::NESTED_DISSECTION, directIterative, verbose); pardisoSolver->FactorMatrix(KsigmaM); invKSolver = pardisoSolver; #endif if (invKSolver == NULL) { printf("Error: no linear solver specified in SolveGenEigShInv.\n"); return 1; } // create (K-sigma*M)^{-1}*M solver InvMKSolver invKMSolver(invKSolver, M); const int maxIter = 10000; // call ARPACK INTEGER IDO = 0; char BMAT = 'G'; INTEGER N = np; char WHICH[3] = "LM"; INTEGER NEV = numEigenvalues; double TOL = 0.0; double * RESID = (double*) malloc (sizeof(double) * N); INTEGER NCV = 3 * NEV; if (NCV > N) NCV = N; double * V = (double*) malloc (sizeof(double) * N * NCV); INTEGER LDV = N; INTEGER IPARAM[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; IPARAM[0] = 1; // no user-provided shifts IPARAM[2] = maxIter; IPARAM[3] = 1; IPARAM[6] = 3; // the mode (shift-inverted generalized eigenproblem) INTEGER IPNTR[11]; double * WORKD = (double*) malloc (sizeof(double) * 3 * N); INTEGER LWORKL = 2 * (NCV*NCV + 8*NCV); // at least NCV**2 + 8*NCV; double * WORKL = (double*) malloc (sizeof(double) * LWORKL); INTEGER INFO = 0; double * buffer = (double*) malloc (sizeof(double) * N); if (verbose >= 1) { cout << "Dimension of the system : " << np << endl; cout << "Number of 'requested' eigenvalues : " << NEV << endl; cout << "Entering the ARPACK eigenvalue routine..." << endl; fflush(NULL); } do { DSAUPD(&IDO, &BMAT, &N, WHICH, &NEV, &TOL, RESID, &NCV, V, &LDV, IPARAM, IPNTR, WORKD, WORKL, &LWORKL, &INFO); if (INFO != 0) { printf("Error: DSAUPD returned non-zero exit code %d .\n", (int)INFO); delete(invKSolver); return -1; } //printf("IDO=%d\n", (int)IDO); fflush(NULL); //c ===> OP = (inv[K - sigma*M])*M and B = M. switch(IDO) { case -1: //c IDO = -1: compute Y = OP * X where //c IPNTR(1) is the pointer into WORKD for X, //c IPNTR(2) is the pointer into WORKD for Y. //c This is for the initialization phase to force the //c starting vector into the range of OP. //printf("IDO = -1\n"); invKMSolver.ComputeInvMK(&WORKD[IPNTR[0]-1], &WORKD[IPNTR[1]-1]); break; case 1: //c IDO = 1: compute Y = (K - sigma*M)^-1 * Z //c IPNTR(2) is the pointer into WORKD for Y, //c IPNTR(3) is the pointer into WORKD for Z. //c (see dsdrv4.f example) //printf("IDO = 1\n"); invKSolver->SolveLinearSystem(&WORKD[IPNTR[1]-1], &WORKD[IPNTR[2]-1]); break; case 2: //c IDO = 2: compute Y = B * X where //c IPNTR(1) is the pointer into WORKD for X, //c IPNTR(2) is the pointer into WORKD for Y. //printf("IDO = 2\n"); M->MultiplyVector(&WORKD[IPNTR[0]-1], &WORKD[IPNTR[1]-1]); break; case 3: printf("Error: case IDO=3 should have never happened.\n"); delete(invKSolver); return -1; break; case 99: break; default: printf("Error: unknown case.\n"); delete(invKSolver); return -1; break; }; } while (IDO != 99); // obtain the eigenvalues and eigenvectors INTEGER RVEC = 1; char HOWMNY = 'A'; // all eigenvectors INTEGER * SELECT = (INTEGER*) malloc (sizeof(INTEGER) * NCV); double * D = eigenvalues; double * Z = eigenvectors; INTEGER LDZ = N; double SIGMA = sigma; DSEUPD(&RVEC, &HOWMNY, SELECT, D, Z, &LDZ, &SIGMA, &BMAT, &N, WHICH, &NEV, &TOL, RESID, &NCV, V, &LDV, IPARAM, IPNTR, WORKD, WORKL, &LWORKL, &INFO); free(SELECT); free(RESID); free(V); free(WORKD); free(WORKL); free(buffer); if (sigma != 0) { delete(KsigmaM); } int nconv = IPARAM[4]; // normalize results for(int i=0; i<nconv; i++) M->NormalizeVector(&eigenvectors[np*i]); //solver.FindEigenvectors(); //nconv = solver.ConvergedEigenvalues(); if (verbose >= 1) { cout << "ARPACK solver is done." << endl; //cout << "Dimension of the system : " << np << endl; //cout << "Number of 'requested' eigenvalues : " << NEV << endl; cout << "Number of 'converged' eigenvalues : " << nconv << endl; cout << "Number of Arnoldi vectors generated: " << NCV << endl; cout << "Number of iterations taken : " << IPARAM[2] << endl; cout << endl; // Printing eigenvalues. cout << "Eigenvalues:" << endl; //for (int i=numEigenvalues-nconv; i<numEigenvalues; i++) for (int i=0; i<nconv; i++) { cout << " lambda[" << (i+1) << "]: " << eigenvalues[i] << endl; } cout << endl; // Printing the residual norm || A*x - lambda*B*x || // for the nconv accurately computed eigenvectors. double * Ax = new double[np]; double * Bx = new double[np]; double * ResNorm = new double[nconv]; double infinityNormK = K->GetInfinityNorm(); double infinityNormM = M->GetInfinityNorm(); double infNorm = infinityNormK; if (infinityNormM > infNorm) infNorm = infinityNormM; for (int i=0; i<nconv; i++) { K->MultiplyVector(&eigenvectors[np*i],Ax); M->MultiplyVector(&eigenvectors[np*i],Bx); for(int j=0; j<np; j++) Ax[j] = Ax[j] - eigenvalues[i] * Bx[j]; //cblas_daxpy(np, -eigenvalues[i], Bx, 1, Ax, 1); ResNorm[i] = 0; for(int j=0; j<np; j++) ResNorm[i] += Ax[j] * Ax[j]; ResNorm[i] = sqrt(ResNorm[i]) / fabs(eigenvalues[i]) / infNorm; //ResNorm[i] = cblas_dnrm2(np, Ax, 1) / fabs(eigenvalues[i]); } /* for (int i=0; i<nconv; i++) { cout << "||A*x(" << (i+1) << ") - lambda(" << (i+1); cout << ")*B*x(" << (i+1) << ")|| / |lambda| / max(||A||,||B||) = " << ResNorm[i] << endl; } cout << endl; */ //printf("Cleaning up ARPACK workspace.\n");fflush(NULL); delete[] Ax; delete[] Bx; delete[] ResNorm; } delete(invKSolver); return nconv; } int ARPACKSolver::SolveGenEigShInv(SparseMatrix * K, SparseMatrix * M, SparseMatrix * C, int numEigenvalues, double * eigenvalues, double * eigenvectors, double sigma, double eps, int numLinearSolverThreads, int verbose) { int np = K->Getn(); if (np != M->Getn()) return -1; // convert to dense matrix int numCons = C->Getn(); double * dataC = (double*) malloc (sizeof(double) * np * numCons); C->MakeDenseMatrix(dataC, np); // do SVD on C Matrix<double> CM(numCons, np, dataC, false, false); Matrix<double> UM(numCons, numCons); Matrix<double> Sigma(numCons, 1); double * VT = (double*) malloc (sizeof(double) * np * numCons); Matrix<double> VTM(numCons, np, VT, false, false); // same shape as CM CM.SVD(UM, Sigma, VTM); // regularize C double * sigmaValues = Sigma.GetData(); int c = 0; for(c = 0; c < numCons; c++) // find the rank of matrix C (=c) { if (sigmaValues[c] < eps) break; } // VT, after only keeping rows 1..c double * newC = (double*) malloc (sizeof(double) * np * c); int counter = 0; for(int i = 0; i < np; i++) { double * pointer = &VT[numCons * i]; for(int j = 0; j < c; j++) { newC[counter] = pointer[j]; counter++; } } free(dataC); free(VT); // from now on, we just use newC SparseMatrixOutline * POutline = new SparseMatrixOutline(np); // for the permutation matrix double * bufferc = (double*) malloc(sizeof(double) * c); // indices[i] tells the position of column i after the permutation int * indices = (int*) calloc(np, sizeof(int)); for(int i = 0; i < np; i++) indices[i] = i; // Gaussian elimination for(int i = 0; i < c; i++) // over all rows of newC { // find column with maximum absolute value in the current row double maxValue = 0.0; int column = i; // columns 1..i-1 are already zero, because of Gaussian elimination for(int j = i; j < np; j++) { if (fabs(newC[ELT(c, i, j)]) > maxValue) { maxValue = fabs(newC[ELT(c, i, j)]); column = j; } } // now, "column" contains the column with max absolute value // swap indices[column] and indices[i] int tmp = indices[column]; indices[column] = indices[i]; indices[i] = tmp; // swap columns i and "column" memcpy(bufferc, &newC[ELT(c, 0, column)], sizeof(double) * c); memcpy(&newC[ELT(c, 0, column)], &newC[ELT(c, 0, i)], sizeof(double) * c); memcpy(&newC[ELT(c, 0, i)], bufferc, sizeof(double) * c); double value = newC[ELT(c, i, i)]; for(int j = i+1; j < c; j++) { double scale = newC[ELT(c, j, i)] / value; for(int l = i; l < np; l++) newC[ELT(c, j, l)] -= scale * newC[ELT(c, i, l)]; } } for(int i = 0; i < np; i++) POutline->AddEntry(indices[i], i, 1.0); SparseMatrix * P = new SparseMatrix(POutline); delete(POutline); free(indices); free(bufferc); // form Cp and Cn double * Cp = &newC[0]; double * Cn = &newC[c*c]; // solve Kx = lambda Mx with ARPACK, shift-invert mode (mode number 3) // need multiplication with (K-sigma*M)^{-1}, (K-sigma*M)^{-1} M, and with M SparseMatrix * KsigmaM = K; if (sigma != 0) { // compute KsigmaM = K - sigma * M KsigmaM = new SparseMatrix(*K); KsigmaM->BuildSubMatrixIndices(*M); KsigmaM->AddSubMatrix(-sigma, *M); } int npc = np - c; Matrix<double> CnM (c, npc, Cn); Matrix<double> CpM (c, c, Cp); Matrix<double> invCpM = Inverse(CpM); // form the nullspace Z double * ZUpper = (double*) malloc (sizeof(double) * npc * c); Matrix<double> ZupperM(c, npc, ZUpper, false, false); ZupperM = invCpM * CnM; ZupperM *= -1; SparseMatrix * PKP = new SparseMatrix(KsigmaM->ConjugateMatrix(*P, 0, M->Getn())); //thresholded Z, used as the preconditioner SparseMatrixOutline * spZOutline = new SparseMatrixOutline(np); for(int i = 0; i < c; i++) { for(int j = 0; j < np-c; j++) { if (ZUpper[ELT(c, i, j)] > 1E-10) spZOutline->AddEntry(i, j, ZUpper[ELT(c, i, j)]); } } for(int i = c ; i < np; i++) spZOutline->AddEntry(i, i-c, 1.0); SparseMatrix * spZ = new SparseMatrix(spZOutline); delete(spZOutline); SparseMatrix * ZKZ = new SparseMatrix(PKP->ConjugateMatrix(*spZ, 0, npc)); free(ZUpper); delete(PKP); delete(spZ); int directIterative = 0; PardisoSolver * pardisoSolver = new PardisoSolver(ZKZ, numLinearSolverThreads, PardisoSolver::REAL_SYM_INDEFINITE, PardisoSolver::NESTED_DISSECTION, directIterative, verbose); pardisoSolver->FactorMatrix(ZKZ); // create M* multiplicator ZTAZMultiplicator Mmult(M, P, &invCpM, &CnM); // create (M)^{-1} solver InvZTAZSolver invZTAZSolver(KsigmaM, pardisoSolver, P, &invCpM, &CnM); // create (M)^{-1}*K solver InvZTAZMSolver invZTAZMSolver(KsigmaM, M, pardisoSolver, P, &invCpM, &CnM); const int maxIter = 10000; // call ARPACK INTEGER IDO = 0; char BMAT = 'G'; INTEGER N = npc; char WHICH[3] = "LM"; INTEGER NEV = numEigenvalues; double TOL = 0.0; double * RESID = (double*) malloc (sizeof(double) * N); INTEGER NCV = 3 * NEV; if (NCV > N) NCV = N; double * V = (double*) malloc (sizeof(double) * N * NCV); INTEGER LDV = N; INTEGER IPARAM[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; IPARAM[0] = 1; // no user-provided shifts IPARAM[2] = maxIter; IPARAM[3] = 1; IPARAM[6] = 3; // the mode (shift-inverted generalized eigenproblem) INTEGER IPNTR[11]; double * WORKD = (double*) malloc (sizeof(double) * 3 * N); INTEGER LWORKL = 2 * (NCV*NCV + 8*NCV); // at least NCV**2 + 8*NCV; double * WORKL = (double*) malloc (sizeof(double) * LWORKL); INTEGER INFO = 0; double * buffer = (double*) malloc (sizeof(double) * N); if (verbose >= 1) { cout << "Dimension of the system : " << npc << endl; cout << "Number of 'requested' eigenvalues : " << NEV << endl; cout << "Entering the ARPACK eigenvalue routine..." << endl; fflush(NULL); } do { DSAUPD(&IDO, &BMAT, &N, WHICH, &NEV, &TOL, RESID, &NCV, V, &LDV, IPARAM, IPNTR, WORKD, WORKL, &LWORKL, &INFO); if (INFO != 0) { printf("Error: DSAUPD returned non-zero exit code %d .\n", (int)INFO); delete(pardisoSolver); delete(P); free(newC); delete(ZKZ); return -1; } //printf("IDO=%d\n", (int)IDO); fflush(NULL); //c ===> OP = (inv[K - sigma*M])*M and B = M. switch(IDO) { case -1: //c IDO = -1: compute Y = OP * X where //c IPNTR(1) is the pointer into WORKD for X, //c IPNTR(2) is the pointer into WORKD for Y. //c This is for the initialization phase to force the //c starting vector into the range of OP. //printf("IDO = -1\n"); invZTAZMSolver.ComputeInvZTAZM(&WORKD[IPNTR[0]-1], &WORKD[IPNTR[1]-1]); break; case 1: //c IDO = 1: compute Y = (K - sigma*M)^-1 * Z //c IPNTR(2) is the pointer into WORKD for Y, //c IPNTR(3) is the pointer into WORKD for Z. //c (see dsdrv4.f example) //printf("IDO = 1\n"); invZTAZSolver.ComputeInvZTAZ(&WORKD[IPNTR[1]-1], &WORKD[IPNTR[2]-1]); break; case 2: //c IDO = 2: compute Y = B * X where //c IPNTR(1) is the pointer into WORKD for X, //c IPNTR(2) is the pointer into WORKD for Y. //printf("IDO = 2\n"); Mmult.Multiply(&WORKD[IPNTR[0]-1], &WORKD[IPNTR[1]-1]); break; case 3: printf("Error: case IDO=3 should have never happened.\n"); delete(pardisoSolver); delete(P); free(newC); delete(ZKZ); return -1; break; case 99: break; default: printf("Error: unknown case.\n"); delete(pardisoSolver); delete(P); free(newC); delete(ZKZ); return -1; break; }; } while (IDO != 99); // obtain the eigenvalues and eigenvectors INTEGER RVEC = 1; char HOWMNY = 'A'; // all eigenvectors INTEGER * SELECT = (INTEGER*) malloc (sizeof(INTEGER) * NCV); double * D = eigenvalues; double * Z = eigenvectors; INTEGER LDZ = N; double SIGMA = sigma; DSEUPD(&RVEC, &HOWMNY, SELECT, D, Z, &LDZ, &SIGMA, &BMAT, &N, WHICH, &NEV, &TOL, RESID, &NCV, V, &LDV, IPARAM, IPNTR, WORKD, WORKL, &LWORKL, &INFO); free(SELECT); free(RESID); free(V); free(WORKD); free(WORKL); free(buffer); if (sigma != 0) delete(KsigmaM); int nconv = IPARAM[4]; /* Multiply the constrained eigenvectors with Z: Z = P [ -C_p^{-1} C_n ] [ I ] */ double * buffer2 = (double*) malloc(sizeof(double) * np * nconv); for(int i = 0; i < nconv; i++) { Matrix<double> eM(npc, 1, &eigenvectors[npc*i], false, false); Matrix<double> bcM(c, 1, &buffer2[np*i], false, false); bcM = invCpM * (CnM * eM); bcM *= -1.0; for(int j = 0; j < npc; j++) buffer2[np*i+c+j] = eigenvectors[npc*i+j]; } for(int i = 0; i < nconv; i++) P->MultiplyVector(&buffer2[np*i], &eigenvectors[np*i]); free(buffer2); // normalize results for(int i=0; i<nconv; i++) M->NormalizeVector(&eigenvectors[np*i]); //solver.FindEigenvectors(); //nconv = solver.ConvergedEigenvalues(); if (verbose >= 1) { cout << "ARPACK solver is done." << endl; //cout << "Dimension of the system : " << np << endl; //cout << "Number of 'requested' eigenvalues : " << NEV << endl; cout << "Number of 'converged' eigenvalues : " << nconv << endl; cout << "Number of Arnoldi vectors generated: " << NCV << endl; cout << "Number of iterations taken : " << IPARAM[2] << endl; cout << endl; // Printing eigenvalues. cout << "Eigenvalues:" << endl; for (int i=0; i<nconv; i++) cout << " lambda[" << (i+1) << "]: " << eigenvalues[i] << endl; cout << endl; // Printing the residual norm || A*x - lambda*B*x || // for the nconv accurately computed eigenvectors. double * Ax = new double[np]; double * Bx = new double[np]; double * ResNorm = new double[nconv]; double infinityNormK = K->GetInfinityNorm(); double infinityNormM = M->GetInfinityNorm(); double infNorm = infinityNormK; if (infinityNormM > infNorm) infNorm = infinityNormM; for (int i=0; i<nconv; i++) { K->MultiplyVector(&eigenvectors[np*i],Ax); M->MultiplyVector(&eigenvectors[np*i],Bx); for(int j=0; j<np; j++) Ax[j] = Ax[j] - eigenvalues[i] * Bx[j]; //cblas_daxpy(np, -eigenvalues[i], Bx, 1, Ax, 1); ResNorm[i] = 0; for(int j=0; j<np; j++) ResNorm[i] += Ax[j] * Ax[j]; ResNorm[i] = sqrt(ResNorm[i]) / fabs(eigenvalues[i]) / infNorm; //ResNorm[i] = cblas_dnrm2(np, Ax, 1) / fabs(eigenvalues[i]); } /* for (int i=0; i<nconv; i++) { cout << "||A*x(" << (i+1) << ") - lambda(" << (i+1); cout << ")*B*x(" << (i+1) << ")|| / |lambda| / max(||A||,||B||) = " << ResNorm[i] << endl; } cout << endl; */ //printf("Cleaning up the ARPACK workspace.\n");fflush(NULL); delete[] Ax; delete[] Bx; delete[] ResNorm; } delete(pardisoSolver); delete(P); free(newC); delete(ZKZ); return nconv; } //void DSAUPD(INTEGER * IDO, char * BMAT, INTEGER * N, char * WHICH, INTEGER * NEV, double * TOL, double * RESID, INTEGER * NCV, double * V, INTEGER * LDV, INTEGER * IPARAM, INTEGER * IPNTR, double * WORKD, double * WORKL, INTEGER * LWORKL, INTEGER * INFO) //{ //} // //void DSEUPD(INTEGER * RVEC, char * HOWMNY, INTEGER * SELECT, double * D, double * Z, INTEGER * LDZ, double * SIGMA, char * BMAT, INTEGER * N, char * WHICH, INTEGER * NEV, double * TOL, double * RESID, INTEGER * NCV, double * V, INTEGER * LDV, INTEGER * IPARAM, INTEGER * IPNTR, double * WORKD, double * WORKL, INTEGER * LWORKL, INTEGER * INFO) //{ //}
[ "1614435795@qq.com" ]
1614435795@qq.com
a7cccfa54c1d15c97ba48027e3138a7c36b8b2b5
1972e07379ad5d73e9011884c3538ae992a2258d
/src/main.cpp
618b72ae652c6ebb31466ca3df96763718c41dd5
[ "MIT" ]
permissive
happinesscoin/happinesscoin
eb5c513b80d6f6666b3ee1f90624783559f69ada
02aae962bf5e49651386b399e97665763e837b01
refs/heads/master
2020-12-24T18:55:39.477695
2016-04-14T02:32:23
2016-04-14T02:32:23
56,201,124
1
1
null
null
null
null
UTF-8
C++
false
false
170,302
cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "alert.h" #include "checkpoints.h" #include "db.h" #include "txdb.h" #include "net.h" #include "init.h" #include "ui_interface.h" #include "checkqueue.h" #include <boost/algorithm/string/replace.hpp> #include <boost/filesystem.hpp> #include <boost/filesystem/fstream.hpp> //#include"config.h" using namespace std; using namespace boost; // // Global state // CCriticalSection cs_setpwalletRegistered; set<CWallet*> setpwalletRegistered; CCriticalSection cs_main; CTxMemPool mempool; unsigned int nTransactionsUpdated = 0; map<uint256, CBlockIndex*> mapBlockIndex; uint256 hashGenesisBlock("0x3ad3aa8b1f51c1440839e841e9f64477d69eaf9801aa1990c5d4a2f0cb2adfae");// static CBigNum bnProofOfWorkLimit(~uint256(0) >> 16); // Happinesscoin: starting difficulty is 1 / 2^12 CBlockIndex* pindexGenesisBlock = NULL; int nBestHeight = -1; uint256 nBestChainWork = 0; uint256 nBestInvalidWork = 0; uint256 hashBestChain = 0; CBlockIndex* pindexBest = NULL; set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexValid; // may contain all CBlockIndex*'s that have validness >=BLOCK_VALID_TRANSACTIONS, and must contain those who aren't failed int64 nTimeBestReceived = 0; int nScriptCheckThreads = 0; bool fImporting = false; bool fReindex = false; bool fBenchmark = false; bool fTxIndex = false; unsigned int nCoinCacheSize = 5000; /** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */ int64 CTransaction::nMinTxFee = 1; /** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */ int64 CTransaction::nMinRelayTxFee = 1; CMedianFilter<int> cPeerBlockCounts(8, 0); // Amount of blocks that other nodes claim to have map<uint256, CBlock*> mapOrphanBlocks; multimap<uint256, CBlock*> mapOrphanBlocksByPrev; map<uint256, CTransaction> mapOrphanTransactions; map<uint256, set<uint256> > mapOrphanTransactionsByPrev; // Constant stuff for coinbase transactions we create: CScript COINBASE_FLAGS; const string strMessageMagic = "Happinesscoin Signed Message:\n"; double dHashesPerSec = 0.0; int64 nHPSTimerStart = 0; // Settings int64 nTransactionFee = 0; int64 nMinimumInputValue = DUST_HARD_LIMIT; ////////////////////////////////////////////////////////////////////////////// // // dispatching functions // // These functions dispatch to one or all registered wallets void RegisterWallet(CWallet* pwalletIn) { { LOCK(cs_setpwalletRegistered); setpwalletRegistered.insert(pwalletIn); } } void UnregisterWallet(CWallet* pwalletIn) { { LOCK(cs_setpwalletRegistered); setpwalletRegistered.erase(pwalletIn); } } // get the wallet transaction with the given hash (if it exists) bool static GetTransaction(const uint256& hashTx, CWalletTx& wtx) { BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered) if (pwallet->GetTransaction(hashTx,wtx)) return true; return false; } // erases transaction with the given hash from all wallets void static EraseFromWallets(uint256 hash) { BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered) pwallet->EraseFromWallet(hash); } // make sure all wallets know about the given transaction, in the given block void SyncWithWallets(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate) { BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered) pwallet->AddToWalletIfInvolvingMe(hash, tx, pblock, fUpdate); } // notify wallets about a new best chain void static SetBestChain(const CBlockLocator& loc) { BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered) pwallet->SetBestChain(loc); } // notify wallets about an updated transaction void static UpdatedTransaction(const uint256& hashTx) { BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered) pwallet->UpdatedTransaction(hashTx); } // dump all wallets void static PrintWallets(const CBlock& block) { BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered) pwallet->PrintWallet(block); } // notify wallets about an incoming inventory (for request counts) void static Inventory(const uint256& hash) { BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered) pwallet->Inventory(hash); } // ask wallets to resend their transactions void static ResendWalletTransactions() { BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered) pwallet->ResendWalletTransactions(); } ////////////////////////////////////////////////////////////////////////////// // // CCoinsView implementations // bool CCoinsView::GetCoins(const uint256 &txid, CCoins &coins) { return false; } bool CCoinsView::SetCoins(const uint256 &txid, const CCoins &coins) { return false; } bool CCoinsView::HaveCoins(const uint256 &txid) { return false; } CBlockIndex *CCoinsView::GetBestBlock() { return NULL; } bool CCoinsView::SetBestBlock(CBlockIndex *pindex) { return false; } bool CCoinsView::BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockIndex *pindex) { return false; } bool CCoinsView::GetStats(CCoinsStats &stats) { return false; } CCoinsViewBacked::CCoinsViewBacked(CCoinsView &viewIn) : base(&viewIn) { } bool CCoinsViewBacked::GetCoins(const uint256 &txid, CCoins &coins) { return base->GetCoins(txid, coins); } bool CCoinsViewBacked::SetCoins(const uint256 &txid, const CCoins &coins) { return base->SetCoins(txid, coins); } bool CCoinsViewBacked::HaveCoins(const uint256 &txid) { return base->HaveCoins(txid); } CBlockIndex *CCoinsViewBacked::GetBestBlock() { return base->GetBestBlock(); } bool CCoinsViewBacked::SetBestBlock(CBlockIndex *pindex) { return base->SetBestBlock(pindex); } void CCoinsViewBacked::SetBackend(CCoinsView &viewIn) { base = &viewIn; } bool CCoinsViewBacked::BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockIndex *pindex) { return base->BatchWrite(mapCoins, pindex); } bool CCoinsViewBacked::GetStats(CCoinsStats &stats) { return base->GetStats(stats); } CCoinsViewCache::CCoinsViewCache(CCoinsView &baseIn, bool fDummy) : CCoinsViewBacked(baseIn), pindexTip(NULL) { } bool CCoinsViewCache::GetCoins(const uint256 &txid, CCoins &coins) { if (cacheCoins.count(txid)) { coins = cacheCoins[txid]; return true; } if (base->GetCoins(txid, coins)) { cacheCoins[txid] = coins; return true; } return false; } std::map<uint256,CCoins>::iterator CCoinsViewCache::FetchCoins(const uint256 &txid) { std::map<uint256,CCoins>::iterator it = cacheCoins.lower_bound(txid); if (it != cacheCoins.end() && it->first == txid) return it; CCoins tmp; if (!base->GetCoins(txid,tmp)) return cacheCoins.end(); std::map<uint256,CCoins>::iterator ret = cacheCoins.insert(it, std::make_pair(txid, CCoins())); tmp.swap(ret->second); return ret; } CCoins &CCoinsViewCache::GetCoins(const uint256 &txid) { std::map<uint256,CCoins>::iterator it = FetchCoins(txid); assert(it != cacheCoins.end()); return it->second; } bool CCoinsViewCache::SetCoins(const uint256 &txid, const CCoins &coins) { cacheCoins[txid] = coins; return true; } bool CCoinsViewCache::HaveCoins(const uint256 &txid) { return FetchCoins(txid) != cacheCoins.end(); } CBlockIndex *CCoinsViewCache::GetBestBlock() { if (pindexTip == NULL) pindexTip = base->GetBestBlock(); return pindexTip; } bool CCoinsViewCache::SetBestBlock(CBlockIndex *pindex) { pindexTip = pindex; return true; } bool CCoinsViewCache::BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockIndex *pindex) { for (std::map<uint256, CCoins>::const_iterator it = mapCoins.begin(); it != mapCoins.end(); it++) cacheCoins[it->first] = it->second; pindexTip = pindex; return true; } bool CCoinsViewCache::Flush() { bool fOk = base->BatchWrite(cacheCoins, pindexTip); if (fOk) cacheCoins.clear(); return fOk; } unsigned int CCoinsViewCache::GetCacheSize() { return cacheCoins.size(); } /** CCoinsView that brings transactions from a memorypool into view. It does not check for spendings by memory pool transactions. */ CCoinsViewMemPool::CCoinsViewMemPool(CCoinsView &baseIn, CTxMemPool &mempoolIn) : CCoinsViewBacked(baseIn), mempool(mempoolIn) { } bool CCoinsViewMemPool::GetCoins(const uint256 &txid, CCoins &coins) { if (base->GetCoins(txid, coins)) return true; if (mempool.exists(txid)) { const CTransaction &tx = mempool.lookup(txid); coins = CCoins(tx, MEMPOOL_HEIGHT); return true; } return false; } bool CCoinsViewMemPool::HaveCoins(const uint256 &txid) { return mempool.exists(txid) || base->HaveCoins(txid); } CCoinsViewCache *pcoinsTip = NULL; CBlockTreeDB *pblocktree = NULL; ////////////////////////////////////////////////////////////////////////////// // // mapOrphanTransactions // bool AddOrphanTx(const CTransaction& tx) { uint256 hash = tx.GetHash(); if (mapOrphanTransactions.count(hash)) return false; // Ignore big transactions, to avoid a // send-big-orphans memory exhaustion attack. If a peer has a legitimate // large transaction with a missing parent then we assume // it will rebroadcast it later, after the parent transaction(s) // have been mined or received. // 10,000 orphans, each of which is at most 5,000 bytes big is // at most 500 megabytes of orphans: unsigned int sz = tx.GetSerializeSize(SER_NETWORK, CTransaction::CURRENT_VERSION); if (sz > 5000) { printf("ignoring large orphan tx (size: %u, hash: %s)\n", sz, hash.ToString().c_str()); return false; } mapOrphanTransactions[hash] = tx; BOOST_FOREACH(const CTxIn& txin, tx.vin) mapOrphanTransactionsByPrev[txin.prevout.hash].insert(hash); printf("stored orphan tx %s (mapsz %"PRIszu")\n", hash.ToString().c_str(), mapOrphanTransactions.size()); return true; } void static EraseOrphanTx(uint256 hash) { if (!mapOrphanTransactions.count(hash)) return; const CTransaction& tx = mapOrphanTransactions[hash]; BOOST_FOREACH(const CTxIn& txin, tx.vin) { mapOrphanTransactionsByPrev[txin.prevout.hash].erase(hash); if (mapOrphanTransactionsByPrev[txin.prevout.hash].empty()) mapOrphanTransactionsByPrev.erase(txin.prevout.hash); } mapOrphanTransactions.erase(hash); } unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) { unsigned int nEvicted = 0; while (mapOrphanTransactions.size() > nMaxOrphans) { // Evict a random orphan: uint256 randomhash = GetRandHash(); map<uint256, CTransaction>::iterator it = mapOrphanTransactions.lower_bound(randomhash); if (it == mapOrphanTransactions.end()) it = mapOrphanTransactions.begin(); EraseOrphanTx(it->first); ++nEvicted; } return nEvicted; } ////////////////////////////////////////////////////////////////////////////// // // CTransaction / CTxOut // bool CTxOut::IsDust() const { // Happinesscoin: IsDust() detection disabled, allows any valid dust to be relayed. // The fees imposed on each dust txo is considered sufficient spam deterrant. return false; } bool CTransaction::IsStandard(string& strReason) const { if (nVersion > CTransaction::CURRENT_VERSION || nVersion < 1) { strReason = "version"; return false; } if (!IsFinal()) { strReason = "not-final"; return false; } // Extremely large transactions with lots of inputs can cost the network // almost as much to process as they cost the sender in fees, because // computing signature hashes is O(ninputs*txsize). Limiting transactions // to MAX_STANDARD_TX_SIZE mitigates CPU exhaustion attacks. unsigned int sz = this->GetSerializeSize(SER_NETWORK, CTransaction::CURRENT_VERSION); if (sz >= MAX_STANDARD_TX_SIZE) { strReason = "tx-size"; return false; } BOOST_FOREACH(const CTxIn& txin, vin) { // Biggest 'standard' txin is a 3-signature 3-of-3 CHECKMULTISIG // pay-to-script-hash, which is 3 ~80-byte signatures, 3 // ~65-byte public keys, plus a few script ops. if (txin.scriptSig.size() > 500) { strReason = "scriptsig-size"; return false; } if (!txin.scriptSig.IsPushOnly()) { strReason = "scriptsig-not-pushonly"; return false; } } BOOST_FOREACH(const CTxOut& txout, vout) { if (!::IsStandard(txout.scriptPubKey)) { strReason = "scriptpubkey"; return false; } if (txout.IsDust()) { strReason = "dust"; return false; } } return true; } // // Check transaction inputs, and make sure any // pay-to-script-hash transactions are evaluating IsStandard scripts // // Why bother? To avoid denial-of-service attacks; an attacker // can submit a standard HASH... OP_EQUAL transaction, // which will get accepted into blocks. The redemption // script can be anything; an attacker could use a very // expensive-to-check-upon-redemption script like: // DUP CHECKSIG DROP ... repeated 100 times... OP_1 // bool CTransaction::AreInputsStandard(CCoinsViewCache& mapInputs) const { if (IsCoinBase()) return true; // Coinbases don't use vin normally for (unsigned int i = 0; i < vin.size(); i++) { const CTxOut& prev = GetOutputFor(vin[i], mapInputs); vector<vector<unsigned char> > vSolutions; txnouttype whichType; // get the scriptPubKey corresponding to this input: const CScript& prevScript = prev.scriptPubKey; if (!Solver(prevScript, whichType, vSolutions)) return false; int nArgsExpected = ScriptSigArgsExpected(whichType, vSolutions); if (nArgsExpected < 0) return false; // Transactions with extra stuff in their scriptSigs are // non-standard. Note that this EvalScript() call will // be quick, because if there are any operations // beside "push data" in the scriptSig the // IsStandard() call returns false vector<vector<unsigned char> > stack; if (!EvalScript(stack, vin[i].scriptSig, *this, i, false, 0)) return false; if (whichType == TX_SCRIPTHASH) { if (stack.empty()) return false; CScript subscript(stack.back().begin(), stack.back().end()); vector<vector<unsigned char> > vSolutions2; txnouttype whichType2; if (!Solver(subscript, whichType2, vSolutions2)) return false; if (whichType2 == TX_SCRIPTHASH) return false; int tmpExpected; tmpExpected = ScriptSigArgsExpected(whichType2, vSolutions2); if (tmpExpected < 0) return false; nArgsExpected += tmpExpected; } if (stack.size() != (unsigned int)nArgsExpected) return false; } return true; } unsigned int CTransaction::GetLegacySigOpCount() const { unsigned int nSigOps = 0; BOOST_FOREACH(const CTxIn& txin, vin) { nSigOps += txin.scriptSig.GetSigOpCount(false); } BOOST_FOREACH(const CTxOut& txout, vout) { nSigOps += txout.scriptPubKey.GetSigOpCount(false); } return nSigOps; } int CMerkleTx::SetMerkleBranch(const CBlock* pblock) { CBlock blockTmp; if (pblock == NULL) { CCoins coins; if (pcoinsTip->GetCoins(GetHash(), coins)) { CBlockIndex *pindex = FindBlockByHeight(coins.nHeight); if (pindex) { if (!blockTmp.ReadFromDisk(pindex)) return 0; pblock = &blockTmp; } } } if (pblock) { // Update the tx's hashBlock hashBlock = pblock->GetHash(); // Locate the transaction for (nIndex = 0; nIndex < (int)pblock->vtx.size(); nIndex++) if (pblock->vtx[nIndex] == *(CTransaction*)this) break; if (nIndex == (int)pblock->vtx.size()) { vMerkleBranch.clear(); nIndex = -1; printf("ERROR: SetMerkleBranch() : couldn't find tx in block\n"); return 0; } // Fill in merkle branch vMerkleBranch = pblock->GetMerkleBranch(nIndex); } // Is the tx in a block that's in the main chain map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock); if (mi == mapBlockIndex.end()) return 0; CBlockIndex* pindex = (*mi).second; if (!pindex || !pindex->IsInMainChain()) return 0; return pindexBest->nHeight - pindex->nHeight + 1; } //#include<QMessageBox> bool CTransaction::CheckTransaction(CValidationState &state) const { // Basic checks that don't depend on any context if (vin.empty()) return state.DoS(10, error("CTransaction::CheckTransaction() : vin empty")); if (vout.empty()) return state.DoS(10, error("CTransaction::CheckTransaction() : vout empty")); // Size limits if (::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE) return state.DoS(100, error("CTransaction::CheckTransaction() : size limits failed")); // Check for negative or overflow output values int64 nValueOut = 0; BOOST_FOREACH(const CTxOut& txout, vout) { if (txout.nValue < 0) return state.DoS(100, error("CTransaction::CheckTransaction() : txout.nValue negative")); if (txout.nValue > MAX_MONEY) return state.DoS(100, error("CTransaction::CheckTransaction() : txout.nValue too high")); nValueOut += txout.nValue; if (!MoneyRange(nValueOut)) return state.DoS(100, error("CTransaction::CheckTransaction() : txout total out of range")); } // Check for duplicate inputs set<COutPoint> vInOutPoints; BOOST_FOREACH(const CTxIn& txin, vin) { if (vInOutPoints.count(txin.prevout)) return state.DoS(100, error("CTransaction::CheckTransaction() : duplicate inputs")); vInOutPoints.insert(txin.prevout); } if (IsCoinBase()) { if (vin[0].scriptSig.size() < 2 || vin[0].scriptSig.size() > 100) return state.DoS(100, error("CTransaction::CheckTransaction() : coinbase script size")); } else { BOOST_FOREACH(const CTxIn& txin, vin) if (txin.prevout.IsNull()) return state.DoS(10, error("CTransaction::CheckTransaction() : prevout is null")); } return true; } int64 CTransaction::GetMinFee(unsigned int nBlockSize, bool fAllowFree, enum GetMinFee_mode mode) const { // Base fee is either nMinTxFee or nMinRelayTxFee int64 nBaseFee = (mode == GMF_RELAY) ? nMinRelayTxFee : nMinTxFee; unsigned int nBytes = ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION); unsigned int nNewBlockSize = nBlockSize + nBytes; int64 nMinFee = (1 + (int64)nBytes / 1000) * nBaseFee; if (fAllowFree) { // There is a free transaction area in blocks created by most miners, // * If we are relaying we allow transactions up to DEFAULT_BLOCK_PRIORITY_SIZE - 1000 // to be considered to fall into this category. We don't want to encourage sending // multiple transactions instead of one big transaction to avoid fees. // * If we are creating a transaction we allow transactions up to 5,000 bytes // to be considered safe and assume they can likely make it into this section. if (nBytes < (mode == GMF_SEND ? 5000 : (DEFAULT_BLOCK_PRIORITY_SIZE - 1000))) nMinFee = 0; } // Happinesscoin // To limit dust spam, add nBaseFee for each output less than DUST_SOFT_LIMIT BOOST_FOREACH(const CTxOut& txout, vout) if (txout.nValue < DUST_SOFT_LIMIT) nMinFee += nBaseFee; // Raise the price as the block approaches full if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2) { if (nNewBlockSize >= MAX_BLOCK_SIZE_GEN) return MAX_MONEY; nMinFee *= MAX_BLOCK_SIZE_GEN / (MAX_BLOCK_SIZE_GEN - nNewBlockSize); } if (!MoneyRange(nMinFee)) nMinFee = MAX_MONEY; return nMinFee; } void CTxMemPool::pruneSpent(const uint256 &hashTx, CCoins &coins) { LOCK(cs); std::map<COutPoint, CInPoint>::iterator it = mapNextTx.lower_bound(COutPoint(hashTx, 0)); // iterate over all COutPoints in mapNextTx whose hash equals the provided hashTx while (it != mapNextTx.end() && it->first.hash == hashTx) { coins.Spend(it->first.n); // and remove those outputs from coins it++; } } bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fCheckInputs, bool fLimitFree, bool* pfMissingInputs) { if (pfMissingInputs) *pfMissingInputs = false; if (!tx.CheckTransaction(state)) return error("CTxMemPool::accept() : CheckTransaction failed"); // Coinbase is only valid in a block, not as a loose transaction if (tx.IsCoinBase()) return state.DoS(100, error("CTxMemPool::accept() : coinbase as individual tx")); // To help v0.1.5 clients who would see it as a negative number if ((int64)tx.nLockTime > std::numeric_limits<int>::max()) return error("CTxMemPool::accept() : not accepting nLockTime beyond 2038 yet"); // Rather not work on nonstandard transactions (unless -testnet) string strNonStd; if (!fTestNet && !tx.IsStandard(strNonStd)) return error("CTxMemPool::accept() : nonstandard transaction (%s)", strNonStd.c_str()); // is it already in the memory pool? uint256 hash = tx.GetHash(); { LOCK(cs); if (mapTx.count(hash)) return false; } // Check for conflicts with in-memory transactions CTransaction* ptxOld = NULL; for (unsigned int i = 0; i < tx.vin.size(); i++) { COutPoint outpoint = tx.vin[i].prevout; if (mapNextTx.count(outpoint)) { // Disable replacement feature for now return false; // Allow replacing with a newer version of the same transaction if (i != 0) return false; ptxOld = mapNextTx[outpoint].ptx; if (ptxOld->IsFinal()) return false; if (!tx.IsNewerThan(*ptxOld)) return false; for (unsigned int i = 0; i < tx.vin.size(); i++) { COutPoint outpoint = tx.vin[i].prevout; if (!mapNextTx.count(outpoint) || mapNextTx[outpoint].ptx != ptxOld) return false; } break; } } if (fCheckInputs) { CCoinsView dummy; CCoinsViewCache view(dummy); { LOCK(cs); CCoinsViewMemPool viewMemPool(*pcoinsTip, *this); view.SetBackend(viewMemPool); // do we already have it? if (view.HaveCoins(hash)) return false; // do all inputs exist? // Note that this does not check for the presence of actual outputs (see the next check for that), // only helps filling in pfMissingInputs (to determine missing vs spent). BOOST_FOREACH(const CTxIn txin, tx.vin) { if (!view.HaveCoins(txin.prevout.hash)) { if (pfMissingInputs) *pfMissingInputs = true; return false; } } // are the actual inputs available? if (!tx.HaveInputs(view)) return state.Invalid(error("CTxMemPool::accept() : inputs already spent")); // Bring the best block into scope view.GetBestBlock(); // we have all inputs cached now, so switch back to dummy, so we don't need to keep lock on mempool view.SetBackend(dummy); } // Check for non-standard pay-to-script-hash in inputs if (!tx.AreInputsStandard(view) && !fTestNet) return error("CTxMemPool::accept() : nonstandard transaction input"); // Note: if you modify this code to accept non-standard transactions, then // you should add code here to check that the transaction does a // reasonable number of ECDSA signature verifications. int64 nFees = tx.GetValueIn(view)-tx.GetValueOut(); unsigned int nSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); // Don't accept it if it can't get into a block int64 txMinFee = tx.GetMinFee(1000, true, GMF_RELAY); if (fLimitFree && nFees < txMinFee) return error("CTxMemPool::accept() : not enough fees %s, %"PRI64d" < %"PRI64d, hash.ToString().c_str(), nFees, txMinFee); // Continuously rate-limit free transactions // This mitigates 'penny-flooding' -- sending thousands of free transactions just to // be annoying or make others' transactions take longer to confirm. if (fLimitFree && nFees < CTransaction::nMinRelayTxFee) { static double dFreeCount; static int64 nLastTime; int64 nNow = GetTime(); LOCK(cs); // Use an exponentially decaying ~10-minute window: dFreeCount *= pow(1.0 - 1.0/600.0, (double)(nNow - nLastTime)); nLastTime = nNow; // -limitfreerelay unit is thousand-bytes-per-minute // At default rate it would take over a month to fill 1GB if (dFreeCount >= GetArg("-limitfreerelay", 15)*10*1000) return error("CTxMemPool::accept() : free transaction rejected by rate limiter"); if (fDebug) printf("Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize); dFreeCount += nSize; } // Check against previous transactions // This is done last to help prevent CPU exhaustion denial-of-service attacks. if (!tx.CheckInputs(state, view, true, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC)) { return error("CTxMemPool::accept() : ConnectInputs failed %s", hash.ToString().c_str()); } } // Store transaction in memory { LOCK(cs); if (ptxOld) { printf("CTxMemPool::accept() : replacing tx %s with new version\n", ptxOld->GetHash().ToString().c_str()); remove(*ptxOld); } addUnchecked(hash, tx); } ///// are we sure this is ok when loading transactions or restoring block txes // If updated, erase old tx from wallet if (ptxOld) EraseFromWallets(ptxOld->GetHash()); SyncWithWallets(hash, tx, NULL, true); return true; } bool CTransaction::AcceptToMemoryPool(CValidationState &state, bool fCheckInputs, bool fLimitFree, bool* pfMissingInputs) { try { return mempool.accept(state, *this, fCheckInputs, fLimitFree, pfMissingInputs); } catch(std::runtime_error &e) { return state.Abort(_("System error: ") + e.what()); } } bool CTxMemPool::addUnchecked(const uint256& hash, const CTransaction &tx) { // Add to memory pool without checking anything. Don't call this directly, // call CTxMemPool::accept to properly check the transaction first. { mapTx[hash] = tx; for (unsigned int i = 0; i < tx.vin.size(); i++) mapNextTx[tx.vin[i].prevout] = CInPoint(&mapTx[hash], i); nTransactionsUpdated++; } return true; } bool CTxMemPool::remove(const CTransaction &tx, bool fRecursive) { // Remove transaction from memory pool { LOCK(cs); uint256 hash = tx.GetHash(); if (fRecursive) { for (unsigned int i = 0; i < tx.vout.size(); i++) { std::map<COutPoint, CInPoint>::iterator it = mapNextTx.find(COutPoint(hash, i)); if (it != mapNextTx.end()) remove(*it->second.ptx, true); } } if (mapTx.count(hash)) { BOOST_FOREACH(const CTxIn& txin, tx.vin) mapNextTx.erase(txin.prevout); mapTx.erase(hash); nTransactionsUpdated++; } } return true; } bool CTxMemPool::removeConflicts(const CTransaction &tx) { // Remove transactions which depend on inputs of tx, recursively LOCK(cs); BOOST_FOREACH(const CTxIn &txin, tx.vin) { std::map<COutPoint, CInPoint>::iterator it = mapNextTx.find(txin.prevout); if (it != mapNextTx.end()) { const CTransaction &txConflict = *it->second.ptx; if (txConflict != tx) remove(txConflict, true); } } return true; } void CTxMemPool::clear() { LOCK(cs); mapTx.clear(); mapNextTx.clear(); ++nTransactionsUpdated; } void CTxMemPool::queryHashes(std::vector<uint256>& vtxid) { vtxid.clear(); LOCK(cs); vtxid.reserve(mapTx.size()); for (map<uint256, CTransaction>::iterator mi = mapTx.begin(); mi != mapTx.end(); ++mi) vtxid.push_back((*mi).first); } int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet) const { if (hashBlock == 0 || nIndex == -1) return 0; // Find the block it claims to be in map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock); if (mi == mapBlockIndex.end()) return 0; CBlockIndex* pindex = (*mi).second; if (!pindex || !pindex->IsInMainChain()) return 0; // Make sure the merkle branch connects to this block if (!fMerkleVerified) { if (CBlock::CheckMerkleBranch(GetHash(), vMerkleBranch, nIndex) != pindex->hashMerkleRoot) return 0; fMerkleVerified = true; } pindexRet = pindex; return pindexBest->nHeight - pindex->nHeight + 1; } int CMerkleTx::GetBlocksToMaturity() const { if (!IsCoinBase()) return 0; return max(0, (COINBASE_MATURITY+0) - GetDepthInMainChain());//此处有修改,关于币的成熟时间 } bool CMerkleTx::AcceptToMemoryPool(bool fCheckInputs, bool fLimitFree) { CValidationState state; return CTransaction::AcceptToMemoryPool(state, fCheckInputs, fLimitFree); } bool CWalletTx::AcceptWalletTransaction(bool fCheckInputs) { { LOCK(mempool.cs); // Add previous supporting transactions first BOOST_FOREACH(CMerkleTx& tx, vtxPrev) { if (!tx.IsCoinBase()) { uint256 hash = tx.GetHash(); if (!mempool.exists(hash) && pcoinsTip->HaveCoins(hash)) tx.AcceptToMemoryPool(fCheckInputs, false); } } return AcceptToMemoryPool(fCheckInputs, false); } return false; } // Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, bool fAllowSlow) { CBlockIndex *pindexSlow = NULL; { LOCK(cs_main); { LOCK(mempool.cs); if (mempool.exists(hash)) { txOut = mempool.lookup(hash); return true; } } if (fTxIndex) { CDiskTxPos postx; if (pblocktree->ReadTxIndex(hash, postx)) { CAutoFile file(OpenBlockFile(postx, true), SER_DISK, CLIENT_VERSION); CBlockHeader header; try { file >> header; fseek(file, postx.nTxOffset, SEEK_CUR); file >> txOut; } catch (std::exception &e) { return error("%s() : deserialize or I/O error", __PRETTY_FUNCTION__); } hashBlock = header.GetHash(); if (txOut.GetHash() != hash) return error("%s() : txid mismatch", __PRETTY_FUNCTION__); return true; } } if (fAllowSlow) { // use coin database to locate block that contains transaction, and scan it int nHeight = -1; { CCoinsViewCache &view = *pcoinsTip; CCoins coins; if (view.GetCoins(hash, coins)) nHeight = coins.nHeight; } if (nHeight > 0) pindexSlow = FindBlockByHeight(nHeight); } } if (pindexSlow) { CBlock block; if (block.ReadFromDisk(pindexSlow)) { BOOST_FOREACH(const CTransaction &tx, block.vtx) { if (tx.GetHash() == hash) { txOut = tx; hashBlock = pindexSlow->GetBlockHash(); return true; } } } } return false; } ////////////////////////////////////////////////////////////////////////////// // // CBlock and CBlockIndex // static CBlockIndex* pblockindexFBBHLast; CBlockIndex* FindBlockByHeight(int nHeight) { CBlockIndex *pblockindex; if (nHeight < nBestHeight / 2) pblockindex = pindexGenesisBlock; else pblockindex = pindexBest; if (pblockindexFBBHLast && abs(nHeight - pblockindex->nHeight) > abs(nHeight - pblockindexFBBHLast->nHeight)) pblockindex = pblockindexFBBHLast; while (pblockindex->nHeight > nHeight) pblockindex = pblockindex->pprev; while (pblockindex->nHeight < nHeight) pblockindex = pblockindex->pnext; pblockindexFBBHLast = pblockindex; return pblockindex; } bool CBlock::ReadFromDisk(const CBlockIndex* pindex) { if (!ReadFromDisk(pindex->GetBlockPos())) return false; if (GetHash() != pindex->GetBlockHash()) return error("CBlock::ReadFromDisk() : GetHash() doesn't match index"); return true; } uint256 static GetOrphanRoot(const CBlockHeader* pblock) { // Work back to the first block in the orphan chain while (mapOrphanBlocks.count(pblock->hashPrevBlock)) pblock = mapOrphanBlocks[pblock->hashPrevBlock]; return pblock->GetHash(); } int64 static GetBlockValue(int nHeight, int64 nFees) { int64 nSubsidy = 1 * COIN; // Subsidy is cut in half every 840000 blocks, which will occur approximately every 4 years // nSubsidy >>= (nHeight / 840000); // Happinesscoin: 840k blocks in ~4 years // int64 count=0,totalblocks=0,blocks10point=14400; // for(count=0;count<10;count++) // { // totalblocks+=(blocks10point<<count); // if(nHeight<totalblocks) // break; // } // nSubsidy>>=count; if(nHeight==1) nSubsidy=40000000*COIN; else if(nHeight>1&&nHeight<30*3*1440) nSubsidy=2.08*COIN; else if(nHeight>=30*3*1440) nSubsidy=0.069*COIN; return nSubsidy + nFees; } static const int64 nTargetTimespan = 30 *60; // Happinesscoin: 30min static const int64 nTargetSpacing = 1 * 60; // Happinesscoin:30s static const int64 nInterval = nTargetTimespan / nTargetSpacing;//每隔多少块改变难度60 // // minimum amount of work that could possibly be required nTime after // minimum work required was nBase // unsigned int ComputeMinWork(unsigned int nBase, int64 nTime) { // Testnet has min-difficulty blocks // after nTargetSpacing*2 time between blocks: if (fTestNet && nTime > nTargetSpacing*2) return bnProofOfWorkLimit.GetCompact(); CBigNum bnResult; bnResult.SetCompact(nBase); while (nTime > 0 && bnResult < bnProofOfWorkLimit) { // Maximum 400% adjustment... bnResult *= 4; // ... in best-case exactly 4-times-normal target time nTime -= nTargetTimespan*4; } if (bnResult > bnProofOfWorkLimit) bnResult = bnProofOfWorkLimit; return bnResult.GetCompact(); } unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock) { unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact(); // Genesis block if (pindexLast == NULL) return nProofOfWorkLimit; // Only change once per interval if ((pindexLast->nHeight+1) % nInterval != 0) { // Special difficulty rule for testnet: if (fTestNet) { // If the new block's timestamp is more than 2* 10 minutes // then allow mining of a min-difficulty block. if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2) return nProofOfWorkLimit; else { // Return the last non-special-min-difficulty-rules-block const CBlockIndex* pindex = pindexLast; while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit) pindex = pindex->pprev; return pindex->nBits; } } return pindexLast->nBits; } // Happinesscoin: This fixes an issue where a 51% attack can change difficulty at will. // Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz int blockstogoback = nInterval-1; if ((pindexLast->nHeight+1) != nInterval) blockstogoback = nInterval; // Go back by what we want to be 14 days worth of blocks const CBlockIndex* pindexFirst = pindexLast; for (int i = 0; pindexFirst && i < blockstogoback; i++) pindexFirst = pindexFirst->pprev; assert(pindexFirst); // Limit adjustment step int64 nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); printf(" nActualTimespan = %"PRI64d" before bounds\n", nActualTimespan); if (nActualTimespan < nTargetTimespan/4)//限制难度改变幅度 nActualTimespan = nTargetTimespan/4; if (nActualTimespan > nTargetTimespan*4) nActualTimespan = nTargetTimespan*4; // Retarget CBigNum bnNew; bnNew.SetCompact(pindexLast->nBits); bnNew *= nActualTimespan; bnNew /= nTargetTimespan; if (bnNew > bnProofOfWorkLimit) bnNew = bnProofOfWorkLimit; /// debug print printf("GetNextWorkRequired RETARGET\n"); printf("nTargetTimespan = %"PRI64d" nActualTimespan = %"PRI64d"\n", nTargetTimespan, nActualTimespan); printf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str()); printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); return bnNew.GetCompact(); } bool CheckProofOfWork(uint256 hash, unsigned int nBits) { CBigNum bnTarget; bnTarget.SetCompact(nBits); // Check range if (bnTarget <= 0 || bnTarget > bnProofOfWorkLimit) return error("CheckProofOfWork() : nBits below minimum work"); // Check proof of work matches claimed amount if (hash > bnTarget.getuint256()) return error("CheckProofOfWork() : hash doesn't match nBits"); return true; } // Return maximum amount of blocks that other nodes claim to have int GetNumBlocksOfPeers() { return std::max(cPeerBlockCounts.median(), Checkpoints::GetTotalBlocksEstimate()); } bool IsInitialBlockDownload() { if (pindexBest == NULL || fImporting || fReindex || nBestHeight < Checkpoints::GetTotalBlocksEstimate()) return true; static int64 nLastUpdate; static CBlockIndex* pindexLastBest; if (pindexBest != pindexLastBest) { pindexLastBest = pindexBest; nLastUpdate = GetTime(); } return (GetTime() - nLastUpdate < 10 && pindexBest->GetBlockTime() < GetTime() - 24 * 60 * 60); } void static InvalidChainFound(CBlockIndex* pindexNew) { if (pindexNew->nChainWork > nBestInvalidWork) { nBestInvalidWork = pindexNew->nChainWork; pblocktree->WriteBestInvalidWork(CBigNum(nBestInvalidWork)); uiInterface.NotifyBlocksChanged(); } printf("InvalidChainFound: invalid block=%s height=%d log2_work=%.8g date=%s\n", pindexNew->GetBlockHash().ToString().c_str(), pindexNew->nHeight, log(pindexNew->nChainWork.getdouble())/log(2.0), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexNew->GetBlockTime()).c_str()); printf("InvalidChainFound: current best=%s height=%d log2_work=%.8g date=%s\n", hashBestChain.ToString().c_str(), nBestHeight, log(nBestChainWork.getdouble())/log(2.0), DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str()); if (pindexBest && nBestInvalidWork > nBestChainWork + (pindexBest->GetBlockWork() * 6).getuint256()) printf("InvalidChainFound: Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.\n"); } void static InvalidBlockFound(CBlockIndex *pindex) { pindex->nStatus |= BLOCK_FAILED_VALID; pblocktree->WriteBlockIndex(CDiskBlockIndex(pindex)); setBlockIndexValid.erase(pindex); InvalidChainFound(pindex); if (pindex->pnext) { CValidationState stateDummy; ConnectBestBlock(stateDummy); // reorganise away from the failed block } } bool ConnectBestBlock(CValidationState &state) { do { CBlockIndex *pindexNewBest; { std::set<CBlockIndex*,CBlockIndexWorkComparator>::reverse_iterator it = setBlockIndexValid.rbegin(); if (it == setBlockIndexValid.rend()) return true; pindexNewBest = *it; } if (pindexNewBest == pindexBest || (pindexBest && pindexNewBest->nChainWork == pindexBest->nChainWork)) return true; // nothing to do // check ancestry CBlockIndex *pindexTest = pindexNewBest; std::vector<CBlockIndex*> vAttach; do { if (pindexTest->nStatus & BLOCK_FAILED_MASK) { // mark descendants failed CBlockIndex *pindexFailed = pindexNewBest; while (pindexTest != pindexFailed) { pindexFailed->nStatus |= BLOCK_FAILED_CHILD; setBlockIndexValid.erase(pindexFailed); pblocktree->WriteBlockIndex(CDiskBlockIndex(pindexFailed)); pindexFailed = pindexFailed->pprev; } InvalidChainFound(pindexNewBest); break; } if (pindexBest == NULL || pindexTest->nChainWork > pindexBest->nChainWork) vAttach.push_back(pindexTest); if (pindexTest->pprev == NULL || pindexTest->pnext != NULL) { reverse(vAttach.begin(), vAttach.end()); BOOST_FOREACH(CBlockIndex *pindexSwitch, vAttach) { boost::this_thread::interruption_point(); try { if (!SetBestChain(state, pindexSwitch)) return false; } catch(std::runtime_error &e) { return state.Abort(_("System error: ") + e.what()); } } return true; } pindexTest = pindexTest->pprev; } while(true); } while(true); } void CBlockHeader::UpdateTime(const CBlockIndex* pindexPrev) { nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime()); // Updating time can change work required on testnet: if (fTestNet) nBits = GetNextWorkRequired(pindexPrev, this); } const CTxOut &CTransaction::GetOutputFor(const CTxIn& input, CCoinsViewCache& view) { const CCoins &coins = view.GetCoins(input.prevout.hash); assert(coins.IsAvailable(input.prevout.n)); return coins.vout[input.prevout.n]; } int64 CTransaction::GetValueIn(CCoinsViewCache& inputs) const { if (IsCoinBase()) return 0; int64 nResult = 0; for (unsigned int i = 0; i < vin.size(); i++) nResult += GetOutputFor(vin[i], inputs).nValue; return nResult; } unsigned int CTransaction::GetP2SHSigOpCount(CCoinsViewCache& inputs) const { if (IsCoinBase()) return 0; unsigned int nSigOps = 0; for (unsigned int i = 0; i < vin.size(); i++) { const CTxOut &prevout = GetOutputFor(vin[i], inputs); if (prevout.scriptPubKey.IsPayToScriptHash()) nSigOps += prevout.scriptPubKey.GetSigOpCount(vin[i].scriptSig); } return nSigOps; } void CTransaction::UpdateCoins(CValidationState &state, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight, const uint256 &txhash) const { // mark inputs spent if (!IsCoinBase()) { BOOST_FOREACH(const CTxIn &txin, vin) { CCoins &coins = inputs.GetCoins(txin.prevout.hash); CTxInUndo undo; assert(coins.Spend(txin.prevout, undo)); txundo.vprevout.push_back(undo); } } // add outputs assert(inputs.SetCoins(txhash, CCoins(*this, nHeight))); } bool CTransaction::HaveInputs(CCoinsViewCache &inputs) const { if (!IsCoinBase()) { // first check whether information about the prevout hash is available for (unsigned int i = 0; i < vin.size(); i++) { const COutPoint &prevout = vin[i].prevout; if (!inputs.HaveCoins(prevout.hash)) return false; } // then check whether the actual outputs are available for (unsigned int i = 0; i < vin.size(); i++) { const COutPoint &prevout = vin[i].prevout; const CCoins &coins = inputs.GetCoins(prevout.hash); if (!coins.IsAvailable(prevout.n)) return false; } } return true; } bool CScriptCheck::operator()() const { const CScript &scriptSig = ptxTo->vin[nIn].scriptSig; if (!VerifyScript(scriptSig, scriptPubKey, *ptxTo, nIn, nFlags, nHashType)) return error("CScriptCheck() : %s VerifySignature failed", ptxTo->GetHash().ToString().c_str()); return true; } bool VerifySignature(const CCoins& txFrom, const CTransaction& txTo, unsigned int nIn, unsigned int flags, int nHashType) { return CScriptCheck(txFrom, txTo, nIn, flags, nHashType)(); } bool CTransaction::CheckInputs(CValidationState &state, CCoinsViewCache &inputs, bool fScriptChecks, unsigned int flags, std::vector<CScriptCheck> *pvChecks) const { if (!IsCoinBase()) { if (pvChecks) pvChecks->reserve(vin.size()); // This doesn't trigger the DoS code on purpose; if it did, it would make it easier // for an attacker to attempt to split the network. if (!HaveInputs(inputs)) return state.Invalid(error("CheckInputs() : %s inputs unavailable", GetHash().ToString().c_str())); // While checking, GetBestBlock() refers to the parent block. // This is also true for mempool checks. int nSpendHeight = inputs.GetBestBlock()->nHeight + 1; int64 nValueIn = 0; int64 nFees = 0; for (unsigned int i = 0; i < vin.size(); i++) { const COutPoint &prevout = vin[i].prevout; const CCoins &coins = inputs.GetCoins(prevout.hash); // If prev is coinbase, check that it's matured if (coins.IsCoinBase()) { if (nSpendHeight - coins.nHeight < COINBASE_MATURITY) return state.Invalid(error("CheckInputs() : tried to spend coinbase at depth %d", nSpendHeight - coins.nHeight)); } // Check for negative or overflow input values nValueIn += coins.vout[prevout.n].nValue; if (!MoneyRange(coins.vout[prevout.n].nValue) || !MoneyRange(nValueIn)) return state.DoS(100, error("CheckInputs() : txin values out of range")); } if (nValueIn < GetValueOut()) return state.DoS(100, error("CheckInputs() : %s value in < value out", GetHash().ToString().c_str())); // Tally transaction fees int64 nTxFee = nValueIn - GetValueOut(); if (nTxFee < 0) return state.DoS(100, error("CheckInputs() : %s nTxFee < 0", GetHash().ToString().c_str())); nFees += nTxFee; if (!MoneyRange(nFees)) return state.DoS(100, error("CheckInputs() : nFees out of range")); // The first while(true) above does all the inexpensive checks. // Only if ALL inputs pass do we perform expensive ECDSA signature checks. // Helps prevent CPU exhaustion attacks. // Skip ECDSA signature verification when connecting blocks // before the last block chain checkpoint. This is safe because block merkle hashes are // still computed and checked, and any change will be caught at the next checkpoint. if (fScriptChecks) { for (unsigned int i = 0; i < vin.size(); i++) { const COutPoint &prevout = vin[i].prevout; const CCoins &coins = inputs.GetCoins(prevout.hash); // Verify signature CScriptCheck check(coins, *this, i, flags, 0); if (pvChecks) { pvChecks->push_back(CScriptCheck()); check.swap(pvChecks->back()); } else if (!check()) { if (flags & SCRIPT_VERIFY_STRICTENC) { // For now, check whether the failure was caused by non-canonical // encodings or not; if so, don't trigger DoS protection. CScriptCheck check(coins, *this, i, flags & (~SCRIPT_VERIFY_STRICTENC), 0); if (check()) return state.Invalid(); } return state.DoS(100,false); } } } } return true; } bool CBlock::DisconnectBlock(CValidationState &state, CBlockIndex *pindex, CCoinsViewCache &view, bool *pfClean) { assert(pindex == view.GetBestBlock()); if (pfClean) *pfClean = false; bool fClean = true; CBlockUndo blockUndo; CDiskBlockPos pos = pindex->GetUndoPos(); if (pos.IsNull()) return error("DisconnectBlock() : no undo data available"); if (!blockUndo.ReadFromDisk(pos, pindex->pprev->GetBlockHash())) return error("DisconnectBlock() : failure reading undo data"); if (blockUndo.vtxundo.size() + 1 != vtx.size()) return error("DisconnectBlock() : block and undo data inconsistent"); // undo transactions in reverse order for (int i = vtx.size() - 1; i >= 0; i--) { const CTransaction &tx = vtx[i]; uint256 hash = tx.GetHash(); // check that all outputs are available if (!view.HaveCoins(hash)) { fClean = fClean && error("DisconnectBlock() : outputs still spent? database corrupted"); view.SetCoins(hash, CCoins()); } CCoins &outs = view.GetCoins(hash); CCoins outsBlock = CCoins(tx, pindex->nHeight); // The CCoins serialization does not serialize negative numbers. // No network rules currently depend on the version here, so an inconsistency is harmless // but it must be corrected before txout nversion ever influences a network rule. if (outsBlock.nVersion < 0) outs.nVersion = outsBlock.nVersion; if (outs != outsBlock) fClean = fClean && error("DisconnectBlock() : added transaction mismatch? database corrupted"); // remove outputs outs = CCoins(); // restore inputs if (i > 0) { // not coinbases const CTxUndo &txundo = blockUndo.vtxundo[i-1]; if (txundo.vprevout.size() != tx.vin.size()) return error("DisconnectBlock() : transaction and undo data inconsistent"); for (unsigned int j = tx.vin.size(); j-- > 0;) { const COutPoint &out = tx.vin[j].prevout; const CTxInUndo &undo = txundo.vprevout[j]; CCoins coins; view.GetCoins(out.hash, coins); // this can fail if the prevout was already entirely spent if (undo.nHeight != 0) { // undo data contains height: this is the last output of the prevout tx being spent if (!coins.IsPruned()) fClean = fClean && error("DisconnectBlock() : undo data overwriting existing transaction"); coins = CCoins(); coins.fCoinBase = undo.fCoinBase; coins.nHeight = undo.nHeight; coins.nVersion = undo.nVersion; } else { if (coins.IsPruned()) fClean = fClean && error("DisconnectBlock() : undo data adding output to missing transaction"); } if (coins.IsAvailable(out.n)) fClean = fClean && error("DisconnectBlock() : undo data overwriting existing output"); if (coins.vout.size() < out.n+1) coins.vout.resize(out.n+1); coins.vout[out.n] = undo.txout; if (!view.SetCoins(out.hash, coins)) return error("DisconnectBlock() : cannot restore coin inputs"); } } } // move best block pointer to prevout block view.SetBestBlock(pindex->pprev); if (pfClean) { *pfClean = fClean; return true; } else { return fClean; } } void static FlushBlockFile(bool fFinalize = false) { LOCK(cs_LastBlockFile); CDiskBlockPos posOld(nLastBlockFile, 0); FILE *fileOld = OpenBlockFile(posOld); if (fileOld) { if (fFinalize) TruncateFile(fileOld, infoLastBlockFile.nSize); FileCommit(fileOld); fclose(fileOld); } fileOld = OpenUndoFile(posOld); if (fileOld) { if (fFinalize) TruncateFile(fileOld, infoLastBlockFile.nUndoSize); FileCommit(fileOld); fclose(fileOld); } } bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize); static CCheckQueue<CScriptCheck> scriptcheckqueue(128); void ThreadScriptCheck() { RenameThread("bitcoin-scriptch"); scriptcheckqueue.Thread(); } bool CBlock::ConnectBlock(CValidationState &state, CBlockIndex* pindex, CCoinsViewCache &view, bool fJustCheck) { // Check it again in case a previous version let a bad block in if (!CheckBlock(state, !fJustCheck, !fJustCheck)) return false; // verify that the view's current state corresponds to the previous block assert(pindex->pprev == view.GetBestBlock()); // Special case for the genesis block, skipping connection of its transactions // (its coinbase is unspendable) if (GetHash() == hashGenesisBlock) { view.SetBestBlock(pindex); pindexGenesisBlock = pindex; return true; } bool fScriptChecks = pindex->nHeight >= Checkpoints::GetTotalBlocksEstimate(); // Do not allow blocks that contain transactions which 'overwrite' older transactions, // unless those are already completely spent. // If such overwrites are allowed, coinbases and transactions depending upon those // can be duplicated to remove the ability to spend the first instance -- even after // being sent to another address. // See BIP30 and http://r6.ca/blog/20120206T005236Z.html for more information. // This logic is not necessary for memory pool transactions, as AcceptToMemoryPool // already refuses previously-known transaction ids entirely. // This rule was originally applied all blocks whose timestamp was after October 1, 2012, 0:00 UTC. // Now that the whole chain is irreversibly beyond that time it is applied to all blocks, // this prevents exploiting the issue against nodes in their initial block download. bool fEnforceBIP30 = true; if (fEnforceBIP30) { for (unsigned int i=0; i<vtx.size(); i++) { uint256 hash = GetTxHash(i); if (view.HaveCoins(hash) && !view.GetCoins(hash).IsPruned()) return state.DoS(100, error("ConnectBlock() : tried to overwrite transaction")); } } // BIP16 didn't become active until Oct 1 2012 int64 nBIP16SwitchTime = 1349049600; bool fStrictPayToScriptHash = (pindex->nTime >= nBIP16SwitchTime); unsigned int flags = SCRIPT_VERIFY_NOCACHE | (fStrictPayToScriptHash ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE); CBlockUndo blockundo; CCheckQueueControl<CScriptCheck> control(fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL); int64 nStart = GetTimeMicros(); int64 nFees = 0; int nInputs = 0; unsigned int nSigOps = 0; CDiskTxPos pos(pindex->GetBlockPos(), GetSizeOfCompactSize(vtx.size())); std::vector<std::pair<uint256, CDiskTxPos> > vPos; vPos.reserve(vtx.size()); for (unsigned int i=0; i<vtx.size(); i++) { const CTransaction &tx = vtx[i]; nInputs += tx.vin.size(); nSigOps += tx.GetLegacySigOpCount(); if (nSigOps > MAX_BLOCK_SIGOPS) return state.DoS(100, error("ConnectBlock() : too many sigops")); if (!tx.IsCoinBase()) { if (!tx.HaveInputs(view)) return state.DoS(100, error("ConnectBlock() : inputs missing/spent")); if (fStrictPayToScriptHash) { // Add in sigops done by pay-to-script-hash inputs; // this is to prevent a "rogue miner" from creating // an incredibly-expensive-to-validate block. nSigOps += tx.GetP2SHSigOpCount(view); if (nSigOps > MAX_BLOCK_SIGOPS) return state.DoS(100, error("ConnectBlock() : too many sigops")); } nFees += tx.GetValueIn(view)-tx.GetValueOut(); std::vector<CScriptCheck> vChecks; if (!tx.CheckInputs(state, view, fScriptChecks, flags, nScriptCheckThreads ? &vChecks : NULL)) return false; control.Add(vChecks); } CTxUndo txundo; tx.UpdateCoins(state, view, txundo, pindex->nHeight, GetTxHash(i)); if (!tx.IsCoinBase()) blockundo.vtxundo.push_back(txundo); vPos.push_back(std::make_pair(GetTxHash(i), pos)); pos.nTxOffset += ::GetSerializeSize(tx, SER_DISK, CLIENT_VERSION); } int64 nTime = GetTimeMicros() - nStart; if (fBenchmark) printf("- Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin)\n", (unsigned)vtx.size(), 0.001 * nTime, 0.001 * nTime / vtx.size(), nInputs <= 1 ? 0 : 0.001 * nTime / (nInputs-1)); if (vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees)) return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%"PRI64d" vs limit=%"PRI64d")", vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees))); if (!control.Wait()) return state.DoS(100, false); int64 nTime2 = GetTimeMicros() - nStart; if (fBenchmark) printf("- Verify %u txins: %.2fms (%.3fms/txin)\n", nInputs - 1, 0.001 * nTime2, nInputs <= 1 ? 0 : 0.001 * nTime2 / (nInputs-1)); if (fJustCheck) return true; // Write undo information to disk if (pindex->GetUndoPos().IsNull() || (pindex->nStatus & BLOCK_VALID_MASK) < BLOCK_VALID_SCRIPTS) { if (pindex->GetUndoPos().IsNull()) { CDiskBlockPos pos; if (!FindUndoPos(state, pindex->nFile, pos, ::GetSerializeSize(blockundo, SER_DISK, CLIENT_VERSION) + 40)) return error("ConnectBlock() : FindUndoPos failed"); if (!blockundo.WriteToDisk(pos, pindex->pprev->GetBlockHash())) return state.Abort(_("Failed to write undo data")); // update nUndoPos in block index pindex->nUndoPos = pos.nPos; pindex->nStatus |= BLOCK_HAVE_UNDO; } pindex->nStatus = (pindex->nStatus & ~BLOCK_VALID_MASK) | BLOCK_VALID_SCRIPTS; CDiskBlockIndex blockindex(pindex); if (!pblocktree->WriteBlockIndex(blockindex)) return state.Abort(_("Failed to write block index")); } if (fTxIndex) if (!pblocktree->WriteTxIndex(vPos)) return state.Abort(_("Failed to write transaction index")); // add this block to the view's block chain assert(view.SetBestBlock(pindex)); // Watch for transactions paying to me for (unsigned int i=0; i<vtx.size(); i++) SyncWithWallets(GetTxHash(i), vtx[i], this, true); return true; } bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) { // All modifications to the coin state will be done in this cache. // Only when all have succeeded, we push it to pcoinsTip. CCoinsViewCache view(*pcoinsTip, true); // Find the fork (typically, there is none) CBlockIndex* pfork = view.GetBestBlock(); CBlockIndex* plonger = pindexNew; while (pfork && pfork != plonger) { while (plonger->nHeight > pfork->nHeight) { plonger = plonger->pprev; assert(plonger != NULL); } if (pfork == plonger) break; pfork = pfork->pprev; assert(pfork != NULL); } // List of what to disconnect (typically nothing) vector<CBlockIndex*> vDisconnect; for (CBlockIndex* pindex = view.GetBestBlock(); pindex != pfork; pindex = pindex->pprev) vDisconnect.push_back(pindex); // List of what to connect (typically only pindexNew) vector<CBlockIndex*> vConnect; for (CBlockIndex* pindex = pindexNew; pindex != pfork; pindex = pindex->pprev) vConnect.push_back(pindex); reverse(vConnect.begin(), vConnect.end()); if (vDisconnect.size() > 0) { printf("REORGANIZE: Disconnect %"PRIszu" blocks; %s..\n", vDisconnect.size(), pfork->GetBlockHash().ToString().c_str()); printf("REORGANIZE: Connect %"PRIszu" blocks; ..%s\n", vConnect.size(), pindexNew->GetBlockHash().ToString().c_str()); } // Disconnect shorter branch vector<CTransaction> vResurrect; BOOST_FOREACH(CBlockIndex* pindex, vDisconnect) { CBlock block; if (!block.ReadFromDisk(pindex)) return state.Abort(_("Failed to read block")); int64 nStart = GetTimeMicros(); if (!block.DisconnectBlock(state, pindex, view)) return error("SetBestBlock() : DisconnectBlock %s failed", pindex->GetBlockHash().ToString().c_str()); if (fBenchmark) printf("- Disconnect: %.2fms\n", (GetTimeMicros() - nStart) * 0.001); // Queue memory transactions to resurrect. // We only do this for blocks after the last checkpoint (reorganisation before that // point should only happen with -reindex/-loadblock, or a misbehaving peer. BOOST_FOREACH(const CTransaction& tx, block.vtx) if (!tx.IsCoinBase() && pindex->nHeight > Checkpoints::GetTotalBlocksEstimate()) vResurrect.push_back(tx); } // Connect longer branch vector<CTransaction> vDelete; BOOST_FOREACH(CBlockIndex *pindex, vConnect) { CBlock block; if (!block.ReadFromDisk(pindex)) return state.Abort(_("Failed to read block")); int64 nStart = GetTimeMicros(); if (!block.ConnectBlock(state, pindex, view)) { if (state.IsInvalid()) { InvalidChainFound(pindexNew); InvalidBlockFound(pindex); } return error("SetBestBlock() : ConnectBlock %s failed", pindex->GetBlockHash().ToString().c_str()); } if (fBenchmark) printf("- Connect: %.2fms\n", (GetTimeMicros() - nStart) * 0.001); // Queue memory transactions to delete BOOST_FOREACH(const CTransaction& tx, block.vtx) vDelete.push_back(tx); } // Flush changes to global coin state int64 nStart = GetTimeMicros(); int nModified = view.GetCacheSize(); assert(view.Flush()); int64 nTime = GetTimeMicros() - nStart; if (fBenchmark) printf("- Flush %i transactions: %.2fms (%.4fms/tx)\n", nModified, 0.001 * nTime, 0.001 * nTime / nModified); // Make sure it's successfully written to disk before changing memory structure bool fIsInitialDownload = IsInitialBlockDownload(); if (!fIsInitialDownload || pcoinsTip->GetCacheSize() > nCoinCacheSize) { // Typical CCoins structures on disk are around 100 bytes in size. // Pushing a new one to the database can cause it to be written // twice (once in the log, and once in the tables). This is already // an overestimation, as most will delete an existing entry or // overwrite one. Still, use a conservative safety factor of 2. if (!CheckDiskSpace(100 * 2 * 2 * pcoinsTip->GetCacheSize())) return state.Error(); FlushBlockFile(); pblocktree->Sync(); if (!pcoinsTip->Flush()) return state.Abort(_("Failed to write to coin database")); } // At this point, all changes have been done to the database. // Proceed by updating the memory structures. // Disconnect shorter branch BOOST_FOREACH(CBlockIndex* pindex, vDisconnect) if (pindex->pprev) pindex->pprev->pnext = NULL; // Connect longer branch BOOST_FOREACH(CBlockIndex* pindex, vConnect) if (pindex->pprev) pindex->pprev->pnext = pindex; // Resurrect memory transactions that were in the disconnected branch BOOST_FOREACH(CTransaction& tx, vResurrect) { // ignore validation errors in resurrected transactions CValidationState stateDummy; if (!tx.AcceptToMemoryPool(stateDummy, true, false)) mempool.remove(tx, true); } // Delete redundant memory transactions that are in the connected branch BOOST_FOREACH(CTransaction& tx, vDelete) { mempool.remove(tx); mempool.removeConflicts(tx); } // Update best block in wallet (so we can detect restored wallets) if ((pindexNew->nHeight % 20160) == 0 || (!fIsInitialDownload && (pindexNew->nHeight % 144) == 0)) { const CBlockLocator locator(pindexNew); ::SetBestChain(locator); } // New best block hashBestChain = pindexNew->GetBlockHash(); pindexBest = pindexNew; pblockindexFBBHLast = NULL; nBestHeight = pindexBest->nHeight; nBestChainWork = pindexNew->nChainWork; nTimeBestReceived = GetTime(); nTransactionsUpdated++; printf("SetBestChain: new best=%s height=%d log2_work=%.8g tx=%lu date=%s progress=%f\n", hashBestChain.ToString().c_str(), nBestHeight, log(nBestChainWork.getdouble())/log(2.0), (unsigned long)pindexNew->nChainTx, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str(), Checkpoints::GuessVerificationProgress(pindexBest)); // Check the version of the last 100 blocks to see if we need to upgrade: if (!fIsInitialDownload) { int nUpgraded = 0; const CBlockIndex* pindex = pindexBest; for (int i = 0; i < 100 && pindex != NULL; i++) { if (pindex->nVersion > CBlock::CURRENT_VERSION) ++nUpgraded; pindex = pindex->pprev; } if (nUpgraded > 0) printf("SetBestChain: %d of last 100 blocks above version %d\n", nUpgraded, CBlock::CURRENT_VERSION); if (nUpgraded > 100/2) // strMiscWarning is read by GetWarnings(), called by Qt and the JSON-RPC code to warn the user: strMiscWarning = _("Warning: This version is obsolete, upgrade required!"); } std::string strCmd = GetArg("-blocknotify", ""); if (!fIsInitialDownload && !strCmd.empty()) { boost::replace_all(strCmd, "%s", hashBestChain.GetHex()); boost::thread t(runCommand, strCmd); // thread runs free } return true; } bool CBlock::AddToBlockIndex(CValidationState &state, const CDiskBlockPos &pos) { // Check for duplicate uint256 hash = GetHash(); if (mapBlockIndex.count(hash)) return state.Invalid(error("AddToBlockIndex() : %s already exists", hash.ToString().c_str())); // Construct new block index object CBlockIndex* pindexNew = new CBlockIndex(*this); assert(pindexNew); map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first; pindexNew->phashBlock = &((*mi).first); map<uint256, CBlockIndex*>::iterator miPrev = mapBlockIndex.find(hashPrevBlock); if (miPrev != mapBlockIndex.end()) { pindexNew->pprev = (*miPrev).second; pindexNew->nHeight = pindexNew->pprev->nHeight + 1; } pindexNew->nTx = vtx.size(); pindexNew->nChainWork = (pindexNew->pprev ? pindexNew->pprev->nChainWork : 0) + pindexNew->GetBlockWork().getuint256(); pindexNew->nChainTx = (pindexNew->pprev ? pindexNew->pprev->nChainTx : 0) + pindexNew->nTx; pindexNew->nFile = pos.nFile; pindexNew->nDataPos = pos.nPos; pindexNew->nUndoPos = 0; pindexNew->nStatus = BLOCK_VALID_TRANSACTIONS | BLOCK_HAVE_DATA; setBlockIndexValid.insert(pindexNew); if (!pblocktree->WriteBlockIndex(CDiskBlockIndex(pindexNew))) return state.Abort(_("Failed to write block index")); // New best? if (!ConnectBestBlock(state)) return false; if (pindexNew == pindexBest) { // Notify UI to display prev block's coinbase if it was ours static uint256 hashPrevBestCoinBase; UpdatedTransaction(hashPrevBestCoinBase); hashPrevBestCoinBase = GetTxHash(0); } if (!pblocktree->Flush()) return state.Abort(_("Failed to sync block index")); uiInterface.NotifyBlocksChanged(); return true; } bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64 nTime, bool fKnown = false) { bool fUpdatedLast = false; LOCK(cs_LastBlockFile); if (fKnown) { if (nLastBlockFile != pos.nFile) { nLastBlockFile = pos.nFile; infoLastBlockFile.SetNull(); pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile); fUpdatedLast = true; } } else { while (infoLastBlockFile.nSize + nAddSize >= MAX_BLOCKFILE_SIZE) { printf("Leaving block file %i: %s\n", nLastBlockFile, infoLastBlockFile.ToString().c_str()); FlushBlockFile(true); nLastBlockFile++; infoLastBlockFile.SetNull(); pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile); // check whether data for the new file somehow already exist; can fail just fine fUpdatedLast = true; } pos.nFile = nLastBlockFile; pos.nPos = infoLastBlockFile.nSize; } infoLastBlockFile.nSize += nAddSize; infoLastBlockFile.AddBlock(nHeight, nTime); if (!fKnown) { unsigned int nOldChunks = (pos.nPos + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE; unsigned int nNewChunks = (infoLastBlockFile.nSize + BLOCKFILE_CHUNK_SIZE - 1) / BLOCKFILE_CHUNK_SIZE; if (nNewChunks > nOldChunks) { if (CheckDiskSpace(nNewChunks * BLOCKFILE_CHUNK_SIZE - pos.nPos)) { FILE *file = OpenBlockFile(pos); if (file) { printf("Pre-allocating up to position 0x%x in blk%05u.dat\n", nNewChunks * BLOCKFILE_CHUNK_SIZE, pos.nFile); AllocateFileRange(file, pos.nPos, nNewChunks * BLOCKFILE_CHUNK_SIZE - pos.nPos); fclose(file); } } else return state.Error(); } } if (!pblocktree->WriteBlockFileInfo(nLastBlockFile, infoLastBlockFile)) return state.Abort(_("Failed to write file info")); if (fUpdatedLast) pblocktree->WriteLastBlockFile(nLastBlockFile); return true; } bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize) { pos.nFile = nFile; LOCK(cs_LastBlockFile); unsigned int nNewSize; if (nFile == nLastBlockFile) { pos.nPos = infoLastBlockFile.nUndoSize; nNewSize = (infoLastBlockFile.nUndoSize += nAddSize); if (!pblocktree->WriteBlockFileInfo(nLastBlockFile, infoLastBlockFile)) return state.Abort(_("Failed to write block info")); } else { CBlockFileInfo info; if (!pblocktree->ReadBlockFileInfo(nFile, info)) return state.Abort(_("Failed to read block info")); pos.nPos = info.nUndoSize; nNewSize = (info.nUndoSize += nAddSize); if (!pblocktree->WriteBlockFileInfo(nFile, info)) return state.Abort(_("Failed to write block info")); } unsigned int nOldChunks = (pos.nPos + UNDOFILE_CHUNK_SIZE - 1) / UNDOFILE_CHUNK_SIZE; unsigned int nNewChunks = (nNewSize + UNDOFILE_CHUNK_SIZE - 1) / UNDOFILE_CHUNK_SIZE; if (nNewChunks > nOldChunks) { if (CheckDiskSpace(nNewChunks * UNDOFILE_CHUNK_SIZE - pos.nPos)) { FILE *file = OpenUndoFile(pos); if (file) { printf("Pre-allocating up to position 0x%x in rev%05u.dat\n", nNewChunks * UNDOFILE_CHUNK_SIZE, pos.nFile); AllocateFileRange(file, pos.nPos, nNewChunks * UNDOFILE_CHUNK_SIZE - pos.nPos); fclose(file); } } else return state.Error(); } return true; } bool CBlock::CheckBlock(CValidationState &state, bool fCheckPOW, bool fCheckMerkleRoot) const { // These are checks that are independent of context // that can be verified before saving an orphan block. // Size limits if (vtx.empty() || vtx.size() > MAX_BLOCK_SIZE || ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE) return state.DoS(100, error("CheckBlock() : size limits failed")); // Happinesscoin: Special short-term limits to avoid 10,000 BDB lock limit: if (GetBlockTime() < 1376568000) // stop enforcing 15 August 2013 00:00:00 { // Rule is: #unique txids referenced <= 4,500 // ... to prevent 10,000 BDB lock exhaustion on old clients set<uint256> setTxIn; for (size_t i = 0; i < vtx.size(); i++) { setTxIn.insert(vtx[i].GetHash()); if (i == 0) continue; // skip coinbase txin BOOST_FOREACH(const CTxIn& txin, vtx[i].vin) setTxIn.insert(txin.prevout.hash); } size_t nTxids = setTxIn.size(); if (nTxids > 4500) return error("CheckBlock() : 15 August maxlocks violation"); } // Check proof of work matches claimed amount if (fCheckPOW && !CheckProofOfWork(GetPoWHash(), nBits)) return state.DoS(50, error("CheckBlock() : proof of work failed")); // Check timestamp if (GetBlockTime() > GetAdjustedTime() + 2 * 60 * 60) return state.Invalid(error("CheckBlock() : block timestamp too far in the future")); // First transaction must be coinbase, the rest must not be if (vtx.empty() || !vtx[0].IsCoinBase()) return state.DoS(100, error("CheckBlock() : first tx is not coinbase")); for (unsigned int i = 1; i < vtx.size(); i++) if (vtx[i].IsCoinBase()) return state.DoS(100, error("CheckBlock() : more than one coinbase")); BOOST_FOREACH(const CTransaction& tx, vtx) if (!tx.CheckTransaction(state)) return error("CheckBlock() : CheckTransaction failed"); // Build the merkle tree already. We need it anyway later, and it makes the // block cache the transaction hashes, which means they don't need to be // recalculated many times during this block's validation. BuildMerkleTree(); // Check for duplicate txids. This is caught by ConnectInputs(), // but catching it earlier avoids a potential DoS attack: set<uint256> uniqueTx; for (unsigned int i=0; i<vtx.size(); i++) { uniqueTx.insert(GetTxHash(i)); } if (uniqueTx.size() != vtx.size()) return state.DoS(100, error("CheckBlock() : duplicate transaction"), true); unsigned int nSigOps = 0; BOOST_FOREACH(const CTransaction& tx, vtx) { nSigOps += tx.GetLegacySigOpCount(); } if (nSigOps > MAX_BLOCK_SIGOPS) return state.DoS(100, error("CheckBlock() : out-of-bounds SigOpCount")); // Check merkle root if (fCheckMerkleRoot && hashMerkleRoot != BuildMerkleTree()) return state.DoS(100, error("CheckBlock() : hashMerkleRoot mismatch")); return true; } bool CBlock::AcceptBlock(CValidationState &state, CDiskBlockPos *dbp) { // Check for duplicate uint256 hash = GetHash(); if (mapBlockIndex.count(hash)) return state.Invalid(error("AcceptBlock() : block already in mapBlockIndex")); // Get prev block index CBlockIndex* pindexPrev = NULL; int nHeight = 0; if (hash != hashGenesisBlock) { map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashPrevBlock); if (mi == mapBlockIndex.end()) return state.DoS(10, error("AcceptBlock() : prev block not found")); pindexPrev = (*mi).second; nHeight = pindexPrev->nHeight+1; // Check proof of work if (nBits != GetNextWorkRequired(pindexPrev, this)) return state.DoS(100, error("AcceptBlock() : incorrect proof of work")); // Check timestamp against prev if (GetBlockTime() <= pindexPrev->GetMedianTimePast()) return state.Invalid(error("AcceptBlock() : block's timestamp is too early")); // Check that all transactions are finalized BOOST_FOREACH(const CTransaction& tx, vtx) if (!tx.IsFinal(nHeight, GetBlockTime())) return state.DoS(10, error("AcceptBlock() : contains a non-final transaction")); // Check that the block chain matches the known block chain up to a checkpoint if (!Checkpoints::CheckBlock(nHeight, hash)) return state.DoS(100, error("AcceptBlock() : rejected by checkpoint lock-in at %d", nHeight)); // Don't accept any forks from the main chain prior to last checkpoint CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex); if (pcheckpoint && nHeight < pcheckpoint->nHeight) return state.DoS(100, error("AcceptBlock() : forked chain older than last checkpoint (height %d)", nHeight)); // Reject block.nVersion=1 blocks when 95% (75% on testnet) of the network has upgraded: if (nVersion < 2) { if ((!fTestNet && CBlockIndex::IsSuperMajority(2, pindexPrev, 950, 1000)) || (fTestNet && CBlockIndex::IsSuperMajority(2, pindexPrev, 75, 100))) { return state.Invalid(error("AcceptBlock() : rejected nVersion=1 block")); } } // Enforce block.nVersion=2 rule that the coinbase starts with serialized block height if (nVersion >= 2) { // if 750 of the last 1,000 blocks are version 2 or greater (51/100 if testnet): if ((!fTestNet && CBlockIndex::IsSuperMajority(2, pindexPrev, 750, 1000)) || (fTestNet && CBlockIndex::IsSuperMajority(2, pindexPrev, 51, 100))) { CScript expect = CScript() << nHeight; if (vtx[0].vin[0].scriptSig.size() < expect.size() || !std::equal(expect.begin(), expect.end(), vtx[0].vin[0].scriptSig.begin())) return state.DoS(100, error("AcceptBlock() : block height mismatch in coinbase")); } } } // Write block to history file try { unsigned int nBlockSize = ::GetSerializeSize(*this, SER_DISK, CLIENT_VERSION); CDiskBlockPos blockPos; if (dbp != NULL) blockPos = *dbp; if (!FindBlockPos(state, blockPos, nBlockSize+8, nHeight, nTime, dbp != NULL)) return error("AcceptBlock() : FindBlockPos failed"); if (dbp == NULL) if (!WriteToDisk(blockPos)) return state.Abort(_("Failed to write block")); if (!AddToBlockIndex(state, blockPos)) return error("AcceptBlock() : AddToBlockIndex failed"); } catch(std::runtime_error &e) { return state.Abort(_("System error: ") + e.what()); } // Relay inventory, but don't relay old inventory during initial block download int nBlockEstimate = Checkpoints::GetTotalBlocksEstimate(); if (hashBestChain == hash) { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) if (nBestHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : nBlockEstimate)) pnode->PushInventory(CInv(MSG_BLOCK, hash)); } return true; } bool CBlockIndex::IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned int nRequired, unsigned int nToCheck) { // Happinesscoin: temporarily disable v2 block lockin until we are ready for v2 transition return false; unsigned int nFound = 0; for (unsigned int i = 0; i < nToCheck && nFound < nRequired && pstart != NULL; i++) { if (pstart->nVersion >= minVersion) ++nFound; pstart = pstart->pprev; } return (nFound >= nRequired); } bool ProcessBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, CDiskBlockPos *dbp) { // Check for duplicate uint256 hash = pblock->GetHash(); if (mapBlockIndex.count(hash)) return state.Invalid(error("ProcessBlock() : already have block %d %s", mapBlockIndex[hash]->nHeight, hash.ToString().c_str())); if (mapOrphanBlocks.count(hash)) return state.Invalid(error("ProcessBlock() : already have block (orphan) %s", hash.ToString().c_str())); // Preliminary checks if (!pblock->CheckBlock(state)) return error("ProcessBlock() : CheckBlock FAILED"); CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex); if (pcheckpoint && pblock->hashPrevBlock != hashBestChain) { // Extra checks to prevent "fill up memory by spamming with bogus blocks" int64 deltaTime = pblock->GetBlockTime() - pcheckpoint->nTime; if (deltaTime < 0) { return state.DoS(100, error("ProcessBlock() : block with timestamp before last checkpoint")); } CBigNum bnNewBlock; bnNewBlock.SetCompact(pblock->nBits); CBigNum bnRequired; bnRequired.SetCompact(ComputeMinWork(pcheckpoint->nBits, deltaTime)); if (bnNewBlock > bnRequired) { return state.DoS(100, error("ProcessBlock() : block with too little proof-of-work")); } } // If we don't already have its previous block, shunt it off to holding area until we get it if (pblock->hashPrevBlock != 0 && !mapBlockIndex.count(pblock->hashPrevBlock)) { printf("ProcessBlock: ORPHAN BLOCK, prev=%s\n", pblock->hashPrevBlock.ToString().c_str()); // Accept orphans as long as there is a node to request its parents from if (pfrom) { CBlock* pblock2 = new CBlock(*pblock); mapOrphanBlocks.insert(make_pair(hash, pblock2)); mapOrphanBlocksByPrev.insert(make_pair(pblock2->hashPrevBlock, pblock2)); // Ask this guy to fill in what we're missing pfrom->PushGetBlocks(pindexBest, GetOrphanRoot(pblock2)); } return true; } // Store to disk if (!pblock->AcceptBlock(state, dbp)) return error("ProcessBlock() : AcceptBlock FAILED"); // Recursively process any orphan blocks that depended on this one vector<uint256> vWorkQueue; vWorkQueue.push_back(hash); for (unsigned int i = 0; i < vWorkQueue.size(); i++) { uint256 hashPrev = vWorkQueue[i]; for (multimap<uint256, CBlock*>::iterator mi = mapOrphanBlocksByPrev.lower_bound(hashPrev); mi != mapOrphanBlocksByPrev.upper_bound(hashPrev); ++mi) { CBlock* pblockOrphan = (*mi).second; // Use a dummy CValidationState so someone can't setup nodes to counter-DoS based on orphan resolution (that is, feeding people an invalid block based on LegitBlockX in order to get anyone relaying LegitBlockX banned) CValidationState stateDummy; if (pblockOrphan->AcceptBlock(stateDummy)) vWorkQueue.push_back(pblockOrphan->GetHash()); mapOrphanBlocks.erase(pblockOrphan->GetHash()); delete pblockOrphan; } mapOrphanBlocksByPrev.erase(hashPrev); } printf("ProcessBlock: ACCEPTED\n"); return true; } CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter& filter) { header = block.GetBlockHeader(); vector<bool> vMatch; vector<uint256> vHashes; vMatch.reserve(block.vtx.size()); vHashes.reserve(block.vtx.size()); for (unsigned int i = 0; i < block.vtx.size(); i++) { uint256 hash = block.vtx[i].GetHash(); if (filter.IsRelevantAndUpdate(block.vtx[i], hash)) { vMatch.push_back(true); vMatchedTxn.push_back(make_pair(i, hash)); } else vMatch.push_back(false); vHashes.push_back(hash); } txn = CPartialMerkleTree(vHashes, vMatch); } uint256 CPartialMerkleTree::CalcHash(int height, unsigned int pos, const std::vector<uint256> &vTxid) { if (height == 0) { // hash at height 0 is the txids themself return vTxid[pos]; } else { // calculate left hash uint256 left = CalcHash(height-1, pos*2, vTxid), right; // calculate right hash if not beyong the end of the array - copy left hash otherwise1 if (pos*2+1 < CalcTreeWidth(height-1)) right = CalcHash(height-1, pos*2+1, vTxid); else right = left; // combine subhashes return Hash(BEGIN(left), END(left), BEGIN(right), END(right)); } } void CPartialMerkleTree::TraverseAndBuild(int height, unsigned int pos, const std::vector<uint256> &vTxid, const std::vector<bool> &vMatch) { // determine whether this node is the parent of at least one matched txid bool fParentOfMatch = false; for (unsigned int p = pos << height; p < (pos+1) << height && p < nTransactions; p++) fParentOfMatch |= vMatch[p]; // store as flag bit vBits.push_back(fParentOfMatch); if (height==0 || !fParentOfMatch) { // if at height 0, or nothing interesting below, store hash and stop vHash.push_back(CalcHash(height, pos, vTxid)); } else { // otherwise, don't store any hash, but descend into the subtrees TraverseAndBuild(height-1, pos*2, vTxid, vMatch); if (pos*2+1 < CalcTreeWidth(height-1)) TraverseAndBuild(height-1, pos*2+1, vTxid, vMatch); } } uint256 CPartialMerkleTree::TraverseAndExtract(int height, unsigned int pos, unsigned int &nBitsUsed, unsigned int &nHashUsed, std::vector<uint256> &vMatch) { if (nBitsUsed >= vBits.size()) { // overflowed the bits array - failure fBad = true; return 0; } bool fParentOfMatch = vBits[nBitsUsed++]; if (height==0 || !fParentOfMatch) { // if at height 0, or nothing interesting below, use stored hash and do not descend if (nHashUsed >= vHash.size()) { // overflowed the hash array - failure fBad = true; return 0; } const uint256 &hash = vHash[nHashUsed++]; if (height==0 && fParentOfMatch) // in case of height 0, we have a matched txid vMatch.push_back(hash); return hash; } else { // otherwise, descend into the subtrees to extract matched txids and hashes uint256 left = TraverseAndExtract(height-1, pos*2, nBitsUsed, nHashUsed, vMatch), right; if (pos*2+1 < CalcTreeWidth(height-1)) right = TraverseAndExtract(height-1, pos*2+1, nBitsUsed, nHashUsed, vMatch); else right = left; // and combine them before returning return Hash(BEGIN(left), END(left), BEGIN(right), END(right)); } } CPartialMerkleTree::CPartialMerkleTree(const std::vector<uint256> &vTxid, const std::vector<bool> &vMatch) : nTransactions(vTxid.size()), fBad(false) { // reset state vBits.clear(); vHash.clear(); // calculate height of tree int nHeight = 0; while (CalcTreeWidth(nHeight) > 1) nHeight++; // traverse the partial tree TraverseAndBuild(nHeight, 0, vTxid, vMatch); } CPartialMerkleTree::CPartialMerkleTree() : nTransactions(0), fBad(true) {} uint256 CPartialMerkleTree::ExtractMatches(std::vector<uint256> &vMatch) { vMatch.clear(); // An empty set will not work if (nTransactions == 0) return 0; // check for excessively high numbers of transactions if (nTransactions > MAX_BLOCK_SIZE / 60) // 60 is the lower bound for the size of a serialized CTransaction return 0; // there can never be more hashes provided than one for every txid if (vHash.size() > nTransactions) return 0; // there must be at least one bit per node in the partial tree, and at least one node per hash if (vBits.size() < vHash.size()) return 0; // calculate height of tree int nHeight = 0; while (CalcTreeWidth(nHeight) > 1) nHeight++; // traverse the partial tree unsigned int nBitsUsed = 0, nHashUsed = 0; uint256 hashMerkleRoot = TraverseAndExtract(nHeight, 0, nBitsUsed, nHashUsed, vMatch); // verify that no problems occured during the tree traversal if (fBad) return 0; // verify that all bits were consumed (except for the padding caused by serializing it as a byte sequence) if ((nBitsUsed+7)/8 != (vBits.size()+7)/8) return 0; // verify that all hashes were consumed if (nHashUsed != vHash.size()) return 0; return hashMerkleRoot; } bool AbortNode(const std::string &strMessage) { strMiscWarning = strMessage; printf("*** %s\n", strMessage.c_str()); uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_ERROR); StartShutdown(); return false; } bool CheckDiskSpace(uint64 nAdditionalBytes) { uint64 nFreeBytesAvailable = filesystem::space(GetDataDir()).available; // Check for nMinDiskSpace bytes (currently 50MB) if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes) return AbortNode(_("Error: Disk space is low!")); return true; } CCriticalSection cs_LastBlockFile; CBlockFileInfo infoLastBlockFile; int nLastBlockFile = 0; FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fReadOnly) { if (pos.IsNull()) return NULL; boost::filesystem::path path = GetDataDir() / "blocks" / strprintf("%s%05u.dat", prefix, pos.nFile); boost::filesystem::create_directories(path.parent_path()); FILE* file = fopen(path.string().c_str(), "rb+"); if (!file && !fReadOnly) file = fopen(path.string().c_str(), "wb+"); if (!file) { printf("Unable to open file %s\n", path.string().c_str()); return NULL; } if (pos.nPos) { if (fseek(file, pos.nPos, SEEK_SET)) { printf("Unable to seek to position %u of %s\n", pos.nPos, path.string().c_str()); fclose(file); return NULL; } } return file; } FILE* OpenBlockFile(const CDiskBlockPos &pos, bool fReadOnly) { return OpenDiskFile(pos, "blk", fReadOnly); } FILE* OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly) { return OpenDiskFile(pos, "rev", fReadOnly); } CBlockIndex * InsertBlockIndex(uint256 hash) { if (hash == 0) return NULL; // Return existing map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end()) return (*mi).second; // Create new CBlockIndex* pindexNew = new CBlockIndex(); if (!pindexNew) throw runtime_error("LoadBlockIndex() : new CBlockIndex failed"); mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first; pindexNew->phashBlock = &((*mi).first); return pindexNew; } bool static LoadBlockIndexDB() { if (!pblocktree->LoadBlockIndexGuts()) return false; boost::this_thread::interruption_point(); // Calculate nChainWork vector<pair<int, CBlockIndex*> > vSortedByHeight; vSortedByHeight.reserve(mapBlockIndex.size()); BOOST_FOREACH(const PAIRTYPE(uint256, CBlockIndex*)& item, mapBlockIndex) { CBlockIndex* pindex = item.second; vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex)); } sort(vSortedByHeight.begin(), vSortedByHeight.end()); BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight) { CBlockIndex* pindex = item.second; pindex->nChainWork = (pindex->pprev ? pindex->pprev->nChainWork : 0) + pindex->GetBlockWork().getuint256(); pindex->nChainTx = (pindex->pprev ? pindex->pprev->nChainTx : 0) + pindex->nTx; if ((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_TRANSACTIONS && !(pindex->nStatus & BLOCK_FAILED_MASK)) setBlockIndexValid.insert(pindex); } // Load block file info pblocktree->ReadLastBlockFile(nLastBlockFile); printf("LoadBlockIndexDB(): last block file = %i\n", nLastBlockFile); if (pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile)) printf("LoadBlockIndexDB(): last block file info: %s\n", infoLastBlockFile.ToString().c_str()); // Load nBestInvalidWork, OK if it doesn't exist CBigNum bnBestInvalidWork; pblocktree->ReadBestInvalidWork(bnBestInvalidWork); nBestInvalidWork = bnBestInvalidWork.getuint256(); // Check whether we need to continue reindexing bool fReindexing = false; pblocktree->ReadReindexing(fReindexing); fReindex |= fReindexing; // Check whether we have a transaction index pblocktree->ReadFlag("txindex", fTxIndex); printf("LoadBlockIndexDB(): transaction index %s\n", fTxIndex ? "enabled" : "disabled"); // Load hashBestChain pointer to end of best chain pindexBest = pcoinsTip->GetBestBlock(); if (pindexBest == NULL) return true; hashBestChain = pindexBest->GetBlockHash(); nBestHeight = pindexBest->nHeight; nBestChainWork = pindexBest->nChainWork; // set 'next' pointers in best chain CBlockIndex *pindex = pindexBest; while(pindex != NULL && pindex->pprev != NULL) { CBlockIndex *pindexPrev = pindex->pprev; pindexPrev->pnext = pindex; pindex = pindexPrev; } printf("LoadBlockIndexDB(): hashBestChain=%s height=%d date=%s\n", hashBestChain.ToString().c_str(), nBestHeight, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str()); return true; } bool VerifyDB(int nCheckLevel, int nCheckDepth) { if (pindexBest == NULL || pindexBest->pprev == NULL) return true; // Verify blocks in the best chain if (nCheckDepth <= 0) nCheckDepth = 1000000000; // suffices until the year 19000 if (nCheckDepth > nBestHeight) nCheckDepth = nBestHeight; nCheckLevel = std::max(0, std::min(4, nCheckLevel)); printf("Verifying last %i blocks at level %i\n", nCheckDepth, nCheckLevel); CCoinsViewCache coins(*pcoinsTip, true); CBlockIndex* pindexState = pindexBest; CBlockIndex* pindexFailure = NULL; int nGoodTransactions = 0; CValidationState state; for (CBlockIndex* pindex = pindexBest; pindex && pindex->pprev; pindex = pindex->pprev) { boost::this_thread::interruption_point(); if (pindex->nHeight < nBestHeight-nCheckDepth) break; CBlock block; // check level 0: read from disk if (!block.ReadFromDisk(pindex)) return error("VerifyDB() : *** block.ReadFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); // check level 1: verify block validity if (nCheckLevel >= 1 && !block.CheckBlock(state)) return error("VerifyDB() : *** found bad block at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); // check level 2: verify undo validity if (nCheckLevel >= 2 && pindex) { CBlockUndo undo; CDiskBlockPos pos = pindex->GetUndoPos(); if (!pos.IsNull()) { if (!undo.ReadFromDisk(pos, pindex->pprev->GetBlockHash())) return error("VerifyDB() : *** found bad undo data at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); } } // check level 3: check for inconsistencies during memory-only disconnect of tip blocks if (nCheckLevel >= 3 && pindex == pindexState && (coins.GetCacheSize() + pcoinsTip->GetCacheSize()) <= 2*nCoinCacheSize + 32000) { bool fClean = true; if (!block.DisconnectBlock(state, pindex, coins, &fClean)) return error("VerifyDB() : *** irrecoverable inconsistency in block data at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); pindexState = pindex->pprev; if (!fClean) { nGoodTransactions = 0; pindexFailure = pindex; } else nGoodTransactions += block.vtx.size(); } } if (pindexFailure) return error("VerifyDB() : *** coin database inconsistencies found (last %i blocks, %i good transactions before that)\n", pindexBest->nHeight - pindexFailure->nHeight + 1, nGoodTransactions); // check level 4: try reconnecting blocks if (nCheckLevel >= 4) { CBlockIndex *pindex = pindexState; while (pindex != pindexBest) { boost::this_thread::interruption_point(); pindex = pindex->pnext; CBlock block; if (!block.ReadFromDisk(pindex)) return error("VerifyDB() : *** block.ReadFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); if (!block.ConnectBlock(state, pindex, coins)) return error("VerifyDB() : *** found unconnectable block at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); } } printf("No coin database inconsistencies in last %i blocks (%i transactions)\n", pindexBest->nHeight - pindexState->nHeight, nGoodTransactions); return true; } void UnloadBlockIndex() { mapBlockIndex.clear(); setBlockIndexValid.clear(); pindexGenesisBlock = NULL; nBestHeight = 0; nBestChainWork = 0; nBestInvalidWork = 0; hashBestChain = 0; pindexBest = NULL; } bool LoadBlockIndex() { if (fTestNet) { pchMessageStart[0] = 0xfc; pchMessageStart[1] = 0xc1; pchMessageStart[2] = 0xb7; pchMessageStart[3] = 0xdc; hashGenesisBlock = uint256("0xf5ae71e26c74beacc88382716aced69cddf3dffff24f384e1808905e0188f68f"); } // // Load block index from databases // if (!fReindex && !LoadBlockIndexDB()) return false; return true; } bool InitBlockIndex() { // Check whether we're already initialized if (pindexGenesisBlock != NULL) return true; // Use the provided setting for -txindex in the new database fTxIndex = GetBoolArg("-txindex", false); pblocktree->WriteFlag("txindex", fTxIndex); printf("Initializing databases...\n"); // Only add the genesis block if not reindexing (in which case we reuse the one already on disk) if (!fReindex) { // Genesis Block: // CBlock(hash=12a765e31ffd4059bada, PoW=0000050c34a64b415b6b, ver=1, hashPrevBlock=00000000000000000000, hashMerkleRoot=97ddfbbae6, nTime=1317972665, nBits=1e0ffff0, nNonce=2084524493, vtx=1) // CTransaction(hash=97ddfbbae6, ver=1, vin.size=1, vout.size=1, nLockTime=0) // CTxIn(COutPoint(0000000000, -1), coinbase 04ffff001d0104404e592054696d65732030352f4f63742f32303131205374657665204a6f62732c204170706c65e280997320566973696f6e6172792c2044696573206174203536) // CTxOut(nValue=50.00000000, scriptPubKey=040184710fa689ad5023690c80f3a4) // vMerkleTree: 97ddfbbae6 // Genesis block const char* pszTimestamp = "Created By zaobi.org .QQ:260682605 ,欢迎咨询!2016-4-11"; CTransaction txNew; txNew.vin.resize(1); txNew.vout.resize(1); txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp)); txNew.vout[0].nValue = 1 * COIN; txNew.vout[0].scriptPubKey = CScript() << ParseHex("041e0ddf48212a743ebe0bef72fd6bb420e1d49b29a173e554994c1cfec73884d7896bf419d95b6deef6f63bd5f2a8fc662c79e1e4f70f585776d82209cec5aa4c") << OP_CHECKSIG; CBlock block; block.vtx.push_back(txNew); block.hashPrevBlock = 0; block.hashMerkleRoot = block.BuildMerkleTree(); block.nVersion = 1; block.nTime = 1460317620; block.nBits = bnProofOfWorkLimit.GetCompact(); block.nNonce = 660107; if (fTestNet) { block.nTime = 1317798646; block.nNonce = 385270584; } //// debug print if(block.GetHash()!=hashGenesisBlock){ uint256 powhash=block.GetPoWHash(); while (powhash > bnProofOfWorkLimit.getuint256()){ if (++block.nNonce==0) break; powhash = block.GetPoWHash(); } printf("HASH WE NEED 0x%s\n", block.GetHash().ToString().c_str()); printf("hashGenesisBlock 0x%s\n", hashGenesisBlock.ToString().c_str()); printf("MerkleRoot 0x%s\n", block.hashMerkleRoot.ToString().c_str()); printf("nNounce %d\n",block.nNonce); } assert(block.hashMerkleRoot == uint256("0x45fa65b0695f9f02eef70a3b39449a11c7a2921e3129edf4593f40d2b1aad205")); block.print(); assert(block.GetHash() == hashGenesisBlock); // Start new block file try { unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION); CDiskBlockPos blockPos; CValidationState state; if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime)) return error("LoadBlockIndex() : FindBlockPos failed"); if (!block.WriteToDisk(blockPos)) return error("LoadBlockIndex() : writing genesis block to disk failed"); if (!block.AddToBlockIndex(state, blockPos)) return error("LoadBlockIndex() : genesis block not accepted"); } catch(std::runtime_error &e) { return error("LoadBlockIndex() : failed to initialize block database: %s", e.what()); } } return true; } void PrintBlockTree() { // pre-compute tree structure map<CBlockIndex*, vector<CBlockIndex*> > mapNext; for (map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi) { CBlockIndex* pindex = (*mi).second; mapNext[pindex->pprev].push_back(pindex); // test //while (rand() % 3 == 0) // mapNext[pindex->pprev].push_back(pindex); } vector<pair<int, CBlockIndex*> > vStack; vStack.push_back(make_pair(0, pindexGenesisBlock)); int nPrevCol = 0; while (!vStack.empty()) { int nCol = vStack.back().first; CBlockIndex* pindex = vStack.back().second; vStack.pop_back(); // print split or gap if (nCol > nPrevCol) { for (int i = 0; i < nCol-1; i++) printf("| "); printf("|\\\n"); } else if (nCol < nPrevCol) { for (int i = 0; i < nCol; i++) printf("| "); printf("|\n"); } nPrevCol = nCol; // print columns for (int i = 0; i < nCol; i++) printf("| "); // print item CBlock block; block.ReadFromDisk(pindex); printf("%d (blk%05u.dat:0x%x) %s tx %"PRIszu"", pindex->nHeight, pindex->GetBlockPos().nFile, pindex->GetBlockPos().nPos, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", block.GetBlockTime()).c_str(), block.vtx.size()); PrintWallets(block); // put the main time-chain first vector<CBlockIndex*>& vNext = mapNext[pindex]; for (unsigned int i = 0; i < vNext.size(); i++) { if (vNext[i]->pnext) { swap(vNext[0], vNext[i]); break; } } // iterate children for (unsigned int i = 0; i < vNext.size(); i++) vStack.push_back(make_pair(nCol+i, vNext[i])); } } bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) { int64 nStart = GetTimeMillis(); int nLoaded = 0; try { CBufferedFile blkdat(fileIn, 2*MAX_BLOCK_SIZE, MAX_BLOCK_SIZE+8, SER_DISK, CLIENT_VERSION); uint64 nStartByte = 0; if (dbp) { // (try to) skip already indexed part CBlockFileInfo info; if (pblocktree->ReadBlockFileInfo(dbp->nFile, info)) { nStartByte = info.nSize; blkdat.Seek(info.nSize); } } uint64 nRewind = blkdat.GetPos(); while (blkdat.good() && !blkdat.eof()) { boost::this_thread::interruption_point(); blkdat.SetPos(nRewind); nRewind++; // start one byte further next time, in case of failure blkdat.SetLimit(); // remove former limit unsigned int nSize = 0; try { // locate a header unsigned char buf[4]; blkdat.FindByte(pchMessageStart[0]); nRewind = blkdat.GetPos()+1; blkdat >> FLATDATA(buf); if (memcmp(buf, pchMessageStart, 4)) continue; // read size blkdat >> nSize; if (nSize < 80 || nSize > MAX_BLOCK_SIZE) continue; } catch (std::exception &e) { // no valid block header found; don't complain break; } try { // read block uint64 nBlockPos = blkdat.GetPos(); blkdat.SetLimit(nBlockPos + nSize); CBlock block; blkdat >> block; nRewind = blkdat.GetPos(); // process block if (nBlockPos >= nStartByte) { LOCK(cs_main); if (dbp) dbp->nPos = nBlockPos; CValidationState state; if (ProcessBlock(state, NULL, &block, dbp)) nLoaded++; if (state.IsError()) break; } } catch (std::exception &e) { printf("%s() : Deserialize or I/O error caught during load\n", __PRETTY_FUNCTION__); } } fclose(fileIn); } catch(std::runtime_error &e) { AbortNode(_("Error: system error: ") + e.what()); } if (nLoaded > 0) printf("Loaded %i blocks from external file in %"PRI64d"ms\n", nLoaded, GetTimeMillis() - nStart); return nLoaded > 0; } ////////////////////////////////////////////////////////////////////////////// // // CAlert // extern map<uint256, CAlert> mapAlerts; extern CCriticalSection cs_mapAlerts; string GetWarnings(string strFor) { int nPriority = 0; string strStatusBar; string strRPC; if (GetBoolArg("-testsafemode")) strRPC = "test"; if (!CLIENT_VERSION_IS_RELEASE) strStatusBar = _("This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"); // Misc warnings like out of disk space and clock is wrong if (strMiscWarning != "") { nPriority = 1000; strStatusBar = strMiscWarning; } // Longer invalid proof-of-work chain if (pindexBest && nBestInvalidWork > nBestChainWork + (pindexBest->GetBlockWork() * 6).getuint256()) { nPriority = 2000; strStatusBar = strRPC = _("Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade."); } // Alerts { LOCK(cs_mapAlerts); BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts) { const CAlert& alert = item.second; if (alert.AppliesToMe() && alert.nPriority > nPriority) { nPriority = alert.nPriority; strStatusBar = alert.strStatusBar; } } } if (strFor == "statusbar") return strStatusBar; else if (strFor == "rpc") return strRPC; assert(!"GetWarnings() : invalid parameter"); return "error"; } ////////////////////////////////////////////////////////////////////////////// // // Messages // bool static AlreadyHave(const CInv& inv) { switch (inv.type) { case MSG_TX: { bool txInMap = false; { LOCK(mempool.cs); txInMap = mempool.exists(inv.hash); } return txInMap || mapOrphanTransactions.count(inv.hash) || pcoinsTip->HaveCoins(inv.hash); } case MSG_BLOCK: return mapBlockIndex.count(inv.hash) || mapOrphanBlocks.count(inv.hash); } // Don't know what it is, just say we already got one return true; } // The message start string is designed to be unlikely to occur in normal data. // The characters are rarely used upper ASCII, not valid as UTF-8, and produce // a large 4-byte int at any alignment. unsigned char pchMessageStart[4] = { 0xfb, 0xc0, 0xb6, 0xdb }; // Happinesscoin: increase each by adding 2 to bitcoin's value. void static ProcessGetData(CNode* pfrom) { std::deque<CInv>::iterator it = pfrom->vRecvGetData.begin(); vector<CInv> vNotFound; while (it != pfrom->vRecvGetData.end()) { // Don't bother if send buffer is too full to respond anyway if (pfrom->nSendSize >= SendBufferSize()) break; // Don't waste work on slow peers until they catch up on the blocks we // give them. 80 bytes is just the size of a block header - obviously // the minimum we might return. if (pfrom->nBlocksRequested * 80 > pfrom->nSendBytes) break; const CInv &inv = *it; { boost::this_thread::interruption_point(); it++; if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK) { bool send = true; map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(inv.hash); pfrom->nBlocksRequested++; if (mi != mapBlockIndex.end()) { // If the requested block is at a height below our last // checkpoint, only serve it if it's in the checkpointed chain int nHeight = ((*mi).second)->nHeight; CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex); if (pcheckpoint && nHeight < pcheckpoint->nHeight) { if (!((*mi).second)->IsInMainChain()) { printf("ProcessGetData(): ignoring request for old block that isn't in the main chain\n"); send = false; } } } else { send = false; } if (send) { // Send block from disk CBlock block; block.ReadFromDisk((*mi).second); if (inv.type == MSG_BLOCK) pfrom->PushMessage("block", block); else // MSG_FILTERED_BLOCK) { LOCK(pfrom->cs_filter); if (pfrom->pfilter) { CMerkleBlock merkleBlock(block, *pfrom->pfilter); pfrom->PushMessage("merkleblock", merkleBlock); // CMerkleBlock just contains hashes, so also push any transactions in the block the client did not see // This avoids hurting performance by pointlessly requiring a round-trip // Note that there is currently no way for a node to request any single transactions we didnt send here - // they must either disconnect and retry or request the full block. // Thus, the protocol spec specified allows for us to provide duplicate txn here, // however we MUST always provide at least what the remote peer needs typedef std::pair<unsigned int, uint256> PairType; BOOST_FOREACH(PairType& pair, merkleBlock.vMatchedTxn) if (!pfrom->setInventoryKnown.count(CInv(MSG_TX, pair.second))) pfrom->PushMessage("tx", block.vtx[pair.first]); } // else // no response } // Trigger them to send a getblocks request for the next batch of inventory if (inv.hash == pfrom->hashContinue) { // Bypass PushInventory, this must send even if redundant, // and we want it right after the last block so they don't // wait for other stuff first. vector<CInv> vInv; vInv.push_back(CInv(MSG_BLOCK, hashBestChain)); pfrom->PushMessage("inv", vInv); pfrom->hashContinue = 0; } } } else if (inv.IsKnownType()) { // Send stream from relay memory bool pushed = false; { LOCK(cs_mapRelay); map<CInv, CDataStream>::iterator mi = mapRelay.find(inv); if (mi != mapRelay.end()) { pfrom->PushMessage(inv.GetCommand(), (*mi).second); pushed = true; } } if (!pushed && inv.type == MSG_TX) { LOCK(mempool.cs); if (mempool.exists(inv.hash)) { CTransaction tx = mempool.lookup(inv.hash); CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss.reserve(1000); ss << tx; pfrom->PushMessage("tx", ss); pushed = true; } } if (!pushed) { vNotFound.push_back(inv); } } // Track requests for our stuff. Inventory(inv.hash); if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK) break; } } pfrom->vRecvGetData.erase(pfrom->vRecvGetData.begin(), it); if (!vNotFound.empty()) { // Let the peer know that we didn't find what it asked for, so it doesn't // have to wait around forever. Currently only SPV clients actually care // about this message: it's needed when they are recursively walking the // dependencies of relevant unconfirmed transactions. SPV clients want to // do that because they want to know about (and store and rebroadcast and // risk analyze) the dependencies of transactions relevant to them, without // having to download the entire memory pool. pfrom->PushMessage("notfound", vNotFound); } } bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) { RandAddSeedPerfmon(); if (fDebug) printf("received: %s (%"PRIszu" bytes)\n", strCommand.c_str(), vRecv.size()); if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0) { printf("dropmessagestest DROPPING RECV MESSAGE\n"); return true; } if (strCommand == "version") { // Each connection can only send one version message if (pfrom->nVersion != 0) { pfrom->Misbehaving(1); return false; } int64 nTime; CAddress addrMe; CAddress addrFrom; uint64 nNonce = 1; vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe; if (pfrom->nVersion < MIN_PEER_PROTO_VERSION) { // disconnect from peers older than this proto version printf("partner %s using obsolete version %i; disconnecting\n", pfrom->addr.ToString().c_str(), pfrom->nVersion); pfrom->fDisconnect = true; return false; } if (pfrom->nVersion == 10300) pfrom->nVersion = 300; if (!vRecv.empty()) vRecv >> addrFrom >> nNonce; if (!vRecv.empty()) { vRecv >> pfrom->strSubVer; pfrom->cleanSubVer = SanitizeString(pfrom->strSubVer); } if (!vRecv.empty()) vRecv >> pfrom->nStartingHeight; if (!vRecv.empty()) vRecv >> pfrom->fRelayTxes; // set to true after we get the first filter* message else pfrom->fRelayTxes = true; if (pfrom->fInbound && addrMe.IsRoutable()) { pfrom->addrLocal = addrMe; SeenLocal(addrMe); } // Disconnect if we connected to ourself if (nNonce == nLocalHostNonce && nNonce > 1) { printf("connected to self at %s, disconnecting\n", pfrom->addr.ToString().c_str()); pfrom->fDisconnect = true; return true; } // Be shy and don't send version until we hear if (pfrom->fInbound) pfrom->PushVersion(); pfrom->fClient = !(pfrom->nServices & NODE_NETWORK); AddTimeData(pfrom->addr, nTime); // Change version pfrom->PushMessage("verack"); pfrom->ssSend.SetVersion(min(pfrom->nVersion, PROTOCOL_VERSION)); if (!pfrom->fInbound) { // Advertise our address if (!fNoListen && !IsInitialBlockDownload()) { CAddress addr = GetLocalAddress(&pfrom->addr); if (addr.IsRoutable()) pfrom->PushAddress(addr); } // Get recent addresses if (pfrom->fOneShot || pfrom->nVersion >= CADDR_TIME_VERSION || addrman.size() < 1000) { pfrom->PushMessage("getaddr"); pfrom->fGetAddr = true; } addrman.Good(pfrom->addr); } else { if (((CNetAddr)pfrom->addr) == (CNetAddr)addrFrom) { addrman.Add(addrFrom, addrFrom); addrman.Good(addrFrom); } } // Relay alerts { LOCK(cs_mapAlerts); BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts) item.second.RelayTo(pfrom); } pfrom->fSuccessfullyConnected = true; printf("receive version message: %s: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", pfrom->cleanSubVer.c_str(), pfrom->nVersion, pfrom->nStartingHeight, addrMe.ToString().c_str(), addrFrom.ToString().c_str(), pfrom->addr.ToString().c_str()); cPeerBlockCounts.input(pfrom->nStartingHeight); } else if (pfrom->nVersion == 0) { // Must have a version message before anything else pfrom->Misbehaving(1); return false; } else if (strCommand == "verack") { pfrom->SetRecvVersion(min(pfrom->nVersion, PROTOCOL_VERSION)); } else if (strCommand == "addr") { vector<CAddress> vAddr; vRecv >> vAddr; // Don't want addr from older versions unless seeding if (pfrom->nVersion < CADDR_TIME_VERSION && addrman.size() > 1000) return true; if (vAddr.size() > 1000) { pfrom->Misbehaving(20); return error("message addr size() = %"PRIszu"", vAddr.size()); } // Store the new addresses vector<CAddress> vAddrOk; int64 nNow = GetAdjustedTime(); int64 nSince = nNow - 10 * 60; BOOST_FOREACH(CAddress& addr, vAddr) { boost::this_thread::interruption_point(); if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60) addr.nTime = nNow - 5 * 24 * 60 * 60; pfrom->AddAddressKnown(addr); bool fReachable = IsReachable(addr); if (addr.nTime > nSince && !pfrom->fGetAddr && vAddr.size() <= 10 && addr.IsRoutable()) { // Relay to a limited number of other nodes { LOCK(cs_vNodes); // Use deterministic randomness to send to the same nodes for 24 hours // at a time so the setAddrKnowns of the chosen nodes prevent repeats static uint256 hashSalt; if (hashSalt == 0) hashSalt = GetRandHash(); uint64 hashAddr = addr.GetHash(); uint256 hashRand = hashSalt ^ (hashAddr<<32) ^ ((GetTime()+hashAddr)/(24*60*60)); hashRand = Hash(BEGIN(hashRand), END(hashRand)); multimap<uint256, CNode*> mapMix; BOOST_FOREACH(CNode* pnode, vNodes) { if (pnode->nVersion < CADDR_TIME_VERSION) continue; unsigned int nPointer; memcpy(&nPointer, &pnode, sizeof(nPointer)); uint256 hashKey = hashRand ^ nPointer; hashKey = Hash(BEGIN(hashKey), END(hashKey)); mapMix.insert(make_pair(hashKey, pnode)); } int nRelayNodes = fReachable ? 2 : 1; // limited relaying of addresses outside our network(s) for (multimap<uint256, CNode*>::iterator mi = mapMix.begin(); mi != mapMix.end() && nRelayNodes-- > 0; ++mi) ((*mi).second)->PushAddress(addr); } } // Do not store addresses outside our network if (fReachable) vAddrOk.push_back(addr); } addrman.Add(vAddrOk, pfrom->addr, 2 * 60 * 60); if (vAddr.size() < 1000) pfrom->fGetAddr = false; if (pfrom->fOneShot) pfrom->fDisconnect = true; } else if (strCommand == "inv") { vector<CInv> vInv; vRecv >> vInv; if (vInv.size() > MAX_INV_SZ) { pfrom->Misbehaving(20); return error("message inv size() = %"PRIszu"", vInv.size()); } // find last block in inv vector unsigned int nLastBlock = (unsigned int)(-1); for (unsigned int nInv = 0; nInv < vInv.size(); nInv++) { if (vInv[vInv.size() - 1 - nInv].type == MSG_BLOCK) { nLastBlock = vInv.size() - 1 - nInv; break; } } for (unsigned int nInv = 0; nInv < vInv.size(); nInv++) { const CInv &inv = vInv[nInv]; boost::this_thread::interruption_point(); pfrom->AddInventoryKnown(inv); bool fAlreadyHave = AlreadyHave(inv); if (fDebug) printf(" got inventory: %s %s\n", inv.ToString().c_str(), fAlreadyHave ? "have" : "new"); if (!fAlreadyHave) { if (!fImporting && !fReindex) pfrom->AskFor(inv); } else if (inv.type == MSG_BLOCK && mapOrphanBlocks.count(inv.hash)) { pfrom->PushGetBlocks(pindexBest, GetOrphanRoot(mapOrphanBlocks[inv.hash])); } else if (nInv == nLastBlock) { // In case we are on a very long side-chain, it is possible that we already have // the last block in an inv bundle sent in response to getblocks. Try to detect // this situation and push another getblocks to continue. pfrom->PushGetBlocks(mapBlockIndex[inv.hash], uint256(0)); if (fDebug) printf("force request: %s\n", inv.ToString().c_str()); } // Track requests for our stuff Inventory(inv.hash); } } else if (strCommand == "getdata") { vector<CInv> vInv; vRecv >> vInv; if (vInv.size() > MAX_INV_SZ) { pfrom->Misbehaving(20); return error("message getdata size() = %"PRIszu"", vInv.size()); } if (fDebugNet || (vInv.size() != 1)) printf("received getdata (%"PRIszu" invsz)\n", vInv.size()); if ((fDebugNet && vInv.size() > 0) || (vInv.size() == 1)) printf("received getdata for: %s\n", vInv[0].ToString().c_str()); pfrom->vRecvGetData.insert(pfrom->vRecvGetData.end(), vInv.begin(), vInv.end()); ProcessGetData(pfrom); } else if (strCommand == "getblocks") { CBlockLocator locator; uint256 hashStop; vRecv >> locator >> hashStop; // Find the last block the caller has in the main chain CBlockIndex* pindex = locator.GetBlockIndex(); // Send the rest of the chain if (pindex) pindex = pindex->pnext; int nLimit = 500; printf("getblocks %d to %s limit %d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString().c_str(), nLimit); for (; pindex; pindex = pindex->pnext) { if (pindex->GetBlockHash() == hashStop) { printf(" getblocks stopping at %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); break; } pfrom->PushInventory(CInv(MSG_BLOCK, pindex->GetBlockHash())); if (--nLimit <= 0) { // When this block is requested, we'll send an inv that'll make them // getblocks the next batch of inventory. printf(" getblocks stopping at limit %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); pfrom->hashContinue = pindex->GetBlockHash(); break; } } } else if (strCommand == "getheaders") { CBlockLocator locator; uint256 hashStop; vRecv >> locator >> hashStop; CBlockIndex* pindex = NULL; if (locator.IsNull()) { // If locator is null, return the hashStop block map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashStop); if (mi == mapBlockIndex.end()) return true; pindex = (*mi).second; } else { // Find the last block the caller has in the main chain pindex = locator.GetBlockIndex(); if (pindex) pindex = pindex->pnext; } // we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end vector<CBlock> vHeaders; int nLimit = 2000; printf("getheaders %d to %s\n", (pindex ? pindex->nHeight : -1), hashStop.ToString().c_str()); for (; pindex; pindex = pindex->pnext) { vHeaders.push_back(pindex->GetBlockHeader()); if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop) break; } pfrom->PushMessage("headers", vHeaders); } else if (strCommand == "tx") { vector<uint256> vWorkQueue; vector<uint256> vEraseQueue; CDataStream vMsg(vRecv); CTransaction tx; vRecv >> tx; CInv inv(MSG_TX, tx.GetHash()); pfrom->AddInventoryKnown(inv); bool fMissingInputs = false; CValidationState state; if (tx.AcceptToMemoryPool(state, true, true, &fMissingInputs)) { RelayTransaction(tx, inv.hash); mapAlreadyAskedFor.erase(inv); vWorkQueue.push_back(inv.hash); vEraseQueue.push_back(inv.hash); printf("AcceptToMemoryPool: %s %s : accepted %s (poolsz %"PRIszu")\n", pfrom->addr.ToString().c_str(), pfrom->cleanSubVer.c_str(), tx.GetHash().ToString().c_str(), mempool.mapTx.size()); // Recursively process any orphan transactions that depended on this one for (unsigned int i = 0; i < vWorkQueue.size(); i++) { uint256 hashPrev = vWorkQueue[i]; for (set<uint256>::iterator mi = mapOrphanTransactionsByPrev[hashPrev].begin(); mi != mapOrphanTransactionsByPrev[hashPrev].end(); ++mi) { const uint256& orphanHash = *mi; const CTransaction& orphanTx = mapOrphanTransactions[orphanHash]; bool fMissingInputs2 = false; // Use a dummy CValidationState so someone can't setup nodes to counter-DoS based on orphan // resolution (that is, feeding people an invalid transaction based on LegitTxX in order to get // anyone relaying LegitTxX banned) CValidationState stateDummy; if (tx.AcceptToMemoryPool(stateDummy, true, true, &fMissingInputs2)) { printf(" accepted orphan tx %s\n", orphanHash.ToString().c_str()); RelayTransaction(orphanTx, orphanHash); mapAlreadyAskedFor.erase(CInv(MSG_TX, orphanHash)); vWorkQueue.push_back(orphanHash); vEraseQueue.push_back(orphanHash); } else if (!fMissingInputs2) { // invalid or too-little-fee orphan vEraseQueue.push_back(orphanHash); printf(" removed orphan tx %s\n", orphanHash.ToString().c_str()); } } } BOOST_FOREACH(uint256 hash, vEraseQueue) EraseOrphanTx(hash); } else if (fMissingInputs) { AddOrphanTx(tx); // DoS prevention: do not allow mapOrphanTransactions to grow unbounded unsigned int nEvicted = LimitOrphanTxSize(MAX_ORPHAN_TRANSACTIONS); if (nEvicted > 0) printf("mapOrphan overflow, removed %u tx\n", nEvicted); } int nDoS = 0; if (state.IsInvalid(nDoS)) { printf("%s from %s %s was not accepted into the memory pool\n", tx.GetHash().ToString().c_str(), pfrom->addr.ToString().c_str(), pfrom->cleanSubVer.c_str()); if (nDoS > 0) pfrom->Misbehaving(nDoS); } } else if (strCommand == "block" && !fImporting && !fReindex) // Ignore blocks received while importing { CBlock block; vRecv >> block; printf("received block %s\n", block.GetHash().ToString().c_str()); // block.print(); CInv inv(MSG_BLOCK, block.GetHash()); pfrom->AddInventoryKnown(inv); CValidationState state; if (ProcessBlock(state, pfrom, &block) || state.CorruptionPossible()) mapAlreadyAskedFor.erase(inv); int nDoS = 0; if (state.IsInvalid(nDoS)) if (nDoS > 0) pfrom->Misbehaving(nDoS); } else if (strCommand == "getaddr") { pfrom->vAddrToSend.clear(); vector<CAddress> vAddr = addrman.GetAddr(); BOOST_FOREACH(const CAddress &addr, vAddr) pfrom->PushAddress(addr); } else if (strCommand == "mempool") { std::vector<uint256> vtxid; LOCK2(mempool.cs, pfrom->cs_filter); mempool.queryHashes(vtxid); vector<CInv> vInv; BOOST_FOREACH(uint256& hash, vtxid) { CInv inv(MSG_TX, hash); if ((pfrom->pfilter && pfrom->pfilter->IsRelevantAndUpdate(mempool.lookup(hash), hash)) || (!pfrom->pfilter)) vInv.push_back(inv); if (vInv.size() == MAX_INV_SZ) break; } if (vInv.size() > 0) pfrom->PushMessage("inv", vInv); } else if (strCommand == "ping") { if (pfrom->nVersion > BIP0031_VERSION) { uint64 nonce = 0; vRecv >> nonce; // Echo the message back with the nonce. This allows for two useful features: // // 1) A remote node can quickly check if the connection is operational // 2) Remote nodes can measure the latency of the network thread. If this node // is overloaded it won't respond to pings quickly and the remote node can // avoid sending us more work, like chain download requests. // // The nonce stops the remote getting confused between different pings: without // it, if the remote node sends a ping once per second and this node takes 5 // seconds to respond to each, the 5th ping the remote sends would appear to // return very quickly. pfrom->PushMessage("pong", nonce); } } else if (strCommand == "alert") { CAlert alert; vRecv >> alert; uint256 alertHash = alert.GetHash(); if (pfrom->setKnown.count(alertHash) == 0) { if (alert.ProcessAlert()) { // Relay pfrom->setKnown.insert(alertHash); { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) alert.RelayTo(pnode); } } else { // Small DoS penalty so peers that send us lots of // duplicate/expired/invalid-signature/whatever alerts // eventually get banned. // This isn't a Misbehaving(100) (immediate ban) because the // peer might be an older or different implementation with // a different signature key, etc. pfrom->Misbehaving(10); } } } else if (!fBloomFilters && (strCommand == "filterload" || strCommand == "filteradd" || strCommand == "filterclear")) { pfrom->CloseSocketDisconnect(); return error("peer %s attempted to set a bloom filter even though we do not advertise that service", pfrom->addr.ToString().c_str()); } else if (strCommand == "filterload") { CBloomFilter filter; vRecv >> filter; if (!filter.IsWithinSizeConstraints()) // There is no excuse for sending a too-large filter pfrom->Misbehaving(100); else { LOCK(pfrom->cs_filter); delete pfrom->pfilter; pfrom->pfilter = new CBloomFilter(filter); pfrom->pfilter->UpdateEmptyFull(); } pfrom->fRelayTxes = true; } else if (strCommand == "filteradd") { vector<unsigned char> vData; vRecv >> vData; // Nodes must NEVER send a data item > 520 bytes (the max size for a script data object, // and thus, the maximum size any matched object can have) in a filteradd message if (vData.size() > MAX_SCRIPT_ELEMENT_SIZE) { pfrom->Misbehaving(100); } else { LOCK(pfrom->cs_filter); if (pfrom->pfilter) pfrom->pfilter->insert(vData); else pfrom->Misbehaving(100); } } else if (strCommand == "filterclear") { LOCK(pfrom->cs_filter); delete pfrom->pfilter; pfrom->pfilter = new CBloomFilter(); pfrom->fRelayTxes = true; } else { // Ignore unknown commands for extensibility } // Update the last seen time for this node's address if (pfrom->fNetworkNode) if (strCommand == "version" || strCommand == "addr" || strCommand == "inv" || strCommand == "getdata" || strCommand == "ping") AddressCurrentlyConnected(pfrom->addr); return true; } // requires LOCK(cs_vRecvMsg) bool ProcessMessages(CNode* pfrom) { //if (fDebug) // printf("ProcessMessages(%zu messages)\n", pfrom->vRecvMsg.size()); // // Message format // (4) message start // (12) command // (4) size // (4) checksum // (x) data // bool fOk = true; if (!pfrom->vRecvGetData.empty()) ProcessGetData(pfrom); // this maintains the order of responses if (!pfrom->vRecvGetData.empty()) return fOk; std::deque<CNetMessage>::iterator it = pfrom->vRecvMsg.begin(); while (!pfrom->fDisconnect && it != pfrom->vRecvMsg.end()) { // Don't bother if send buffer is too full to respond anyway if (pfrom->nSendSize >= SendBufferSize()) break; // get next message CNetMessage& msg = *it; //if (fDebug) // printf("ProcessMessages(message %u msgsz, %zu bytes, complete:%s)\n", // msg.hdr.nMessageSize, msg.vRecv.size(), // msg.complete() ? "Y" : "N"); // end, if an incomplete message is found if (!msg.complete()) break; // at this point, any failure means we can delete the current message it++; // Scan for message start if (memcmp(msg.hdr.pchMessageStart, pchMessageStart, sizeof(pchMessageStart)) != 0) { printf("\n\nPROCESSMESSAGE: INVALID MESSAGESTART\n\n"); fOk = false; break; } // Read header CMessageHeader& hdr = msg.hdr; if (!hdr.IsValid()) { printf("\n\nPROCESSMESSAGE: ERRORS IN HEADER %s\n\n\n", hdr.GetCommand().c_str()); continue; } string strCommand = hdr.GetCommand(); // Message size unsigned int nMessageSize = hdr.nMessageSize; // Checksum CDataStream& vRecv = msg.vRecv; uint256 hash = Hash(vRecv.begin(), vRecv.begin() + nMessageSize); unsigned int nChecksum = 0; memcpy(&nChecksum, &hash, sizeof(nChecksum)); if (nChecksum != hdr.nChecksum) { printf("ProcessMessages(%s, %u bytes) : CHECKSUM ERROR nChecksum=%08x hdr.nChecksum=%08x\n", strCommand.c_str(), nMessageSize, nChecksum, hdr.nChecksum); continue; } // Process message bool fRet = false; try { { LOCK(cs_main); fRet = ProcessMessage(pfrom, strCommand, vRecv); } boost::this_thread::interruption_point(); } catch (std::ios_base::failure& e) { if (strstr(e.what(), "end of data")) { // Allow exceptions from under-length message on vRecv printf("ProcessMessages(%s, %u bytes) : Exception '%s' caught, normally caused by a message being shorter than its stated length\n", strCommand.c_str(), nMessageSize, e.what()); } else if (strstr(e.what(), "size too large")) { // Allow exceptions from over-long size printf("ProcessMessages(%s, %u bytes) : Exception '%s' caught\n", strCommand.c_str(), nMessageSize, e.what()); } else { PrintExceptionContinue(&e, "ProcessMessages()"); } } catch (boost::thread_interrupted) { throw; } catch (std::exception& e) { PrintExceptionContinue(&e, "ProcessMessages()"); } catch (...) { PrintExceptionContinue(NULL, "ProcessMessages()"); } if (!fRet) printf("ProcessMessage(%s, %u bytes) FAILED\n", strCommand.c_str(), nMessageSize); break; } // In case the connection got shut down, its receive buffer was wiped if (!pfrom->fDisconnect) pfrom->vRecvMsg.erase(pfrom->vRecvMsg.begin(), it); return fOk; } bool SendMessages(CNode* pto, bool fSendTrickle) { TRY_LOCK(cs_main, lockMain); if (lockMain) { // Don't send anything until we get their version message if (pto->nVersion == 0) return true; // Keep-alive ping. We send a nonce of zero because we don't use it anywhere // right now. if (pto->nLastSend && GetTime() - pto->nLastSend > 30 * 60 && pto->vSendMsg.empty()) { uint64 nonce = 0; if (pto->nVersion > BIP0031_VERSION) pto->PushMessage("ping", nonce); else pto->PushMessage("ping"); } // Start block sync if (pto->fStartSync && !fImporting && !fReindex) { pto->fStartSync = false; pto->PushGetBlocks(pindexBest, uint256(0)); } // Resend wallet transactions that haven't gotten in a block yet // Except during reindex, importing and IBD, when old wallet // transactions become unconfirmed and spams other nodes. if (!fReindex && !fImporting && !IsInitialBlockDownload()) { ResendWalletTransactions(); } // Address refresh broadcast static int64 nLastRebroadcast; if (!IsInitialBlockDownload() && (GetTime() - nLastRebroadcast > 24 * 60 * 60)) { { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) { // Periodically clear setAddrKnown to allow refresh broadcasts if (nLastRebroadcast) pnode->setAddrKnown.clear(); // Rebroadcast our address if (!fNoListen) { CAddress addr = GetLocalAddress(&pnode->addr); if (addr.IsRoutable()) pnode->PushAddress(addr); } } } nLastRebroadcast = GetTime(); } // // Message: addr // if (fSendTrickle) { vector<CAddress> vAddr; vAddr.reserve(pto->vAddrToSend.size()); BOOST_FOREACH(const CAddress& addr, pto->vAddrToSend) { // returns true if wasn't already contained in the set if (pto->setAddrKnown.insert(addr).second) { vAddr.push_back(addr); // receiver rejects addr messages larger than 1000 if (vAddr.size() >= 1000) { pto->PushMessage("addr", vAddr); vAddr.clear(); } } } pto->vAddrToSend.clear(); if (!vAddr.empty()) pto->PushMessage("addr", vAddr); } // // Message: inventory // vector<CInv> vInv; vector<CInv> vInvWait; { LOCK(pto->cs_inventory); vInv.reserve(pto->vInventoryToSend.size()); vInvWait.reserve(pto->vInventoryToSend.size()); BOOST_FOREACH(const CInv& inv, pto->vInventoryToSend) { if (pto->setInventoryKnown.count(inv)) continue; // trickle out tx inv to protect privacy if (inv.type == MSG_TX && !fSendTrickle) { // 1/4 of tx invs blast to all immediately static uint256 hashSalt; if (hashSalt == 0) hashSalt = GetRandHash(); uint256 hashRand = inv.hash ^ hashSalt; hashRand = Hash(BEGIN(hashRand), END(hashRand)); bool fTrickleWait = ((hashRand & 3) != 0); // always trickle our own transactions if (!fTrickleWait) { CWalletTx wtx; if (GetTransaction(inv.hash, wtx)) if (wtx.fFromMe) fTrickleWait = true; } if (fTrickleWait) { vInvWait.push_back(inv); continue; } } // returns true if wasn't already contained in the set if (pto->setInventoryKnown.insert(inv).second) { vInv.push_back(inv); if (vInv.size() >= 1000) { pto->PushMessage("inv", vInv); vInv.clear(); } } } pto->vInventoryToSend = vInvWait; } if (!vInv.empty()) pto->PushMessage("inv", vInv); // // Message: getdata // vector<CInv> vGetData; int64 nNow = GetTime() * 1000000; while (!pto->mapAskFor.empty() && (*pto->mapAskFor.begin()).first <= nNow) { const CInv& inv = (*pto->mapAskFor.begin()).second; if (!AlreadyHave(inv)) { if (fDebugNet) printf("sending getdata: %s\n", inv.ToString().c_str()); vGetData.push_back(inv); if (vGetData.size() >= 1000) { pto->PushMessage("getdata", vGetData); vGetData.clear(); } } pto->mapAskFor.erase(pto->mapAskFor.begin()); } if (!vGetData.empty()) pto->PushMessage("getdata", vGetData); } return true; } ////////////////////////////////////////////////////////////////////////////// // // happinesscoinMiner // int static FormatHashBlocks(void* pbuffer, unsigned int len) { unsigned char* pdata = (unsigned char*)pbuffer; unsigned int blocks = 1 + ((len + 8) / 64); unsigned char* pend = pdata + 64 * blocks; memset(pdata + len, 0, 64 * blocks - len); pdata[len] = 0x80; unsigned int bits = len * 8; pend[-1] = (bits >> 0) & 0xff; pend[-2] = (bits >> 8) & 0xff; pend[-3] = (bits >> 16) & 0xff; pend[-4] = (bits >> 24) & 0xff; return blocks; } static const unsigned int pSHA256InitState[8] = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19}; void SHA256Transform(void* pstate, void* pinput, const void* pinit) { SHA256_CTX ctx; unsigned char data[64]; SHA256_Init(&ctx); for (int i = 0; i < 16; i++) ((uint32_t*)data)[i] = ByteReverse(((uint32_t*)pinput)[i]); for (int i = 0; i < 8; i++) ctx.h[i] = ((uint32_t*)pinit)[i]; SHA256_Update(&ctx, data, sizeof(data)); for (int i = 0; i < 8; i++) ((uint32_t*)pstate)[i] = ctx.h[i]; } // Some explaining would be appreciated class COrphan { public: CTransaction* ptx; set<uint256> setDependsOn; double dPriority; double dFeePerKb; COrphan(CTransaction* ptxIn) { ptx = ptxIn; dPriority = dFeePerKb = 0; } void print() const { printf("COrphan(hash=%s, dPriority=%.1f, dFeePerKb=%.1f)\n", ptx->GetHash().ToString().c_str(), dPriority, dFeePerKb); BOOST_FOREACH(uint256 hash, setDependsOn) printf(" setDependsOn %s\n", hash.ToString().c_str()); } }; uint64 nLastBlockTx = 0; uint64 nLastBlockSize = 0; // We want to sort transactions by priority and fee, so: typedef boost::tuple<double, double, CTransaction*> TxPriority; class TxPriorityCompare { bool byFee; public: TxPriorityCompare(bool _byFee) : byFee(_byFee) { } bool operator()(const TxPriority& a, const TxPriority& b) { if (byFee) { if (a.get<1>() == b.get<1>()) return a.get<0>() < b.get<0>(); return a.get<1>() < b.get<1>(); } else { if (a.get<0>() == b.get<0>()) return a.get<1>() < b.get<1>(); return a.get<0>() < b.get<0>(); } } }; CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) { // Create new block auto_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate()); if(!pblocktemplate.get()) return NULL; CBlock *pblock = &pblocktemplate->block; // pointer for convenience // Create coinbase tx CTransaction txNew; txNew.vin.resize(1); txNew.vin[0].prevout.SetNull(); txNew.vout.resize(1); txNew.vout[0].scriptPubKey = scriptPubKeyIn; // Add our coinbase tx as first transaction pblock->vtx.push_back(txNew); pblocktemplate->vTxFees.push_back(-1); // updated at end pblocktemplate->vTxSigOps.push_back(-1); // updated at end // Largest block you're willing to create: unsigned int nBlockMaxSize = GetArg("-blockmaxsize", DEFAULT_BLOCK_MAX_SIZE); // Limit to betweeen 1K and MAX_BLOCK_SIZE-1K for sanity: nBlockMaxSize = std::max((unsigned int)1000, std::min((unsigned int)(MAX_BLOCK_SIZE-1000), nBlockMaxSize)); // How much of the block should be dedicated to high-priority transactions, // included regardless of the fees they pay unsigned int nBlockPrioritySize = GetArg("-blockprioritysize", DEFAULT_BLOCK_PRIORITY_SIZE); nBlockPrioritySize = std::min(nBlockMaxSize, nBlockPrioritySize); // Minimum block size you want to create; block will be filled with free transactions // until there are no more or the block reaches this size: unsigned int nBlockMinSize = GetArg("-blockminsize", 0); nBlockMinSize = std::min(nBlockMaxSize, nBlockMinSize); // Collect memory pool transactions into the block int64 nFees = 0; { LOCK2(cs_main, mempool.cs); CBlockIndex* pindexPrev = pindexBest; CCoinsViewCache view(*pcoinsTip, true); // Priority order to process transactions list<COrphan> vOrphan; // list memory doesn't move map<uint256, vector<COrphan*> > mapDependers; bool fPrintPriority = GetBoolArg("-printpriority"); // This vector will be sorted into a priority queue: vector<TxPriority> vecPriority; vecPriority.reserve(mempool.mapTx.size()); for (map<uint256, CTransaction>::iterator mi = mempool.mapTx.begin(); mi != mempool.mapTx.end(); ++mi) { CTransaction& tx = (*mi).second; if (tx.IsCoinBase() || !tx.IsFinal()) continue; COrphan* porphan = NULL; double dPriority = 0; int64 nTotalIn = 0; bool fMissingInputs = false; BOOST_FOREACH(const CTxIn& txin, tx.vin) { // Read prev transaction if (!view.HaveCoins(txin.prevout.hash)) { // This should never happen; all transactions in the memory // pool should connect to either transactions in the chain // or other transactions in the memory pool. if (!mempool.mapTx.count(txin.prevout.hash)) { printf("ERROR: mempool transaction missing input\n"); if (fDebug) assert("mempool transaction missing input" == 0); fMissingInputs = true; if (porphan) vOrphan.pop_back(); break; } // Has to wait for dependencies if (!porphan) { // Use list for automatic deletion vOrphan.push_back(COrphan(&tx)); porphan = &vOrphan.back(); } mapDependers[txin.prevout.hash].push_back(porphan); porphan->setDependsOn.insert(txin.prevout.hash); nTotalIn += mempool.mapTx[txin.prevout.hash].vout[txin.prevout.n].nValue; continue; } const CCoins &coins = view.GetCoins(txin.prevout.hash); int64 nValueIn = coins.vout[txin.prevout.n].nValue; nTotalIn += nValueIn; int nConf = pindexPrev->nHeight - coins.nHeight + 1; dPriority += (double)nValueIn * nConf; } if (fMissingInputs) continue; // Priority is sum(valuein * age) / txsize unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); dPriority /= nTxSize; // This is a more accurate fee-per-kilobyte than is used by the client code, because the // client code rounds up the size to the nearest 1K. That's good, because it gives an // incentive to create smaller transactions. double dFeePerKb = double(nTotalIn-tx.GetValueOut()) / (double(nTxSize)/1000.0); if (porphan) { porphan->dPriority = dPriority; porphan->dFeePerKb = dFeePerKb; } else vecPriority.push_back(TxPriority(dPriority, dFeePerKb, &(*mi).second)); } // Collect transactions into block uint64 nBlockSize = 1000; uint64 nBlockTx = 0; int nBlockSigOps = 100; bool fSortedByFee = (nBlockPrioritySize <= 0); TxPriorityCompare comparer(fSortedByFee); std::make_heap(vecPriority.begin(), vecPriority.end(), comparer); while (!vecPriority.empty()) { // Take highest priority transaction off the priority queue: double dPriority = vecPriority.front().get<0>(); double dFeePerKb = vecPriority.front().get<1>(); CTransaction& tx = *(vecPriority.front().get<2>()); std::pop_heap(vecPriority.begin(), vecPriority.end(), comparer); vecPriority.pop_back(); // Size limits unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); if (nBlockSize + nTxSize >= nBlockMaxSize) continue; // Legacy limits on sigOps: unsigned int nTxSigOps = tx.GetLegacySigOpCount(); if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS) continue; // Skip free transactions if we're past the minimum block size: if (fSortedByFee && (dFeePerKb < CTransaction::nMinTxFee) && (nBlockSize + nTxSize >= nBlockMinSize)) continue; // Prioritize by fee once past the priority size or we run out of high-priority // transactions: if (!fSortedByFee && ((nBlockSize + nTxSize >= nBlockPrioritySize) || (dPriority < COIN * 720 / 250))) { fSortedByFee = true; comparer = TxPriorityCompare(fSortedByFee); std::make_heap(vecPriority.begin(), vecPriority.end(), comparer); } if (!tx.HaveInputs(view)) continue; int64 nTxFees = tx.GetValueIn(view)-tx.GetValueOut(); nTxSigOps += tx.GetP2SHSigOpCount(view); if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS) continue; CValidationState state; if (!tx.CheckInputs(state, view, true, SCRIPT_VERIFY_P2SH)) continue; CTxUndo txundo; uint256 hash = tx.GetHash(); tx.UpdateCoins(state, view, txundo, pindexPrev->nHeight+1, hash); // Added pblock->vtx.push_back(tx); pblocktemplate->vTxFees.push_back(nTxFees); pblocktemplate->vTxSigOps.push_back(nTxSigOps); nBlockSize += nTxSize; ++nBlockTx; nBlockSigOps += nTxSigOps; nFees += nTxFees; if (fPrintPriority) { printf("priority %.1f feeperkb %.1f txid %s\n", dPriority, dFeePerKb, tx.GetHash().ToString().c_str()); } // Add transactions that depend on this one to the priority queue if (mapDependers.count(hash)) { BOOST_FOREACH(COrphan* porphan, mapDependers[hash]) { if (!porphan->setDependsOn.empty()) { porphan->setDependsOn.erase(hash); if (porphan->setDependsOn.empty()) { vecPriority.push_back(TxPriority(porphan->dPriority, porphan->dFeePerKb, porphan->ptx)); std::push_heap(vecPriority.begin(), vecPriority.end(), comparer); } } } } } nLastBlockTx = nBlockTx; nLastBlockSize = nBlockSize; printf("CreateNewBlock(): total size %"PRI64u"\n", nBlockSize); pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nHeight+1, nFees); pblocktemplate->vTxFees[0] = -nFees; // Fill in header pblock->hashPrevBlock = pindexPrev->GetBlockHash(); pblock->UpdateTime(pindexPrev); pblock->nBits = GetNextWorkRequired(pindexPrev, pblock); pblock->nNonce = 0; pblock->vtx[0].vin[0].scriptSig = CScript() << OP_0 << OP_0; pblocktemplate->vTxSigOps[0] = pblock->vtx[0].GetLegacySigOpCount(); CBlockIndex indexDummy(*pblock); indexDummy.pprev = pindexPrev; indexDummy.nHeight = pindexPrev->nHeight + 1; CCoinsViewCache viewNew(*pcoinsTip, true); CValidationState state; if (!pblock->ConnectBlock(state, &indexDummy, viewNew, true)) throw std::runtime_error("CreateNewBlock() : ConnectBlock failed"); } return pblocktemplate.release(); } CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) { CPubKey pubkey; if (!reservekey.GetReservedKey(pubkey)) return NULL; CScript scriptPubKey = CScript() << pubkey << OP_CHECKSIG; return CreateNewBlock(scriptPubKey); } void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce) { // Update nExtraNonce static uint256 hashPrevBlock; if (hashPrevBlock != pblock->hashPrevBlock) { nExtraNonce = 0; hashPrevBlock = pblock->hashPrevBlock; } ++nExtraNonce; unsigned int nHeight = pindexPrev->nHeight+1; // Height first in coinbase required for block.version=2 pblock->vtx[0].vin[0].scriptSig = (CScript() << nHeight << CBigNum(nExtraNonce)) + COINBASE_FLAGS; assert(pblock->vtx[0].vin[0].scriptSig.size() <= 100); pblock->hashMerkleRoot = pblock->BuildMerkleTree(); } void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash1) { // // Pre-build hash buffers // struct { struct unnamed2 { int nVersion; uint256 hashPrevBlock; uint256 hashMerkleRoot; unsigned int nTime; unsigned int nBits; unsigned int nNonce; } block; unsigned char pchPadding0[64]; uint256 hash1; unsigned char pchPadding1[64]; } tmp; memset(&tmp, 0, sizeof(tmp)); tmp.block.nVersion = pblock->nVersion; tmp.block.hashPrevBlock = pblock->hashPrevBlock; tmp.block.hashMerkleRoot = pblock->hashMerkleRoot; tmp.block.nTime = pblock->nTime; tmp.block.nBits = pblock->nBits; tmp.block.nNonce = pblock->nNonce; FormatHashBlocks(&tmp.block, sizeof(tmp.block)); FormatHashBlocks(&tmp.hash1, sizeof(tmp.hash1)); // Byte swap all the input buffer for (unsigned int i = 0; i < sizeof(tmp)/4; i++) ((unsigned int*)&tmp)[i] = ByteReverse(((unsigned int*)&tmp)[i]); // Precalc the first half of the first hash, which stays constant SHA256Transform(pmidstate, &tmp.block, pSHA256InitState); memcpy(pdata, &tmp.block, 128); memcpy(phash1, &tmp.hash1, 64); } bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey) { uint256 hash = pblock->GetPoWHash(); uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256(); if (hash > hashTarget) return false; //// debug print printf("happinesscoinMiner:\n"); printf("proof-of-work found \n hash: %s \ntarget: %s\n", hash.GetHex().c_str(), hashTarget.GetHex().c_str()); pblock->print(); printf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue).c_str()); // Found a solution { LOCK(cs_main); if (pblock->hashPrevBlock != hashBestChain) return error("happinesscoinMiner : generated block is stale"); // Remove key from key pool reservekey.KeepKey(); // Track how many getdata requests this block gets { LOCK(wallet.cs_wallet); wallet.mapRequestCount[pblock->GetHash()] = 0; } // Process this block the same as if we had received it from another node CValidationState state; if (!ProcessBlock(state, NULL, pblock)) return error("happinesscoinMiner : ProcessBlock, block not accepted"); } return true; } void static happinesscoinMiner(CWallet *pwallet) { printf("happinesscoinMiner started\n"); SetThreadPriority(THREAD_PRIORITY_LOWEST); RenameThread("happinesscoin-miner"); // Each thread has its own key and counter CReserveKey reservekey(pwallet); unsigned int nExtraNonce = 0; try { while(true) { while (vNodes.empty()) MilliSleep(1000); // // Create new block // unsigned int nTransactionsUpdatedLast = nTransactionsUpdated; CBlockIndex* pindexPrev = pindexBest; auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey)); if (!pblocktemplate.get()) return; CBlock *pblock = &pblocktemplate->block; IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); printf("Running happinesscoinMiner with %"PRIszu" transactions in block (%u bytes)\n", pblock->vtx.size(), ::GetSerializeSize(*pblock, SER_NETWORK, PROTOCOL_VERSION)); // // Pre-build hash buffers // char pmidstatebuf[32+16]; char* pmidstate = alignup<16>(pmidstatebuf); char pdatabuf[128+16]; char* pdata = alignup<16>(pdatabuf); char phash1buf[64+16]; char* phash1 = alignup<16>(phash1buf); FormatHashBuffers(pblock, pmidstate, pdata, phash1); unsigned int& nBlockTime = *(unsigned int*)(pdata + 64 + 4); unsigned int& nBlockBits = *(unsigned int*)(pdata + 64 + 8); //unsigned int& nBlockNonce = *(unsigned int*)(pdata + 64 + 12); // // Search // int64 nStart = GetTime(); uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256(); while(true) { unsigned int nHashesDone = 0; uint256 thash; char scratchpad[SCRYPT_SCRATCHPAD_SIZE]; while(true) { scrypt_1024_1_1_256_sp(BEGIN(pblock->nVersion), BEGIN(thash), scratchpad); if (thash <= hashTarget) { // Found a solution SetThreadPriority(THREAD_PRIORITY_NORMAL); CheckWork(pblock, *pwallet, reservekey); SetThreadPriority(THREAD_PRIORITY_LOWEST); break; } pblock->nNonce += 1; nHashesDone += 1; if ((pblock->nNonce & 0xFF) == 0) break; } // Meter hashes/sec static int64 nHashCounter; if (nHPSTimerStart == 0) { nHPSTimerStart = GetTimeMillis(); nHashCounter = 0; } else nHashCounter += nHashesDone; if (GetTimeMillis() - nHPSTimerStart > 4000) { static CCriticalSection cs; { LOCK(cs); if (GetTimeMillis() - nHPSTimerStart > 4000) { dHashesPerSec = 1000.0 * nHashCounter / (GetTimeMillis() - nHPSTimerStart); nHPSTimerStart = GetTimeMillis(); nHashCounter = 0; static int64 nLogTime; if (GetTime() - nLogTime > 30 * 60) { nLogTime = GetTime(); printf("hashmeter %6.0f khash/s\n", dHashesPerSec/1000.0); } } } } // Check for stop or if block needs to be rebuilt boost::this_thread::interruption_point(); if (vNodes.empty()) break; if (pblock->nNonce >= 0xffff0000) break; if (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60) break; if (pindexPrev != pindexBest) break; // Update nTime every few seconds pblock->UpdateTime(pindexPrev); nBlockTime = ByteReverse(pblock->nTime); if (fTestNet) { // Changing pblock->nTime can change work required on testnet: nBlockBits = ByteReverse(pblock->nBits); hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256(); } } } } catch (boost::thread_interrupted) { printf("happinesscoinMiner terminated\n"); throw; } } void GenerateBitcoins(bool fGenerate, CWallet* pwallet) { static boost::thread_group* minerThreads = NULL; int nThreads = GetArg("-genproclimit", -1); if (nThreads < 0) nThreads = boost::thread::hardware_concurrency(); if (minerThreads != NULL) { minerThreads->interrupt_all(); delete minerThreads; minerThreads = NULL; } if (nThreads == 0 || !fGenerate) return; minerThreads = new boost::thread_group(); for (int i = 0; i < nThreads; i++) minerThreads->create_thread(boost::bind(&happinesscoinMiner, pwallet)); } // Amount compression: // * If the amount is 0, output 0 // * first, divide the amount (in base units) by the largest power of 10 possible; call the exponent e (e is max 9) // * if e<9, the last digit of the resulting number cannot be 0; store it as d, and drop it (divide by 10) // * call the result n // * output 1 + 10*(9*n + d - 1) + e // * if e==9, we only know the resulting number is not zero, so output 1 + 10*(n - 1) + 9 // (this is decodable, as d is in [1-9] and e is in [0-9]) uint64 CTxOutCompressor::CompressAmount(uint64 n) { if (n == 0) return 0; int e = 0; while (((n % 10) == 0) && e < 9) { n /= 10; e++; } if (e < 9) { int d = (n % 10); assert(d >= 1 && d <= 9); n /= 10; return 1 + (n*9 + d - 1)*10 + e; } else { return 1 + (n - 1)*10 + 9; } } uint64 CTxOutCompressor::DecompressAmount(uint64 x) { // x = 0 OR x = 1+10*(9*n + d - 1) + e OR x = 1+10*(n - 1) + 9 if (x == 0) return 0; x--; // x = 10*(9*n + d - 1) + e int e = x % 10; x /= 10; uint64 n = 0; if (e < 9) { // x = 9*n + d - 1 int d = (x % 9) + 1; x /= 9; // x = n n = x*10 + d; } else { n = x+1; } while (e) { n *= 10; e--; } return n; } class CMainCleanup { public: CMainCleanup() {} ~CMainCleanup() { // block headers std::map<uint256, CBlockIndex*>::iterator it1 = mapBlockIndex.begin(); for (; it1 != mapBlockIndex.end(); it1++) delete (*it1).second; mapBlockIndex.clear(); // orphan blocks std::map<uint256, CBlock*>::iterator it2 = mapOrphanBlocks.begin(); for (; it2 != mapOrphanBlocks.end(); it2++) delete (*it2).second; mapOrphanBlocks.clear(); // orphan transactions mapOrphanTransactions.clear(); } } instance_of_cmaincleanup;
[ "aapool@outlook.com" ]
aapool@outlook.com
e9814faaf08df2557923e36e14cc39a90c3bd6ca
7a704e838d89f942a1099fec141f1fbe9828e528
/hysia/core/HysiaDecode/include/MultiDecoder.hpp
9d652c3ad92e49b3219aa5dbc194eabd6e08bef2
[ "Apache-2.0" ]
permissive
cap-ntu/Video-to-Retail-Platform
3ee00d22b7fd94925adac08c5ea733ee647f4574
757c68d9de0778e3da8bbfa678d89251a6955573
refs/heads/hysia_v2
2023-02-14T05:22:16.792928
2021-01-10T02:31:43
2021-01-10T02:31:43
212,741,650
63
20
Apache-2.0
2021-01-10T02:32:00
2019-10-04T05:22:08
Python
UTF-8
C++
false
false
4,538
hpp
/* * Author : Wang Yongjie * Email : yongjie.wang@ntu.edu.sg * Description: Video decoder */ #ifndef _MULTIDECODER_HPP #define _MULTIDECODER_HPP #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> #include "BaseDec.h" #include "CpuDec.h" #include "GpuDec.h" #include "AudioDec.h" #include "DecodeQueue.hpp" #include "CheckDevice.h" #include <sys/stat.h> #include <cstring> #include <exception> class MultiDecoder{ public: //default constructor using GPU MultiDecoder(char *filename){ if(check_device(1) == 0){ std::cout<<"Using GPU"<<std::endl; vdec.reset(new GPUDecoder(0)); }else{ vdec.reset(new CPUDecoder()); } adec.reset(new AudioDecoder()); this->filename = filename; } MultiDecoder(char *filename, char *device, int device_id = 0){ if(strcmp(device, "CPU") == 0){ vdec.reset(new CPUDecoder()); }else if(strcmp(device, "GPU") == 0){ try{ vdec.reset(new GPUDecoder(device_id)); }catch(std::exception &e){ std::cout<<"exception in create GPU decoder:\t"<<e.what()<<std::endl; } } this->filename = filename; adec.reset(new AudioDecoder()); } ~MultiDecoder(){ // release allocated resources vdec.release(); adec.release(); } int GetFrames(){ // video decode vdec->IngestVideo(this->filename); vdec->DecodeFrames(this->queue); } int GetAudios(){ // audio decode adec->IngestVideo(this->filename); adec->DecodeClips(&this->audio_buffer, &this->size); } int SaveFile(const char *path){ // path the path saved the decoded videos //save the decoded file into disk if(path == NULL) return -1; char directory[128] = {0}; sprintf(directory, "%s/%s", path, this->filename); if(! mkdir(directory, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)){ std::cout<<"create "<<directory<<" failed"<<std::endl; } char audio_dir[128], video_dir[128]; sprintf(audio_dir, "%s/%s", directory, "pcm"); sprintf(video_dir, "%s/%s", directory, "frame"); if(! mkdir(audio_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)){// create video directory std::cout<<"create "<<audio_dir<<" failed"<<std::endl; } if(! mkdir(video_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)){ // create audio directory std::cout<<"create "<<video_dir<<" failed"<<std::endl; } char audio_filename[128] = {0}; char video_filename[128] = {0}; sprintf(audio_filename, "%s/%s.pcm", audio_dir, this->filename); // save audio pcm file FILE *fp_pcm = fopen(audio_filename, "wb"); fwrite(this->audio_buffer, 1, this->size, fp_pcm); fclose(fp_pcm); // save video frames int cnt = 0; while(queue.get_size() > 0){ sprintf(video_filename, "%s/%s-%08d.jpg", video_dir, this->filename, cnt); printf("%s\n", video_filename); cnt = cnt + 1; cv::Mat *tmp = queue.pop(); if(!tmp){continue;} cv::imwrite(video_filename, *tmp); } return 0; } int SaveMemory(const char *ip = NULL, const int port = 0){ // save data into redis // left empty temperoraily if(ip == NULL && port == 0) { std::cerr<<"errors in:"; return -1; } } int SetAlignedParam(const float duration = 1.0){// default audio length is 1. second for a frame int sample_rate = 44100; this->length = (int)(duration * sample_rate / 2 * 2 + 1); this->start = -length / 2; this->end = length / 2; this->step = sample_rate * (1.0 / 30.); // 30 frames per second this->ptr = length / 2; }; int GetAlignedData(uint8_t **buffer){ // Get aligned audio data *buffer = new uint8_t[this->length]; memset(*buffer, 0, sizeof(uint8_t) * this->length); this->ptr = std::max(this->ptr, 0); this->start = std::max(this->start, 0); this->end = std::min(this->end, this->size); int copy_len = this->end - this->start; memcpy(*buffer + this->ptr, this->audio_buffer + this->start, sizeof(uint8_t) * copy_len); // memory copy //update this->start = this->start + this->step; this->end = this->end + this->step; this->ptr = this->ptr - this->step; return 0; } private: DecodeQueue<cv::Mat* > queue = DecodeQueue<cv::Mat* >(1000000); // video decode queue std::unique_ptr<BaseDecoder> vdec = nullptr; // video codec std::unique_ptr<AudioDecoder> adec = nullptr; // audio codec uint8_t *audio_buffer = nullptr; // audio decode buffer public: int size; // audio buffer length char *filename = nullptr; // video files to be decoded int start, end; // memory copy start/end point int length; // audio length for a single frame int ptr; // int step; // sample numbers of per audio frame }; #endif
[ "huaizhen001@e.ntu.edu.sg" ]
huaizhen001@e.ntu.edu.sg
deae93ecb90a9af93230c791bdfb1161de1b3456
cc8a39e61c1de4f8657fe32a50249f369cf57577
/health_check/cpp_daemon/src/gtest_boost.cc
4b963c9f485b3817eda9b423d13d1d3262233cf3
[ "BSD-3-Clause" ]
permissive
xcnix/HPC_Scripts
addfd3e765b9030980a05ce7565b0519a3226301
5be3870aedde320de55fcd9190936f8e84b11735
refs/heads/master
2023-06-23T06:28:52.470806
2018-10-11T20:06:13
2018-10-11T20:06:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,094
cc
//Make sure THREAD SAFE is Active #define BOOST_SPIRIT_THREADSAFE #include <gtest/gtest.h> #include <boost/asio.hpp> #include <boost/bind.hpp> #include <boost/thread.hpp> #include <boost/date_time.hpp> /** * @brief Basic shared lock tests * @see http://www.boost.org/doc/libs/1_41_0/doc/html/thread/synchronization.html#thread.synchronization.locks.shared_lock */ TEST ( boost, locks ) { return; boost::shared_mutex m1; { boost::unique_lock<boost::shared_mutex> wlock(m1); ASSERT_TRUE(wlock); { boost::shared_lock<boost::shared_mutex> rlock(m1, boost::try_to_lock); ASSERT_FALSE(rlock); } { boost::shared_mutex* mutexptr = wlock.release(); ASSERT_EQ(mutexptr, &m1); } { boost::shared_lock<boost::shared_mutex> rlock(m1); ASSERT_TRUE(rlock); } } } /** * @short Test shared mutex 5 times */ void testsharedmutex(boost::shared_mutex &m1) // NOLINT { // std::cout << "thread " << boost::this_thread::get_id() << std::endl; for (int i = 0; i < 1; ++i) { //lock_guard is a unique_lock aka a write lock! boost::lock_guard<boost::shared_mutex> r1lock(m1); // std::cout << "thread locked " << boost::this_thread::get_id() << std::endl; // for (int v = 0; v < 50; ++v) // boost::this_thread::yield(); } } /** * @short Test shared 3 mutexs 5 times */ void testshared3mutex(boost::shared_mutex &m1, boost::shared_mutex &m2, boost::shared_mutex &m3) // NOLINT { // std::cout << "thread " << boost::this_thread::get_id() << std::endl; for (int i = 0; i < 1; ++i) { boost::shared_lock<boost::shared_mutex> r1lock(m1, boost::defer_lock); boost::shared_lock<boost::shared_mutex> r2lock(m2, boost::defer_lock); boost::shared_lock<boost::shared_mutex> r3lock(m3, boost::defer_lock); boost::lock(r1lock, r2lock, r3lock); { boost::this_thread::sleep(boost::posix_time::seconds(1)); // std::cout << "thread locked " << boost::this_thread::get_id() << std::endl; EXPECT_TRUE(r1lock); EXPECT_TRUE(r2lock); EXPECT_TRUE(r3lock); // for (int v = 0; v < 50; ++v) // boost::this_thread::yield(); } } } /** * @brief Tests locking and threads * Loads 10 threads and three mutexs, * then runs half the of the threads trying * to lock 1 mutex with the other 5 threads * locking all three mutexs * @see http://www.boost.org/dboc/libs/1_47_0/doc/html/thread/synchronization.html#thread.synchronization.locks.shared_lock * @see http://www.boost.org/doc/libs/1_47_0/doc/html/thread/thread_management.html */ TEST ( boost, threaded_locks ) { // std::cout << boost::this_thread::get_id() << std::endl; // std::cout << boost::thread::hardware_concurrency() << std::endl; boost::shared_mutex m1, m2, m3; boost::thread t1(testsharedmutex, boost::ref(m1)); boost::thread t2(testsharedmutex, boost::ref(m1)); boost::thread t3(testsharedmutex, boost::ref(m1)); boost::thread t4(testsharedmutex, boost::ref(m1)); boost::thread t5(testsharedmutex, boost::ref(m1)); boost::thread t10(testshared3mutex, boost::ref(m1), boost::ref(m2), boost::ref(m3)); boost::thread t20(testshared3mutex, boost::ref(m1), boost::ref(m2), boost::ref(m3)); boost::thread t30(testshared3mutex, boost::ref(m1), boost::ref(m2), boost::ref(m3)); boost::thread t40(testshared3mutex, boost::ref(m1), boost::ref(m2), boost::ref(m3)); boost::thread t50(testshared3mutex, boost::ref(m1), boost::ref(m2), boost::ref(m3)); // std::cout << "threading" << std::endl; t1.join(); t2.join(); t3.join(); t4.join(); t5.join(); t10.join(); t20.join(); t30.join(); t40.join(); t50.join(); } class boost_asio_server_test : public ::testing::Test { public: boost_asio_server_test() : endpoint(boost::asio::ip::address::from_string("127.0.0.1") , 8129), acceptor(io_service, endpoint), lsock(io_service), sock(io_service), data("SOME DATA TO TEST") { } boost::asio::io_service io_service; boost::asio::ip::tcp::endpoint endpoint; boost::asio::ip::tcp::acceptor acceptor; boost::asio::ip::tcp::socket lsock; boost::asio::ip::tcp::socket sock; const std::string data; boost::array<char, 4096> buffer1; boost::array<char, 4096> buffer2; void connect_handler(const boost::system::error_code &ec) { EXPECT_FALSE(ec); boost::asio::async_write(sock, boost::asio::buffer(data), boost::bind(&boost_asio_server_test::write_handler, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); boost::asio::async_read(sock, boost::asio::buffer(buffer1), boost::asio::transfer_at_least(data.length()), boost::bind(&boost_asio_server_test::read_handler1, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); } void read_handler1(const boost::system::error_code& ec, std::size_t bytes_transferred) { EXPECT_FALSE(ec); EXPECT_EQ(bytes_transferred, data.length()); EXPECT_EQ(data, std::string(buffer1.begin(), buffer1.begin() + bytes_transferred)); } void read_handler2(const boost::system::error_code& ec, std::size_t bytes_transferred) { EXPECT_FALSE(ec); EXPECT_EQ(bytes_transferred, data.length()); EXPECT_EQ(data, std::string(buffer2.begin(), buffer2.begin() + bytes_transferred)); } void accept_handler(const boost::system::error_code &ec) { EXPECT_FALSE(ec); boost::asio::async_write(lsock, boost::asio::buffer(data), boost::bind(&boost_asio_server_test::write_handler, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); boost::asio::async_read(lsock, boost::asio::buffer(buffer2), boost::asio::transfer_at_least(data.length()), boost::bind(&boost_asio_server_test::read_handler2, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); } void write_handler(const boost::system::error_code &ec, std::size_t bytes_transferred) { EXPECT_FALSE(ec); EXPECT_EQ(bytes_transferred, data.length()); } }; /** * @brief Listen and Read TCP Socket test * listens on a port, then connects to same port * the same data is sent accross both sockets * and then verified. * runs in 3 threads to verify it works with threads * @see http://en.highscore.de/cpp/boost/asio.html */ TEST_F ( boost_asio_server_test, listenread ) { boost::thread_group threads; acceptor.listen(); acceptor.async_accept(lsock, boost::bind(&boost_asio_server_test::accept_handler, this, boost::asio::placeholders::error )); sock.async_connect(endpoint, boost::bind(&boost_asio_server_test::connect_handler, this, boost::asio::placeholders::error )); threads.create_thread(boost::bind(&boost::asio::io_service::run, &io_service)); threads.create_thread(boost::bind(&boost::asio::io_service::run, &io_service)); threads.create_thread(boost::bind(&boost::asio::io_service::run, &io_service)); threads.join_all(); }
[ "nate@ucar.edu" ]
nate@ucar.edu
14c8451fe22e3a1502459345bb8ef560d8ac15a9
1ffd8bf6ab8bc8cbae85cfe65ea8d0c564b65e80
/examples/SchedulerSemaphore/SchedulerSemaphore.ino
e9ae286b9ebe7a44dcf3103eae87f230092e8bc2
[]
no_license
srmq/esp8266-scheduler
ba06ba99e89a8afd1e37e4dd10aa4c7bc1c6074e
498112d0ca3d16b85838c1ab9a2a34174a52155c
refs/heads/master
2021-07-08T11:44:34.821579
2017-10-06T01:41:00
2017-10-06T01:41:00
116,195,941
1
1
null
2018-01-04T00:37:02
2018-01-04T00:37:02
null
UTF-8
C++
false
false
1,990
ino
/** * @file SchedulerSemaphore.ino * @version 1.0 * * @section License * Copyright (C) 2015-2016, Mikael Patel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * @section Description * This Arduino sketch shows how to use the Scheduler library; * Classical semafores used in this example to protect serial * output sequences. */ #include <Scheduler.h> #include <Scheduler/Semaphore.h> // Check for SparkFun SAMD21 Breakout #if defined(ARDUINO_ARCH_SAMD) && (USB_PID == 0x8D21) #define Serial SerialUSB #endif Semaphore mutex; void setup() { Serial.begin(57600); while (!Serial); Serial.println(F("SchedulerSemaphore: started")); Scheduler.start(NULL, loop1); } void loop() { static unsigned int i = 1; unsigned long start, stop, ms; start = millis(); mutex.wait(); { stop = millis(); ms = stop - start; Serial.print(stop); Serial.print(F(":loop::i=")); Serial.print(i); Serial.print(F(", wait=")); Serial.println(ms); Serial.flush(); delay(100); } mutex.signal(); delay(random(300)); i += 1; } void loop1() { mutex.wait(); { Serial.print(millis()); Serial.println(F(":loop1::step-1")); delay(random(100)); Serial.print(millis()); Serial.println(F(":loop1::step-2")); delay(random(100)); Serial.print(millis()); Serial.println(F(":loop1::step-3")); Serial.flush(); delay(random(100)); } mutex.signal(); }
[ "mikael.patel@gmail.com" ]
mikael.patel@gmail.com
e2b1ddcc18d31b3bbe023c94c54d76ba390d0c65
a1732b958ae73657900585a4e8991a05072212d6
/2020/day8/computer.cpp
73a975188026da5dcc21ce212598231ba4af86fb
[ "MIT" ]
permissive
bielskij/AOC
97fca8183955caf4d46967ac1bf4b00d9dc04f12
270aa757f9025d8da399adbc5db214f47ef0b6de
refs/heads/master
2023-01-08T10:23:40.667070
2022-12-29T07:58:04
2022-12-29T07:58:04
226,080,843
3
0
null
2020-12-09T08:27:49
2019-12-05T10:57:02
C++
UTF-8
C++
false
false
1,069
cpp
/* * computer.cpp * * Created on: 19.11.2020 * Author: jarko */ #include "utils/file.h" #include "utils/utils.h" #include "utils/graph.h" #include "computer.h" #define DEBUG_LEVEL 5 #include "common/debug.h" void Computer::reset() { this->_pc = 0; this->_acc = 0; } Computer::Computer() { this->_breakpoint = -1; this->reset(); } void Computer::tick(const std::vector<std::string> &code) { std::vector<std::string> toks = utils::strTok(code[this->pc()], ' '); if (toks[0] == "acc") { this->_acc += utils::toInt(toks[1]); this->_pc++; } else if (toks[0] == "nop") { this->_pc++; } else if (toks[0] == "jmp") { this->_pc += utils::toInt(toks[1]); } else { ERR(("Not supported opcode '%s'!", toks[0].c_str())); abort(); } if (this->_breakpoint >= 0) { if (this->_pc == this->_breakpoint) { throw BreakpointException(); } } } void Computer::run(const std::vector<std::string> &code) { while (this->pc() < code.size()) { this->tick(code); } } void Computer::setBreakpoint(int pc) { this->_breakpoint = pc; }
[ "jaroslaw.bielski@7bulls.com" ]
jaroslaw.bielski@7bulls.com
4e99d0bd66f2bf2bf50ac20dd295a83edc64a85d
2124d0b0d00c3038924f5d2ad3fe14b35a1b8644
/analysis/NuclMed/SOE/include/CEvent.h
360f612e9c652ca45d0594158a6a6210f6fb80a0
[]
no_license
arceciemat/GAMOS
2f3059e8b0992e217aaf98b8591ef725ad654763
7db8bd6d1846733387b6cc946945f0821567662b
refs/heads/master
2023-07-08T13:31:01.021905
2023-06-26T10:57:43
2023-06-26T10:57:43
21,818,258
1
0
null
null
null
null
UTF-8
C++
false
false
1,600
h
#pragma once #ifndef _SOE_CEVENT__ #define _SOE_CEVENT__ #include "CHit.h" #include "CCone.h" #include "CPETLine.h" #include <map> // #include "boostincludes.h" #include "constants.h" enum EVENT_TYPE { EVENTTYPE_NONE = 0, COMPTON_EVENT, PET_EVENT }; class CEvent { public: CEvent(int in_ID = 0, EVENT_TYPE in_eventType = COMPTON_EVENT); virtual ~CEvent(); // copy and assign constructors CEvent(const CEvent& in_obj); CEvent& operator= (const CEvent& in_obj); // Get/Set methods void Set( const C3Vector& in_hitPosition1, const double& in_hitE1 , const C3Vector& in_hitPosition2, const double& in_hitE2 ); int GetID() const { return m_ID; } int GetEventType() const { return m_eventType; } inline const CHit& GetHit1() const { return m_hit1; } inline const CHit& GetHit2() const { return m_hit2; } inline double GetHitE1() const { return m_hit1.GetE(); } inline double GetHitE2() const { return m_hit2.GetE(); } const C3Vector& GetHitPosition1() const { return m_hit1.GetPosition(); } const C3Vector& GetHitPosition2() const { return m_hit2.GetPosition(); } // virtual functions virtual bool operator==(const CEvent& in_obj) const; // == virtual bool operator!=(const CEvent& in_obj) const; // != // (De)Serialization virtual void Serialize( std::ostream& outstream ) const; virtual void Deserialize( std::istream& instream ); private: // data int m_ID; int m_eventType; CHit m_hit1; CHit m_hit2; }; typedef std::map<long, CEvent*> CEventMap; #endif
[ "pedro.arce@ciemat.es" ]
pedro.arce@ciemat.es
f108790f81d149aeff57f3573adc801e1def50d1
168758fe0b5ef0d1fe53300890ce20da82caaba9
/src/kernel/pit.cpp
eb8f722db9c0c3f81ed8f8fd134b8a62e181ede4
[]
no_license
jimbob843/purasu
2b3cb559bfd17ed3f20d7e2c480fd242427c17f9
6eeff38214e1d2cd359c45346587528dae17c94e
refs/heads/master
2021-01-01T04:40:55.889119
2016-05-07T13:36:53
2016-05-07T13:36:53
58,266,486
0
0
null
null
null
null
UTF-8
C++
false
false
1,053
cpp
// // Name: pit.cpp // Project: Purasu Operating System // Author: James Smith // Date: 24-May-2014 // Purpose: Programmable Interrupt Timer (PIT) // #include "pit.h" #include "idt.h" #include "console.h" static DWORD tick = 0; static void timer_callback(registers_t regs) { tick++; con_Write("Tick: "); con_WriteDec(tick); con_Write("\n"); } void PITDevice::InitDevice() { DWORD frequency = 50; // 50 ms // Firstly, register our timer callback. idt_RegisterHandler(IRQ_0, &timer_callback); // The value we send to the PIT is the value to divide it's input clock // (1193180 Hz) by, to get our required frequency. Important to note is // that the divisor must be small enough to fit into 16-bits. DWORD divisor = 1193180 / frequency; // Send the command byte. OUTPORT_BYTE(0x43, 0x36); // Divisor has to be sent byte-wise, so split here into upper/lower bytes. BYTE l = (BYTE)(divisor & 0xFF); BYTE h = (BYTE)( (divisor>>8) & 0xFF ); // Send the frequency divisor. OUTPORT_BYTE(0x40, l); OUTPORT_BYTE(0x40, h); }
[ "jsmith@marlet.co.uk" ]
jsmith@marlet.co.uk
59a4b91b5a9b0071fabe4921a862cd00b43fa50d
e45f197f56ec6d81728e7aa857a536db9220f9e4
/SkProjects/GNSS_Viewer_V2/ConSrePorDlg.h
1c555a2bd97eb7eda92e6fb7a903434246d7bebb
[]
no_license
asion0/AsionGitCodes
82bfbaf5bf14eebeb375f3d83ecbcee5c45989ad
7f493fb2a67e053387026a5652fc28f53e76f73c
refs/heads/master
2016-09-10T20:12:25.665716
2013-12-31T09:11:47
2013-12-31T09:11:47
15,427,503
1
2
null
null
null
null
BIG5
C++
false
false
560
h
#pragma once #include "afxwin.h" // CConSrePorDlg 對話方塊 class CConSrePorDlg : public CDialog { DECLARE_DYNAMIC(CConSrePorDlg) public: CConSrePorDlg(CWnd* pParent = NULL); // 標準建構函式 virtual ~CConSrePorDlg(); // 對話方塊資料 enum { IDD = IDD_CON_SRE_POR }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支援 DECLARE_MESSAGE_MAP() public: CComboBox m_comport; CComboBox m_baudrate; virtual BOOL OnInitDialog(); afx_msg void OnBnClickedOk(); U08 messages[10]; CComboBox m_attribute; };
[ "asion.lin@gmail.com" ]
asion.lin@gmail.com
705b41e590ad96c22bea0f9cc6fec4ecbf649c04
e9aa170d98e825fd624abb73cd019c5349e8be6b
/dialog.h
553502328e12a1ebd6e14d21edaf27a3709d39ea
[]
no_license
ronaldnoronha/9220Pool1
2e029c66e91906772d5a36aae9635bc6ddc31448
843eff8573d28f3e02ed57eda302e84068b2ee9c
refs/heads/master
2020-03-09T15:15:08.375255
2018-04-10T14:26:23
2018-04-10T14:26:23
128,854,473
0
0
null
null
null
null
UTF-8
C++
false
false
449
h
#ifndef DIALOG_H #define DIALOG_H #include "ball.h" #include <QDialog> #include <QTimer> #include <QPainter> #include <iostream> namespace Ui { class Dialog; } class Dialog : public QDialog { Q_OBJECT public: explicit Dialog(QWidget *parent = 0); ~Dialog(); protected: void paintEvent(QPaintEvent *); private: Ui::Dialog *ui; Ball m_ball; int m_counter; public slots: void nextFrame(); }; #endif // DIALOG_H
[ "rnor3536@uni.sydney.edu.au" ]
rnor3536@uni.sydney.edu.au
3b23199a1807203ad0d69598a6babf4d0d060d9c
9932f630351e1838a30c182a3d8f1afa212abcf4
/TeraGateServer_New/TeraGateServer_New/main.cpp
2badfa32c9597d6826cb5bd0c9129c644dcb933c
[]
no_license
xlskrp12/TeraGate
14e43df820cae8acffdc51346caec5f1302e8c8e
83c49cbcca4ec90da98962773cfee86d92295d19
refs/heads/master
2021-01-12T01:42:27.624606
2018-02-12T01:56:05
2018-02-12T01:56:05
78,419,373
0
1
null
null
null
null
UHC
C++
false
false
13,837
cpp
#include "stdafx.h" HANDLE hIocp; bool isShutdown = false; //#define _PacketDef PACKET::GetInstance() WorldData worldData[NUM_OF_OBJECT]; // npc, object 확인용 const bool isNPC(const int id) { if (id < MAX_USER) return false; else if (id > NUM_OF_NPC_AND_PLAYER) return false; return true; } const bool isObject(const int id) { if (id > NUM_OF_NPC_AND_PLAYER) return true; return false; } //패킷 보내기 void SendPacket(int id, unsigned char *packet) { OverlappedEx *over = new OverlappedEx; memset(over, 0, sizeof(OverlappedEx)); over->operation = OP_SEND; over->wsabuf.buf = reinterpret_cast<CHAR *>(over->iocpBuffer); over->wsabuf.len = packet[0]; memcpy(over->iocpBuffer, packet, packet[0]); int retval = WSASend(worldData[id].s, &over->wsabuf, 1, NULL, 0, &over->originalOverlapped, NULL); if (0 != retval) { int errNo = WSAGetLastError(); errDisplay("SendPacket:WSASend", errNo); cout << id << "번 에서 오류" << endl; while (true); } } void SendPutPlayerPacket(int id, int object) { sc_packet_put_player packet; //memset(&packet,0, sizeof(packet)); packet.id = object; packet.size = sizeof(packet); packet.type = SC_PUT_PLAYER; packet.x = worldData[object].obj.getPosX(); packet.y = worldData[object].obj.getPosY(); packet.z = worldData[object].obj.getPosZ(); packet.roty = worldData[object].obj.getRotY(); packet.teamId = worldData[object].obj.getTeamId(); cout << object << endl; SendPacket(id, reinterpret_cast<unsigned char *>(&packet)); } void SendRemovePlayerPacket(int id, int object) { sc_packet_remove_player packet; packet.id = object; packet.size = sizeof(packet); packet.type = SC_REMOVE_PLAYER; SendPacket(id, reinterpret_cast<unsigned char *>(&packet)); } void SendAttackPacket(int id) { } void LoginPlayer(int id) { cout << id << " 번 player 로그인" << endl; worldData[id].packetSize = 0; worldData[id].previousSize = 0; memset(&worldData[id].recvOverlap.originalOverlapped, 0, sizeof(worldData[id].recvOverlap.originalOverlapped)); worldData[id].recvOverlap.operation = OP_RECV; worldData[id].recvOverlap.wsabuf.buf = reinterpret_cast<CHAR *>(worldData[id].recvOverlap.iocpBuffer); worldData[id].recvOverlap.wsabuf.len = sizeof(worldData[id].recvOverlap.iocpBuffer); worldData[id].vlLock.lock(); worldData[id].viewList.clear(); worldData[id].vlLock.unlock(); worldData[id].vlLock.lock(); sc_packet_put_player enterPacket; enterPacket.id = id; enterPacket.size = sizeof(enterPacket); enterPacket.type = SC_PUT_PLAYER; enterPacket.x = worldData[id].obj.getPosX(); enterPacket.y = worldData[id].obj.getPosY(); enterPacket.z = worldData[id].obj.getPosZ(); enterPacket.roty = worldData[id].obj.getRotY(); enterPacket.teamId = worldData[id].obj.getTeamId(); worldData[id].vlLock.unlock(); SendPacket(id, reinterpret_cast<unsigned char *>(&enterPacket)); for (auto i = 0; i < MAX_USER; ++i) { if (false == worldData[i].connected) continue; if (i == id) continue; worldData[i].vlLock.lock(); worldData[i].viewList.insert(id); worldData[i].vlLock.unlock(); SendPacket(i, reinterpret_cast<unsigned char *>(&enterPacket)); } worldData[id].connected = true; cout << id << "connected in login" << endl; } void LogoutPlayer(int id) { } void DBThreadStart() { } // 로그인 관련 및 DB관련 void TimerThread() { } //npc관련 및 pc공격과 충돌체크등의 처리를 맡음 void Initialize() { //MinionTimerSet(); //_PacketDef->Init(); int radius = 0; int radian = 0; //for (int i = 0; i < NUM_OF_OBJECT; i++) //{ // worldData[i].previousSize = 0; // worldData[i].packetSize = 0; // ZeroMemory(worldData[i].packetBuf, sizeof(worldData[i].packetBuf)); //} for (auto i = 0; i < MAX_USER; i++) { worldData[i].connected = false; worldData[i].recvOverlap.operation = OP_RECV; worldData[i].obj.setHP(PLAYER_HP); worldData[i].obj.setMaxHP(PLAYER_HP); worldData[i].obj.setMovement(30.0f); radius = 2800; if (i % 2 == 0) { radian = DEGREE_TO_RADIAN(210); worldData[i].obj.setPos(radius*cos(radian), 0.f, radius*sin(radian)); worldData[i].obj.setRotY(0.f); worldData[i].obj.setTeam(TEAM_L); } else { radian = DEGREE_TO_RADIAN(-30); worldData[i].obj.setPos(radius*cos(radian), 0.f, radius*sin(radian)); worldData[i].obj.setRotY(0.f); worldData[i].obj.setTeam(TEAM_R); } worldData[i].recvOverlap.wsabuf.buf = reinterpret_cast<CHAR *>(worldData[i].recvOverlap.iocpBuffer); worldData[i].recvOverlap.wsabuf.len = sizeof(worldData[i].recvOverlap.iocpBuffer); cout << i << " 번 초기화 완료" << endl; } for (auto i = MAX_USER; i < NUM_OF_NPC_AND_PLAYER; i++) { worldData[i].connected = false; } for (auto i = NUM_OF_NPC_AND_PLAYER; i < NUM_OF_NPC_AND_PLAYER + NUM_OF_TOWER; i++) { worldData[i].connected = false; } for (auto i = NUM_OF_NPC_AND_PLAYER + NUM_OF_TOWER; i < NUM_OF_OBJECT; i++) { worldData[i].connected = false; } _wsetlocale(LC_ALL, L"korean"); WSADATA wsa; WSAStartup(MAKEWORD(2, 2), &wsa); hIocp = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, NULL, 0); } // 초기화 void ProcessPacket(int id, unsigned char buf[]) { D3DXVECTOR3 _pos = worldData[id].obj.getPos(); float roty = worldData[id].obj.getRotY(); float movement = worldData[id].obj.getMovement(); switch (buf[1]) { case CS_LOGIN: { //_PacketDef->LoginPlayer(id); LoginPlayer(id); } break; case CS_RIGHT_UP: { roty = 45; _pos.x += movement * sin(DEGREE_TO_RADIAN(roty)); _pos.z += movement * cos(DEGREE_TO_RADIAN(roty)); } break; case CS_LEFT_UP: { roty = -45; _pos.x += movement * sin(DEGREE_TO_RADIAN(roty)); _pos.z += movement * cos(DEGREE_TO_RADIAN(roty)); } break; case CS_RIGHT_DOWN: { roty = 135; _pos.x += movement * sin(DEGREE_TO_RADIAN(roty)); _pos.z += movement * cos(DEGREE_TO_RADIAN(roty)); } break; case CS_LEFT_DOWN: { roty = -135; _pos.x += movement * sin(DEGREE_TO_RADIAN(roty)); _pos.z += movement * cos(DEGREE_TO_RADIAN(roty)); } break; case CS_UP: { roty = 0; _pos.x += movement * sin(DEGREE_TO_RADIAN(roty)); _pos.z += movement * cos(DEGREE_TO_RADIAN(roty)); } break; case CS_DOWN: { roty = -180; _pos.x += movement * sin(DEGREE_TO_RADIAN(roty)); _pos.z += movement * cos(DEGREE_TO_RADIAN(roty)); } break; case CS_LEFT: { roty = 90; _pos.x += movement * sin(DEGREE_TO_RADIAN(roty)); _pos.z += movement * cos(DEGREE_TO_RADIAN(roty)); } break; case CS_RIGHT: { roty = -90; _pos.x += movement * sin(DEGREE_TO_RADIAN(roty)); _pos.z += movement * cos(DEGREE_TO_RADIAN(roty)); } break; case CS_FIRE: { } break; case CS_ATTACK: { } break; case CS_SKILL_E: { } break; case CS_SHIFT_DOWN: { } break; case CS_SHIFT_UP: { } break; default: cout << "Unknown type packet received\n"; while (true); } cout << _pos.x << " , " << _pos.z << endl; // PC 이동 처리 //_PacketDef->SetWorldDataRotY(id, roty); worldData[id].obj.setPos(_pos.x, _pos.y, _pos.z); if (CS_LEFT_UP == buf[1] || CS_RIGHT_DOWN == buf[1]) { roty += 180; } if (CS_UP == buf[1] || CS_DOWN == buf[1]) { roty += 90; } else if (CS_LEFT == buf[1] || CS_RIGHT == buf[1]) { roty -= 90; } worldData[id].obj.setRotY(roty); sc_packet_pos movPacket; movPacket.id = id; movPacket.size = sizeof(movPacket); movPacket.type = SC_POS; movPacket.x = _pos.x; movPacket.y = _pos.y; movPacket.z = _pos.z; movPacket.roty = roty; SendPacket(id, reinterpret_cast<unsigned char *>(&movPacket)); // 모든 클라이언트에 뿌려주기 unordered_set<int> newList; for (auto i = 0; i < MAX_USER; ++i) { if (false == worldData[i].connected) continue; if (i == id) continue; newList.insert(i); } for (auto i : newList) { worldData[id].vlLock.lock(); if (0 == worldData[id].viewList.count(i)) { worldData[id].viewList.insert(i); worldData[id].vlLock.unlock(); SendPutPlayerPacket(id, i); worldData[i].vlLock.lock(); if (0 == worldData[i].viewList.count(id)) { worldData[i].viewList.insert(id); worldData[i].vlLock.unlock(); SendPutPlayerPacket(i, id); } else { worldData[i].vlLock.unlock(); SendPacket(i, reinterpret_cast<unsigned char *>(&movPacket)); } } else { worldData[id].vlLock.unlock(); worldData[i].vlLock.lock(); if (0 != worldData[i].viewList.count(id)) { worldData[i].viewList.insert(id); worldData[i].vlLock.unlock(); SendPutPlayerPacket(i, id); } else { worldData[i].vlLock.unlock(); SendPacket(i, reinterpret_cast<unsigned char *>(&movPacket)); } } } unordered_set<int> removeList; worldData[id].vlLock.lock(); for (auto i : worldData[id].viewList) { if (0 != newList.count(i)) continue; removeList.insert(i); } for (auto i : removeList) worldData[id].viewList.erase(i); worldData[id].vlLock.unlock(); for (auto i : removeList) { SendRemovePlayerPacket(id, i); } for (auto i : removeList) { if (true == isNPC(i)) continue; if (true == isObject(i)) continue; worldData[i].vlLock.lock(); if (0 != worldData[i].viewList.count(id)) { worldData[i].viewList.erase(id); worldData[i].vlLock.unlock(); SendRemovePlayerPacket(i, id); } else worldData[i].vlLock.unlock(); } } // PC의 움직임 처리 void WorkerThreadStart() { while (0 == isShutdown) { DWORD ioSize; DWORD key; OverlappedEx *myOverlap; BOOL result = GetQueuedCompletionStatus(hIocp, &ioSize, &key, reinterpret_cast<LPOVERLAPPED *>(&myOverlap), INFINITE); if (0 == ioSize) { //_PacketDef->SocketClose(key); sc_packet_remove_player disConnected; disConnected.id = key; disConnected.size = sizeof(disConnected); disConnected.type = SC_REMOVE_PLAYER; for (auto i = 0; i < MAX_USER; ++i) { if (false == worldData[i].connected) continue; if (key == i) continue; SendPacket(i, reinterpret_cast<unsigned char*>(&disConnected)); } worldData[key].connected = false; cout << key << "removed" << endl; } if (OP_RECV == myOverlap->operation) { unsigned char *bufPtr = worldData[key].recvOverlap.iocpBuffer; int remained = ioSize; while (0 < remained) { if (0 == worldData[key].packetSize) worldData[key].packetSize = bufPtr[0]; int required = worldData[key].packetSize - worldData[key].previousSize; if (remained >= required) { memcpy(worldData[key].packetBuf + worldData[key].previousSize, bufPtr, required); ProcessPacket(key, worldData[key].packetBuf); bufPtr += required; remained -= required; cout << remained << endl; worldData[key].packetSize = 0; worldData[key].previousSize = 0; } else { memcpy(worldData[key].packetBuf + worldData[key].previousSize, bufPtr, remained); bufPtr += remained; worldData[key].previousSize += remained; remained = 0; } } DWORD flags = 0; WSARecv(worldData[key].s, &worldData[key].recvOverlap.wsabuf, 1, NULL, &flags, &worldData[key].recvOverlap.originalOverlapped, NULL); } else if (OP_SEND == myOverlap->operation) { delete myOverlap; } else if (OP_MOVE == myOverlap->operation) { delete myOverlap; } else { cout << "Unknown IOCP Event\n"; exit(-1); } } } // 항상 처리되는 스레드 void AcceptThreadStart() { struct sockaddr_in listen_addr; SOCKET acceptSocket = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, WSA_FLAG_OVERLAPPED); memset(&listen_addr, 0, sizeof(listen_addr)); listen_addr.sin_family = AF_INET; listen_addr.sin_addr.s_addr = htonl(ADDR_ANY); listen_addr.sin_port = htons(MY_SERVER_PORT); ::bind(acceptSocket, reinterpret_cast<sockaddr *>(&listen_addr), sizeof(listen_addr)); listen(acceptSocket, 10); while (false == isShutdown) { struct sockaddr_in client_addr; int addrSize = sizeof(client_addr); SOCKET newClient = WSAAccept(acceptSocket, reinterpret_cast<sockaddr *>(&client_addr), &addrSize, NULL, NULL); printf("\n client access\n"); if (INVALID_SOCKET == newClient) { int errNO = WSAGetLastError(); errDisplay("Accept::WSAAccept", errNO); while (true); } int newID = -1; for (auto i = 0; i < MAX_USER; ++i) { if (false == worldData[i].connected) { newID = i; break; } } if (-1 == newID) { cout << "MAX concurrent User excceded\n"; closesocket(newClient); cout << "close socket" << endl; continue; } cout << newID << endl; worldData[newID].s = newClient; cout << newID << " accept" << endl; CreateIoCompletionPort(reinterpret_cast<HANDLE>(newClient), hIocp, newID, 0); DWORD flags = 0; int retval = WSARecv(newClient, &worldData[newID].recvOverlap.wsabuf, 1, NULL, &flags, &worldData[newID].recvOverlap.originalOverlapped, NULL); if (0 != retval) { int errNo = WSAGetLastError(); if (WSA_IO_PENDING != errNo) errDisplay("Accept::WSARecv", errNo); } } } // 서버에 클라를 연결할때 사용하는 스레드 void cleanUp() { WSACleanup(); } int main() { wcout.imbue(std::locale("kor")); vector<thread *> workerThread; Timer timer; Initialize(); for (auto i = 0; i < NUM_THREADS; ++i) { workerThread.push_back(new thread{ WorkerThreadStart }); } thread timerThread{ TimerThread }; thread acceptThread{ AcceptThreadStart }; thread DBThread{ DBThreadStart }; while (false == isShutdown) { if (timer.isOn()) {} } for (auto th : workerThread) { th->join(); delete th; } timerThread.join(); acceptThread.join(); DBThread.join(); cleanUp(); return 0; }
[ "xlskrp@gmail.com" ]
xlskrp@gmail.com
245dfaa7fa0fec071d96a2dd396a67fa24de6322
68da2c756b091a117f72f739b79f0df36e5d6ef0
/GeneratedFiles/ui_heatview.h
5906804b826072340dbb146a56d34fc3743ccf70
[]
no_license
SobolevSpace/xUnitTestDemo
01797b95338ab0ffe4b5ad2f9f573a19c22e4700
e6c8771effd83d3b23d39eef6106bd4f1dc666c0
refs/heads/master
2020-06-16T14:05:37.990686
2019-07-14T01:20:20
2019-07-14T01:20:20
195,602,458
0
0
null
2019-07-14T01:20:21
2019-07-07T02:42:14
C++
UTF-8
C++
false
false
1,627
h
/******************************************************************************** ** Form generated from reading UI file 'heatview.ui' ** ** Created by: Qt User Interface Compiler version 5.9.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_HEATVIEW_H #define UI_HEATVIEW_H #include <QtCore/QVariant> #include <QtWidgets/QAction> #include <QtWidgets/QApplication> #include <QtWidgets/QButtonGroup> #include <QtWidgets/QHeaderView> #include <QtWidgets/QSlider> #include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE class Ui_HeatView { public: QSlider *SliderSelectTime; void setupUi(QWidget *HeatView) { if (HeatView->objectName().isEmpty()) HeatView->setObjectName(QStringLiteral("HeatView")); HeatView->resize(400, 419); SliderSelectTime = new QSlider(HeatView); SliderSelectTime->setObjectName(QStringLiteral("SliderSelectTime")); SliderSelectTime->setGeometry(QRect(0, 400, 400, 17)); SliderSelectTime->setMaximum(400); SliderSelectTime->setOrientation(Qt::Horizontal); retranslateUi(HeatView); QMetaObject::connectSlotsByName(HeatView); } // setupUi void retranslateUi(QWidget *HeatView) { HeatView->setWindowTitle(QApplication::translate("HeatView", "Form", Q_NULLPTR)); } // retranslateUi }; namespace Ui { class HeatView: public Ui_HeatView {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_HEATVIEW_H
[ "noreply@github.com" ]
noreply@github.com
4ebb871b8904d3b6f1cc4e12517b7e7c83f7849b
53f0935ea44e900e00dc86d66f5181c5514d9b8e
/acsl/intermediate/all-star/Octohex.cpp
1dcc4aceb4f95c9f715c9e07d523a19aae4b09fb
[]
no_license
losvald/algo
3dad94842ad5eb4c7aa7295e69a9e727a27177f6
26ccb862c4808f0d5970cee4ab461d1bd4cecac6
refs/heads/master
2016-09-06T09:05:57.985891
2015-11-05T05:13:19
2015-11-05T05:13:19
26,628,114
0
1
null
null
null
null
UTF-8
C++
false
false
281
cpp
#include <string.h> #include <stdio.h> #include <ctype.h> #include <stdlib.h> #include <conio.h> #include <iostream.h> #include <iomanip.h> int main() { long long int a, b; scanf("%llo %llo", &a, &b); printf("%llx", a*b); getch(); return 0; }
[ "leo.osvald@gmail.com" ]
leo.osvald@gmail.com
96de933134b4b5f6c4ce2475b21e64846ebdc9e9
cf903c879aa07d59fdc9bb6e0d0217e03d4f03d7
/PA/Tema2/poduri.cpp
2f3a7cf39bb1a6dd95beae435d6f0a8fb7bf77c3
[]
no_license
GeorgeF23/Teme_anul2
644ed9bd9a495ef0ac769436ee04e23be67a0ff0
6605ba4f72b026d01e9c191e4a61f036b0096537
refs/heads/master
2023-05-04T07:45:12.562954
2021-05-24T12:21:59
2021-05-24T12:21:59
314,865,799
0
0
null
null
null
null
UTF-8
C++
false
false
4,026
cpp
#include <bits/stdc++.h> using namespace std; /** * @brief Verifica daca o coordonata e pe uscat * @note * @param x: linia * @param y: coloana * @param n: numarul total de linii * @param m: numarul total de coloane * @retval */ bool is_finish(int x, int y, int n, int m) { return (x == 0 || x == n + 1 || y == 0 || y == m + 1); } /** * @brief Calculeaza distanta minima pana la tarm * @note * @param x: linia initiala * @param y: coloana initiala * @param grid: harta * @param n: numarul de linii * @param m: numarul de coloane * @retval distanta minima */ int shortest_path(int x, int y, vector<vector<char>> grid, int n, int m) { queue<pair<int, int>> q; vector<vector<int>> dist(n + 2, vector<int>(m + 2, 0)); q.push(make_pair(x, y)); dist[x][y] = 0; while (!q.empty()) { pair<int, int> pos = q.front(); int current_dist = dist[pos.first][pos.second]; // Verifica daca pozitia e pe mal if (is_finish(pos.first, pos.second, n, m)) { return current_dist; } pair<int, int> move_aux; if (grid[pos.first][pos.second] == 'V') { // Adauga pozitiile de pe verticala move_aux = make_pair(pos.first + 1, pos.second); if (grid[move_aux.first][move_aux.second] != '.') { q.push(move_aux); dist[move_aux.first][move_aux.second] = current_dist + 1; } move_aux = make_pair(pos.first - 1, pos.second); if (grid[move_aux.first][move_aux.second] != '.') { q.push(move_aux); dist[move_aux.first][move_aux.second] = current_dist + 1; } } else if (grid[pos.first][pos.second] == 'O') { // Adauga pozitiile de pe orizontala move_aux = make_pair(pos.first, pos.second + 1); if (grid[move_aux.first][move_aux.second] != '.') { q.push(move_aux); dist[move_aux.first][move_aux.second] = current_dist + 1; } move_aux = make_pair(pos.first, pos.second - 1); if (grid[move_aux.first][move_aux.second] != '.') { q.push(move_aux); dist[move_aux.first][move_aux.second] = current_dist + 1; } } else if (grid[pos.first][pos.second] == 'D') { // Adauga pozitiile de pe orizontala si verticala move_aux = make_pair(pos.first + 1, pos.second); if (grid[move_aux.first][move_aux.second] != '.') { q.push(move_aux); dist[move_aux.first][move_aux.second] = current_dist + 1; } move_aux = make_pair(pos.first - 1, pos.second); if (grid[move_aux.first][move_aux.second] != '.') { q.push(move_aux); dist[move_aux.first][move_aux.second] = current_dist + 1; } move_aux = make_pair(pos.first, pos.second + 1); if (grid[move_aux.first][move_aux.second] != '.') { q.push(move_aux); dist[move_aux.first][move_aux.second] = current_dist + 1; } move_aux = make_pair(pos.first, pos.second - 1); if (grid[move_aux.first][move_aux.second] != '.') { q.push(move_aux); dist[move_aux.first][move_aux.second] = current_dist + 1; } } // Marcheaza pozitia ca fiind vizitata si scoate din coada grid[pos.first][pos.second] = '.'; q.pop(); } return -1; } int main() { ifstream in; ofstream out; in.open("poduri.in"); out.open("poduri.out"); // Read input int n, m, x, y; in >> n >> m >> x >> y; vector<vector<char>> grid(n + 2, vector<char>(m + 2, 0)); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { in >> grid[i][j]; } } out << shortest_path(x, y, grid, n, m); in.close(); out.close(); return 0; }
[ "floareageorge@gmail.com" ]
floareageorge@gmail.com
00f31d0a7b10672463aea93d98b6a0870e98a96b
2088d9eb0de86ea3029645eca35a7eeef7f1b7bc
/算法/有向图强连通.cpp
2e226bcbbbfeba2eee13b8a54e0e5bf4e46adc35
[]
no_license
HLHL1/Algorithm
c6355213c5c07d8e2551eae276c36eb9878001af
f2f8a51c66056a2ef0dfdaed553b15b5464e6d2f
refs/heads/master
2020-03-21T04:37:20.689961
2019-12-22T07:49:40
2019-12-22T07:49:40
138,118,556
0
0
null
null
null
null
GB18030
C++
false
false
3,080
cpp
#include<iostream> #include<algorithm> #include<queue> #include<cstdio> #include<cstring> using namespace std; void Tarjan ( int x ) { dfn[ x ] = ++dfs_num ; low[ x ] = dfs_num ; vis [ x ] = true ;//是否在栈中 stack [ ++top ] = x ; for ( int i=head[ x ] ; i!=0 ; i=e[i].next ){ int temp = e[ i ].to ; if ( !dfn[ temp ] ){ Tarjan ( temp ) ; low[ x ] = gmin ( low[ x ] , low[ temp ] ) ; } else if ( vis[ temp ])low[ x ] = gmin ( low[ x ] , dfn[ temp ] ) ; } if ( dfn[ x ]==low[ x ] ) {//构成强连通分量 vis[ x ] = false ; color[ x ] = ++col_num ;//染色 while ( stack[ top ] != x ) {//清空 color [stack[ top ]] = col_num ; vis [ stack[ top-- ] ] = false ; } top -- ; } } /* Sample Input 3 3 1 2 2 1 2 3 Sample Output 1 */ #include<iostream> #include<algorithm> #include<queue> #include<cstdio> #include<cstring> using namespace std; const int maxn = 50100; /* 7 9 1 3 1 2 3 5 5 6 7 7 4 6 3 4 4 1 2 4 */ struct EDGE{ int next, to, w; }edge[maxn << 4]; int head[maxn]; int cnt,dfn[maxn],low[maxn],vis[maxn],Stack[maxn],color[maxn]; int dfs_num,top,col_num; void init_add(){ cnt = 0; memset(head, -1, sizeof(head)); } void add(int u, int v){ edge[cnt].next = head[u]; edge[cnt].to = v; head[u] = cnt++; } void init_Tarjan() { dfs_num = 0; top = 0; col_num = 0; memset(dfn, 0, sizeof(dfn)); memset(low, 0, sizeof(low)); memset(vis,false , sizeof(vis)); memset(Stack, 0, sizeof(Stack)); memset(color, 0, sizeof(color)); } void Tarjan(int x) { dfn[x] = ++dfs_num; low[x] = dfs_num; vis[x] = true;//是否在栈中 Stack[++top] = x; for (int i = head[x]; i != -1; i = edge[i].next){ int temp = edge[i].to; if (!dfn[temp]){ Tarjan(temp); low[x] = min(low[x], low[temp]); } else if (vis[temp]) low[x] = min(low[x], dfn[temp]); } if (dfn[x] == low[x]) {//构成强连通分量 vis[x] = false; color[x] = ++col_num;//染色 while (Stack[top] != x) {//清空 color[Stack[top]] = col_num; vis[Stack[top--]] = false; } top--; } } int main() { int n, m; scanf("%d%d", &n, &m); init_add(); for (int i = 0; i < m; i++) { int u, v; scanf("%d%d", &u, &v); add(u, v); } init_Tarjan(); for (int i = 1; i <= n; i++) { if (!color[i]) { Tarjan(i); } } int dgree[maxn] = { 0 }; for (int i = 1; i <= n; i++) { for (int u = head[i]; u != -1; u = edge[u].next) { if (color[i] != color[edge[u].to]) { dgree[color[i]]++; } } } int ret = 0,flag=0,kk; for (int i = 1; i <=col_num ; i++) { if (dgree[i] == 0) { flag++; kk = i; } } if (flag > 1 || flag == 0) { ret = 0; } else { for (int j = 1; j <= n; j++) { if (color[j] == kk) { ret++; } } } printf("%d\n", ret); system("pause"); return 0; }
[ "1716903153@qq.com" ]
1716903153@qq.com
505963771591ab7a15142168b159186b0f3b4ba2
e8281ca4ab4e1f2ea635dd0d85a5e56e7f469e5b
/TIVS/666-IVS(OpenCV)-GPO/IVS/Batch_manager.h
ff54dec97428a0f20b2cf96ee3de7915c27baea6
[]
no_license
majkyun888/C-Pro
287aaa0ca981e935820384bf55c66e1976d76f93
92482ebc097c904852fbb3128fd9e30689d70ea3
refs/heads/master
2021-08-14T10:18:37.934296
2021-08-11T00:16:01
2021-08-11T00:16:01
208,016,334
0
2
null
null
null
null
UTF-8
C++
false
false
4,336
h
#pragma once #include "stdafx.h" #include "hpdf.h" #include "Recipe_manager.h" #include "Globals.h" #include "Def_globali.h" #include "File_mngmt.h" //Pour added 20190328 #include "afx.h" /* #include "afx.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> #include <setjmp.h> #include "hpdf.h" */ #define TEXT_MODE_LEFT 1 #define TEXT_MODE_CENTER 2 #define TEXT_MODE_RIGHT 4 #define TEXT_MODE_LEFTRIGHT 8 // two texts: one to left, one to right #define VERT_STEP 15 #define VERT_STEP2 25 #define POS_X_ZERO 80 #define ALIGN_LEFT 150 #define ALIGN_RIGHT 410 #define N_MAX_PAGE 50 #define EDGE 110 #define MAXLEN_BATCH_TXT 100 #define MAX_RECIPE_LEN 50 class CBatch_manager : public CDialog { DECLARE_DYNAMIC(CBatch_manager) public: CBatch_manager(CWnd* pParent = NULL); // standard constructor virtual ~CBatch_manager(); // Dialog Data enum { IDD = IDD_BATCH_DIALOG }; int read_string( wchar_t* buffer, wchar_t* caption ); int Load_data(void); int Save_data(void); int Create_report(void); int Grippers_statistics(void); //Pour added 20190328 //=============== int Create_HGA_report(int lang); // make pdf format HGA data int Create_Log_pdf( int lang ,int type); // make pdf format Log data int Create_Log_pdf( int lang, CTime &save_time); // make pdf format log data,xinchang int Create_AlarmLog_pdf( int lang, CTime &save_time); // make pdf format log data,xinchang //Pour added 20190222 int Txt2pdf(); //Pour added 20190220 for transfer alarm log int Txt2pdf_alarm(); //=============== //Pour added 20190328 struct batch_data { int status; // 0=not running - 1=batch active wchar_t recipe[MAX_RECIPE_LEN+1]; // current recipe name wchar_t oper[MAXLEN_BATCH_TXT+1]; wchar_t name[MAXLEN_BATCH_TXT+1]; wchar_t code[MAXLEN_BATCH_TXT+1]; wchar_t desc[MAXLEN_BATCH_TXT+1]; CTime start_time; CTime end_time; } current; protected: HPDF_Doc pdf; HPDF_Font font; HPDF_Page page; char current_code[100]; char file_name[100]; char full_name[100]; int num_pages; int pdf_lng; // pdf language // strings to store font name and encoding used for pdf // char fontname[50]; // char encoding[50]; char* fontname; char* encoding; UINT codepage; // char encoding[100]; float posx; float posy; float page_dimx; float page_dimy; float left_margin; float right_margin; float top_margin; float bottom_margin; float row_height; //Pour added 20180903 float line_length; int n_prod_in; char *time2txt( CTime* time, int format=0 ); int Create_pdf( int lang ); int Create_grippers_report( int lang ); int Add_statistic( char* varname, char** string ); int Add_statistic( char* varname, wchar_t** string ); int gripper_read( char* varname, char* string, UINT* totisp, UINT* totrej ); int Add_text( const char* txt, int mode ); int Add_text( const char* txt1, const char* txt2, int mode ); int Add_text( const wchar_t* txt, int mode ); int Add_text( const wchar_t* txt1, const char* txt2, int mode ); int Add_text( const wchar_t* txt1, const wchar_t* txt2, int mode ); // int Add_text( const wchar_t* txt, int mode ); int Add_new_page( int npg ); //Pour added 20190328 // -------------------- //new code for HGA and LOG int Add_HGA_new_page( int npg,int tpg ); int Add_Log_new_page( int npg ); //--------------------- //Pour added 20190328 int Create_page_0 ( void ); // int Create_page_0_LQ( void ); // int Create_page_0_FD( void ); void DrawPageNumber ( HPDF_Page page, float x, float y, const char* label ); //void InsertBatchData( HPDF_Page page, char* txtL, char* txtR, int dim, int nDec, int posY); //void GetDataAndTimeFromFile( char* deststring ); virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support DECLARE_MESSAGE_MAP() public: virtual void OnOK(); virtual void OnCancel(); afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); afx_msg void OnStnClickedBatchcodeVal(); afx_msg void OnStnClickedBatchoperVal(); afx_msg void OnStnClickedBatchnameVal(); afx_msg void OnStnClickedBatchdescVal(); };
[ "majkyun@163.com" ]
majkyun@163.com
0b0db5b51229da9f6ae43cb8281103f855fe02cd
b3465a4bebc12c8f4eabad301c343c5c9694afdf
/007-Factory/devicefactory/Project/IOontroller.h
20f5f77822c2d7586d98058f3de183f311fcc1ca
[]
no_license
dincerunal/design_patterns
fc7be618986b110078deb010fd74d55ca981662f
243933001dcd12aaa65dbfeb600252eddcac72c2
refs/heads/main
2023-05-13T20:20:29.953153
2021-06-02T14:00:14
2021-06-02T14:00:14
372,414,976
1
0
null
null
null
null
UTF-8
C++
false
false
247
h
#pragma once #include "Device.h" class IOController : public Device { public: IOController(const std::string &name, const std::string &protocol) : Device(name, protocol) {} void sendAlarm(const std::string &alarm) override; private: //... };
[ "noreply@github.com" ]
noreply@github.com
ff7beaff49babe209f010eaa6c6a20494d78a356
c9cdb8772eb74c832b703624f6395f1e8b84c09e
/CCore/src/CancelPacketList.cpp
01398d8bed6fd62c1bcac7deab94e9eaab50ba10
[ "BSL-1.0" ]
permissive
SergeyStrukov/CCore
70799f40d0ecfec75ab9298f60e7396413931800
509bd439ae5621603f9fbe8e8b3ca03721ac283b
refs/heads/master
2021-01-17T17:01:19.899215
2015-08-12T18:41:25
2015-08-12T18:41:25
3,891,233
6
1
null
null
null
null
UTF-8
C++
false
false
2,952
cpp
/* CancelPacketList.cpp */ //---------------------------------------------------------------------------------------- // // Project: CCore 1.02 // // Tag: General // // License: Boost Software License - Version 1.0 - August 17th, 2003 // // see http://www.boost.org/LICENSE_1_0.txt or the local copy // // Copyright (c) 2010 Sergey Strukov. All rights reserved. // //---------------------------------------------------------------------------------------- #include <CCore/inc/CancelPacketList.h> #include <CCore/inc/Abort.h> namespace CCore { /* class CancelPacketList */ const char * GetTextDesc(CancelPacketList::Event ev) { static const char *const Table[]= { "Cancelled", "Cancelled on put", "" }; return Table[ev]; } void CancelPacketList::cancel(PacketHeader *packet) { { Mutex::Lock lock(mutex); if( PacketList *list=*packet->getExt<PacketList *>() ) list->del(packet); stat.count(Event_cancel); } packet->popExt<PacketList *>(); packet->complete(); } CancelPacketList::CancelPacketList() : mutex("CancelPacketList") { } CancelPacketList::CancelPacketList(TextLabel name) : mutex(name) { } CancelPacketList::~CancelPacketList() { } void CancelPacketList::getStat(StatInfo &ret) { Mutex::Lock lock(mutex); ret=stat; } bool CancelPacketList::try_put(PacketList &list,PacketHeader *packet) { Mutex::Lock lock(mutex); if( packet->setCancelFunction(function_cancel())==Packet_NoCancelFunction ) { packet->pushExt<PacketList *>(&list); list.put(packet); return true; } stat.count(Event_cancel_on_put); return false; } void CancelPacketList::put(PacketList &list,PacketHeader *packet) { if( !try_put(list,packet) ) packet->complete(); } PacketHeader * CancelPacketList::get(PacketList &list) { for(;;) { Mutex::Lock lock(mutex); PacketHeader *packet=list.get(); if( !packet ) return 0; if( packet->clearCancelFunction()!=Packet_Cancelled ) { packet->popExt<PacketList *>(); return packet; } else { *packet->getExt<PacketList *>()=0; } } } void CancelPacketList::get(PacketList &list,PacketList &dst) { for(;;) { Mutex::Lock lock(mutex); PacketHeader *packet=list.get(); if( !packet ) return; if( packet->clearCancelFunction()!=Packet_Cancelled ) { packet->popExt<PacketList *>(); dst.put(packet); } else { *packet->getExt<PacketList *>()=0; } } } void CancelPacketList::complete(PacketList &list) { PacketList temp; get(list,temp); temp.complete(); } } // namespace CCore
[ "sshimnick@hotmail.com" ]
sshimnick@hotmail.com
ae4d7a1c99ad594f15224bb66b63394ad5f761b8
cf5b60492f74c289bbda7a79bce04f15f17eb0d6
/字节跳动探索/字符串/4.cpp
93a138838d0834236ff3f1e0e7cbcc945c676013
[]
no_license
RoseAlice2018/Leetcode
8bfcf850baeda0a1be45e08e0b913b933f8bd519
e3c713f3dab13f96efe13949d8b8f3be21a2fe9e
refs/heads/master
2021-07-14T10:51:58.002714
2021-02-09T08:19:37
2021-02-09T08:19:37
290,232,050
1
2
null
null
null
null
UTF-8
C++
false
false
1,238
cpp
#include<iostream> #include<vector> using namespace std; class Solution { public: string multiply(string num1, string num2) { int size1=num1.size(); int size2=num2.size(); string res; if((size1==1&&num1[0]=='0')||(size2==0&&num2[0]=='0')) { res+='0'; return res; } int num[15000]; int maxsize=0; string temp(num1.rbegin(),num1.rend()); int i=0; while(i<size1) { int a=temp[i]-'0'; //mutiply for(int j=0;j<size2;j++) { int b=num2[j]-'0'; int t=a*b+num[i+j]; if(t<10) { num[i+j]+=t; maxsize=i+j; } else { num[i+j]+=t%10; //carry num[i+j+1]+=(t-t%10)/10; maxsize=i+j+1; } } i++; } for( i=0;i<=maxsize;i++) { res+=num[i]+'0'; } return res; } };
[ "40765813+RoseAlice2018@users.noreply.github.com" ]
40765813+RoseAlice2018@users.noreply.github.com
08ea52d6b276906984a416f777adf39849510193
9e81b80feb8407ceeea2949317840d93561f43da
/Hojas de trabajo/HT3_EJERCICIO_01.cpp
1e983050d8e4afee589a8c5bcac6fe7ad3a1b4bf
[]
no_license
aparedesg/Proyecto-Progra1
db6106693a2d398ecfa0ca87f034811c5900b061
ad61920dc6aa211de8083bb61bd50f8be078deae
refs/heads/master
2022-06-02T02:54:09.145777
2020-05-03T01:26:18
2020-05-03T01:26:18
260,804,351
0
0
null
null
null
null
WINDOWS-1250
C++
false
false
4,641
cpp
/*Ejercicio # 1: El presidente de un club de futbol requiere calcular el sueldo de sus jugadores si se tiene como dato la edad y la nacionalidad del jugador. Ademas se sabe que el sueldo se calculara de la siguiente manera: Sueldo fijo $2500.00 Si es extranjero recibe un bono de $500.00 Si la edad esta entre 15 y 20, el salario incrementa en $1400.00 Si la edad esta entre 21 y 25, el salario incrementa en $1500.00 Si la edad esta entre 26 y 30, el salario incrementa en $1200.00 Si la edad es mayor a 30, el salario incrementa en $800.00 Determine el sueldo del jugador si se tiene como datos la edad y nacionalidad. Mostrar un reporte del total a pagar de planilla, así como el total de jugadores por los rangos de edad. Ademas de indicar que rango de edad es el mas remunerado.*/ #include <fstream> #include <iostream> #include <string> using namespace std; //Creo mi Estructura Principal struct planilla{ int edad; int nacionalidad; int sueldo; }; //Llamo a las funciones con las que trabajaré void mp(); void leer_archivo(); void grabar_archivo(); //Dentro del programa mando a llamar al Menú Principal int main(){ mp(); } //Creo mi función del Menú Principal void mp(){ int resp; do { system("CLS"); cout<<"--------------------------"<<"\n"; cout<<" Menu Principal Planilla Club de Futbol"<<"\n"; cout<<"-------------------"<<"\n"; cout<<" 1 - Ingresar Jugador "<<"\n"; cout<<" 2 - Mostrar Planilla "<<"\n"; cout<<" 3 - Salir"<<"\n"; cout<<"--------------------------"<<"\n"; cout<<" Seleccione su opcion: "; cin>>resp; if (resp==1){ system("CLS"); grabar_archivo(); } else if (resp==2){ system("CLS"); leer_archivo(); } else if (resp==3) break; else break; } while(resp!=3); } //Creo mi función para grabar al archivo void grabar_archivo(){ //variables basadas en la estructura int edad_jug; int nacionalidad_jug; int sueldo; fflush(stdin); cout<<"Ingrese Edad del jugador: "<<endl; cin>>edad_jug; fflush(stdin); cout<<"Eres extranjero? 1=Si - 0=No "<<endl; cin>>nacionalidad_jug; //Establezco las condiciones planteadas if (nacionalidad_jug == 1) { if (edad_jug >=15 and edad_jug <= 20){ sueldo=(2500+1400)+500; cout<<sueldo; } else if (edad_jug>=21 and edad_jug <= 25){ sueldo=(2500+1500)+500; cout<<sueldo; }else if (edad_jug>=26 and edad_jug <= 30){ sueldo=(2500+1200)+500; cout<<sueldo; }else if (edad_jug>30){ sueldo=(2500+800)+500; cout<<sueldo; } }else { if (edad_jug>=15 and edad_jug <= 20){ sueldo=(2500+1400); cout<<sueldo; }else if (edad_jug>=21 and edad_jug <= 25){ sueldo=(2500+1500); cout<<sueldo; }else if (edad_jug>=26 and edad_jug <= 30){ sueldo=(2500+1200); cout<<sueldo; }else if (edad_jug>30){ sueldo=(2500+800); cout<<sueldo; } } ofstream archivo; //Agregar archivo archivo.open("planilla.txt",ios::app); //archivo.open(na.c_str(),ios::app); archivo<<edad_jug<<"\t"<<nacionalidad_jug<<"\t"<<sueldo<<endl; archivo.close(); } //Creo mi funcion para leer el archivo void leer_archivo(){ ifstream archivo; //leer archivo archivo.open("planilla.txt",ios::in); cout << "---------------------------------------------" << endl; cout << "EDAD"<< "\t" << "NACIONALIDAD" << "\t" <<"\t"<< "SUELDO" << endl; cout << "---------------------------------------------" << endl; int lineas,i=0; string s,linea; float sumatoriasalarial=0.00; if(archivo.fail()){ cout<<"No se pudo abrir el archivo!!!"; exit(1); //break; } while (getline(archivo, s)) lineas++; archivo.close(); planilla recordset[lineas]; archivo.open("planilla.txt",ios::in); if(archivo.fail()){ cout<<"No se pudo abrir el archivo!!!"; exit(1); } //Leer datos del archivo for (int i = 0; i < lineas; i++) { if (!archivo) { cerr << "No se puede abrir el archivo " << endl; system("PAUSE"); } archivo>>recordset[i].edad>>recordset[i].nacionalidad>>recordset[i].sueldo; } archivo.close(); for(int i = 0; i < lineas; i++){ cout<<recordset[i].edad<<"\t"<<"\t"<<recordset[i].nacionalidad<<"\t"<<"\t"<<recordset[i].sueldo<<endl; sumatoriasalarial+=recordset[i].sueldo; } cout<<endl<<"Total a pagar de planilla: "<<sumatoriasalarial<<endl<<endl; system("PAUSE"); }
[ "noreply@github.com" ]
noreply@github.com
98ae3c8d22842d3857f20f6676dcd8fa145bf98d
ec15b129676eba0cbf2305eff226f3682de9722b
/IterativeSegmentTree.cpp
c069821754f0b9b109fc52eeefee6c026a6d3909
[]
no_license
exsanik/data_structures
93653f495947a12088e31fffcc4c8cd4b47362b1
f122c087ce63390f0b584d0ea8dcea20e9f99467
refs/heads/master
2020-11-24T02:05:15.520487
2020-05-03T18:11:07
2020-05-03T18:11:07
227,918,833
1
0
null
null
null
null
UTF-8
C++
false
false
1,918
cpp
class SegmentTree { private: vector<vector<int64_t>> segmentTreeContainer; public: explicit SegmentTree(const vector<int64_t>& segmentTreeBase) { int rowLength = segmentTreeBase.size(); const int logElements = __builtin_clz(rowLength); // get the postion of the highest "1" bit segmentTreeContainer.resize(logElements); segmentTreeContainer[0] = segmentTreeBase; for (int i = 1; i < logElements; ++i, rowLength /= 2) { segmentTreeContainer[i].resize(rowLength); } rowLength = segmentTreeBase.size(); for (int rowIndex = 1; rowLength > 1; rowIndex++) { for (int columnIndex = 0; columnIndex < rowLength / 2; columnIndex++) { segmentTreeContainer[rowIndex][columnIndex] = std::min( segmentTreeContainer[rowIndex - 1][2 * columnIndex], segmentTreeContainer[rowIndex - 1][2 * columnIndex + 1]); } rowLength /= 2; } } int64_t rangeMinimumQuery(const int leftBorder, const int rightBorder) { int currentLeftBorder = leftBorder; int currentRightBorder = rightBorder + 1; int64_t queryResult = INT64_MAX; int depthLevel = 0; while (currentLeftBorder != currentRightBorder) { if (currentLeftBorder % 2) { queryResult = std::min( segmentTreeContainer[depthLevel][currentLeftBorder], queryResult); currentLeftBorder++; } if (currentRightBorder % 2) { queryResult = std::min( segmentTreeContainer[depthLevel][currentRightBorder], queryResult); } currentLeftBorder >>= 1; currentRightBorder >>= 1; depthLevel++; } return queryResult; } };
[ "noreply@github.com" ]
noreply@github.com
846b9c4bae5476db09e468c5afff77b414edd957
bac438a87edf552a9e193b69e5bb7217703172d6
/w14/g1/6.cpp
f38ef034533eb29b8697483699fa488fc89fd072
[]
no_license
Beisenbek/PP1_2020_FALL
4aac350e2fdb8f3c0dc31dd7c9495bbd6b291c33
dc94eb58cebcb83f05296fdd7e1cdf6dd65db442
refs/heads/master
2023-02-20T20:30:37.723139
2021-01-26T12:15:52
2021-01-26T12:15:52
293,035,486
1
1
null
null
null
null
UTF-8
C++
false
false
543
cpp
#include <iostream> #include <vector> #include <map> using namespace std; int main() { int n = 4; int &c = n; int *p = &n; cout << &n << endl; cout << &c << endl; cout << p << endl; n = 12; cout << n << endl; cout << c << endl; cout << *p << endl; cout << "======" << endl; *p = 13; cout << n << endl; cout << c << endl; cout << *p << endl; cout << "======" << endl; c = 14; cout << n << endl; cout << c << endl; cout << *p << endl; return 0; }
[ "bbaisakov@dar.kz" ]
bbaisakov@dar.kz
a2de2868a8856ad960e60d71ace29666b519c51b
1dbced382333c820a90068f15f40e177c4032274
/src/caffe/layers/structSVM_loss_layer.cpp
2cda6f2be98e8557eaa54613088e11ddbeb28684
[ "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
permissive
hyzcn/struct-max-sum
baf521769a782ea345d0cb74a2431a1bc656a6f1
e31227d8ebc7276b8ce1995a12cb874d071c977d
refs/heads/master
2021-06-12T21:42:28.955480
2017-04-01T02:23:52
2017-04-01T02:23:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
24,607
cpp
/* * structSVM_loss_layer.cpp * * Created on: Feb 23, 2016 * Author: zehuany */ #include <algorithm> #include <cfloat> #include <cmath> #include <vector> #include "caffe/util/io.hpp" #include "caffe/util/math_functions.hpp" #include "caffe/loss_layers.hpp" namespace caffe { template <typename Dtype> void StructSVMLossLayer<Dtype>::Reshape( const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { CHECK_EQ(bottom[0]->num(), bottom[1]->num()) << "The data and label should have the same number."; vector<int> loss_shape(0); // Loss layers output a scalar; 0 axes. top[0]->Reshape(loss_shape); int num=bottom[0]->num(); int dim=bottom[0]->count()/num; loss_t.Reshape(bottom[0]->shape()); r_sum.assign(num+1, Dtype(-DBL_MAX)); hyper=this->layer_param_.structsvm_loss_param().chyper(); normalize=this->layer_param_.structsvm_loss_param().normalize(); lamda2=this->layer_param_.structsvm_loss_param().mweight(); // resize 2 for hard loss. Hard loss has been deprecated but maintain orginal code here. switch (this->layer_param_.structsvm_loss_param().losstype()){ case StructSVMLossParameter_LossType_SETDIFF: m_begin.resize(dim-1); m_end.resize(dim-1); max_sum.resize(dim-1); for (int i=0;i<dim-1;i++){ max_sum[i].assign(2,Dtype(-DBL_MAX)); m_end[i].resize(2); m_begin[i].resize(2); } break; case StructSVMLossParameter_LossType_OVERLAP: // max_sum.assign(dim-1,Dtype(-DBL_MAX)); m_begin.resize(dim-1); m_end.resize(dim-1); clsloss.resize(dim-1); cal_gradient.resize(dim-1); max_sum.resize(dim-1); for (int i=0;i<dim-1;i++){ max_sum[i].assign(2,Dtype(-DBL_MAX)); m_end[i].resize(2); m_begin[i].resize(2); } ctype=false; break; case StructSVMLossParameter_LossType_OVERLAP3CHANNEL: // max_sum.assign((dim-1)/3,Dtype(-DBL_MAX)); max_sum.resize((dim-1)/3); m_begin.resize((dim-1)/3); m_end.resize((dim-1)/3); clsloss.resize((dim-1)/3); cal_gradient.resize((dim-1)/3); for (int i=0;i<(dim-1)/3;i++){ max_sum[i].assign(2,Dtype(-DBL_MAX)); m_end[i].resize(2); m_begin[i].resize(2); } ctype=true; break; default: LOG(FATAL) << "Unknown Losstype"; } } template <typename Dtype> void StructSVMLossLayer<Dtype>::Inference_augmented(const Dtype* array, const Dtype* label, int num, int dim){ Dtype s_first,s_middle,s_end; Dtype s_s; bool convert; Dtype t_length; Dtype lamda=1; switch (this->layer_param_.structsvm_loss_param().losstype()){ case StructSVMLossParameter_LossType_SETDIFF: //........................|y_i|-|y_i\cap\y_i^*|..................................... for (int i = 1; i < dim; ++i){ s_middle =array[i]+ (label[0]==i?lamda:Dtype(0)); max_sum[i-1][0]=s_middle; r_sum[0]=s_middle; r_begin=0; m_begin[i-1][0]=0; m_end[i-1][0]=0; for (int j=1; j< num; ++j){ s_middle=array[i+j*dim]+ (label[j]==i?lamda:Dtype(0)); if (r_sum[j-1]>0){ r_sum[j]=r_sum[j-1]+s_middle; } else{ r_sum[j]=s_middle; r_begin=j; } if (r_sum[j]>max_sum[i-1][0]){ max_sum[i-1][0]=r_sum[j]; m_begin[i-1][0]=r_begin; m_end[i-1][0] =j; } } } break; case StructSVMLossParameter_LossType_OVERLAP: for (int i=0;i<dim-1;i++){ max_sum[i].assign(2,Dtype(-DBL_MAX)); } //..........................|y_i\cup y_i^*|-|y_i\cap y_i^*| for (int i = 1; i < dim; ++i){ s_middle=array[i]+ (label[0]!=i && slabel==i?lamda:Dtype(0)); max_sum[i-1][0]=s_middle; r_sum[0]=s_middle; r_begin=0; m_begin[i-1][0]=0; m_end[i-1][0]=0; s_s=0; convert=false; for (int j=1; j< num; ++j){ s_middle=array[i+j*dim]+ (label[j]!=i && slabel==i?lamda:Dtype(0)); if (r_sum[j-1]>s_s){ r_sum[j]=r_sum[j-1]+s_middle; } else{ r_sum[j]=s_middle+s_s; r_begin=j; } //t_length = label[j]!=i?0:std::min(end-start+1,std::max(0,end-j)); t_length = slabel!=i?0:std::min(end-start+1,std::max(0,end-j)); t_length=t_length*lamda; if (r_sum[j]+t_length>max_sum[i-1][0]){ max_sum[i-1][0]=r_sum[j]+t_length; m_begin[i-1][0]=r_begin; m_end[i-1][0] =j; } if (label[j]==i) s_s+=lamda; else if (convert){ s_s=0; convert=false; } } } break; case StructSVMLossParameter_LossType_OVERLAP3CHANNEL: //..........................s_first+s_middle*+s_end-----|y_i\cup y_i^*|-|y_i\cap y_i^*| for (int i=0;i<(dim-1)/3;i++){ max_sum[i].assign(2,Dtype(-DBL_MAX)); } for (int i = 1; i < dim; i=i+3){ int temp=(i-1)/3; s_first=array[i]+ (label[0]!=temp+1 && slabel==temp+1?lamda:Dtype(0)); s_end =array[i+dim+2]+ (label[0]!=temp+1 && slabel== temp+1?lamda:Dtype(0)); max_sum[temp][0]=s_first+s_end; r_sum[0]=s_first; r_begin=0; m_begin[temp][0]=0; m_end[temp][0]=1; s_s=0; convert=false; for (int j=1; j< num; ++j){ s_first=array[i+j*dim]+ (label[j]!=temp+1 && slabel== temp+1?lamda:Dtype(0)); s_end =array[i+j*dim+2]+ (label[j]!=temp+1 && slabel== temp+1?lamda:Dtype(0)); s_middle =array[i+j*dim+1]*lamda2+ (label[j]!=temp+1 && slabel== temp+1?lamda:Dtype(0)); t_length = slabel!=temp+1?0:std::min(end-start+1,std::max(0,end-j)); t_length=t_length*lamda; if (r_sum[j-1]+s_middle>s_s+s_first){ r_sum[j]=r_sum[j-1]+s_middle; } else{ r_sum[j]=s_first+s_s; r_begin=j; } if (r_sum[j-1]+s_end+t_length>max_sum[temp][0]){ max_sum[temp][0]=r_sum[j-1]+s_end+t_length; m_begin[temp][0]=r_begin; m_end[temp][0] =j; } if (label[j]==temp+1) s_s+=lamda; else if (convert){ s_s=0; convert=false; } } } break; default: LOG(FATAL) << "Unknown Losstype"; } } template <typename Dtype> void StructSVMLossLayer<Dtype>::Inference (const Dtype* array, const Dtype * label, int num, int dim, int k){ //K_largest problem for temporal localization Dtype s_first,s_middle,s_end; vector<Dtype> r_min(k,Dtype(DBL_MAX)); vector<Dtype> cand_k(k,0); vector<int> min_end(k,0); vector<Dtype>r_max(k,Dtype(-DBL_MAX)); vector<int> max_start(k,0); if (!ctype) { for (int i = 1; i < dim; ++i){ // re-initialization for (int m=0;m<k;m++){ r_min[m]=Dtype(DBL_MAX); min_end[m]=0; } r_min[0]=0; r_sum[0]=0; for (int j=1; j <= num; ++j){ r_sum[j]=r_sum[j-1]+array[i+(j-1)*dim]; int p=0; for (int l=0;l<k;l++){ cand_k[l]=r_sum[j]-r_min[l]; // one by one merge while ((p<k) && (cand_k[l]<=max_sum[i-1][p])) p++; if (p==k) break; for (int q=k-1;q>p;q--){ max_sum[i-1][q]=max_sum[i-1][q-1]; m_begin[i-1][q]=m_begin[i-1][q-1]; m_end[i-1][q]=m_end[i-1][q-1]; } max_sum[i-1][p]=cand_k[l]; m_begin[i-1][p]=min_end[l]; m_end[i-1][p]=j-1; } // insert for (int l=0;l<k;l++){ if (r_sum[j]<r_min[l]){ for (int n=k-1;n>l;--n){ r_min[n]=r_min[n-1]; min_end[n]=min_end[n-1]; } r_min[l]=r_sum[j]; min_end[l]=j; break; } else continue; } } } } // three-channels distribution else { for (int i = 1; i < dim; i=i+3) { int temp=(i-1)/3; for (int m=0;m<k;m++) r_max[m]=Dtype(-DBL_MAX); for (int j=0; j < num; ++j){ //insert it to max_sum if (j==0){ //insert it to r_max then continue r_max[0]=array[i]; max_start[0]=0; } else{ // insert it to max_sum int p=0; s_first=array[j*dim+i]; s_middle=array[j*dim+i+1]; s_end=array[j*dim+i+2]; for (int l=0;l<k;l++){ // one by one merge if (r_max[l]==Dtype(-DBL_MAX)) break; cand_k[l]=r_max[l]+s_end; while ((p<k) && (cand_k[l]<=max_sum[temp][p])) p++; if (p==k) break; for (int q=k-1;q>p;q--){ max_sum[temp][q]=max_sum[temp][q-1]; m_begin[temp][q]=m_begin[temp][q-1]; m_end[temp][q]=m_end[temp][q-1]; } max_sum[temp][p]=cand_k[l]; m_begin[temp][p]=max_start[l]; m_end[temp][p]=j; } // insert it to r_max for (int l=0;l<k;l++) if (r_max[l]!=Dtype(-DBL_MAX)) r_max[l]=r_max[l]+s_middle; else break; //insert s_first for (int l=0;l<k;l++){ if (s_first>r_max[l]){ for (int n=k-1;n>l;--n){ r_max[n]=r_max[n-1]; max_start[n]=max_start[n-1]; } r_max[l]=s_first; max_start[l]=j; break; } else continue; } } } } } max_start.clear(); r_max.clear(); min_end.clear(); r_min.clear(); cand_k.clear(); } template <typename Dtype> void StructSVMLossLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { const Dtype* bottom_data = bottom[0]->cpu_data(); Dtype* bottom_diff = bottom[0]->mutable_cpu_diff(); const Dtype* label = bottom[1]->cpu_data(); Dtype lamda=1; int num = bottom[0]->num(); int count = bottom[0]->count(); int dim = count / num; int sdim; Dtype sloss=0,sg = 0; static Dtype iouloss=0; static int iter_=0; static vector<Dtype> losses; static vector<Dtype> IoUs; // ----------------------calculate the end and begin ------------------------------ start=num; end=-1; slabel=0; bool mask=false; for (int i=0; i < num; i++){ if (label[i]!=0){ if (!mask){ mask=true; start=i; } slabel=label[i]; } else if (mask){ mask=false; end=i-1; } } if (mask) end=num-1; //----------------------find maximum box for each label----------------------------- Inference_augmented(bottom_data, label, num, dim); caffe_set(count, Dtype(0), bottom_diff); // estimated y, sdim should start with 0 CHECK(slabel>0) << "background videos are not allowed"; sdim=slabel-1; Dtype plength,wlength,ratio; switch(this->layer_param_.structsvm_loss_param().losstype()){ case StructSVMLossParameter_LossType_SETDIFF: // not implemented break; // one channel structsvm case StructSVMLossParameter_LossType_OVERLAP: plength=m_end[sdim][0]-m_begin[sdim][0]+1; wlength=end-start+1; CHECK(wlength==8); // should be commentted afterwards ratio=wlength/plength; for (int i=0; i < num; i++){ if (label[i]!=0) sg = sg + bottom_data[i*dim + static_cast<int>(label[i])]; } sloss=(max_sum[sdim][0]-sg)/wlength; if (normalize){ sloss=0; for (int i=0;i<num;i++) if ((i>=m_begin[sdim][0])&&(i<=m_end[sdim][0])&&(i>=start)&&(i<=end)) sloss +=0; else if (i>=m_begin[sdim][0]&&i<=m_end[sdim][0]) sloss +=bottom_data[i*dim + slabel]/plength; else if (i>=start&&i<=end) sloss -=bottom_data[i*dim + static_cast<int>(label[i])]/wlength; } //propogaete sloss(change after normalize) for (int i=0; i < num; i++){ if (label[i]!=0) bottom_diff[i*dim + static_cast<int>(label[i])]=Dtype(1); } for (int i=m_begin[sdim][0];i<=m_end[sdim][0];i++) bottom_diff[i*dim + sdim+1] = normalize?ratio:Dtype(1); // add classfing loss if (!this->layer_param_.structsvm_loss_param().only_locate()){ for (int i=0;i<dim-1;i++){ cal_gradient[i] = false; clsloss[i] = 0; plength=m_end[i][0]-m_begin[i][0]+1; if (i!=sdim){ clsloss[i] = std::max(lamda*wlength+max_sum[i][0]-sg,Dtype(0))/wlength; cal_gradient[i]=clsloss[i]>0?true:false; if (normalize && cal_gradient[i]){ ratio=wlength/plength; clsloss[i] = ((lamda*wlength+max_sum[i][0])*ratio-sg)/wlength; } } } } break; case StructSVMLossParameter_LossType_OVERLAP3CHANNEL: CHECK(start<end)<<"end should be bigger than start"; plength=std::max(1,m_end[sdim][0]-m_begin[sdim][0]-1); wlength=std::max(1,end-start-1); ratio =wlength/plength; CHECK(wlength==6)<<start<<" "<<end; for (int i=0; i < num; i++) if (label[i]!=0) sg = sg + bottom_data[i*dim + static_cast<int>((label[i]-1)*3+2)]; sg=sg-bottom_data[start*dim + static_cast<int>((label[start]-1)*3+2)]+ bottom_data[start*dim + static_cast<int>((label[start]-1)*3+1)]+ bottom_data[end*dim + static_cast<int>((label[end]-1)*3+3)]- bottom_data[end*dim + static_cast<int>((label[end]-1)*3+2)]; // calculate sloss sloss=std::max (Dtype(0),max_sum[sdim][0]-sg)/(end-start+1); if (normalize){ sloss=0; for (int i=0;i<num;i++) if ((i>m_begin[sdim][0])&&(i<m_end[sdim][0])&&(i>start)&&(i<end)) sloss +=0; else if (i>m_begin[sdim][0]&&i<m_end[sdim][0]) sloss +=bottom_data[i*dim + sdim*3+2]/plength; else if (i>start&&i<end) sloss -=bottom_data[i*dim + sdim*3+2]/wlength; sloss=lamda2*sloss+bottom_data[m_begin[sdim][0]*dim+sdim*3+1]+bottom_data[m_end[sdim][0]*dim+sdim*3+3]- bottom_data[start*dim+sdim*3+1]-bottom_data[end*dim+sdim*3+3]; sloss=sloss/Dtype(3); } //add cls closs if (!this->layer_param_.structsvm_loss_param().only_locate()){ for (int i=0;i<(dim-1)/3;i++){ cal_gradient[i] = false; clsloss[i] = 0; plength=std::max(1,m_end[i][0]-m_begin[i][0]-1); Dtype pside=bottom_data[m_begin[i][0]*dim+i*3+1]+bottom_data[m_end[i][0]*dim+i*3+3]; Dtype gside= bottom_data[start*dim+sdim*3+1]+bottom_data[end*dim+sdim*3+3]; if (i!=sdim){ clsloss[i] = std::max(lamda*(end-start+1)+max_sum[i][0]-sg,Dtype(0))/(end-start+1); cal_gradient[i]=clsloss[i]>0?true:false; if (normalize && cal_gradient[i]){ clsloss[i] = lamda*3+(max_sum[i][0]-pside)*lamda2/plength-(sg-gside)*lamda2/wlength+pside-gside; clsloss[i] = clsloss[i]/Dtype(3); } } } } for (int i=start+1; i < end; i++) if (label[i]!=0) bottom_diff[i*dim + static_cast<int>((label[i]-1)*3+2)]=Dtype(lamda2); // replement afer normalize delete L2 norm for (int i = m_begin[sdim][0]+1; i < m_end[sdim][0]; i++) bottom_diff[i*dim+sdim*3+2]=normalize?ratio*lamda2:Dtype(lamda2); bottom_diff[start*dim+sdim*3+1]=Dtype(1); bottom_diff[end*dim+sdim*3+3]=Dtype(1); bottom_diff[m_begin[sdim][0]*dim+sdim*3+1]=Dtype(1); bottom_diff[m_end[sdim][0]*dim+sdim*3+3]=Dtype(1); dim=(dim-1)/3+1; break; default: LOG(FATAL) << "Unknown Losstype"; } Dtype* loss = top[0]->mutable_cpu_data(); loss[0] = sloss; // add cls loss if (!this->layer_param_.structsvm_loss_param().only_locate()){ for (int i=0;i< dim-1;i++) loss[0] += clsloss[i]*hyper/(dim-2); } /** calulate overlap **/ int bi=std::max(0,std::min(end,m_end[sdim][0])-std::max(start,m_begin[sdim][0])+1); int bu=end-start+m_end[sdim][0]-m_begin[sdim][0]-bi+2; Dtype iou=Dtype(bi)/Dtype(bu); // smoothed loss output LOG(INFO)<<slabel<<"---iou:"<<iou<<"----loss:"<<loss[0]<<"----gt:"<<sg<<"---pre:"<<max_sum[sdim][0]; if (IoUs.size() < 100) { IoUs.push_back(iou); int size = IoUs.size(); iouloss = (iouloss * (size - 1) + iou) / Dtype(size); } else { int idx = iter_% 100; iouloss += (iou - IoUs[idx]) / 100.0; IoUs[idx]=iou; } if (++iter_%100==0) this->ofile<<iouloss<<std::endl; } template <typename Dtype> void StructSVMLossLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top, const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom) { if (propagate_down[1]) { LOG(FATAL) << this->type() << " Layer cannot backpropagate to label inputs."; } if (propagate_down[0]) { Dtype* bottom_diff = bottom[0]->mutable_cpu_diff(); Dtype* loss_temp=loss_t.mutable_cpu_data(); Dtype wlength=0,plength; const Dtype* label = bottom[1]->cpu_data(); int num = bottom[0]->num(); int count = bottom[0]->count(); int dim = count / num; int sdim = slabel-1; caffe_set(count, Dtype(0), loss_temp); switch(this->layer_param_.structsvm_loss_param().losstype()){ case StructSVMLossParameter_LossType_SETDIFF: // nor implement break; // one channel structsvm case StructSVMLossParameter_LossType_OVERLAP: wlength=end-start+1; for (int i = 0; i < num; ++i) { if ((i>=m_begin[sdim][0])&&(i<=m_end[sdim][0])&&(i>=start)&&(i<=end)) bottom_diff[i * dim + sdim +1] = 0; else bottom_diff[i * dim + static_cast<int>(label[i])] *= -1; } if (!this->layer_param_.structsvm_loss_param().only_locate()){ for (int i=0;i < dim-1; ++i){ if (cal_gradient[i]){ plength=m_end[i][0]-m_begin[i][0]+1; for (int j=0;j < num; j++){ if ((j>=m_begin[i][0])&&(j<=m_end[i][0])) loss_temp[j * dim + i+1] += normalize?wlength/plength:Dtype(1); if ((j>=start)&&(j<=end)) loss_temp[j*dim + static_cast<int>(label[j])] += Dtype(-1); } } } } break; case StructSVMLossParameter_LossType_OVERLAP3CHANNEL: wlength=std::max(1,end-start-1); for (int i = 0; i < num; ++i) { if ((i>m_begin[sdim][0])&&(i<m_end[sdim][0])&&(i>start)&&(i<end)) bottom_diff[i * dim + sdim*3 +2] = 0; else if (label[i]!=0){ if (i==start) bottom_diff[i * dim + static_cast<int>((label[i]-1)*3 + 1)] *= -1; else if (i==end) bottom_diff[i * dim + static_cast<int>((label[i]-1)*3 + 3)] *= -1; else bottom_diff[i * dim + static_cast<int>((label[i]-1)*3 + 2)] *= -1; }//caffe mul } if (end == m_end[sdim][0]) bottom_diff[end * dim + sdim * 3 + 3]=0; if (start == m_begin[sdim][0]) bottom_diff[start * dim + sdim * 3 + 1]=0; if (!this->layer_param_.structsvm_loss_param().only_locate()){ for (int i=0;i < (dim-1)/3; ++i){ if (cal_gradient[i]){ plength=std::max(1,m_end[i][0]-m_begin[i][0]-1); for (int j=0;j < num; j++){ if ((j>m_begin[i][0])&&(j<m_end[i][0])) loss_temp[j * dim + i * 3 + 2] += normalize?wlength*lamda2/plength:Dtype(lamda2); if ((j>start)&&(j<end)) loss_temp[j*dim + sdim * 3 + 2] += Dtype(-lamda2); } loss_temp[start*dim+sdim*3+1] += normalize?Dtype(-wlength):Dtype(-1); loss_temp[end*dim+sdim*3+3] += normalize?Dtype(-wlength):Dtype(-1); loss_temp[m_begin[i][0]*dim+i*3+1] += normalize?Dtype(wlength):Dtype(1); loss_temp[m_end[i][0]*dim+i*3+3] += normalize?Dtype(wlength):Dtype(1); } } } wlength=normalize?wlength*3:(end-start+1); dim=(dim-1)/3+1; break; default: LOG(FATAL) << "Unknown LossType"; } const Dtype loss_weight = top[0]->cpu_diff()[0]; caffe_scal(count, loss_weight/wlength, bottom_diff); if (!this->layer_param_.structsvm_loss_param().only_locate()){ caffe_scal(count,loss_weight*hyper/(wlength*(dim-2)),loss_temp); caffe_add(count,bottom_diff,loss_temp,bottom_diff); } } } INSTANTIATE_CLASS(StructSVMLossLayer); REGISTER_LAYER_CLASS(StructSVMLoss); } // namespace caffe
[ "zehuany@umich.edu" ]
zehuany@umich.edu
e082e87da401115b86bc57bdcdf7ab9c181ac29f
bd9e090345eb7e66caf84aae73767c1e551cdde1
/rl_local_planner/src/wp_generator.cpp
0cc7913263997906f946384480404bb097cd7511
[ "BSD-3-Clause" ]
permissive
dangaw255/arena-flatland
3d3a9d3f246c5ef1c9794bd4247278927e7d7d66
584ff41e7edc055ee59f7c8d8bdec2a5a4809410
refs/heads/main
2023-01-24T15:23:35.695104
2020-11-23T19:47:07
2020-11-23T19:47:07
315,422,618
1
0
BSD-3-Clause
2020-11-23T19:42:45
2020-11-23T19:42:44
null
UTF-8
C++
false
false
5,183
cpp
/* * @name wp_generator.cpp * @brief Generation of waypoints on the global path and * determination of the closest waypoints to the robot. * @author Ronja Gueldenring * @date 2019/04/05 **/ #include <rl_local_planner/wp_generator.h> namespace rl_local_planner { WpGenerator::WpGenerator(const ros::NodeHandle& node_handle) : nh_{node_handle}{ // Get params of parameter server nh_.getParam("rl_agent/look_ahead_distance", look_ahead_distance_); nh_.getParam("rl_agent/wp_reached_dist", wp_reached_dist_); nh_.getParam("rl_agent/num_of_wps", num_of_wps_); nh_.getParam("rl_agent/robot_frame", robot_frame_); // Services std::string global_plan_service_name = ros::this_node::getName() + "/set_gobal_plan"; set_path_service = nh_.advertiseService(global_plan_service_name, &WpGenerator::path_callback_, this); //Publisher wp_pub_ = nh_.advertise<rl_msgs::Waypoint>("wp", 1, true); wp_reached_pub_ = nh_.advertise<rl_msgs::Waypoint>("wp_reached", 1, true); } bool WpGenerator::path_callback_(rl_msgs::SetPath::Request& request, rl_msgs::SetPath::Response& response){ if(request.path.poses.size() == 0){ return false; } path_frame_ = request.path.header.frame_id; geometry_msgs::PoseStamped goal_temp = request.path.poses.back(); goal_ = tf::Vector3(goal_temp.pose.position.x, goal_temp.pose.position.y, 0.); precalculate_waypoints_(request.path.poses); get_closest_wps(); return true; } void WpGenerator::precalculate_waypoints_(std::vector<geometry_msgs::PoseStamped> global_plan){ waypoints_.clear(); geometry_msgs::PoseStamped prev = global_plan[0]; double dist = 0.0; for(int i = 1; i < global_plan.size(); i++){ dist += metric_dist((prev.pose.position.x - global_plan[i].pose.position.x), (prev.pose.position.y - global_plan[i].pose.position.y)); if(dist > look_ahead_distance_){ dist = 0.0; waypoints_.push_back(global_plan[i]); } prev = global_plan[i]; } for(int i = 0; i < num_of_wps_ + 1; i++){ waypoints_.push_back(global_plan.back()); } return; } void WpGenerator::get_closest_wps(){ if(waypoints_.size() < num_of_wps_){ return; } //Prepare Waypoint-message that will be published rl_msgs::Waypoint msg; msg.header.frame_id = robot_frame_; msg.header.stamp = ros::Time::now(); msg.is_new.data = false; // Get Transform from path_frame_ to robot_frame tf::StampedTransform transform; try{ tf_.lookupTransform(robot_frame_, path_frame_, ros::Time(0), transform); } catch (tf::TransformException ex){ ROS_ERROR("%s",ex.what()); ros::WallDuration(1.0).sleep(); } //Find closest point on path tf::Vector3 closest_wp = get_transformed_wp_(waypoints_[0], transform); double dist = metric_dist(closest_wp.getX(), closest_wp.getY()); for(int i = 1; i < waypoints_.size(); i++){ tf::Vector3 temp_wp = get_transformed_wp_(waypoints_[i], transform); double temp_dist = metric_dist(temp_wp.getX(), temp_wp.getY()); if (temp_dist < dist){ dist = temp_dist; closest_wp = temp_wp; }else{ //Closest point on path found! int start_index = i - 1; //Is closest wp reached in a certain radius? if (dist < wp_reached_dist_){ msg.is_new.data = true; for (int k = 0; k < i; k++){ waypoints_.erase(waypoints_.begin()); } start_index = 0; } // Is closest waypoint already overtaken? Then take next one. tf::Vector3 second_wp = get_transformed_wp_(waypoints_[start_index + 1], transform); double dist_second_wp = metric_dist(temp_wp.getX(), temp_wp.getY()); if (dist + look_ahead_distance_ > dist_second_wp){ start_index +=1; } //Getting all sequencing waypoints. std::vector<geometry_msgs::Point> points; for(int j = start_index; j < start_index + num_of_wps_; j++){ geometry_msgs::Point p; if (j < waypoints_.size()){ tf::Vector3 wp = get_transformed_wp_(waypoints_[j], transform); p.x = wp.getX(); p.y = wp.getY(); points.push_back(p); } } msg.points = points; if (msg.is_new.data == true){ wp_reached_pub_.publish(msg); }else{ wp_pub_.publish(msg); } break; } } return; } tf::Vector3 WpGenerator::get_transformed_wp_(geometry_msgs::PoseStamped wp, tf::StampedTransform transform){ tf::Vector3 wp_vec(wp.pose.position.x, wp.pose.position.y, 0.); tf::Vector3 wp_vec_transformed = transform*wp_vec; return wp_vec_transformed; } double WpGenerator::metric_dist(double x, double y){ double dist = sqrt(pow(x , 2) + pow(y , 2)); return dist; }//metric_dist }; // namespace rl_local_planner int main(int argc, char** argv){ ros::init(argc, argv, "wp_generator"); ros::NodeHandle node; int rl_mode; std::string train_mode_topic = ros::this_node::getNamespace() + "/rl_agent/train_mode"; node.param(train_mode_topic, rl_mode, 1); rl_local_planner::WpGenerator wg(node); ros::WallRate r(100); while (ros::ok()) { wg.get_closest_wps(); ros::spinOnce(); r.sleep(); } return 0; };
[ "linh4138@yahoo.de" ]
linh4138@yahoo.de
e9cd0813a6e9a02568cd38af75cf3809c98918ad
33d9f9536fed2fc9ee0a68a85206f2f9d64f1b76
/gsum.cpp
63b090784e4555e772e6a95187e30ef09a258c10
[]
no_license
tanyasharma6317/data-structures-questions
29ced119b05472249738473ed4ad053b5236ca98
6d801b6415bdf8b37cafe4b32968e2e0ff347bb4
refs/heads/master
2022-12-29T22:54:16.042412
2020-10-23T05:56:22
2020-10-23T05:56:22
300,130,992
0
0
null
null
null
null
UTF-8
C++
false
false
258
cpp
#include<iostream> #include<bits/stdc++.h> using namespace std; double geometric_sum(int k) { if(k==0) { return 1; } double n=geometric_sum(k-1); return n+ 1.0/ pow(2,k); } int main() { cout<<geometric_sum(3); }
[ "noreply@github.com" ]
noreply@github.com
a4257377a485780a25f3dec0ce8212c2f947ce9d
54bed339ce0b76e4735c0ce7c4a358fd55d9cd12
/core/include/GameLoop.h
1d18fe273374580b42422cd0c817e5f7068b451b
[]
no_license
object71/AztecBlocks
2d9edf2d4b7240cd76da8759baa6d1f322fe74ab
646ab85e69a0c56c6c4546cb5b3ac9968502174d
refs/heads/master
2021-07-08T05:12:23.202424
2020-10-12T15:23:50
2020-10-12T15:23:50
199,054,804
0
0
null
null
null
null
UTF-8
C++
false
false
415
h
#pragma once #include <chrono> #include <memory> #include "Interfaces.h" class GameLoop { private: bool m_running; std::chrono::milliseconds m_step; IFullComponent& m_mainComponent; public: GameLoop(IFullComponent& component); ~GameLoop(); bool getRunning(); void setRunning(const bool& value); std::chrono::milliseconds getStep(); void setStep(const std::chrono::milliseconds& value); void run(); };
[ "capitane71@gmail.com" ]
capitane71@gmail.com
632636bb019fe593665c95be8f1a02ccb29ea70e
29bce9d3c2a7a73275944f00fca9826da23a8504
/Software/src/lib/misc.h
dbf74cf7d5e89d889299ce7fc2611f8b781bf000
[]
no_license
gabriel-lepetitaimon/VoxPopuli
bbc72211aef0aa5789feb3e12307554cfab271a1
ced3b7537e3332d3a586337500630369615c38f7
refs/heads/master
2021-06-10T20:55:17.533663
2016-11-16T14:42:53
2016-11-16T14:42:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,860
h
#ifndef MISC_SAFE_H #define MISC_SAFE_H #include <string> #include <vector> #include <stdint.h> char intToHex(uint8_t value); uint8_t hexToInt(char value); std::string intToHexStr(const std::vector<uint8_t> &v); std::vector<uint8_t> hexStrToInt(const std::string& str); class HexData{ public: HexData(); HexData(const std::string &data); HexData(const std::vector<uint8_t> &data); HexData(const char* data, const unsigned int size=1); HexData(const uint8_t data); HexData(const HexData& data); ~HexData(); static HexData fromHexStr(std::string data); std::string toHexStr() const; std::string toIntStr(char sep = ' ') const; std::string toCharStr() const; std::string strData() const; unsigned int toInt() const; bool toInt(unsigned int& r) const; const std::vector<uint8_t> &data() const; uint8_t byteAt(int i) const {return (*_data)[i];} uint8_t& operator[](size_t i) {return(*_data)[i];} const uint8_t& operator[](size_t i) const {return (*_data)[i];} size_t size() const {return _data->size();} void prepend(const std::vector<uint8_t>& data); void prepend(uint8_t data); void prepend(const std::string& data){ prepend(hexStrToInt(data));} void append(const std::vector<uint8_t>& data); void append(uint8_t data); void append(const std::string& data){ append(hexStrToInt(data));} HexData operator+=(const HexData& data); HexData operator+=(const std::vector<uint8_t>& data); HexData operator+=(const std::string& data); HexData operator+=(uint8_t data); HexData operator+(const HexData& data) const; HexData operator+(uint8_t data) const; protected: HexData(std::vector<uint8_t>* emplace); std::vector<uint8_t>* _data; }; #endif // MISC_SAFE_H
[ "gabriel.lepetitaimon@gmail.com" ]
gabriel.lepetitaimon@gmail.com
ba3502afc1165a8cc89a663509c30dba51c167bd
098fe36aab3fec5febcd6b9e8a1bfc3b91a6a0dc
/ICP-2/Source/heartbeat/heartbeat.ino
425ede4377b7ba2fd0bf6e97c6cf7a08849a5e38
[]
no_license
Abdullah-otb/IOT
79298303e4fb9696d4a68c4bf480cc453da7b59d
dfd63b9536e4f783dd22ad733b32d50be9d0b134
refs/heads/master
2020-07-25T12:54:43.191996
2020-01-21T08:12:27
2020-01-21T08:12:27
208,296,444
0
2
null
null
null
null
UTF-8
C++
false
false
10,041
ino
#include <SoftwareSerial.h> #define DEBUG true SoftwareSerial esp8266(9,10); #include <LiquidCrystal_PCF8574.h> #include <stdlib.h> LiquidCrystal_PCF8574 lcd(0x27); // set the LCD address to 0x27 for a 16 chars and 2 line display #define SSID "ASUS" // "SSID-WiFiname" #define PASS "*******" // "password" #define IP "184.106.153.149"// thingspeak.com ip String msg = "GET /update?key=***********"; //change it with your api key like "GET /update?key=Your Api Key" int switchState2 = 0; int switchState6 = 0; int switchState7 = 0; //Variables float temp; int hum; String tempC; int error; int pulsePin = 0; // Pulse Sensor purple wire connected to analog pin 0 int blinkPin = 13; // pin to blink led at each beat int fadePin = 5; int fadeRate = 0; // Volatile Variables, used in the interrupt service routine! volatile int BPM; // int that holds raw Analog in 0. updated every 2mS volatile int Signal; // holds the incoming raw data volatile int IBI = 600; // int that holds the time interval between beats! Must be seeded! volatile boolean Pulse = false; // "True" when heartbeat is detected. "False" when not a "live beat". volatile boolean QS = false; // becomes true when Arduino finds a beat. // Regards Serial OutPut -- Set This Up to your needs static boolean serialVisual = true; // Set to 'false' by Default. Re-set to 'true' to see Arduino Serial Monitor ASCII Visual Pulse volatile int rate[10]; // array to hold last ten IBI values volatile unsigned long sampleCounter = 0; // used to determine pulse timing volatile unsigned long lastBeatTime = 0; // used to find IBI volatile int P =512; // used to find peak in pulse wave, seeded volatile int T = 512; // used to find trough in pulse wave, seeded volatile int thresh = 525; // used to find instant moment of heart beat, seeded volatile int amp = 100; // used to hold amplitude of pulse waveform, seeded volatile boolean firstBeat = true; // used to seed rate array so we startup with reasonable BPM volatile boolean secondBeat = false; // used to seed rate array so we startup with reasonable BPM void setup() { lcd.setBacklight(255); lcd.begin(16, 2); lcd.print("circuitdigest.com"); delay(100); lcd.setCursor(0,1); lcd.print("Connecting..."); Serial.begin(115200); //or use default 115200. esp8266.begin(115200); Serial.println("AT"); esp8266.println("AT"); delay(5000); if(esp8266.find("OK")){ connectWiFi(); } interruptSetup(); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(2, INPUT); pinMode(6, INPUT); pinMode(7, INPUT); digitalWrite(3, LOW); //Set lights to off initially digitalWrite(4,LOW); digitalWrite(5,LOW); //lcd.noDisplay(); } void loop(){ lcd.clear(); switchState2 = digitalRead(2); switchState6 = digitalRead(6); switchState7 = digitalRead(7); if(switchState2 == HIGH){ Serial.println("2 got pressed"); lcd.clear(); lcd.print("Display Off"); delay(2000); lcd.noDisplay(); } if(switchState6 == HIGH){ Serial.println("6 got pressed"); lcd.clear(); lcd.print("Display On"); delay (2000); lcd.display(); lcd.setCursor(0, 0); lcd.print("BPM = 0"); lcd.setCursor(0, 1); // set the cursor to column 0, line 2 } if(switchState7 == HIGH){ Serial.println("7 got pressed"); lcd.clear(); lcd.print("Reset"); delay (2000); lcd.display(); lcd.setCursor(0, 0); lcd.print("BPM = "); lcd.print(BPM); lcd.setCursor(0, 1); // set the cursor to column 0, line 2 } lcd.display(); lcd.setCursor(0, 0); lcd.print("BPM = "); lcd.print(BPM); delay (100); lcd.setCursor(0, 1); // set the cursor to column 0, line 2 start: //label error=0; delay(1000); updatebeat(); //Resend if transmission is not completed if (error==1){ goto start; //go to label "start" } delay(1000); } void updatebeat(){ String cmd = "AT+CIPSTART=\"TCP\",\""; cmd += IP; cmd += "\",80"; Serial.println(cmd); esp8266.println(cmd); delay(2000); if(esp8266.find("Error")){ return; } cmd = msg ; cmd += "&field1="; cmd += BPM; cmd += "\r\n"; Serial.print("AT+CIPSEND="); esp8266.print("AT+CIPSEND="); Serial.println(cmd.length()); esp8266.println(cmd.length()); // if(esp8266.find(">")){ Serial.print(cmd); esp8266.print(cmd); // } //else{ // Serial.println("AT+CIPCLOSE"); //esp8266.println("AT+CIPCLOSE"); // //Resend... // error=1; //} } boolean connectWiFi(){ Serial.println("AT+CWMODE=1"); esp8266.println("AT+CWMODE=1"); delay(2000); String cmd="AT+CWJAP=\""; cmd+=SSID; cmd+="\",\""; cmd+=PASS; cmd+="\""; Serial.println(cmd); esp8266.println(cmd); delay(5000); if(esp8266.find("OK")){ Serial.println("OK"); return true; }else{ return false; } } void interruptSetup(){ TCCR2A = 0x02; // DISABLE PWM ON DIGITAL PINS 3 AND 11, AND GO INTO CTC MODE TCCR2B = 0x06; // DON'T FORCE COMPARE, 256 PRESCALER OCR2A = 0X7C; // SET THE TOP OF THE COUNT TO 124 FOR 500Hz SAMPLE RATE TIMSK2 = 0x02; // ENABLE INTERRUPT ON MATCH BETWEEN TIMER2 AND OCR2A sei(); // MAKE SURE GLOBAL INTERRUPTS ARE ENABLED } ISR(TIMER2_COMPA_vect){ // triggered when Timer2 counts to 124 cli(); // disable interrupts while we do this Signal = analogRead(pulsePin); // read the Pulse Sensor sampleCounter += 2; // keep track of the time in mS int N = sampleCounter - lastBeatTime; // monitor the time since the last beat to avoid noise // find the peak and trough of the pulse wave if(Signal < thresh && N > (IBI/5)*3){ // avoid dichrotic noise by waiting 3/5 of last IBI if (Signal < T){ // T is the trough T = Signal; // keep track of lowest point in pulse wave } } if(Signal > thresh && Signal > P){ // thresh condition helps avoid noise P = Signal; // P is the peak } // keep track of highest point in pulse wave // NOW IT'S TIME TO LOOK FOR THE HEART BEAT // signal surges up in value every time there is a pulse if (N > 250){ // avoid high frequency noise if ( (Signal > thresh) && (Pulse == false) && (N > (IBI/5)*3) ){ Pulse = true; // set the Pulse flag when there is a pulse digitalWrite(blinkPin,HIGH); // turn on pin 13 LED IBI = sampleCounter - lastBeatTime; // time between beats in mS lastBeatTime = sampleCounter; // keep track of time for next pulse if(secondBeat){ // if this is the second beat secondBeat = false; // clear secondBeat flag for(int i=0; i<=9; i++){ // seed the running total to get a realistic BPM at startup rate[i] = IBI; } } if(firstBeat){ // if it's the first time beat is found firstBeat = false; // clear firstBeat flag secondBeat = true; // set the second beat flag sei(); // enable interrupts again return; // IBI value is unreliable so discard it } word runningTotal = 0; // clear the runningTotal variable for(int i=0; i<=8; i++){ // shift data in the rate array rate[i] = rate[i+1]; // and drop the oldest IBI value runningTotal += rate[i]; // add up the 9 oldest IBI values } rate[9] = IBI; // add the latest IBI to the rate array runningTotal += rate[9]; // add the latest IBI to runningTotal runningTotal /= 10; // average the last 10 IBI values BPM = 60000/runningTotal; // how many beats can fit into a minute? that's BPM! QS = true; // set Quantified Self flag // QS FLAG IS NOT CLEARED INSIDE THIS ISR if(BPM<100){ //orange digitalWrite(3, HIGH); digitalWrite(4, LOW); digitalWrite(5, LOW); } else if(BPM>170){ //Red digitalWrite(3, LOW); digitalWrite(4, HIGH); digitalWrite(5, LOW); } else{ //green digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, HIGH); } } } if (Signal < thresh && Pulse == true){ // when the values are going down, the beat is over digitalWrite(blinkPin,LOW); // turn off pin 13 LED Pulse = false; // reset the Pulse flag so we can do it again amp = P - T; // get amplitude of the pulse wave thresh = amp/2 + T; // set thresh at 50% of the amplitude P = thresh; // reset these for next time T = thresh; } if (N > 2500){ // if 2.5 seconds go by without a beat thresh = 512; // set thresh default P = 512; // set P default T = 512; // set T default lastBeatTime = sampleCounter; // bring the lastBeatTime up to date firstBeat = true; // set these to avoid noise secondBeat = false; // when we get the heartbeat back } sei(); // enable interrupts when youre done! }// end isr
[ "48735557+Abdullah-otb@users.noreply.github.com" ]
48735557+Abdullah-otb@users.noreply.github.com
994b9441c279c8c49565ce207f654e5f776a8fc4
c6a8eba7dedee65362948567d39595ede3bc1376
/KGE/Core/Audio/ComponentAudioClip.cpp
85bdf147a2160d2a7a09a6878efd03bad15e84a9
[ "MIT" ]
permissive
jkeywo/KGE
014718add09d6bbccf9f95513fad167e0276823b
5ad2619a4e205dd549cdf638854db356a80694ea
refs/heads/master
2021-01-13T01:14:48.634544
2014-04-16T17:14:14
2014-04-16T17:14:14
17,664,341
1
0
null
null
null
null
UTF-8
C++
false
false
83
cpp
#include "KGE.hpp" #include "Core/Audio/ComponentAudioClip.hpp" namespace KGE { };
[ "jkeywo@yahoo.co.uk" ]
jkeywo@yahoo.co.uk
68a6b3b16efa14e674952537515e7efe5a619152
849dd6a635641fe095abab7ce35fe93b822e36d7
/PhaseObserver.h
ff4ae852908178e7ec75ccd339758b19a76dac2d
[]
no_license
GuoZhihong/SMALL_WORLD
73178bf92d940c6151d7d7371bd52a2eb7be4d61
7108828d291ccab24776a3ca5caa948ce2657cd3
refs/heads/master
2021-05-09T03:39:02.900968
2018-04-18T11:12:21
2018-04-18T11:12:21
119,249,324
0
0
null
null
null
null
UTF-8
C++
false
false
359
h
#ifndef PhaseObserver_h #define PhaseObserver_h #include"Subject.h" #include<iostream> class PhaseObserver: public Observer { public: PhaseObserver(Subject * subject, int method) :Observer(subject) { this->method = method; }; ~PhaseObserver() {}; void update(int playerIndex); int method = 0; int location = 0; }; #endif PhaseObserver// !1
[ "noreply@github.com" ]
noreply@github.com
837bcffbda8d47f177645bfd811c2ca988b868d5
debeaeb3254bd496fbf0aa15529c10a8a54eec05
/GL3DStereoTool/GL3DStereoTool/opengl/glimports.hpp
fb1ca0faddb3a204a5999987df63e5f47dffce7e
[]
no_license
GitHubGenLi/Special3DGL
12d4599d5b4817459ff1ef7206f035ed429049ed
15d55ab5b01ac8f24574c3d42fe8ca4e05777423
refs/heads/master
2021-05-29T06:54:38.954946
2015-10-13T16:47:50
2015-10-13T16:47:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,135
hpp
/************************************************************************** * * Copyright 2010 VMware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * **************************************************************************/ /* * Central place for all GL includes, and respective OS dependent headers. */ #pragma once #if defined(_WIN32) # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN 1 # endif # include <windows.h> #elif defined(__APPLE__) #elif defined(HAVE_X11) # include <X11/Xlib.h> #endif /* !_WIN32 */ #include <GL/gl.h> #include <GL/glext.h> // Windows 8 GL headers define GL_EXT_paletted_texture but not // GL_TEXTURE_INDEX_SIZE_EXT, and due to the way we include DirectX headers, it // ends up taking precedence over the ones we bundle... #if defined(GL_EXT_paletted_texture) && !defined(GL_TEXTURE_INDEX_SIZE_EXT) #define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED #endif // GL_NVX_gpu_memory_info #define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047 #define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048 #define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049 #define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A #define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B // Stuff that got removed from official Khronos headers. // XXX: Consider removing all our references to it too. #define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 #define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 #define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 #define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 #define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 #define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 #define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A #define GL_FOG_SCALE_SGIX 0x81FC #define GL_FOG_SCALE_VALUE_SGIX 0x81FD #define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 #define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 #define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 #define GL_PATH_SAMPLE_QUALITY_NV 0x9085 #define GL_PATH_STROKE_BOUND_NV 0x9086 #define GL_PATH_STROKE_OVERSAMPLE_COUNT_NV 0x9087 #define GL_MULTI_HULLS_NV 0x908C #define GL_PROJECTIVE_2D_NV 0x9093 #define GL_PROJECTIVE_3D_NV 0x9095 #define GL_TRANSPOSE_PROJECTIVE_2D_NV 0x9097 #define GL_TRANSPOSE_PROJECTIVE_3D_NV 0x9099 // GL_VMWX_map_buffer_debug #define GL_MAP_NOTIFY_EXPLICIT_BIT_VMWX 0x80000000 #if defined(_WIN32) #include <GL/wglext.h> #ifndef PFD_SUPPORT_DIRECTDRAW #define PFD_SUPPORT_DIRECTDRAW 0x00002000 #endif #ifndef PFD_DIRECT3D_ACCELERATED #define PFD_DIRECT3D_ACCELERATED 0x00004000 #endif #ifndef PFD_SUPPORT_COMPOSITION #define PFD_SUPPORT_COMPOSITION 0x00008000 #endif #ifndef WGL_SWAPMULTIPLE_MAX extern "C" typedef struct _WGLSWAP { HDC hdc; UINT uiFlags; } WGLSWAP, *PWGLSWAP, FAR *LPWGLSWAP; #define WGL_SWAPMULTIPLE_MAX 16 #endif /* !WGL_SWAPMULTIPLE_MAX */ #elif defined(__APPLE__) #include <TargetConditionals.h> #if TARGET_OS_IPHONE #elif TARGET_OS_MAC #include <AvailabilityMacros.h> /* Silence deprecated OpenGL warnings. */ #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 #include <OpenGL/OpenGLAvailability.h> #undef OPENGL_DEPRECATED #undef OPENGL_DEPRECATED_MSG #define OPENGL_DEPRECATED(from, to) #define OPENGL_DEPRECATED_MSG(from, to, msg) #endif #include <OpenGL/OpenGL.h> #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 #include <OpenGL/CGLIOSurface.h> #include <OpenGL/CGLDevice.h> #else #define kCGLPFAAcceleratedCompute 97 #define kCGLRPAcceleratedCompute 130 typedef void *CGLShareGroupObj; typedef struct __IOSurface *IOSurfaceRef; #endif #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 #define kCGLPFATripleBuffer 3 #define kCGLPFAOpenGLProfile 99 #define kCGLRPVideoMemoryMegabytes 131 #define kCGLRPTextureMemoryMegabytes 132 #define kCGLCECrashOnRemovedFunctions 316 #define kCGLOGLPVersion_Legacy 0x1000 #define kCGLOGLPVersion_3_2_Core 0x3200 #define kCGLOGLPVersion_GL3_Core 0x3200 #endif #if MAC_OS_X_VERSION_MIN_REQUIRED < 1080 #define kCGLPFABackingVolatile 77 #define kCGLPFASupportsAutomaticGraphicsSwitching 101 #endif #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 #define kCGLOGLPVersion_GL3_Core 0x3200 #define kCGLOGLPVersion_GL4_Core 0x4100 #define kCGLRPMajorGLVersion 133 #endif // OpenGL/CGLProfiler.h seems to no longer be included with XCode #define kCGLCPComment ((CGLContextParameter)1232) #define kCGLCPDumpState ((CGLContextParameter)1233) #define kCGLCPEnableForceFlush ((CGLContextParameter)1234) #define kCGLGOComment ((CGLGlobalOption)1506) #define kCGLGOEnableFunctionTrace ((CGLGlobalOption)1507) #define kCGLGOEnableFunctionStatistics ((CGLGlobalOption)1508) #define kCGLGOResetFunctionTrace ((CGLGlobalOption)1509) #define kCGLGOPageBreak ((CGLGlobalOption)1510) #define kCGLGOResetFunctionStatistics ((CGLGlobalOption)1511) #define kCGLGOEnableDebugAttach ((CGLGlobalOption)1512) #define kCGLGOHideObjects ((CGLGlobalOption)1513) #define kCGLGOEnableBreakpoint ((CGLGlobalOption)1514) #define kCGLGOForceSlowRenderingPath ((CGLGlobalOption)1609) #define kCGLGODisableImmediateRenderPath ((CGLGlobalOption)1610) #define kCGLGODisableCVARenderPath ((CGLGlobalOption)1611) #define kCGLGODisableVARRenderPath ((CGLGlobalOption)1612) #define kCGLGOForceWireframeRendering ((CGLGlobalOption)1613) #define kCGLGOSubmitOnImmediateRenderCommand ((CGLGlobalOption)1614) #define kCGLGOSubmitOnCVARenderCommand ((CGLGlobalOption)1615) #define kCGLGOSubmitOnVAORenderCommand ((CGLGlobalOption)1616) #define kCGLGOSubmitOnClearCommand ((CGLGlobalOption)1617) #define kCGLGOForceSoftwareTransformLighting ((CGLGlobalOption)1618) #define kCGLGOForceSoftwareTexgen ((CGLGlobalOption)1619) #define kCGLGOForceSoftwareTRUFORM_ATI ((CGLGlobalOption)1620) #define kCGLGOForceSoftwareVertexShaders ((CGLGlobalOption)1621) #define kCGLGODisableFragmentShaders_ATI ((CGLGlobalOption)1622) #define kCGLGODisableTexturing ((CGLGlobalOption)1623) #define kCGLGOOutlineTexture ((CGLGlobalOption)1624) #define kCGLGOOutlineTextureColor ((CGLGlobalOption)1625) #define kCGLGOForceSlowBitmapPath ((CGLGlobalOption)1626) #define kCGLGODisableBitmap ((CGLGlobalOption)1627) #define kCGLGOForceSlowReadPixelsPath ((CGLGlobalOption)1630) #define kCGLGODisableReadPixels ((CGLGlobalOption)1631) #define kCGLGOOutlineReadPixelsBuffer ((CGLGlobalOption)1632) #define kCGLGOOutlineReadPixelsBufferColor ((CGLGlobalOption)1633) #define kCGLGOForceSlowDrawPixelsPath ((CGLGlobalOption)1634) #define kCGLGODisableDrawPixels ((CGLGlobalOption)1635) #define kCGLGOOutlineDrawPixelsBuffer ((CGLGlobalOption)1636) #define kCGLGOOutlineDrawPixelsBufferColor ((CGLGlobalOption)1637) #define kCGLGOForceSlowCopyPixelsPath ((CGLGlobalOption)1638) #define kCGLGODisableCopyPixels ((CGLGlobalOption)1639) #define kCGLGOOutlineCopyPixelsBuffer ((CGLGlobalOption)1640) #define kCGLGOOutlineCopyPixelsBufferColor ((CGLGlobalOption)1641) #define kCGLGOMakeAllGLObjectsRequireUpdate ((CGLGlobalOption)1642) #define kCGLGOMakeAllGLStateRequireUpdate ((CGLGlobalOption)1643) extern "C" { // From http://www.opensource.apple.com/source/gdb/gdb-954/libcheckpoint/cpcg.c typedef void * CGSConnectionID; typedef int CGSWindowID; typedef int CGSSurfaceID; CGLError CGLSetSurface(CGLContextObj ctx, CGSConnectionID cid, CGSWindowID wid, CGSSurfaceID sid); CGLError CGLGetSurface(CGLContextObj ctx, CGSConnectionID* cid, CGSWindowID* wid, CGSSurfaceID* sid); CGLError CGLUpdateContext(CGLContextObj ctx); } #endif #else #ifdef HAVE_X11 #include <GL/glx.h> #include <GL/glxext.h> #endif /* Prevent collision with trace::Bool */ #undef Bool #endif //#include "eglimports.hpp"
[ "Tuan.Nguyen@nottingham.ac.uk" ]
Tuan.Nguyen@nottingham.ac.uk
57c32cf35127bea375a61886b86acd2e77e8d709
32731bc457096c4b2f65586dd0261881ee6fbe48
/src/popupbutton.h
c7c8b52738b59875cf6f51a752194646cf951b3a
[]
no_license
bkumpar/f3d
0fca5af927611413d705f53a0cada0b33d17a6e0
9ed1d31e5d8bf741648658e5390fc44f0cd1a90a
refs/heads/master
2023-02-08T15:36:49.859427
2020-12-22T22:01:46
2020-12-22T22:01:46
289,575,207
1
0
null
null
null
null
UTF-8
C++
false
false
498
h
#ifndef POPUPBUTTON_H #define POPUPBUTTON_H #include <QPushButton> #include <QMenu> class PopUpButton : public QPushButton { Q_OBJECT public: explicit PopUpButton(QWidget *parent = 0); PopUpButton( const QIcon & icon, const QString & text, QWidget * parent = 0); ~PopUpButton(); void addItem(QString item); void clearItems(); signals: void choosed(QString text); private slots: void chooseMenuItem(); private: QMenu * menu; }; #endif // POPUPBUTTON_H
[ "bkumpar@gmail.com" ]
bkumpar@gmail.com
3de28c63c9ea8d0e8b6854c3370bd5c875071409
20ec46931fcfa8e1688b7a030bdd172e1326ea33
/Project 4/Vampire.cpp
85409f1b1018d64c6a4a0a540617d2cdaaaa1df7
[]
no_license
kevharvell/CompSci_II
871d8e868223c8fd746bab10267a02260c9ce2cf
d2b0e6a387844a171e313797e48d787c902eda13
refs/heads/master
2020-04-08T21:42:13.879980
2018-11-30T02:11:59
2018-11-30T02:11:59
159,755,039
0
0
null
null
null
null
UTF-8
C++
false
false
2,538
cpp
/***************************************************************************** * Program name: Vampire * Author: Kevin Harvell * Date: 5/2/2018 * Description: Vampire class is a derivative of Character class. Its unique * attributes are having 1 D12 roll for attack, 1 D6 roll for defense, 1 armor, * and 18 strength points. It also has an ability 'Charm' that denies damage * from the enemy 50% of the time. *****************************************************************************/ #include "Vampire.hpp" #include "Die.hpp" #include <iostream> Vampire::Vampire() { m_type = "Vampire"; m_armor = 1; m_strength = 18; } /***************************************************************************** * attack() * attack rolls a D12 Die object once to get the attack value of the Vampire. *****************************************************************************/ int Vampire::attack() { Die attackDie(12); m_attackVal = attackDie.getRandomInt(); return m_attackVal; } /***************************************************************************** * defense() * defense rolls a D6 Die object once to get the defense value of the Vampire. * There's a 50% chance of using the 'Charm' ability, which blocks all damage * Vampire takes. *****************************************************************************/ int Vampire::defense() { if(isCharmed()) { m_defenseVal = 100000; return m_defenseVal; } else { Die defenseDie(6); m_defenseVal = defenseDie.getRandomInt(); return m_defenseVal; } } /***************************************************************************** * recover() * recover restores 50% of strength up to maximum strength. *****************************************************************************/ void Vampire::recover() { int recoverHalf = (18 - m_strength) * .5; m_strength += recoverHalf; } /***************************************************************************** * isCharmed() * isCharmed flips a coin and on one hand, it uses the ability 'Charm', while * on the other, it does not. *****************************************************************************/ bool Vampire::isCharmed() { Die charm(2); int coinFlip = charm.getRandomInt(); if(coinFlip == 1) { return true; } if(coinFlip == 2) { return false; } }
[ "harvellk@oregonstate.edu" ]
harvellk@oregonstate.edu
81e20b381e60088f74890d48723f065cac6b726f
56440b42d3ff55809d6d1fb12f74ceb6d1a24c2e
/lib/CodeGen/CodeGenModule.cpp
592490c5af841209c6d3c0b401f1f26ece3f432a
[ "NCSA" ]
permissive
f-akazawa/mlang
b8b3c393b78ee606ef7bba65c6b286832bcf8471
393edb214478d4185e594ad85ef02779002e6f72
refs/heads/master
2020-04-24T09:02:29.181586
2012-06-08T07:20:17
2012-06-08T07:20:17
34,935,578
1
0
null
null
null
null
UTF-8
C++
false
false
74,105
cpp
//===--- CodeGenModule.cpp - Emit LLVM Code from ASTs for a Module --------===// // // Copyright (C) 2010 yabin @ CGCL // HuaZhong University of Science and Technology, China // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This coordinates the per-module state used while generating code. // //===----------------------------------------------------------------------===// #include "CodeGenModule.h" #include "CGDebugInfo.h" #include "CodeGenFunction.h" #include "CodeGenTBAA.h" #include "CGCall.h" #include "CGOOPABI.h" #include "TargetInfo.h" #include "mlang/Frontend/CodeGenOptions.h" #include "mlang/AST/ASTContext.h" #include "mlang/AST/DefnOOP.h" #include "mlang/AST/Mangle.h" #include "mlang/AST/RecordLayout.h" #include "mlang/AST/Type.h" #include "mlang/Basic/Builtins.h" #include "mlang/Basic/SourceManager.h" #include "mlang/Basic/TargetInfo.h" #include "mlang/Basic/ConvertUTF.h" #include "mlang/Diag/Diagnostic.h" #include "llvm/CallingConv.h" #include "llvm/Module.h" #include "llvm/Intrinsics.h" #include "llvm/LLVMContext.h" #include "llvm/ADT/Triple.h" #include "llvm/Target/Mangler.h" #include "llvm/Target/TargetData.h" #include "llvm/Support/CallSite.h" #include "llvm/Support/ErrorHandling.h" using namespace mlang; using namespace CodeGen; static CGOOPABI &createOOPABI(CodeGenModule &CGM) { // switch (CGM.getContext().Target.getGmatABI()) { // case GmatABI_Nvidia: return *CreateNVGmatABI(CGM); // case GmatABI_AMD: return *CreateAMDGmatABI(CGM); // } llvm_unreachable("invalid Gmat ABI kind"); return *CreateNVGmatABI(CGM); } CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO, llvm::Module &M, const llvm::TargetData &TD, DiagnosticsEngine &diags) : Context(C), Features(C.getLangOptions()), CodeGenOpts(CGO), TheModule(M), TheTargetData(TD), TheTargetCodeGenInfo(0), Diags(diags), ABI(createOOPABI(*this)), Types(C, M, TD, getTargetCodeGenInfo().getABIInfo(), ABI, CGO), TBAA(0), VTables(*this), DebugInfo(0), CFConstantStringClassRef(0), ConstantStringClassRef(0), VMContext(M.getContext()), NSConcreteGlobalScriptDefn(0), NSConcreteStackScriptDefn(0), NSConcreteGlobalScript(0), NSConcreteStackScript(0), NSConcreteGlobalBlockDefn(0), NSConcreteStackBlockDefn(0), NSConcreteGlobalBlock(0), NSConcreteStackBlock(0), BlockObjectAssignDefn(0), BlockObjectDisposeDefn(0), BlockObjectAssign(0), BlockObjectDispose(0), BlockDescriptorType(0), GenericBlockLiteralType(0) { // Enable TBAA unless it's suppressed. if (!CodeGenOpts.RelaxedAliasing && CodeGenOpts.OptimizationLevel > 0) TBAA = new CodeGenTBAA(Context, VMContext, getLangOptions(), ABI.getMangleContext()); // If debug info or coverage generation is enabled, create the CGDebugInfo // object. if (CodeGenOpts.DebugInfo || CodeGenOpts.EmitGcovArcs || CodeGenOpts.EmitGcovNotes) { // DebugInfo = new CGDebugInfo(*this); } Block.GlobalUniqueCount = 0; // Initialize the type cache. llvm::LLVMContext &LLVMContext = M.getContext(); VoidTy = llvm::Type::getVoidTy(LLVMContext); Int8Ty = llvm::Type::getInt8Ty(LLVMContext); Int32Ty = llvm::Type::getInt32Ty(LLVMContext); Int64Ty = llvm::Type::getInt64Ty(LLVMContext); PointerWidthInBits = C.Target.getPointerWidth(0); PointerAlignInBytes = C.toCharUnitsFromBits(C.Target.getPointerAlign(0)).getQuantity(); IntTy = llvm::IntegerType::get(LLVMContext, C.Target.getIntWidth()); IntPtrTy = llvm::IntegerType::get(LLVMContext, PointerWidthInBits); Int8PtrTy = Int8Ty->getPointerTo(0); Int8PtrPtrTy = Int8PtrTy->getPointerTo(0); } CodeGenModule::~CodeGenModule() { delete &ABI; delete TBAA; // delete DebugInfo; } void CodeGenModule::Release() { EmitDeferred(); // EmitCXXGlobalInitFunc(); // EmitCXXGlobalDtorFunc(); EmitCtorList(GlobalCtors, "llvm.global_ctors"); EmitCtorList(GlobalDtors, "llvm.global_dtors"); EmitAnnotations(); EmitLLVMUsed(); //SimplifyPersonality(); if (getCodeGenOpts().EmitDeclMetadata) EmitDefnMetadata(); if (getCodeGenOpts().EmitGcovArcs || getCodeGenOpts().EmitGcovNotes) EmitCoverageFile(); } void CodeGenModule::UpdateCompletedType(const TypeDefn *TD) { // Make sure that this type is translated. Types.UpdateCompletedType(TD); // if (DebugInfo) // DebugInfo->UpdateCompletedType(TD); } llvm::MDNode *CodeGenModule::getTBAAInfo(Type QTy) { if (!TBAA) return 0; return TBAA->getTBAAInfo(QTy); } void CodeGenModule::DecorateInstruction(llvm::Instruction *Inst, llvm::MDNode *TBAAInfo) { Inst->setMetadata(llvm::LLVMContext::MD_tbaa, TBAAInfo); } bool CodeGenModule::isTargetDarwin() const { return getContext().Target.getTriple().isOSDarwin(); } void CodeGenModule::Error(SourceLocation loc, llvm::StringRef error) { unsigned diagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error, error); getDiags().Report(Context.getFullLoc(loc), diagID); } /// ErrorUnsupported - Print out an error that codegen doesn't support the /// specified stmt yet. void CodeGenModule::ErrorUnsupported(const Stmt *S, const char *Type, bool OmitOnError) { if (OmitOnError && getDiags().hasErrorOccurred()) return; unsigned DiagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error, "cannot compile this %0 yet"); std::string Msg = Type; getDiags().Report(Context.getFullLoc(S->getLocStart()), DiagID) << Msg << S->getSourceRange(); } /// ErrorUnsupported - Print out an error that codegen doesn't support the /// specified decl yet. void CodeGenModule::ErrorUnsupported(const Defn *D, const char *Type, bool OmitOnError) { if (OmitOnError && getDiags().hasErrorOccurred()) return; unsigned DiagID = getDiags().getCustomDiagID(DiagnosticsEngine::Error, "cannot compile this %0 yet"); std::string Msg = Type; getDiags().Report(Context.getFullLoc(D->getLocation()), DiagID) << Msg; } llvm::ConstantInt *CodeGenModule::getSize(CharUnits size) { return llvm::ConstantInt::get(SizeTy, size.getQuantity()); } llvm::Constant * CodeGenModule::GetConstantArrayFromStringLiteral(const StringLiteral *E) { // assert(!E->getType()->isPointerType() && "Strings are always arrays"); // Don't emit it as the address of the string, emit the string data itself // as an inline array. // if (E->getCharByteWidth() == 1) { SmallString<64> Str(E->getString()); // Resize the string to the right size, which is indicated by its type. // const ConstantArrayType *CAT = Context.getAsConstantArrayType(E->getType()); // Str.resize(CAT->getSize().getZExtValue()); return llvm::ConstantDataArray::getString(VMContext, Str, false); // } #if 0 llvm::ArrayType *AType = cast<llvm::ArrayType>(getTypes().ConvertType(E->getType())); llvm::Type *ElemTy = AType->getElementType(); unsigned NumElements = AType->getNumElements(); // Wide strings have either 2-byte or 4-byte elements. if (ElemTy->getPrimitiveSizeInBits() == 16) { SmallVector<uint16_t, 32> Elements; Elements.reserve(NumElements); for (unsigned i = 0, e = E->getLength(); i != e; ++i) Elements.push_back(E->getCodeUnit(i)); Elements.resize(NumElements); return llvm::ConstantDataArray::get(VMContext, Elements); } assert(ElemTy->getPrimitiveSizeInBits() == 32); SmallVector<uint32_t, 32> Elements; Elements.reserve(NumElements); for (unsigned i = 0, e = E->getLength(); i != e; ++i) Elements.push_back(E->getCodeUnit(i)); Elements.resize(NumElements); return llvm::ConstantDataArray::get(VMContext, Elements); #endif } void CodeGenModule::setGlobalVisibility(llvm::GlobalValue *GV, const NamedDefn *D) const { // Internal definitions always have default visibility. if (GV->hasLocalLinkage()) { GV->setVisibility(llvm::GlobalValue::DefaultVisibility); return; } // Set visibility for definitions. NamedDefn::LinkageInfo LV = D->getLinkageAndVisibility(); if (LV.visibilityExplicit() || !GV->hasAvailableExternallyLinkage()) GV->setVisibility(GetLLVMVisibility(LV.visibility())); } llvm::StringRef CodeGenModule::getMangledName(GlobalDefn GD) { const NamedDefn *ND = cast<NamedDefn>(GD.getDefn()); llvm::StringRef &Str = MangledDefnNames[GD.getCanonicalDefn()]; if (!Str.empty()) return Str; if (!getOOPABI().getMangleContext().shouldMangleDefnName(ND)) { IdentifierInfo *II = ND->getIdentifier(); assert(II && "Attempt to mangle unnamed decl."); Str = II->getName(); return Str; } llvm::SmallString<256> Buffer; llvm::raw_svector_ostream Out(Buffer); if (const ClassConstructorDefn *D = dyn_cast<ClassConstructorDefn>(ND)) getOOPABI().getMangleContext().mangleCXXCtor(D, GD.getCtorType(), Out); else if (const ClassDestructorDefn *D = dyn_cast<ClassDestructorDefn>(ND)) getOOPABI().getMangleContext().mangleCXXDtor(D, GD.getDtorType(), Out); else if (const ScriptDefn *BD = dyn_cast<ScriptDefn>(ND)) getOOPABI().getMangleContext().mangleBlock(BD, Out); else getOOPABI().getMangleContext().mangleName(ND, Out); // Allocate space for the mangled name. Out.flush(); size_t Length = Buffer.size(); char *Name = MangledNamesAllocator.Allocate<char>(Length); std::copy(Buffer.begin(), Buffer.end(), Name); Str = llvm::StringRef(Name, Length); return Str; } void CodeGenModule::getBlockMangledName(GlobalDefn GD, MangleBuffer &Buffer, const ScriptDefn *BD) { MangleContext &MangleCtx = getOOPABI().getMangleContext(); const Defn *D = GD.getDefn(); llvm::raw_svector_ostream Out(Buffer.getBuffer()); if (D == 0) MangleCtx.mangleGlobalBlock(BD, Out); else if (const ClassConstructorDefn *CD = dyn_cast<ClassConstructorDefn>(D)) MangleCtx.mangleCtorBlock(CD, GD.getCtorType(), BD, Out); else if (const ClassDestructorDefn *DD = dyn_cast<ClassDestructorDefn>(D)) MangleCtx.mangleDtorBlock(DD, GD.getDtorType(), BD, Out); else MangleCtx.mangleBlock(cast<DefnContext>(D), BD, Out); } llvm::GlobalValue *CodeGenModule::GetGlobalValue(llvm::StringRef Name) { return getModule().getNamedValue(Name); } /// AddGlobalCtor - Add a function to the list that will be called before /// main() runs. void CodeGenModule::AddGlobalCtor(llvm::Function * Ctor, int Priority) { // FIXME: Type coercion of void()* types. GlobalCtors.push_back(std::make_pair(Ctor, Priority)); } /// AddGlobalDtor - Add a function to the list that will be called /// when the module is unloaded. void CodeGenModule::AddGlobalDtor(llvm::Function * Dtor, int Priority) { // FIXME: Type coercion of void()* types. GlobalDtors.push_back(std::make_pair(Dtor, Priority)); } void CodeGenModule::EmitCtorList(const CtorList &Fns, const char *GlobalName) { // Ctor function type is void()*. llvm::FunctionType* CtorFTy = llvm::FunctionType::get(VoidTy, false); llvm::Type *CtorPFTy = llvm::PointerType::getUnqual(CtorFTy); // Get the type of a ctor entry, { i32, void ()* }. llvm::StructType *CtorStructTy = llvm::StructType::get(llvm::Type::getInt32Ty(VMContext), llvm::PointerType::getUnqual(CtorFTy), NULL); // Construct the constructor and destructor arrays. std::vector<llvm::Constant*> Ctors; for (CtorList::const_iterator I = Fns.begin(), E = Fns.end(); I != E; ++I) { std::vector<llvm::Constant*> S; S.push_back(llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), I->second, false)); S.push_back(llvm::ConstantExpr::getBitCast(I->first, CtorPFTy)); Ctors.push_back(llvm::ConstantStruct::get(CtorStructTy, S)); } if (!Ctors.empty()) { llvm::ArrayType *AT = llvm::ArrayType::get(CtorStructTy, Ctors.size()); new llvm::GlobalVariable(TheModule, AT, false, llvm::GlobalValue::AppendingLinkage, llvm::ConstantArray::get(AT, Ctors), GlobalName); } } void CodeGenModule::EmitAnnotations() { if (Annotations.empty()) return; // Create a new global variable for the ConstantStruct in the Module. llvm::Constant *Array = llvm::ConstantArray::get(llvm::ArrayType::get(Annotations[0]->getType(), Annotations.size()), Annotations); llvm::GlobalValue *gv = new llvm::GlobalVariable(TheModule, Array->getType(), false, llvm::GlobalValue::AppendingLinkage, Array, "llvm.global.annotations"); gv->setSection("llvm.metadata"); } llvm::GlobalValue::LinkageTypes CodeGenModule::getFunctionLinkage(const FunctionDefn *D) { GVALinkage Linkage = getContext().GetGVALinkageForFunction(D); if (Linkage == GVA_Internal) return llvm::Function::InternalLinkage; // if (D->hasAttr<DLLExportAttr>()) // return llvm::Function::DLLExportLinkage; // // if (D->hasAttr<WeakAttr>()) // return llvm::Function::WeakAnyLinkage; // In C99 mode, 'inline' functions are guaranteed to have a strong // definition somewhere else, so we can use available_externally linkage. if (Linkage == GVA_C99Inline) return llvm::Function::AvailableExternallyLinkage; // In C++, the compiler has to emit a definition in every translation unit // that references the function. We should use linkonce_odr because // a) if all references in this translation unit are optimized away, we // don't need to codegen it. b) if the function persists, it needs to be // merged with other definitions. c) C++ has the ODR, so we know the // definition is dependable. // if (Linkage == GVA_CXXInline || Linkage == GVA_TemplateInstantiation) // return !Context.getLangOptions().AppleKext // ? llvm::Function::LinkOnceODRLinkage // : llvm::Function::InternalLinkage; // An explicit instantiation of a template has weak linkage, since // explicit instantiations can occur in multiple translation units // and must all be equivalent. However, we are not allowed to // throw away these explicit instantiations. // if (Linkage == GVA_ExplicitTemplateInstantiation) // return !Context.getLangOptions().AppleKext // ? llvm::Function::WeakODRLinkage // : llvm::Function::InternalLinkage; // Otherwise, we have strong external linkage. assert(Linkage == GVA_StrongExternal); return llvm::Function::ExternalLinkage; } /// SetFunctionDefinitionAttributes - Set attributes for a global. /// /// FIXME: This is currently only done for aliases and functions, but not for /// variables (these details are set in EmitGlobalVarDefinition for variables). void CodeGenModule::SetFunctionDefinitionAttributes(const FunctionDefn *D, llvm::GlobalValue *GV) { SetCommonAttributes(D, GV); } void CodeGenModule::SetLLVMFunctionAttributes(const Defn *D, const CGFunctionInfo &Info, llvm::Function *F) { unsigned CallingConv; AttributeListType AttributeList; ConstructAttributeList(Info, D, AttributeList, CallingConv); F->setAttributes(llvm::AttrListPtr::get(AttributeList)); F->setCallingConv(static_cast<llvm::CallingConv::ID>(CallingConv)); } void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Defn *D, llvm::Function *F) { if (CodeGenOpts.UnwindTables) F->setHasUWTable(); // if (D->hasAttr<AlwaysInlineAttr>()) // F->addFnAttr(llvm::Attribute::AlwaysInline); // // if (D->hasAttr<NakedAttr>()) // F->addFnAttr(llvm::Attribute::Naked); // // if (D->hasAttr<NoInlineAttr>()) // F->addFnAttr(llvm::Attribute::NoInline); if (isa<ClassConstructorDefn>(D) || isa<ClassDestructorDefn>(D)) F->setUnnamedAddr(true); if (Features.getStackProtectorMode() == LangOptions::SSPOn) F->addFnAttr(llvm::Attribute::StackProtect); else if (Features.getStackProtectorMode() == LangOptions::SSPReq) F->addFnAttr(llvm::Attribute::StackProtectReq); // unsigned alignment = D->getMaxAlignment() / Context.getCharWidth(); // if (alignment) // F->setAlignment(alignment); // C++ ABI requires 2-byte alignment for member functions. if (F->getAlignment() < 2 && isa<ClassMethodDefn>(D)) F->setAlignment(2); } void CodeGenModule::SetCommonAttributes(const Defn *D, llvm::GlobalValue *GV) { if (const NamedDefn *ND = dyn_cast<NamedDefn>(D)) setGlobalVisibility(GV, ND); else GV->setVisibility(llvm::GlobalValue::DefaultVisibility); // if (D->hasAttr<UsedAttr>()) // AddUsedGlobal(GV); // // if (const SectionAttr *SA = D->getAttr<SectionAttr>()) // GV->setSection(SA->getName()); getTargetCodeGenInfo().SetTargetAttributes(D, GV, *this); } void CodeGenModule::SetInternalFunctionAttributes(const Defn *D, llvm::Function *F, const CGFunctionInfo &FI) { SetLLVMFunctionAttributes(D, FI, F); SetLLVMFunctionAttributesForDefinition(D, F); F->setLinkage(llvm::Function::InternalLinkage); SetCommonAttributes(D, F); } void CodeGenModule::SetFunctionAttributes(GlobalDefn GD, llvm::Function *F, bool IsIncompleteFunction) { if (unsigned IID = F->getIntrinsicID()) { // If this is an intrinsic function, set the function's attributes // to the intrinsic's attributes. F->setAttributes(llvm::Intrinsic::getAttributes((llvm::Intrinsic::ID)IID)); return; } const FunctionDefn *FD = cast<FunctionDefn>(GD.getDefn()); if (!IsIncompleteFunction) SetLLVMFunctionAttributes(FD, getTypes().getFunctionInfo(GD), F); // Only a few attributes are set on declarations; these may later be // overridden by a definition. // if (FD->hasAttr<DLLImportAttr>()) { // F->setLinkage(llvm::Function::DLLImportLinkage); // } else if (FD->hasAttr<WeakAttr>() || // FD->isWeakImported()) { // // "extern_weak" is overloaded in LLVM; we probably should have // // separate linkage types for this. // F->setLinkage(llvm::Function::ExternalWeakLinkage); // } else { // F->setLinkage(llvm::Function::ExternalLinkage); // // NamedDefn::LinkageInfo LV = FD->getLinkageAndVisibility(); // if (LV.linkage() == ExternalLinkage && LV.visibilityExplicit()) { // F->setVisibility(GetLLVMVisibility(LV.visibility())); // } // } // if (const SectionAttr *SA = FD->getAttr<SectionAttr>()) // F->setSection(SA->getName()); } void CodeGenModule::AddUsedGlobal(llvm::GlobalValue *GV) { assert(!GV->isDeclaration() && "Only globals with definition can force usage."); LLVMUsed.push_back(GV); } void CodeGenModule::EmitLLVMUsed() { // Don't create llvm.used if there is no need. if (LLVMUsed.empty()) return; llvm::Type *i8PTy = llvm::Type::getInt8PtrTy(VMContext); // Convert LLVMUsed to what ConstantArray needs. std::vector<llvm::Constant*> UsedArray; UsedArray.resize(LLVMUsed.size()); for (unsigned i = 0, e = LLVMUsed.size(); i != e; ++i) { UsedArray[i] = llvm::ConstantExpr::getBitCast(cast<llvm::Constant>(&*LLVMUsed[i]), i8PTy); } if (UsedArray.empty()) return; llvm::ArrayType *ATy = llvm::ArrayType::get(i8PTy, UsedArray.size()); llvm::GlobalVariable *GV = new llvm::GlobalVariable(getModule(), ATy, false, llvm::GlobalValue::AppendingLinkage, llvm::ConstantArray::get(ATy, UsedArray), "llvm.used"); GV->setSection("llvm.metadata"); } void CodeGenModule::EmitDeferred() { // Emit code for any potentially referenced deferred decls. Since a // previously unused static decl may become used during the generation of code // for a static function, iterate until no changes are made. while (!DeferredDefnsToEmit.empty() || !DeferredVTables.empty()) { if (!DeferredVTables.empty()) { const UserClassDefn *RD = DeferredVTables.back(); DeferredVTables.pop_back(); // getVTables().GenerateClassData(getVTableLinkage(RD), RD); continue; } GlobalDefn D = DeferredDefnsToEmit.back(); DeferredDefnsToEmit.pop_back(); // Check to see if we've already emitted this. This is necessary // for a couple of reasons: first, decls can end up in the // deferred-decls queue multiple times, and second, decls can end // up with definitions in unusual ways (e.g. by an extern inline // function acquiring a strong function redefinition). Just // ignore these cases. // // TODO: That said, looking this up multiple times is very wasteful. llvm::StringRef Name = "_script_yabin_"/*getMangledName(D)*/; llvm::GlobalValue *CGRef = GetGlobalValue(Name); assert(CGRef && "Deferred decl wasn't referenced?"); if (!CGRef->isDeclaration()) continue; // GlobalAlias::isDeclaration() defers to the aliasee, but for our // purposes an alias counts as a definition. if (isa<llvm::GlobalAlias>(CGRef)) continue; // Otherwise, emit the definition and move on to the next one. EmitGlobalDefinition(D); } } /// EmitAnnotateAttr - Generate the llvm::ConstantStruct which contains the /// annotation information for a given GlobalValue. The annotation struct is /// {i8 *, i8 *, i8 *, i32}. The first field is a constant expression, the /// GlobalValue being annotated. The second field is the constant string /// created from the AnnotateAttr's annotation. The third field is a constant /// string containing the name of the translation unit. The fourth field is /// the line number in the file of the annotated value declaration. /// /// FIXME: this does not unique the annotation string constants, as llvm-gcc /// appears to. /// //llvm::Constant *CodeGenModule::EmitAnnotateAttr(llvm::GlobalValue *GV, // const AnnotateAttr *AA, // unsigned LineNo) { // llvm::Module *M = &getModule(); // // // get [N x i8] constants for the annotation string, and the filename string // // which are the 2nd and 3rd elements of the global annotation structure. // llvm::Type *SBP = llvm::Type::getInt8PtrTy(VMContext); // llvm::Constant *anno = llvm::ConstantArray::get(VMContext, // AA->getAnnotation(), true); // llvm::Constant *unit = llvm::ConstantArray::get(VMContext, // M->getModuleIdentifier(), // true); // // // Get the two global values corresponding to the ConstantArrays we just // // created to hold the bytes of the strings. // llvm::GlobalValue *annoGV = // new llvm::GlobalVariable(*M, anno->getType(), false, // llvm::GlobalValue::PrivateLinkage, anno, // GV->getName()); // // translation unit name string, emitted into the llvm.metadata section. // llvm::GlobalValue *unitGV = // new llvm::GlobalVariable(*M, unit->getType(), false, // llvm::GlobalValue::PrivateLinkage, unit, // ".str"); // unitGV->setUnnamedAddr(true); // // // Create the ConstantStruct for the global annotation. // llvm::Constant *Fields[4] = { // llvm::ConstantExpr::getBitCast(GV, SBP), // llvm::ConstantExpr::getBitCast(annoGV, SBP), // llvm::ConstantExpr::getBitCast(unitGV, SBP), // llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), LineNo) // }; // return llvm::ConstantStruct::getAnon(Fields); //} bool CodeGenModule::MayDeferGeneration(const NamedDefn *Global) { // Never defer when EmitAllDefns is specified. // if (Features.EmitAllDefns) // return false; return !getContext().DefnMustBeEmitted(Global); } //llvm::Constant *CodeGenModule::GetWeakRefReference(const ValueDefn *VD) { // const AliasAttr *AA = VD->getAttr<AliasAttr>(); // assert(AA && "No alias?"); // // llvm::Type *DefnTy = getTypes().ConvertTypeForMem(VD->getType()); // // // See if there is already something with the target's name in the module. // llvm::GlobalValue *Entry = GetGlobalValue(AA->getAliasee()); // // llvm::Constant *Aliasee; // if (isa<llvm::FunctionType>(DefnTy)) // Aliasee = GetOrCreateLLVMFunction(AA->getAliasee(), DefnTy, GlobalDefn(), // /*ForVTable=*/false); // else // Aliasee = GetOrCreateLLVMGlobal(AA->getAliasee(), // llvm::PointerType::getUnqual(DefnTy), 0); // if (!Entry) { // llvm::GlobalValue* F = cast<llvm::GlobalValue>(Aliasee); // F->setLinkage(llvm::Function::ExternalWeakLinkage); // WeakRefReferences.insert(F); // } // // return Aliasee; //} void CodeGenModule::EmitGlobal(GlobalDefn GD) { const NamedDefn *Global = cast<NamedDefn>(GD.getDefn()); // // Weak references don't produce any output by themselves. // if (Global->hasAttr<WeakRefAttr>()) // return; // // // If this is an alias definition (which otherwise looks like a declaration) // // emit it now. // if (Global->hasAttr<AliasAttr>()) // return EmitAliasDefinition(GD); // Ignore declarations, they will be emitted on their first use. if(const ScriptDefn *SD = dyn_cast<ScriptDefn>(Global)) { if (SD->getIdentifier()) { llvm::StringRef Name = SD->getName(); if (Name == "_NSConcreteGlobalBlock") { NSConcreteGlobalScriptDefn = SD; } else if (Name == "_NSConcreteStackBlock") { NSConcreteStackScriptDefn = SD; } } } else if (const FunctionDefn *FD = dyn_cast<FunctionDefn>(Global)) { if (FD->getIdentifier()) { llvm::StringRef Name = FD->getName(); if (Name == "_Block_object_assign") { BlockObjectAssignDefn = FD; } else if (Name == "_Block_object_dispose") { BlockObjectDisposeDefn = FD; } } } else { const VarDefn *VD = cast<VarDefn>(Global); //assert(VD->isFileVarDefn() && "Cannot emit local var decl as global."); if (VD->getIdentifier()) { llvm::StringRef Name = VD->getName(); if (Name == "_NSConcreteGlobalBlock") { NSConcreteGlobalBlockDefn = VD; } else if (Name == "_NSConcreteStackBlock") { NSConcreteStackBlockDefn = VD; } } // // if (VD->isThisDeclarationADefinition() != VarDefn::Definition) // return; } // Defer code generation when possible if this is a static definition, inline // function etc. These we only want to emit if they are used. if (!MayDeferGeneration(Global)) { // Emit the definition if it can't be deferred. EmitGlobalDefinition(GD); return; } // If we're deferring emission of a C++ variable with an // initializer, remember the order in which it appeared in the file. if (getLangOptions().OOP && isa<VarDefn>(Global) && cast<VarDefn>(Global)->hasInit()) { DelayedCXXInitPosition[Global] = CXXGlobalInits.size(); CXXGlobalInits.push_back(0); } // If the value has already been used, add it directly to the // DeferredDefnsToEmit list. llvm::StringRef MangledName = getMangledName(GD); if (GetGlobalValue(MangledName)) DeferredDefnsToEmit.push_back(GD); else { // Otherwise, remember that we saw a deferred decl with this name. The // first use of the mangled name will cause it to move into // DeferredDefnsToEmit. DeferredDefns[MangledName] = GD; } } void CodeGenModule::EmitGlobalDefinition(GlobalDefn GD) { const NamedDefn *D = cast<NamedDefn>(GD.getDefn()); PrettyStackTraceDefn CrashInfo(const_cast<NamedDefn *>(D), D->getLocation(), Context.getSourceManager(), "Generating code for declaration"); if(const ScriptDefn *Script = dyn_cast<ScriptDefn>(D)) { return EmitGlobalScriptDefinition(Script); } if (const FunctionDefn *Function = dyn_cast<FunctionDefn>(D)) { // At -O0, don't generate IR for functions with available_externally // linkage. if (CodeGenOpts.OptimizationLevel == 0 && /*!Function->hasAttr<AlwaysInlineAttr>() &&*/ getFunctionLinkage(Function) == llvm::Function::AvailableExternallyLinkage) return; if (const ClassMethodDefn *Method = dyn_cast<ClassMethodDefn>(D)) { // Make sure to emit the definition(s) before we emit the thunks. // This is necessary for the generation of certain thunks. // if (const ClassConstructorDefn *CD = dyn_cast<ClassConstructorDefn>(Method)) // EmitClassConstructor(CD, GD.getCtorType()); // else if (const ClassDestructorDefn *DD =dyn_cast<ClassDestructorDefn>(Method)) // EmitClassDestructor(DD, GD.getDtorType()); // else // EmitGlobalFunctionDefinition(GD); // if (Method->isVirtual()) // getVTables().EmitThunks(GD); return; } return EmitGlobalFunctionDefinition(GD); } if (const VarDefn *VD = dyn_cast<VarDefn>(D)) return EmitGlobalVarDefinition(VD); assert(0 && "Invalid argument to EmitGlobalDefinition()"); } /// GetOrCreateLLVMFunction - If the specified mangled name is not in the /// module, create and return an llvm Function with the specified type. If there /// is something in the module with the specified name, return it potentially /// bitcasted to the right type. /// /// If D is non-null, it specifies a decl that correspond to this. This is used /// to set the attributes on the function when it is first created. llvm::Constant * CodeGenModule::GetOrCreateLLVMFunction(llvm::StringRef MangledName, llvm::Type *Ty, GlobalDefn D, bool ForVTable, llvm::Attributes ExtraAttrs) { // Lookup the entry, lazily creating it if necessary. llvm::GlobalValue *Entry = GetGlobalValue(MangledName); if (Entry) { if (WeakRefReferences.count(Entry)) { const FunctionDefn *FD = cast_or_null<FunctionDefn>(D.getDefn()); //FIXME huyabin if (FD /*&& !FD->hasAttr<WeakAttr>()*/) Entry->setLinkage(llvm::Function::ExternalLinkage); WeakRefReferences.erase(Entry); } if (Entry->getType()->getElementType() == Ty) return Entry; // Make sure the result is of the correct type. llvm::Type *PTy = llvm::PointerType::getUnqual(Ty); return llvm::ConstantExpr::getBitCast(Entry, PTy); } // This function doesn't have a complete type (for example, the return // type is an incomplete struct). Use a fake type instead, and make // sure not to try to set attributes. bool IsIncompleteFunction = false; llvm::FunctionType *FTy; if (isa<llvm::FunctionType>(Ty)) { FTy = cast<llvm::FunctionType>(Ty); } else { FTy = llvm::FunctionType::get(VoidTy, false); IsIncompleteFunction = true; } llvm::Function *F = llvm::Function::Create(FTy, llvm::Function::ExternalLinkage, MangledName, &getModule()); assert(F->getName() == MangledName && "name was uniqued!"); if (D.getDefn()) SetFunctionAttributes(D, F, IsIncompleteFunction); if (ExtraAttrs != llvm::Attribute::None) F->addFnAttr(ExtraAttrs); // This is the first use or definition of a mangled name. If there is a // deferred decl with this name, remember that we need to emit it at the end // of the file. llvm::StringMap<GlobalDefn>::iterator DDI = DeferredDefns.find(MangledName); if (DDI != DeferredDefns.end()) { // Move the potentially referenced deferred decl to the DeferredDefnsToEmit // list, and remove it from DeferredDefns (since we don't need it anymore). DeferredDefnsToEmit.push_back(DDI->second); DeferredDefns.erase(DDI); // Otherwise, there are cases we have to worry about where we're // using a declaration for which we must emit a definition but where // we might not find a top-level definition: // - member functions defined inline in their classes // - friend functions defined inline in some class // - special member functions with implicit definitions // If we ever change our AST traversal to walk into class methods, // this will be unnecessary. // // We also don't emit a definition for a function if it's going to be an entry // in a vtable, unless it's already marked as used. } else if (getLangOptions().OOP && D.getDefn()) { // Look for a declaration that's lexically in a record. const FunctionDefn *FD = cast<FunctionDefn>(D.getDefn()); // do { // if (isa<UserClassDefn>(FD->getDefnContext())) { // if (FD->isImplicit() && !ForVTable) { // assert(FD->isUsed() && "Sema didn't mark implicit function as used!"); // DeferredDefnsToEmit.push_back(D.getWithDecl(FD)); // break; // } else { DeferredDefnsToEmit.push_back(D/*.getWithDefn(FD)*/); // break; // } // } // FD = FD->getPreviousDefinition(); // } while (FD); } // Make sure the result is of the requested type. if (!IsIncompleteFunction) { assert(F->getType()->getElementType() == Ty); return F; } llvm::Type *PTy = llvm::PointerType::getUnqual(Ty); return llvm::ConstantExpr::getBitCast(F, PTy); } /// GetAddrOfFunction - Return the address of the given function. If Ty is /// non-null, then this function will use the specified type if it has to /// create it (this occurs when we see a definition of the function). llvm::Constant *CodeGenModule::GetAddrOfFunction(GlobalDefn GD, llvm::Type *Ty, bool ForVTable) { // If there was no specific requested type, just convert it now. if (!Ty) Ty = getTypes().ConvertType(cast<ValueDefn>(GD.getDefn())->getType()); //FIXME huyabin llvm::StringRef MangledName = "_script_yabin_" /*+ getMangledName(GD)*/; return GetOrCreateLLVMFunction(MangledName, Ty, GD, ForVTable); } /// CreateRuntimeFunction - Create a new runtime function with the specified /// type and name. llvm::Constant * CodeGenModule::CreateRuntimeFunction(llvm::FunctionType *FTy, llvm::StringRef Name, llvm::Attributes ExtraAttrs) { return GetOrCreateLLVMFunction(Name, FTy, GlobalDefn(), /*ForVTable=*/false, ExtraAttrs); } /// GetAddrOfFunction - Return the address of the given script. llvm::Constant *CodeGenModule::GetAddrOfScript(const ScriptDefn *SD) { return NULL; } static bool DeclIsConstantGlobal(ASTContext &Context, const VarDefn *D, bool ConstantInit) { // if (!D->getType().isConstant(Context) && !D->getType()->isReferenceType()) // return false; // // if (Context.getLangOptions().CPlusPlus) { // if (const RecordType *Record // = Context.getBaseElementType(D->getType())->getAs<RecordType>()) // return ConstantInit && // cast<UserClassDefn>(Record->getDefn())->isPOD() && // !cast<UserClassDefn>(Record->getDefn())->hasMutableFields(); // } return true; } /// GetOrCreateLLVMGlobal - If the specified mangled name is not in the module, /// create and return an llvm GlobalVariable with the specified type. If there /// is something in the module with the specified name, return it potentially /// bitcasted to the right type. /// /// If D is non-null, it specifies a decl that correspond to this. This is used /// to set the attributes on the global when it is first created. llvm::Constant * CodeGenModule::GetOrCreateLLVMGlobal(llvm::StringRef MangledName, llvm::PointerType *Ty, const VarDefn *D, bool UnnamedAddr) { // Lookup the entry, lazily creating it if necessary. llvm::GlobalValue *Entry = GetGlobalValue(MangledName); if (Entry) { if (WeakRefReferences.count(Entry)) { // if (D && !D->hasAttr<WeakAttr>()) // Entry->setLinkage(llvm::Function::ExternalLinkage); WeakRefReferences.erase(Entry); } if (UnnamedAddr) Entry->setUnnamedAddr(true); if (Entry->getType() == Ty) return Entry; // Make sure the result is of the correct type. return llvm::ConstantExpr::getBitCast(Entry, Ty); } // This is the first use or definition of a mangled name. If there is a // deferred decl with this name, remember that we need to emit it at the end // of the file. llvm::StringMap<GlobalDefn>::iterator DDI = DeferredDefns.find(MangledName); if (DDI != DeferredDefns.end()) { // Move the potentially referenced deferred decl to the DeferredDefnsToEmit // list, and remove it from DeferredDefns (since we don't need it anymore). DeferredDefnsToEmit.push_back(DDI->second); DeferredDefns.erase(DDI); } llvm::GlobalVariable *GV = new llvm::GlobalVariable(getModule(), Ty->getElementType(), false, llvm::GlobalValue::ExternalLinkage, 0, MangledName, 0, false, Ty->getAddressSpace()); // Handle things which are present even on external declarations. if (D) { // FIXME: This code is overly simple and should be merged with other global // handling. GV->setConstant(DeclIsConstantGlobal(Context, D, false)); // Set linkage and visibility in case we never see a definition. NamedDefn::LinkageInfo LV = D->getLinkageAndVisibility(); if (LV.linkage() != ExternalLinkage) { // Don't set internal linkage on declarations. } else { // if (D->hasAttr<DLLImportAttr>()) // GV->setLinkage(llvm::GlobalValue::DLLImportLinkage); // else if (D->hasAttr<WeakAttr>() || D->isWeakImported()) // GV->setLinkage(llvm::GlobalValue::ExternalWeakLinkage); // Set visibility on a declaration only if it's explicit. if (LV.visibilityExplicit()) GV->setVisibility(GetLLVMVisibility(LV.visibility())); } // GV->setThreadLocal(D->isThreadSpecified()); } return GV; } llvm::GlobalVariable * CodeGenModule::CreateOrReplaceCXXRuntimeVariable(llvm::StringRef Name, llvm::Type *Ty, llvm::GlobalValue::LinkageTypes Linkage) { llvm::GlobalVariable *GV = getModule().getNamedGlobal(Name); llvm::GlobalVariable *OldGV = 0; if (GV) { // Check if the variable has the right type. if (GV->getType()->getElementType() == Ty) return GV; // Because C++ name mangling, the only way we can end up with an already // existing global with the same name is if it has been declared extern "C". assert(GV->isDeclaration() && "Declaration has wrong type!"); OldGV = GV; } // Create a new variable. GV = new llvm::GlobalVariable(getModule(), Ty, /*isConstant=*/true, Linkage, 0, Name); if (OldGV) { // Replace occurrences of the old variable if needed. GV->takeName(OldGV); if (!OldGV->use_empty()) { llvm::Constant *NewPtrForOldDecl = llvm::ConstantExpr::getBitCast(GV, OldGV->getType()); OldGV->replaceAllUsesWith(NewPtrForOldDecl); } OldGV->eraseFromParent(); } return GV; } /// GetAddrOfGlobalVar - Return the llvm::Constant for the address of the /// given global variable. If Ty is non-null and if the global doesn't exist, /// then it will be greated with the specified type instead of whatever the /// normal requested type would be. llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDefn *D, llvm::Type *Ty) { assert(D->hasGlobalStorage() && "Not a global variable"); Type ASTTy = D->getType(); if (Ty == 0) Ty = getTypes().ConvertTypeForMem(ASTTy); llvm::PointerType *PTy = llvm::PointerType::get(Ty, getContext().getTargetAddressSpace(ASTTy)); llvm::StringRef MangledName = getMangledName(D); return GetOrCreateLLVMGlobal(MangledName, PTy, D); } /// CreateRuntimeVariable - Create a new runtime global variable with the /// specified type and name. llvm::Constant * CodeGenModule::CreateRuntimeVariable(llvm::Type *Ty, llvm::StringRef Name) { return GetOrCreateLLVMGlobal(Name, llvm::PointerType::getUnqual(Ty), 0, true); } void CodeGenModule::EmitTentativeDefinition(const VarDefn *D) { assert(!D->getInit() && "Cannot emit definite definitions here!"); if (MayDeferGeneration(D)) { // If we have not seen a reference to this variable yet, place it // into the deferred declarations table to be emitted if needed // later. llvm::StringRef MangledName = getMangledName(D); if (!GetGlobalValue(MangledName)) { DeferredDefns[MangledName] = D; return; } } // The tentative definition is the only definition. EmitGlobalVarDefinition(D); } void CodeGenModule::EmitVTable(UserClassDefn *Class, bool DefinitionRequired) { if (DefinitionRequired) { // getVTables().GenerateClassData(getVTableLinkage(Class), Class); } } llvm::GlobalVariable::LinkageTypes CodeGenModule::getVTableLinkage(const UserClassDefn *RD) { if (RD->getLinkage() != ExternalLinkage) return llvm::GlobalVariable::InternalLinkage; // Silence GCC warning. return llvm::GlobalVariable::LinkOnceODRLinkage; } CharUnits CodeGenModule::GetTargetTypeStoreSize(llvm::Type *Ty) const { return Context.toCharUnitsFromBits( TheTargetData.getTypeStoreSizeInBits(Ty)); } void CodeGenModule::EmitGlobalVarDefinition(const VarDefn *D) { llvm::Constant *Init = 0; Type ASTTy = D->getType(); bool NonConstInit = false; const Expr *InitExpr = D->getAnyInitializer(); if (!InitExpr) { // This is a tentative definition; tentative definitions are // implicitly initialized with { 0 }. // // Note that tentative definitions are only emitted at the end of // a translation unit, so they should never have incomplete // type. In addition, EmitTentativeDefinition makes sure that we // never attempt to emit a tentative definition if a real one // exists. A use may still exists, however, so we still may need // to do a RAUW. //assert(!ASTTy->isIncompleteType() && "Unexpected incomplete type"); Init = EmitNullConstant(D->getType()); } else { Init = EmitConstantExpr(InitExpr, D->getType()); if (!Init) { Type T = InitExpr->getType(); if (D->getType()->isReferenceType()) T = D->getType(); if (getLangOptions().OOP) { Init = EmitNullConstant(T); NonConstInit = true; } else { ErrorUnsupported(D, "static initializer"); Init = llvm::UndefValue::get(getTypes().ConvertType(T)); } } else { // We don't need an initializer, so remove the entry for the delayed // initializer position (just in case this entry was delayed). if (getLangOptions().OOP) DelayedCXXInitPosition.erase(D); } } llvm::Type* InitType = Init->getType(); llvm::Constant *Entry = GetAddrOfGlobalVar(D, InitType); // Strip off a bitcast if we got one back. if (llvm::ConstantExpr *CE = dyn_cast<llvm::ConstantExpr>(Entry)) { assert(CE->getOpcode() == llvm::Instruction::BitCast || // all zero index gep. CE->getOpcode() == llvm::Instruction::GetElementPtr); Entry = CE->getOperand(0); } // Entry is now either a Function or GlobalVariable. llvm::GlobalVariable *GV = dyn_cast<llvm::GlobalVariable>(Entry); // We have a definition after a declaration with the wrong type. // We must make a new GlobalVariable* and update everything that used OldGV // (a declaration or tentative definition) with the new GlobalVariable* // (which will be a definition). // // This happens if there is a prototype for a global (e.g. // "extern int x[];") and then a definition of a different type (e.g. // "int x[10];"). This also happens when an initializer has a different type // from the type of the global (this happens with unions). if (GV == 0 || GV->getType()->getElementType() != InitType || GV->getType()->getAddressSpace() != getContext().getTargetAddressSpace(ASTTy)) { // Move the old entry aside so that we'll create a new one. Entry->setName(llvm::StringRef()); // Make a new global with the correct type, this is now guaranteed to work. GV = cast<llvm::GlobalVariable>(GetAddrOfGlobalVar(D, InitType)); // Replace all uses of the old global with the new global llvm::Constant *NewPtrForOldDecl = llvm::ConstantExpr::getBitCast(GV, Entry->getType()); Entry->replaceAllUsesWith(NewPtrForOldDecl); // Erase the old global, since it is no longer used. cast<llvm::GlobalValue>(Entry)->eraseFromParent(); } // if (const AnnotateAttr *AA = D->getAttr<AnnotateAttr>()) { // SourceManager &SM = Context.getSourceManager(); // AddAnnotation(EmitAnnotateAttr(GV, AA, // SM.getInstantiationLineNumber(D->getLocation()))); // } GV->setInitializer(Init); // If it is safe to mark the global 'constant', do so now. GV->setConstant(false); if (!NonConstInit && DeclIsConstantGlobal(Context, D, true)) GV->setConstant(true); GV->setAlignment(getContext().getDefnAlign(D).getQuantity()); // Set the llvm linkage type as appropriate. llvm::GlobalValue::LinkageTypes Linkage = GetLLVMLinkageVarDefinition(D, GV); GV->setLinkage(Linkage); if (Linkage == llvm::GlobalVariable::CommonLinkage) // common vars aren't constant even if declared const. GV->setConstant(false); SetCommonAttributes(D, GV); // Emit the initializer function if necessary. // if (NonConstInit) // EmitCXXGlobalVarDeclInitFunc(D, GV); // Emit global variable debug information. if (CGDebugInfo *DI = getModuleDebugInfo()) { // DI->setLocation(D->getLocation()); // DI->EmitGlobalVariable(GV, D); } } llvm::GlobalValue::LinkageTypes CodeGenModule::GetLLVMLinkageVarDefinition(const VarDefn *D, llvm::GlobalVariable *GV) { // GVALinkage Linkage = getContext().GetGVALinkageForVariable(D); // if (Linkage == GVA_Internal) // return llvm::Function::InternalLinkage; // else if (D->hasAttr<DLLImportAttr>()) // return llvm::Function::DLLImportLinkage; // else if (D->hasAttr<DLLExportAttr>()) // return llvm::Function::DLLExportLinkage; // else if (D->hasAttr<WeakAttr>()) { // if (GV->isConstant()) // return llvm::GlobalVariable::WeakODRLinkage; // else // return llvm::GlobalVariable::WeakAnyLinkage; // } else if (Linkage == GVA_TemplateInstantiation || // Linkage == GVA_ExplicitTemplateInstantiation) // return llvm::GlobalVariable::WeakODRLinkage; // else if (!getLangOptions().CPlusPlus && // ((!CodeGenOpts.NoCommon && !D->getAttr<NoCommonAttr>()) || // D->getAttr<CommonAttr>()) && // !D->hasExternalStorage() && !D->getInit() && // !D->getAttr<SectionAttr>() && !D->isThreadSpecified() && // !D->getAttr<WeakImportAttr>()) { // // Thread local vars aren't considered common linkage. // return llvm::GlobalVariable::CommonLinkage; // } return llvm::GlobalVariable::ExternalLinkage; } /// ReplaceUsesOfNonProtoTypeWithRealFunction - This function is called when we /// implement a function with no prototype, e.g. "int foo() {}". If there are /// existing call uses of the old function in the module, this adjusts them to /// call the new function directly. /// /// This is not just a cleanup: the always_inline pass requires direct calls to /// functions to be able to inline them. If there is a bitcast in the way, it /// won't inline them. Instcombine normally deletes these calls, but it isn't /// run at -O0. static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old, llvm::Function *NewFn) { // If we're redefining a global as a function, don't transform it. llvm::Function *OldFn = dyn_cast<llvm::Function>(Old); if (OldFn == 0) return; llvm::Type *NewRetTy = NewFn->getReturnType(); llvm::SmallVector<llvm::Value*, 4> ArgList; for (llvm::Value::use_iterator UI = OldFn->use_begin(), E = OldFn->use_end(); UI != E; ) { // TODO: Do invokes ever occur in C code? If so, we should handle them too. llvm::Value::use_iterator I = UI++; // Increment before the CI is erased. llvm::CallInst *CI = dyn_cast<llvm::CallInst>(*I); if (!CI) continue; // FIXME: when we allow Invoke, just do CallSite CS(*I) llvm::CallSite CS(CI); if (!CI || !CS.isCallee(I)) continue; // If the return types don't match exactly, and if the call isn't dead, then // we can't transform this call. if (CI->getType() != NewRetTy && !CI->use_empty()) continue; // If the function was passed too few arguments, don't transform. If extra // arguments were passed, we silently drop them. If any of the types // mismatch, we don't transform. unsigned ArgNo = 0; bool DontTransform = false; for (llvm::Function::arg_iterator AI = NewFn->arg_begin(), E = NewFn->arg_end(); AI != E; ++AI, ++ArgNo) { if (CS.arg_size() == ArgNo || CS.getArgument(ArgNo)->getType() != AI->getType()) { DontTransform = true; break; } } if (DontTransform) continue; // Okay, we can transform this. Create the new call instruction and copy // over the required information. ArgList.append(CS.arg_begin(), CS.arg_begin() + ArgNo); llvm::CallInst *NewCall = llvm::CallInst::Create(NewFn, ArgList, "", CI); ArgList.clear(); if (!NewCall->getType()->isVoidTy()) NewCall->takeName(CI); NewCall->setAttributes(CI->getAttributes()); NewCall->setCallingConv(CI->getCallingConv()); // Finally, remove the old call, replacing any uses with the new one. if (!CI->use_empty()) CI->replaceAllUsesWith(NewCall); // Copy debug location attached to CI. if (!CI->getDebugLoc().isUnknown()) NewCall->setDebugLoc(CI->getDebugLoc()); CI->eraseFromParent(); } } // Convert ScriptDefn to a GlobalDefn, which contains a FuntionDefn that has // the void f(void) style. static GlobalDefn ConvertScriptToGlobalFuntion(CodeGenModule &CGM, ScriptDefn* SD) { ASTContext &Ctx = CGM.getContext(); FunctionType::ExtInfo *Info = new FunctionType::ExtInfo(true, false, (unsigned)0, CC_Default, false); Type Ty = Ctx.getFunctionNoProtoType(Type(), *Info); SourceLocation Loc = SD->getLocStart(); DefinitionName Name = SD->getDefnName(); FunctionDefn *FD = FunctionDefn::Create(Ctx, (DefnContext *)0, Loc, Name, Ty); BlockCmd *body = SD->getBlockBody(); FD->setBody(body); return GlobalDefn(FD); } void CodeGenModule::EmitGlobalScriptDefinition(const ScriptDefn* SD) { GlobalDefn GD = ConvertScriptToGlobalFuntion(*this, const_cast<ScriptDefn*>(SD)); return EmitGlobalFunctionDefinition(GD); } void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDefn GD) { const FunctionDefn *D = cast<FunctionDefn>(GD.getDefn()); // Compute the function info and LLVM type. const CGFunctionInfo &FI = getTypes().getFunctionInfo(GD); bool variadic = false; if (const FunctionProtoType *fpt = D->getType()->getAs<FunctionProtoType>()) variadic = fpt->isVariadic(); llvm::FunctionType *Ty = getTypes().GetFunctionType(FI, variadic, false); // Get or create the prototype for the function. llvm::Constant *Entry = GetAddrOfFunction(GD, Ty); // Strip off a bitcast if we got one back. if (llvm::ConstantExpr *CE = dyn_cast<llvm::ConstantExpr>(Entry)) { assert(CE->getOpcode() == llvm::Instruction::BitCast); Entry = CE->getOperand(0); } if (cast<llvm::GlobalValue>(Entry)->getType()->getElementType() != Ty) { llvm::GlobalValue *OldFn = cast<llvm::GlobalValue>(Entry); // If the types mismatch then we have to rewrite the definition. assert(OldFn->isDeclaration() && "Shouldn't replace non-declaration"); // F is the Function* for the one with the wrong type, we must make a new // Function* and update everything that used F (a declaration) with the new // Function* (which will be a definition). // // This happens if there is a prototype for a function // (e.g. "int f()") and then a definition of a different type // (e.g. "int f(int x)"). Move the old function aside so that it // doesn't interfere with GetAddrOfFunction. OldFn->setName(llvm::StringRef()); llvm::Function *NewFn = cast<llvm::Function>(GetAddrOfFunction(GD, Ty)); // If this is an implementation of a function without a prototype, try to // replace any existing uses of the function (which may be calls) with uses // of the new function if (D->getType()->isFunctionNoProtoType()) { ReplaceUsesOfNonProtoTypeWithRealFunction(OldFn, NewFn); OldFn->removeDeadConstantUsers(); } // Replace uses of F with the Function we will endow with a body. if (!Entry->use_empty()) { llvm::Constant *NewPtrForOldDecl = llvm::ConstantExpr::getBitCast(NewFn, Entry->getType()); Entry->replaceAllUsesWith(NewPtrForOldDecl); } // Ok, delete the old function now, which is dead. OldFn->eraseFromParent(); Entry = NewFn; } // We need to set linkage and visibility on the function before // generating code for it because various parts of IR generation // want to propagate this information down (e.g. to local static // declarations). llvm::Function *Fn = cast<llvm::Function>(Entry); setFunctionLinkage(D, Fn); // FIXME: this is redundant with part of SetFunctionDefinitionAttributes setGlobalVisibility(Fn, D); CodeGenFunction(*this).GenerateCode(GD, Fn); SetFunctionDefinitionAttributes(D, Fn); SetLLVMFunctionAttributesForDefinition(D, Fn); // if (const ConstructorAttr *CA = D->getAttr<ConstructorAttr>()) // AddGlobalCtor(Fn, CA->getPriority()); // if (const DestructorAttr *DA = D->getAttr<DestructorAttr>()) // AddGlobalDtor(Fn, DA->getPriority()); } //void CodeGenModule::EmitAliasDefinition(GlobalDefn GD) { // const ValueDefn *D = cast<ValueDefn>(GD.getDefn()); //// const AliasAttr *AA = D->getAttr<AliasAttr>(); //// assert(AA && "Not an alias?"); // // llvm::StringRef MangledName = getMangledName(GD); // // // If there is a definition in the module, then it wins over the alias. // // This is dubious, but allow it to be safe. Just ignore the alias. // llvm::GlobalValue *Entry = GetGlobalValue(MangledName); // if (Entry && !Entry->isDeclaration()) // return; // // llvm::Type *DeclTy = getTypes().ConvertTypeForMem(D->getType()); // // // Create a reference to the named value. This ensures that it is emitted // // if a deferred decl. // llvm::Constant *Aliasee; //// if (isa<llvm::FunctionType>(DeclTy)) //// Aliasee = GetOrCreateLLVMFunction(AA->getAliasee(), DeclTy, GlobalDefn(), //// /*ForVTable=*/false); //// else //// Aliasee = GetOrCreateLLVMGlobal(AA->getAliasee(), //// llvm::PointerType::getUnqual(DeclTy), 0); // // // Create the new alias itself, but don't set a name yet. // llvm::GlobalValue *GA = // new llvm::GlobalAlias(Aliasee->getType(), // llvm::Function::ExternalLinkage, // "", Aliasee, &getModule()); // // if (Entry) { // assert(Entry->isDeclaration()); // // // If there is a declaration in the module, then we had an extern followed // // by the alias, as in: // // extern int test6(); // // ... // // int test6() __attribute__((alias("test7"))); // // // // Remove it and replace uses of it with the alias. // GA->takeName(Entry); // // Entry->replaceAllUsesWith(llvm::ConstantExpr::getBitCast(GA, // Entry->getType())); // Entry->eraseFromParent(); // } else { // GA->setName(MangledName); // } // // // Set attributes which are particular to an alias; this is a // // specialization of the attributes which may be set on a global // // variable/function. //// if (D->hasAttr<DLLExportAttr>()) { //// if (const FunctionDefn *FD = dyn_cast<FunctionDefn>(D)) { //// // The dllexport attribute is ignored for undefined symbols. //// if (FD->hasBody()) //// GA->setLinkage(llvm::Function::DLLExportLinkage); //// } else { //// GA->setLinkage(llvm::Function::DLLExportLinkage); //// } //// } else if (D->hasAttr<WeakAttr>() || //// D->hasAttr<WeakRefAttr>() || //// D->isWeakImported()) { //// GA->setLinkage(llvm::Function::WeakAnyLinkage); //// } // // SetCommonAttributes(D, GA); //} /// getBuiltinLibFunction - Given a builtin id for a function like /// "__builtin_fabsf", return a Function* for "fabsf". llvm::Value *CodeGenModule::getBuiltinLibFunction(const FunctionDefn *FD, unsigned BuiltinID) { assert((Context.BuiltinInfo.isLibFunction(BuiltinID) || Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID)) && "isn't a lib fn"); // Get the name, skip over the __builtin_ prefix (if necessary). llvm::StringRef Name; GlobalDefn D(FD); // If the builtin has been declared explicitly with an assembler label, // use the mangled name. This differs from the plain label on platforms // that prefix labels. // if (FD->hasAttr<AsmLabelAttr>()) // Name = getMangledName(D); // else if (Context.BuiltinInfo.isLibFunction(BuiltinID)) Name = Context.BuiltinInfo.GetName(BuiltinID) + 10; else Name = Context.BuiltinInfo.GetName(BuiltinID); llvm::FunctionType *Ty = cast<llvm::FunctionType>(getTypes().ConvertType(FD->getType())); return GetOrCreateLLVMFunction(Name, Ty, D, /*ForVTable=*/false); } llvm::Function *CodeGenModule::getIntrinsic(unsigned IID, llvm::ArrayRef<llvm::Type*> Tys) { return llvm::Intrinsic::getDeclaration(&getModule(), (llvm::Intrinsic::ID)IID, Tys); } //static llvm::StringMapEntry<llvm::Constant*> & //GetConstantCFStringEntry(llvm::StringMap<llvm::Constant*> &Map, // const StringLiteral *Literal, // bool TargetIsLSB, // bool &IsUTF16, // unsigned &StringLength) { // llvm::StringRef String = Literal->getString(); // unsigned NumBytes = String.size(); // // // Check for simple case. // if (!Literal->containsNonAsciiOrNull()) { // StringLength = NumBytes; // return Map.GetOrCreateValue(String); // } // // // Otherwise, convert the UTF8 literals into a byte string. // llvm::SmallVector<UTF16, 128> ToBuf(NumBytes); // const UTF8 *FromPtr = (UTF8 *)String.data(); // UTF16 *ToPtr = &ToBuf[0]; // // (void)ConvertUTF8toUTF16(&FromPtr, FromPtr + NumBytes, // &ToPtr, ToPtr + NumBytes, // strictConversion); // // // ConvertUTF8toUTF16 returns the length in ToPtr. // StringLength = ToPtr - &ToBuf[0]; // // // Render the UTF-16 string into a byte array and convert to the target byte // // order. // // // // FIXME: This isn't something we should need to do here. // llvm::SmallString<128> AsBytes; // AsBytes.reserve(StringLength * 2); // for (unsigned i = 0; i != StringLength; ++i) { // unsigned short Val = ToBuf[i]; // if (TargetIsLSB) { // AsBytes.push_back(Val & 0xFF); // AsBytes.push_back(Val >> 8); // } else { // AsBytes.push_back(Val >> 8); // AsBytes.push_back(Val & 0xFF); // } // } // // Append one extra null character, the second is automatically added by our // // caller. // AsBytes.push_back(0); // // IsUTF16 = true; // return Map.GetOrCreateValue(llvm::StringRef(AsBytes.data(), AsBytes.size())); //} static llvm::StringMapEntry<llvm::Constant*> & GetConstantStringEntry(llvm::StringMap<llvm::Constant*> &Map, const StringLiteral *Literal, unsigned &StringLength) { llvm::StringRef String = Literal->getString(); StringLength = String.size(); return Map.GetOrCreateValue(String); } //llvm::Constant * //CodeGenModule::GetAddrOfConstantString(const StringLiteral *Literal) { // unsigned StringLength = 0; // llvm::StringMapEntry<llvm::Constant*> &Entry = // GetConstantStringEntry(CFConstantStringMap, Literal, StringLength); // // if (llvm::Constant *C = Entry.getValue()) // return C; // // llvm::Constant *Zero = // llvm::Constant::getNullValue(llvm::Type::getInt32Ty(VMContext)); // llvm::Constant *Zeros[] = { Zero, Zero }; // // Type NSTy = getContext().getNSConstantStringType(); // // llvm::StructType *STy = // cast<llvm::StructType>(getTypes().ConvertType(NSTy)); // // std::vector<llvm::Constant*> Fields(3); // // // Class pointer. // Fields[0] = ConstantStringClassRef; // // // String pointer. // llvm::Constant *C = llvm::ConstantArray::get(VMContext, Entry.getKey().str()); // // llvm::GlobalValue::LinkageTypes Linkage; // bool isConstant; // Linkage = llvm::GlobalValue::PrivateLinkage; // isConstant = /*!Features.WritableStrings*/false; // // llvm::GlobalVariable *GV = // new llvm::GlobalVariable(getModule(), C->getType(), isConstant, Linkage, C, // ".str"); // GV->setUnnamedAddr(true); // CharUnits Align = getContext().getTypeAlignInChars(getContext().CharTy); // GV->setAlignment(Align.getQuantity()); // Fields[1] = llvm::ConstantExpr::getGetElementPtr(GV, Zeros, 2); // // // String length. // llvm::Type *Ty = getTypes().ConvertType(getContext().UInt32Ty); // Fields[2] = llvm::ConstantInt::get(Ty, StringLength); // // // The struct. // C = llvm::ConstantStruct::get(STy, Fields); // GV = new llvm::GlobalVariable(getModule(), C->getType(), true, // llvm::GlobalVariable::PrivateLinkage, C, // "_unnamed_nsstring_"); // // FIXME. Fix section. // if (const char *Sect = // getContext().Target.getNSStringSection()) // GV->setSection(Sect); // Entry.setValue(GV); // // return GV; //} /// GetStringForStringLiteral - Return the appropriate bytes for a /// string literal, properly padded to match the literal type. std::string CodeGenModule::GetStringForStringLiteral(const StringLiteral *E) { // const ASTContext &Context = getContext(); // const VectorType *CAT = // Context.getAsVectorType(E->getType()); // assert(CAT && "String isn't pointer or array!"); // // // Resize the string to the right size. // uint64_t RealLen = CAT->getSize().getZExtValue(); // // if (E->isWide()) // RealLen *= Context.Target.getWCharWidth() / Context.getCharWidth(); std::string Str = E->getString().str(); // Str.resize(RealLen, '\0'); return Str; } /// GetAddrOfConstantStringFromLiteral - Return a pointer to a /// constant array for the given string literal. llvm::Constant * CodeGenModule::GetAddrOfConstantStringFromLiteral(const StringLiteral *S) { // FIXME: This can be more efficient. // FIXME: We shouldn't need to bitcast the constant in the wide string case. llvm::Constant *C = GetAddrOfConstantString(GetStringForStringLiteral(S)); if (S->isWide()) { llvm::Type *DestTy = llvm::PointerType::getUnqual(getTypes().ConvertType(S->getType())); C = llvm::ConstantExpr::getBitCast(C, DestTy); } return C; } /// GenerateWritableString -- Creates storage for a string literal. static llvm::Constant *GenerateStringLiteral(llvm::StringRef str, bool constant, CodeGenModule &CGM, const char *GlobalName) { // Create Constant for this string literal. Don't add a '\0'. llvm::Constant *C = llvm::ConstantDataArray::getString(CGM.getLLVMContext(), str, false); // Create a global variable for this string llvm::GlobalVariable *GV = new llvm::GlobalVariable(CGM.getModule(), C->getType(), constant, llvm::GlobalValue::PrivateLinkage, C, GlobalName); GV->setAlignment(1); GV->setUnnamedAddr(true); return GV; } /// GetAddrOfConstantString - Returns a pointer to a character array /// containing the literal. This contents are exactly that of the /// given string, i.e. it will not be null terminated automatically; /// see GetAddrOfConstantCString. Note that whether the result is /// actually a pointer to an LLVM constant depends on /// Feature.WriteableStrings. /// /// The result has pointer to array type. llvm::Constant *CodeGenModule::GetAddrOfConstantString(llvm::StringRef Str, const char *GlobalName) { bool IsConstant = /*!Features.WritableStrings*/false; // Get the default prefix if a name wasn't specified. if (!GlobalName) GlobalName = ".str"; // Don't share any string literals if strings aren't constant. if (!IsConstant) return GenerateStringLiteral(Str, false, *this, GlobalName); llvm::StringMapEntry<llvm::Constant *> &Entry = ConstantStringMap.GetOrCreateValue(Str); if (Entry.getValue()) return Entry.getValue(); // Create a global variable for this. llvm::Constant *C = GenerateStringLiteral(Str, true, *this, GlobalName); Entry.setValue(C); return C; } /// GetAddrOfConstantCString - Returns a pointer to a character /// array containing the literal and a terminating '\0' /// character. The result has pointer to array type. llvm::Constant *CodeGenModule::GetAddrOfConstantCString(const std::string &Str, const char *GlobalName){ llvm::StringRef StrWithNull(Str.c_str(), Str.size() + 1); return GetAddrOfConstantString(StrWithNull, GlobalName); } /// EmitNamespace - Emit all declarations in a namespace. void CodeGenModule::EmitNamespace(const NamespaceDefn *ND) { for (TypeDefn::defn_iterator I = ND->defns_begin(), E = ND->defns_end(); I != E; ++I) EmitTopLevelDefn(*I); } /// EmitTopLevelDefn - Emit code for a single top level declaration. void CodeGenModule::EmitTopLevelDefn(Defn *D) { // If an error has occurred, stop code generation, but continue // parsing and semantic analysis (to ensure all warnings and errors // are emitted). if (Diags.hasErrorOccurred()) return; // Ignore dependent declarations. // if (D->getDefnContext() && D->getDefnContext()->isDependentContext()) // return; switch (D->getKind()) { case Defn::Script: EmitGlobal(cast<ScriptDefn>(D)); break; case Defn::ClassMethod: case Defn::Function: EmitGlobal(cast<FunctionDefn>(D)); break; case Defn::Var: EmitGlobal(cast<VarDefn>(D)); break; // C++ Decls case Defn::Namespace: EmitNamespace(cast<NamespaceDefn>(D)); break; case Defn::ClassConstructor: // EmitClassConstructors(cast<ClassConstructorDefn>(D)); break; case Defn::ClassDestructor: // EmitClassDestructors(cast<ClassDestructorDefn>(D)); break; default: // Make sure we handled everything we should, every other kind is a // non-top-level decl. FIXME: Would be nice to have an isTopLevelDeclKind // function. Need to recode Defn::Kind to do that easily. assert(isa<TypeDefn>(D) && "Unsupported decl kind"); } } /// Turns the given pointer into a constant. static llvm::Constant *GetPointerConstant(llvm::LLVMContext &Context, const void *Ptr) { uintptr_t PtrInt = reinterpret_cast<uintptr_t>(Ptr); llvm::Type *i64 = llvm::Type::getInt64Ty(Context); return llvm::ConstantInt::get(i64, PtrInt); } static void EmitGlobalDefnMetadata(CodeGenModule &CGM, llvm::NamedMDNode *&GlobalMetadata, GlobalDefn D, llvm::GlobalValue *Addr) { if (!GlobalMetadata) GlobalMetadata = CGM.getModule().getOrInsertNamedMetadata("mlang.global.decl.ptrs"); // TODO: should we report variant information for ctors/dtors? llvm::Value *Ops[] = { Addr, GetPointerConstant(CGM.getLLVMContext(), D.getDefn()) }; GlobalMetadata->addOperand(llvm::MDNode::get(CGM.getLLVMContext(), Ops)); } /// Emits metadata nodes associating all the global values in the /// current module with the Decls they came from. This is useful for /// projects using IR gen as a subroutine. /// /// Since there's currently no way to associate an MDNode directly /// with an llvm::GlobalValue, we create a global named metadata /// with the name 'mlang.global.decl.ptrs'. void CodeGenModule::EmitDefnMetadata() { llvm::NamedMDNode *GlobalMetadata = 0; // StaticLocalDefnMap for (llvm::DenseMap<GlobalDefn,llvm::StringRef>::iterator I = MangledDefnNames.begin(), E = MangledDefnNames.end(); I != E; ++I) { llvm::GlobalValue *Addr = getModule().getNamedValue(I->second); EmitGlobalDefnMetadata(*this, GlobalMetadata, I->first, Addr); } } /// Emits metadata nodes for all the local variables in the current /// function. void CodeGenFunction::EmitDefnMetadata() { if (LocalDefnMap.empty()) return; llvm::LLVMContext &Context = getLLVMContext(); // Find the unique metadata ID for this name. unsigned DeclPtrKind = Context.getMDKindID("mlang.defn.ptr"); llvm::NamedMDNode *GlobalMetadata = 0; for (llvm::DenseMap<const Defn*, llvm::Value*>::iterator I = LocalDefnMap.begin(), E = LocalDefnMap.end(); I != E; ++I) { const Defn *D = I->first; llvm::Value *Addr = I->second; if (llvm::AllocaInst *Alloca = dyn_cast<llvm::AllocaInst>(Addr)) { llvm::Value *DAddr = GetPointerConstant(getLLVMContext(), D); Alloca->setMetadata(DeclPtrKind, llvm::MDNode::get(Context, DAddr)); } else if (llvm::GlobalValue *GV = dyn_cast<llvm::GlobalValue>(Addr)) { GlobalDefn GD = GlobalDefn(cast<VarDefn>(D)); EmitGlobalDefnMetadata(CGM, GlobalMetadata, GD, GV); } } } void CodeGenModule::EmitCoverageFile() { if (!getCodeGenOpts().CoverageFile.empty()) { if (llvm::NamedMDNode *CUNode = TheModule.getNamedMetadata("llvm.dbg.cu")) { llvm::NamedMDNode *GCov = TheModule.getOrInsertNamedMetadata("llvm.gcov"); llvm::LLVMContext &Ctx = TheModule.getContext(); llvm::MDString *CoverageFile = llvm::MDString::get(Ctx, getCodeGenOpts().CoverageFile); for (int i = 0, e = CUNode->getNumOperands(); i != e; ++i) { llvm::MDNode *CU = CUNode->getOperand(i); llvm::Value *node[] = { CoverageFile, CU }; llvm::MDNode *N = llvm::MDNode::get(Ctx, node); GCov->addOperand(N); } } } } ///@name Custom Runtime Function Interfaces ///@{ // // FIXME: These can be eliminated once we can have clients just get the required // AST nodes from the builtin tables. llvm::Constant *CodeGenModule::getBlockObjectDispose() { if (BlockObjectDispose) return BlockObjectDispose; // If we saw an explicit defn, use that. if (BlockObjectDisposeDefn) { return BlockObjectDispose = GetAddrOfFunction( BlockObjectDisposeDefn, getTypes().GetFunctionType(BlockObjectDisposeDefn)); } // Otherwise construct the function by hand. llvm::Type *args[] = { Int8PtrTy, Int32Ty }; llvm::FunctionType *fty = llvm::FunctionType::get(VoidTy, args, false); return BlockObjectDispose = CreateRuntimeFunction(fty, "_Block_object_dispose"); } llvm::Constant *CodeGenModule::getBlockObjectAssign() { if (BlockObjectAssign) return BlockObjectAssign; // If we saw an explicit defn, use that. if (BlockObjectAssignDefn) { return BlockObjectAssign = GetAddrOfFunction( BlockObjectAssignDefn, getTypes().GetFunctionType(BlockObjectAssignDefn)); } // Otherwise construct the function by hand. llvm::Type *args[] = { Int8PtrTy, Int8PtrTy, Int32Ty }; llvm::FunctionType *fty = llvm::FunctionType::get(VoidTy, args, false); return BlockObjectAssign = CreateRuntimeFunction(fty, "_Block_object_assign"); } llvm::Constant *CodeGenModule::getNSConcreteGlobalBlock() { if (NSConcreteGlobalBlock) return NSConcreteGlobalBlock; // If we saw an explicit defn, use that. if (NSConcreteGlobalBlockDefn) { return NSConcreteGlobalBlock = GetAddrOfGlobalVar( NSConcreteGlobalBlockDefn, getTypes().ConvertType(NSConcreteGlobalBlockDefn->getType())); } // Otherwise construct the variable by hand. return NSConcreteGlobalBlock = CreateRuntimeVariable(Int8PtrTy, "_NSConcreteGlobalBlock"); } llvm::Constant *CodeGenModule::getNSConcreteStackBlock() { if (NSConcreteStackBlock) return NSConcreteStackBlock; // If we saw an explicit decl, use that. if (NSConcreteStackBlockDefn) { return NSConcreteStackBlock = GetAddrOfGlobalVar( NSConcreteStackBlockDefn, getTypes().ConvertType(NSConcreteStackBlockDefn->getType())); } // Otherwise construct the variable by hand. return NSConcreteStackBlock = CreateRuntimeVariable(Int8PtrTy, "_NSConcreteStackBlock"); } ///@}
[ "yabin.hwu@gmail.com" ]
yabin.hwu@gmail.com
8cecd54f8be4b5d24edc16f0321a9b869d9b849f
50cc654b7b289d888511060af8364ac8a4a87e24
/src/network/sender.h
e9b2d62f9ba2e9ee52c398ecc016e7f2da428bec
[ "Apache-2.0" ]
permissive
EvilMcJerkface/centiman
b3febc32607ba3b8eaf81bc8d0c8de0fba06db19
213eab0bd391822cbc9a01644979f8409440c376
refs/heads/master
2021-01-17T17:21:49.160580
2015-10-21T22:31:17
2015-10-21T22:31:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,396
h
#ifndef __NETWORK_SENDER_H__ #define __NETWORK_SENDER_H__ #include <map> #include <sys/poll.h> #include <sys/socket.h> #include <sys/types.h> #include <unistd.h> #include "util/counter.h" #include <network/socket-buf.h> #include <processor/processor.h> #include <util/packet.h> #include <util/queue.h> #include <util/queue-batcher.h> #include <util/logger.h> #include <util/util.h> class Processor; class Sender { public: Sender(std::map<int, Queue<Packet> *> * pQueues); ~Sender(); void resetStat(); void setId(int id); void setInQueue(Queue<Packet> *); int getByteCnt(); int getPacketCnt(); int getSendCnt(); int getFullSend(); int getFullPacketSend(); int getCheckCnt(); void run(); static void * runHelper(void *); Counter counter; private: Queue<Packet> * mpInQueue; std::map<int, Queue<Packet> *> * mpOutQueues; SocketBuf ** mpBufs; QueueBatcher<Packet> ** mpBatchers; int mId; Processor * mpProcessor; int mByteCnt; int mPacketCnt; int mSendCnt; int mFullSend; int mFullPacketSend; int mCheckCnt; time_t mStart; int sendBuf(int, SocketBuf *); void serialize(); void swipe(); }; #endif // __NETWORK_SENDER_H__
[ "bailuding@gmail.com" ]
bailuding@gmail.com
c3732b935aae7717b42d093ace3df1e54205cb3c
98aaa56bb0455106d46910d1dfc9d93c7196efb8
/src/game_flow.cpp
07f4f8414a801265a6ee0c92febabff104b49ce2
[]
no_license
Clotho9225/2021_APT_Assignment2_Team_Coding_Everyday
a916f59f49fa9dc9b5e979083bfa94f007d1b209
bf8b1b2d1d33dd96d7ad1c73f81ca4e983f1b9a7
refs/heads/main
2023-04-21T06:09:55.526935
2021-05-16T06:04:05
2021-05-16T06:04:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,700
cpp
#include "game_flow.h" #include "check_input.h" void qwirkle() { std::cout << "Welcome to Qwirkle!" << std::endl; std::cout << "-------------------" << std::endl; } void newGame() { std::string player1_name, player2_name; std::cout << "Starting a New Game" << std::endl << std::endl; std::cout << "Enter a name for player 1(uppercase characters only)" << std::endl; do { std::getline(std::cin, player1_name); if (std::cin.eof()) { std::cout << std::endl; std::cout << "Goodbye" << std::endl; exit(0); } else if (!isValidPlayerName(player1_name)) { std::cout << "Invalid name, please try again." << std::endl; } } while (!isValidPlayerName(player1_name)); std::cout << "Enter a name for player 2(uppercase characters only)" << std::endl; do { std::getline(std::cin, player2_name); if (std::cin.eof()) { std::cout << std::endl; std::cout << "Goodbye" << std::endl; exit(0); } else if (!isValidPlayerName(player2_name)) { std::cout << "Invalid name, please try again." << std::endl; } } while (!isValidPlayerName(player2_name)); // initialise players Player *player1 = new Player(player1_name); Player *player2 = new Player(player2_name); // initialise board Board *board = new Board(); //board->printBoard(); // initialise tile bag which contains shuffled tiles LinkedList *tileBag = new LinkedList(); tileBag->iniTileBag(); // initialise tiles in players' hands player1->initialiseTilesInHand(tileBag); player2->initialiseTilesInHand(tileBag); std::cout << std::endl; std::cout << "Let's Play!" << std::endl; int playerFlag = 1; std::string instructure; Player *currentPlayer = new Player(); while (tileBag->getSize() > 0 && (player1->getTilesInHand()->getSize() > 0 || player2->getTilesInHand()->getSize() > 0) && !std::cin.eof()) { int inputCount = 0; if (tileBag->getSize() > 0) { if (playerFlag == 1) { currentPlayer = player1; game(currentPlayer, player1, player2, board, tileBag, instructure, inputCount); inputCount = 1; playerFlag = 2; } if (playerFlag == 2) { currentPlayer = player2; game(currentPlayer, player1, player2, board, tileBag, instructure, inputCount); playerFlag = 1; } } else { for (unsigned int turn = 0; turn < TILES_IN_HAND_NUM; turn++) { if (playerFlag == 1) { currentPlayer = player1; game(currentPlayer, player1, player2, board, tileBag, instructure, inputCount); playerFlag = 2; } if (playerFlag == 2) { currentPlayer = player2; game(currentPlayer, player1, player2, board, tileBag, instructure, inputCount); playerFlag = 1; } } } } checkEnd(tileBag, player1, player2); } void continueGame(Player **currentPlayer, Player *player1, Player *player2, LinkedList *tileBag, Board *board) { int playerFlag = 0; if ((*currentPlayer)->getName().compare(player1->getName()) == 0) { playerFlag = 1; } else { playerFlag = 2; } std::string instructure; while (tileBag->getSize() > 0 && (player1->getTilesInHand()->getSize() > 0 || player2->getTilesInHand()->getSize() > 0) && !std::cin.eof()) { int inputCount = 0; if (tileBag->getSize() > 0) { if (playerFlag == 1) { *currentPlayer = player1; game(*currentPlayer, player1, player2, board, tileBag, instructure, inputCount); inputCount = 1; playerFlag = 2; } if (playerFlag == 2) { *currentPlayer = player2; game(*currentPlayer, player1, player2, board, tileBag, instructure, inputCount); playerFlag = 1; } } else { for (unsigned int turn = 0; turn < TILES_IN_HAND_NUM; turn++) { if (playerFlag == 1) { *currentPlayer = player1; game(*currentPlayer, player1, player2, board, tileBag, instructure, inputCount); playerFlag = 2; } if (playerFlag == 2) { *currentPlayer = player2; game(*currentPlayer, player1, player2, board, tileBag, instructure, inputCount); playerFlag = 1; } } } } checkEnd(tileBag, player1, player2); } void credits() { std::cout << "---------------------------------- " << std::endl; // print group members' information std::cout << "Name: Yi Yang" << std::endl; std::cout << "Student ID: s3798354" << std::endl; std::cout << "Email: s3798354@student.rmit.edu.au" << std::endl; std::cout << std::endl; std::cout << "Name: Jinghua Gu" << std::endl; std::cout << "Student ID: s3653714" << std::endl; std::cout << "Email: s3653714@student.rmit.edu.au" << std::endl; std::cout << std::endl; std::cout << "Name: Yixin Chen" << std::endl; std::cout << "Student ID: s3855866" << std::endl; std::cout << "Email: s3855866@student.rmit.edu.au" << std::endl; std::cout << std::endl; std::cout << "Name: Sifan Gao" << std::endl; std::cout << "Student ID: s3753605" << std::endl; std::cout << "Email: s3753605@student.rmit.edu.au" << std::endl; std::cout << "---------------------------------- " << std::endl; } void checkEnd(LinkedList *tileBag, Player *player1, Player *player2) { int tilesInBag = tileBag->getSize(); int p1Tiles = player1->getTilesInHand()->getSize(); int p2Tiles = player2->getTilesInHand()->getSize(); if (tilesInBag == 0 && p1Tiles == 0 && p2Tiles == 0) { std::cout << "Game over" << std::endl; std::cout << "Score for " << player1->getName() << ": "; std::cout << player1->getScore() << std::endl; std::cout << "Score for " << player2->getName() << ": "; std::cout << player2->getScore() << std::endl; if (player1->getScore() > player2->getScore()) { std::cout << "Player " << player1->getName() << "won!"; std::cout << std::endl; } else { std::cout << "Player " << player2->getName() << "won!"; std::cout << std::endl; } std::cout << std::endl; std::cout << "Goodbye" << std::endl; exit(0); } } void scores(Player *player1, Player *player2) { std::cout << "Score for " << player1->getName() << ": "; std::cout << player1->getScore() << std::endl; std::cout << "Score for " << player2->getName() << ": "; std::cout << player2->getScore() << std::endl; } // after checking the instruction, check if it's able to place the tile bool checkRule(Player *currentPlayer, Board *board, LinkedList *tileBag, std::string instructure) { int turn = 0; if (tileBag->getSize() < 60) { turn = 1; } bool check = true; // put the tile on the board, update tiles in hand // update tile bag Colour colour = instructure[6]; Shape shape = instructure[7] - '0'; int row = -1; int col = -1; int digits = instructure[14] - '0'; int tens = (instructure[13] - '0') * 10; if (instructure.size() == 14) { col = instructure[13] - '0'; } else if (instructure.size() == 15) { col = tens + digits; } row = instructure[12] - '0' - ASCII_DIF; Rules *rule = new Rules(); check = rule->boardRules(row, col, board, colour, shape, turn); return check; } void placeTile(Player *currentPlayer, Board *board, LinkedList *tileBag, std::string instructure) { int turn = 0; if (tileBag->getSize() < 60) { turn = 1; } // put the tile on the board, update tiles in hand // update tile bag Colour colour = instructure[6]; Shape shape = instructure[7] - '0'; int row = -1; int col = -1; int digits = instructure[14] - '0'; int tens = (instructure[13] - '0') * 10; if (instructure.size() == 14) { col = instructure[13] - '0'; } else if (instructure.size() == 15) { col = tens + digits; } row = instructure[12] - '0' - ASCII_DIF; Rules *rule = new Rules(); int earnedScore = 0; board->putTile2Board(colour, shape, row, col); earnedScore = rule->scoreRules(row, col, board, turn); currentPlayer->playOneTile(colour, shape); currentPlayer->getNewTile(tileBag); // increase the score currentPlayer->increaseScore(earnedScore); } void game(Player *currentPlayer, Player *player1, Player *player2, Board *board, LinkedList *tileBag, std::string instructure, int inputCount) { // turn std::cout << std::endl; std::cout << currentPlayer->getName(); std::cout << ", it's your turn" << std::endl; // print scores(player1, player2); board->printBoard(); std::cout << "Your hand is" << std::endl; currentPlayer->printTilesInHand(); // input int toDo = -1; bool healperBool = true; bool check = true; do { healperBool = true; instructure.clear(); std::getline(std::cin, instructure); // check instruction and do toDo = checkInstruction(instructure, currentPlayer); if (std::cin.eof()) { std::cout << std::endl; std::cout << "Goodbye" << std::endl; exit(0); } else if (toDo == 0) { std::cout << std::endl; std::cout << "Please input again." << std::endl; std::cout << std::endl; healperBool = false; } else if (toDo == 1) { check = checkRule(currentPlayer, board, tileBag, instructure); if (!check) { std::cout << std::endl; std::cout << "Please input again." << std::endl; std::cout << std::endl; healperBool = false; } else { placeTile(currentPlayer, board, tileBag, instructure); } } else if (toDo == 2) { Colour colour = instructure[8]; Shape shape = instructure[9] - '0'; currentPlayer->replaceOneTile(colour, shape, tileBag); } else if (toDo == 3) { std::string fileName = instructure.substr(5, instructure.size() - 5); GameFile *file = new GameFile(); file->saveGame(fileName, currentPlayer, player1, player2, tileBag, board); // continue gaming } } while (!healperBool); }
[ "s3798354@student.rmit.edu.au" ]
s3798354@student.rmit.edu.au
271a1f5bffece77a92df94481aa27fd182cddbc0
79f449ec9e81b170b994d7fa86e3deb0834022b9
/src/string_repr.h
aefb45ec0f5669c405552ded83d72f9f7b82d8a4
[ "MIT" ]
permissive
whunmr/circa
b5bfacd336024a4120be46b52b849ff5a76e93ec
f3667f2af8b46728c1475990ecdf5cf1b3dd1ee2
refs/heads/master
2020-04-08T02:08:24.311295
2013-03-01T04:37:19
2013-03-07T18:09:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
226
h
// Copyright (c) Andrew Fischer. See LICENSE file for license terms. #pragma once namespace circa { void parse_string_repr(const char* str, caValue* valueOut); void write_string_repr(caValue* value, caValue* stringOut); }
[ "paul.hodge.email@gmail.com" ]
paul.hodge.email@gmail.com
0ed1e614ff9124d7e0c0e9d90e0f1c201f0dc1ed
30bdd8ab897e056f0fb2f9937dcf2f608c1fd06a
/DP/1766.cpp
b27a354d1467ada883f22cdd9682064572ee8303
[]
no_license
thegamer1907/Code_Analysis
0a2bb97a9fb5faf01d983c223d9715eb419b7519
48079e399321b585efc8a2c6a84c25e2e7a22a61
refs/heads/master
2020-05-27T01:20:55.921937
2019-11-20T11:15:11
2019-11-20T11:15:11
188,403,594
2
1
null
null
null
null
UTF-8
C++
false
false
1,245
cpp
#include<iostream> using namespace std; int main() { string s; cin >> s; int flag=0; for(int i=0;i<s.length()-1;i++){ if(s[i]=='A' && s[i+1]=='B') { for(int j=i+2;j<s.length()-1;j++){ if(s[j]=='B' && s[j+1]=='A'){ cout << "YES" << endl; return 0; } } break; } } flag=0; for(int i=0;i<s.length()-1;i++){ if(s[i]=='B' && s[i+1]=='A') { for(int j=i+2;j<s.length()-1;j++){ if(s[j]=='A' && s[j+1]=='B'){ cout << "YES" << endl; return 0; } } break; } } cout << "NO" << endl; return 0; }
[ "mukeshchugani10@gmail.com" ]
mukeshchugani10@gmail.com
fc36a4b54492a73b09a8528ba531435be2c1933d
287bcb31bdf291bebc97e8acfdc5ad68eec7c7c7
/FactoryMethod/product_a.h
3fba4364b10ed0c9e8a6fcf5002a1e50cbdee15c
[]
no_license
henrywarhurst/design-patterns
8cb786bc24adbd56731f2961c177ae89bfcc6c87
ee00927b5f4af81ed8632da83a7dc76ceb7c9297
refs/heads/master
2021-01-21T23:04:24.501049
2017-06-28T09:30:20
2017-06-28T09:30:20
95,184,819
0
0
null
null
null
null
UTF-8
C++
false
false
170
h
#ifndef PRODUCT_A_H #define PRODUCT_A_H #include "product.h" class ProductA : public Product { public: ProductA(); virtual ~ProductA(); }; #endif // PRODUCT_A_H
[ "hwar3828@uni.sydney.edu.au" ]
hwar3828@uni.sydney.edu.au
e0af6a31477f742a757fa5485ffe7690d9c77a34
eed7d2565bf2f102386be402a99e320cbc74caa5
/Source/Client/Game.cpp
9ff2072e348048f9c5c8126f3079c900ae5ac2c8
[]
no_license
edelsbrunner/Helbreath-Mysql-2016
f3176d6261a11bb5e22bb226e17264f1c7a39cdd
8a3a5e3aad413631b2b1606a56fa97fc317f63ec
refs/heads/master
2021-01-01T17:58:34.456553
2016-04-09T10:48:55
2016-04-09T10:48:55
null
0
0
null
null
null
null
ISO-8859-1
C++
false
false
1,639,399
cpp
// Game.cpp: implementation of the CGame class. // ////////////////////////////////////////////////////////////////////// #include "Game.h" #if LANGUAGE == ENGLISH #include "lan_eng.h" #elif LANGUAGE == SPANISH #include "lan_Spanish.h" #endif extern char G_cSpriteAlphaDegree; extern char G_cCmdLine[256], G_cCmdLineTokenA[120], G_cCmdLineTokenA_Lowercase[120], G_cCmdLineTokenB[120], G_cCmdLineTokenC[120], G_cCmdLineTokenD[120], G_cCmdLineTokenE[120]; extern class XSocket * G_pCalcSocket; extern BOOL G_bIsCalcSocketConnected; extern DWORD G_dwCalcSocketTime, G_dwCalcSocketSendTime; extern HWND G_hWnd, G_hEditWnd; extern HINSTANCE G_hInstance; char _cDrawingOrder[] = {0, 1, 0, 0, 0, 0, 0, 1, 1}; char _cMantleDrawingOrder[] = {0, 1, 1, 1, 0, 0, 0, 2, 2}; char _cMantleDrawingOrderOnRun[] = {0, 1, 1, 1, 1, 1, 1, 1, 1}; short _tmp_sOwnerType, _tmp_sAppr1, _tmp_sAppr2, _tmp_sAppr3, _tmp_sAppr4; int _tmp_iStatus; char _tmp_cAction, _tmp_cDir, _tmp_cFrame, _tmp_cName[12]; int _tmp_iChatIndex, _tmp_dx, _tmp_dy, _tmp_iApprColor, _tmp_iEffectType, _tmp_iEffectFrame, _tmp_dX, _tmp_dY; // 21.171 2002-6-14 WORD _tmp_wObjectID; char cDynamicObjectData1, cDynamicObjectData2, cDynamicObjectData3, cDynamicObjectData4; WORD wFocusObjectID; short sFocus_dX, sFocus_dY; char cFocusAction, cFocusFrame, cFocusDir, cFocusName[12]; short sFocusX, sFocusY, sFocusOwnerType, sFocusAppr1, sFocusAppr2, sFocusAppr3, sFocusAppr4; int iFocuiStatus; int iFocusApprColor; ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// void CGame::ReadSettings() { m_sMagicShortCut = -1; m_sRecentShortCut = -1; for( int i=0 ; i<6 ; i++ ) m_sShortCut[i] = -1; uint32 val; if((val = ReadSettingsVar("ShowFPS")) == -1) m_bShowFPS = FALSE; else m_bShowFPS = val; if((val = ReadSettingsVar("ShowGrid")) == -1) m_showGrid = FALSE; else m_showGrid = val; if((val = ReadSettingsVar("ShowAllDmg")) == -1) m_showAllDmg = FALSE; else m_showAllDmg = val; if((val = ReadSettingsVar("BigItems")) == -1) m_bigItems = FALSE; else m_bigItems = val; if((val = ReadSettingsVar("PartyAutoAccept")) == -1) m_partyAutoAccept = FALSE; else m_partyAutoAccept = val; if((val = ReadSettingsVar("DetailLevel")) == -1) m_cDetailLevel = FALSE; else m_cDetailLevel = val; if((val = ReadSettingsVar("Music")) == -1) m_bMusicStat = TRUE; else m_bMusicStat = val; if((val = ReadSettingsVar("Sound")) == -1) m_bSoundStat = TRUE; else m_bSoundStat = val; if((val = ReadSettingsVar("EKScreenshot")) == -1) m_ekScreenshot = FALSE; else m_ekScreenshot = val; if((val = ReadSettingsVar("TabbedNotification")) == -1) m_tabbedNotification = FALSE; else m_tabbedNotification = val; if((val = ReadSettingsVar("ManuAutoFill")) == -1) m_manuAutoFill = FALSE; else m_manuAutoFill = val; if((val = ReadSettingsVar("TimeStamp")) == -1) m_showTimeStamp = FALSE; else m_showTimeStamp = val; uint32 ret; ret = ReadSettingsVar("Magic"); if( ret > 0 && ret < 101 ) m_sMagicShortCut = ret - 1; else m_sMagicShortCut = -1; ret = ReadSettingsVar("ShortCut0"); if( ret > 0 && ret < 201 ) m_sShortCut[0] = ret - 1; else m_sShortCut[0] = -1; ret = ReadSettingsVar("ShortCut1"); if( ret > 0 && ret < 201 ) m_sShortCut[1] = ret - 1; else m_sShortCut[1] = -1; ret = ReadSettingsVar("ShortCut2"); if( ret > 0 && ret < 201 ) m_sShortCut[2] = ret - 1; else m_sShortCut[2] = -1; ret = ReadSettingsVar("ShortCut3"); if( ret > 0 && ret < 201 ) m_sShortCut[3] = ret - 1; else m_sShortCut[3] = -1; ret = ReadSettingsVar("ShortCut4"); if( ret > 0 && ret < 201 ) m_sShortCut[4] = ret - 1; else m_sShortCut[4] = -1; } uint32 CGame::ReadSettingsVar(const char * var) { HKEY key; DWORD dwDisp; uint32 val; DWORD size = sizeof(uint32); if( RegCreateKeyEx( HKEY_CURRENT_USER, "Software\\Siementech\\Helbreath\\Settings", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, &dwDisp ) != ERROR_SUCCESS ) return -1; if( RegQueryValueEx(key, var, 0, NULL, (LPBYTE)&val, &size) != ERROR_SUCCESS ) { RegCloseKey(key); return -1; } RegCloseKey(key); return val; } void CGame::WriteSettings() { WriteSettingsVar("ShowFPS", m_bShowFPS); WriteSettingsVar("ShowGrid", m_showGrid); WriteSettingsVar("ShowAllDmg", m_showAllDmg); WriteSettingsVar("BigItems", m_bigItems); WriteSettingsVar("PartyAutoAccept", m_partyAutoAccept); WriteSettingsVar("DetailLevel", m_cDetailLevel); WriteSettingsVar("Music", m_bMusicStat); WriteSettingsVar("Sound", m_bSoundStat); WriteSettingsVar("EKScreenshot", m_ekScreenshot); WriteSettingsVar("TabbedNotification", m_tabbedNotification); WriteSettingsVar("ManuAutoFill", m_manuAutoFill); WriteSettingsVar("TimeStamp", m_showTimeStamp); if( m_sMagicShortCut >= 0 && m_sMagicShortCut < 100 ) WriteSettingsVar("Magic", m_sMagicShortCut + 1); if( m_sShortCut[0] >= 0 && m_sShortCut[0] < 200 ) WriteSettingsVar("ShortCut0", m_sShortCut[0] + 1); if( m_sShortCut[1] >= 0 && m_sShortCut[1] < 200 ) WriteSettingsVar("ShortCut1", m_sShortCut[1] + 1); if( m_sShortCut[2] >= 0 && m_sShortCut[2] < 200 ) WriteSettingsVar("ShortCut2", m_sShortCut[2] + 1); if( m_sShortCut[3] >= 0 && m_sShortCut[3] < 200 ) WriteSettingsVar("ShortCut3", m_sShortCut[3] + 1); if( m_sShortCut[4] >= 0 && m_sShortCut[4] < 200 ) WriteSettingsVar("ShortCut4", m_sShortCut[4] + 1); } void CGame::WriteSettingsVar(const char * var, uint32 val) { HKEY key; DWORD dwDisp; ; DWORD size = sizeof(uint32); if( RegCreateKeyEx( HKEY_CURRENT_USER, "Software\\Siementech\\Helbreath\\Settings", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, &dwDisp ) != ERROR_SUCCESS ) return; RegSetValueEx(key, var, 0, REG_DWORD, (LPBYTE)&val, sizeof(UINT) ); RegCloseKey(key); } CGame::CGame() { int i; srand( (unsigned)time( NULL ) ); ReadSettings(); #ifdef _DEBUG m_bToggleScreen = TRUE; #else m_bToggleScreen = FALSE; #endif m_cLoading = 0; m_bZoomMap = TRUE; m_bIsFirstConn = TRUE; m_iItemDropCnt = 0; m_bItemDrop = FALSE; m_bIsSpecial = FALSE; m_cGameMode = GAMEMODE_ONLOADING; m_cWhisperIndex = MAXWHISPERMSG; m_cGameModeCount = 0; ZeroMemory(m_cMapName, sizeof(m_cMapName)); m_pGSock = NULL; m_pLSock = NULL; m_pMapData = NULL; m_cCommandCount = 0; m_dwCommandTime = 0; //v2.15 SpeedHack m_sPlayerX = NULL; m_sPlayerY = NULL; m_sViewDX = NULL; m_sViewDY = NULL; m_cCommand = OBJECTSTOP; m_bIsObserverMode = FALSE; m_ekSSTime = 0; for (i = 0; i < MAXSPRITES; i++) m_pSprite[i] = NULL; for (i = 0; i < MAXTILES; i++) m_pTileSpr[i] = NULL; for (i = 0; i < MAXEFFECTSPR; i++) m_pEffectSpr[i] = NULL; m_pBGM = NULL; for (i = 0; i < MAXSOUNDEFFECTS; i++) { m_pCSound[i] = NULL; m_pESound[i] = NULL; m_pMSound[i] = NULL; } for (i = 0; i < 13; i++){ strcpy(friendsList[i].friendName, ""); friendsList[i].online = false; } for (i = 0; i < MAXCHATMSGS; i++) m_pChatMsgList[i] = NULL; for (i = 0; i < MAXEFFECTS; i++) m_pEffectList[i] = NULL; for (i = 0; i < MAXITEMS; i++) m_pItemList[i] = NULL; for (i = 0; i < MAXBANKITEMS; i++) m_pBankList[i] = NULL; for (i = 0; i < 4; i++) m_pCharList[i] = NULL; // Snoopy: Fixed here for (i = 0; i < 61; i++) m_cDialogBoxOrder[i] = NULL; for (i = 0; i < MAXMAGICTYPE; i++) m_pMagicCfgList[i] = NULL; for (i = 0; i < MAXSKILLTYPE; i++) m_pSkillCfgList[i] = NULL; for (i = 0; i < TEXTDLGMAXLINES; i++) { m_pMsgTextList[i] = NULL; m_pMsgTextList2[i] = NULL; m_pAgreeMsgTextList[i] = NULL; } for (i = 0; i < MAXBUILDITEMS; i++) m_pBuildItemList[i] = NULL; for (i = 0; i < MAXBUILDITEMS; i++) m_pDispBuildItemList[i] = NULL; // Crafting: for (i = 0; i < MAXBUILDITEMS; i++) m_pCraftItemList[i] = NULL; for (i = 0; i < MAXBUILDITEMS; i++) m_pDispCraftItemList[i] = NULL; for (i = 0; i < MAXITEMNAMES; i++) m_pItemNameList[i] = NULL; for (i = 0; i < MAXLEVEL +20; i++) m_levelExpTable[i] = iGetLevelExp(i); m_stMCursor.cPrevStatus = CURSORSTATUS_NULL; m_stMCursor.dwSelectClickTime = NULL; ZeroMemory(m_cLogServerAddr, sizeof(m_cLogServerAddr)); m_iGameServerMode = 2; // Snoopy: Default is INTERNET for (i = 0; i < MAXMENUITEMS; i++) m_pItemForSaleList[i] = NULL; m_cash = 0; //Character-Info Dialog(F5) m_stDialogBoxInfo[1].sX = 30; m_stDialogBoxInfo[1].sY = 30; m_stDialogBoxInfo[1].sSizeX = 270; m_stDialogBoxInfo[1].sSizeY = 376; //Inventory Dialog(F6) m_stDialogBoxInfo[2].sX = 380; m_stDialogBoxInfo[2].sY = 210; m_stDialogBoxInfo[2].sSizeX = 225; m_stDialogBoxInfo[2].sSizeY = 185; //Magic Circle Dialog(F7) m_stDialogBoxInfo[3].sX = 337; m_stDialogBoxInfo[3].sY = 57; m_stDialogBoxInfo[3].sSizeX = 258;//280; m_stDialogBoxInfo[3].sSizeY = 328;//346; // Item drop confirmation m_stDialogBoxInfo[4].sX = 0; m_stDialogBoxInfo[4].sY = 0; m_stDialogBoxInfo[4].sSizeX = 270; m_stDialogBoxInfo[4].sSizeY = 105; // Age <15 box !?!?!? m_stDialogBoxInfo[5].sX = 0; m_stDialogBoxInfo[5].sY = 0; m_stDialogBoxInfo[5].sSizeX = 310; m_stDialogBoxInfo[5].sSizeY = 170; // ** This is a battle area ** m_stDialogBoxInfo[6].sX = 160; m_stDialogBoxInfo[6].sY = 2; m_stDialogBoxInfo[6].sSizeX = 310; m_stDialogBoxInfo[6].sSizeY = 170; //Guild Menu Dialog m_stDialogBoxInfo[7].sX = 337; m_stDialogBoxInfo[7].sY = 57; m_stDialogBoxInfo[7].sSizeX = 258; m_stDialogBoxInfo[7].sSizeY = 339; //Guild Operation Dialog m_stDialogBoxInfo[8].sX = 337; m_stDialogBoxInfo[8].sY = 57; m_stDialogBoxInfo[8].sSizeX = 295; m_stDialogBoxInfo[8].sSizeY = 346; //Guide Map Dialog m_stDialogBoxInfo[9].sX = 512; m_stDialogBoxInfo[9].sY = 0; m_stDialogBoxInfo[9].sSizeX = 128; m_stDialogBoxInfo[9].sSizeY = 128; //Chatting History Dialog(F9) m_stDialogBoxInfo[10].sX = 135; m_stDialogBoxInfo[10].sY = 273; m_stDialogBoxInfo[10].sSizeX = 364; m_stDialogBoxInfo[10].sSizeY = 162; //Sale Menu Dialog m_stDialogBoxInfo[11].sX = 70; m_stDialogBoxInfo[11].sY = 50; m_stDialogBoxInfo[11].sSizeX = 258; m_stDialogBoxInfo[11].sSizeY = 339; //Level-Up Setting Dialog m_stDialogBoxInfo[12].sX = 0; m_stDialogBoxInfo[12].sY = 0; m_stDialogBoxInfo[12].sSizeX = 258; m_stDialogBoxInfo[12].sSizeY = 339; //City Hall Menu Dialog m_stDialogBoxInfo[13].sX = 337; m_stDialogBoxInfo[13].sY = 57; m_stDialogBoxInfo[13].sSizeX = 258; m_stDialogBoxInfo[13].sSizeY = 339; //Bank Dialog m_stDialogBoxInfo[14].sX = 60; //337 m_stDialogBoxInfo[14].sY = 50; m_stDialogBoxInfo[14].sSizeX = 258; m_stDialogBoxInfo[14].sSizeY = 339; m_stDialogBoxInfo[14].sV1 = 13; //Skill Menu(F8) m_stDialogBoxInfo[15].sX = 337; m_stDialogBoxInfo[15].sY = 57; m_stDialogBoxInfo[15].sSizeX = 258; m_stDialogBoxInfo[15].sSizeY = 339; //Magic Shop Menu m_stDialogBoxInfo[16].sX = 30; m_stDialogBoxInfo[16].sY = 30; m_stDialogBoxInfo[16].sSizeX = 304; m_stDialogBoxInfo[16].sSizeY = 328; //Dialog items drop external screen m_stDialogBoxInfo[17].sX = 0; m_stDialogBoxInfo[17].sY = 0; m_stDialogBoxInfo[17].sSizeX = 215; m_stDialogBoxInfo[17].sSizeY = 87; //Text Dialog m_stDialogBoxInfo[18].sX = 20; m_stDialogBoxInfo[18].sY = 65; m_stDialogBoxInfo[18].sSizeX = 258; // 238 m_stDialogBoxInfo[18].sSizeY = 339; // 274 //System Menu Dialog(F12) m_stDialogBoxInfo[19].sX = 337; m_stDialogBoxInfo[19].sY = 107; m_stDialogBoxInfo[19].sSizeX = 258;//270; //v2.18 m_stDialogBoxInfo[19].sSizeY = 268;//346; //NpcActionQuery Dialog m_stDialogBoxInfo[20].sX = 237; m_stDialogBoxInfo[20].sY = 57; m_stDialogBoxInfo[20].sSizeX = 252; m_stDialogBoxInfo[20].sSizeY = 87; //NpcTalk Dialog m_stDialogBoxInfo[21].sX = 337; m_stDialogBoxInfo[21].sY = 57; m_stDialogBoxInfo[21].sSizeX = 258; m_stDialogBoxInfo[21].sSizeY = 339; //Map m_stDialogBoxInfo[22].sX = 336; m_stDialogBoxInfo[22].sY = 88; m_stDialogBoxInfo[22].sSizeX = 270; m_stDialogBoxInfo[22].sSizeY = 346; //ItemSellorRepair Dialog m_stDialogBoxInfo[23].sX = 337; m_stDialogBoxInfo[23].sY = 57; m_stDialogBoxInfo[23].sSizeX = 258; m_stDialogBoxInfo[23].sSizeY = 339; //Fishing Dialog m_stDialogBoxInfo[24].sX = 193; m_stDialogBoxInfo[24].sY = 241; m_stDialogBoxInfo[24].sSizeX = 263; m_stDialogBoxInfo[24].sSizeY = 100; //Noticement Dialog m_stDialogBoxInfo[25].sX = 162; m_stDialogBoxInfo[25].sY = 40; m_stDialogBoxInfo[25].sSizeX = 315; m_stDialogBoxInfo[25].sSizeY = 171; //Manufacture Dialog m_stDialogBoxInfo[26].sX = 100; m_stDialogBoxInfo[26].sY = 60; m_stDialogBoxInfo[26].sSizeX = 258; m_stDialogBoxInfo[26].sSizeY = 339; //Exchange Dialog m_stDialogBoxInfo[27].sX = 100; m_stDialogBoxInfo[27].sY = 30; m_stDialogBoxInfo[27].sSizeX = 520; m_stDialogBoxInfo[27].sSizeY = 357; //Quest Dialog m_stDialogBoxInfo[28].sX = 0; m_stDialogBoxInfo[28].sY = 0; m_stDialogBoxInfo[28].sSizeX = 258; m_stDialogBoxInfo[28].sSizeY = 339; //Gauge Pannel m_stDialogBoxInfo[29].sX = 0; m_stDialogBoxInfo[29].sY = 434; m_stDialogBoxInfo[29].sSizeX = 157; m_stDialogBoxInfo[29].sSizeY = 53; //Icon Pannel m_stDialogBoxInfo[30].sX = 0; m_stDialogBoxInfo[30].sY = 427; m_stDialogBoxInfo[30].sSizeX = 640; m_stDialogBoxInfo[30].sSizeY = 53;//47; //Sell List Dialog m_stDialogBoxInfo[31].sX = 170; m_stDialogBoxInfo[31].sY = 70; m_stDialogBoxInfo[31].sSizeX = 258; m_stDialogBoxInfo[31].sSizeY = 339; //Party Dialog m_stDialogBoxInfo[32].sX = 0; m_stDialogBoxInfo[32].sY = 0; m_stDialogBoxInfo[32].sSizeX = 258; m_stDialogBoxInfo[32].sSizeY = 339; //Crusade Job Dialog m_stDialogBoxInfo[33].sX = 360; m_stDialogBoxInfo[33].sY = 65; m_stDialogBoxInfo[33].sSizeX = 258; m_stDialogBoxInfo[33].sSizeY = 339; //Item Upgrade Dialog m_stDialogBoxInfo[34].sX = 60; m_stDialogBoxInfo[34].sY = 50; m_stDialogBoxInfo[34].sSizeX = 258; m_stDialogBoxInfo[34].sSizeY = 339; //Help Menu Dialog(F1) m_stDialogBoxInfo[35].sX = 358; m_stDialogBoxInfo[35].sY = 65; m_stDialogBoxInfo[35].sSizeX = 258; m_stDialogBoxInfo[35].sSizeY = 339; //Crusade Commander Dialog m_stDialogBoxInfo[36].sX = 20; m_stDialogBoxInfo[36].sY = 20; m_stDialogBoxInfo[36].sSizeX = 310; m_stDialogBoxInfo[36].sSizeY = 386; //Crusade Constructor Dialog m_stDialogBoxInfo[37].sX = 20; m_stDialogBoxInfo[37].sY = 20; m_stDialogBoxInfo[37].sSizeX = 310; m_stDialogBoxInfo[37].sSizeY = 386; //Crusade Soldier Dialog m_stDialogBoxInfo[38].sX = 20; m_stDialogBoxInfo[38].sY = 20; m_stDialogBoxInfo[38].sSizeX = 310; m_stDialogBoxInfo[38].sSizeY = 386; // Give item ??? m_stDialogBoxInfo[39].sX = 0; m_stDialogBoxInfo[39].sY = 0; m_stDialogBoxInfo[39].sSizeX = 291; m_stDialogBoxInfo[39].sSizeY = 413; // 3.51 Slates Dialog - Diuuude m_stDialogBoxInfo[40].sX = 100; m_stDialogBoxInfo[40].sY = 60; m_stDialogBoxInfo[40].sSizeX = 258; m_stDialogBoxInfo[40].sSizeY = 339; // Snoopy: Item exchange confirmation m_stDialogBoxInfo[41].sX = 285; m_stDialogBoxInfo[41].sY = 200; m_stDialogBoxInfo[41].sSizeX = 270; m_stDialogBoxInfo[41].sSizeY = 105; // MJ Stats Change DialogBox - Diuuude m_stDialogBoxInfo[42].sX = 0; m_stDialogBoxInfo[42].sY = 0; m_stDialogBoxInfo[42].sSizeX = 258; m_stDialogBoxInfo[42].sSizeY = 339; // friends m_stDialogBoxInfo[43].sX = 0; m_stDialogBoxInfo[43].sY = 0; m_stDialogBoxInfo[43].sSizeX = 258; m_stDialogBoxInfo[43].sSizeY = 339; // Snoopy: Resurection m_stDialogBoxInfo[50].sX = 185; m_stDialogBoxInfo[50].sY = 100; m_stDialogBoxInfo[50].sSizeX = 270; m_stDialogBoxInfo[50].sSizeY = 105; //Guild Hall Menu Dialog m_stDialogBoxInfo[51].sX = 337; m_stDialogBoxInfo[51].sY = 57; m_stDialogBoxInfo[51].sSizeX = 258; m_stDialogBoxInfo[51].sSizeY = 339; // DK Weapons Dialog - Jehovah m_stDialogBoxInfo[53].sX = 358; m_stDialogBoxInfo[53].sY = 65; m_stDialogBoxInfo[53].sSizeX = 258; m_stDialogBoxInfo[53].sSizeY = 339; //Quest Helper m_stDialogBoxInfo[55].sX = 530; m_stDialogBoxInfo[55].sY = 130; m_stDialogBoxInfo[55].sSizeX = 110; m_stDialogBoxInfo[55].sSizeY = 36; m_bCtrlPressed = FALSE; m_bShiftPressed = FALSE; m_bEnterPressed = FALSE; m_bEscPressed = FALSE; m_bSoundFlag = FALSE; m_dwDialogCloseTime = 0; m_iTimeLeftSecAccount = NULL; m_iTimeLeftSecIP = NULL; m_bWhisper = TRUE; m_bShout = TRUE; } CGame::~CGame() {} BOOL CGame::bInit(HWND hWnd, HINSTANCE hInst, char * pCmdLine) {int iIndex; int i; class CStrTok * pStrTok; char seps[] = "&= ,\t\n"; char * token; // CLEROTH - BUG for (i = 0; i < MAXSPRITES; i++) m_pSprite[i] = NULL; if (pCmdLine != NULL) { ZeroMemory(G_cCmdLine, sizeof(G_cCmdLine)); ZeroMemory(G_cCmdLineTokenA, sizeof(G_cCmdLineTokenA)); ZeroMemory(G_cCmdLineTokenB, sizeof(G_cCmdLineTokenB)); ZeroMemory(G_cCmdLineTokenC, sizeof(G_cCmdLineTokenC)); ZeroMemory(G_cCmdLineTokenD, sizeof(G_cCmdLineTokenD)); ZeroMemory(G_cCmdLineTokenE, sizeof(G_cCmdLineTokenE)); strcpy(G_cCmdLine, pCmdLine); iIndex = 0; pStrTok = new class CStrTok(pCmdLine, seps); token = pStrTok->pGet(); while( token != NULL ) { switch (iIndex) { case 0: strcpy(G_cCmdLineTokenA, token); break; case 1: strcpy(G_cCmdLineTokenB, token); break; case 2: strcpy(G_cCmdLineTokenC, token); break; case 3: strcpy(G_cCmdLineTokenD, token); break; case 4: strcpy(G_cCmdLineTokenE, token); break; } token = pStrTok->pGet(); iIndex++; } delete pStrTok; } ZeroMemory(G_cCmdLineTokenA_Lowercase, sizeof(G_cCmdLineTokenA_Lowercase)); strcpy(G_cCmdLineTokenA_Lowercase, G_cCmdLineTokenA); _strlwr(G_cCmdLineTokenA_Lowercase); if (memcmp(G_cCmdLineTokenA_Lowercase, "/egparam", 8) == 0) { ZeroMemory(G_cCmdLineTokenA, sizeof(G_cCmdLineTokenA)); memcpy(G_cCmdLineTokenA,"dataq",5); } m_hWnd = hWnd; m_bCommandAvailable = TRUE; m_dwTime = G_dwGlobalTime; m_bSoundFlag = m_DSound.Create(m_hWnd); if(!m_bSoundFlag) m_bSoundStat = m_bMusicStat = FALSE; m_bIsHideLocalCursor = FALSE; m_cEnterCheck = m_cTabCheck = m_cLeftArrowCheck = NULL; ZeroMemory(m_cLogServerAddr, sizeof(m_cLogServerAddr)); strcpy(m_cLogServerAddr, SERVER_IP); m_iLogServerPort = SERVER_PORT; if (bCheckImportantFile() == FALSE) { MessageBox(m_hWnd, MSG_NOTIFY_CHECKSUM, "ERROR1", MB_ICONEXCLAMATION | MB_OK); return FALSE; } if (_bDecodeBuildItemContents() == FALSE) { MessageBox(m_hWnd, MSG_NOTIFY_CHECKSUM,"ERROR2",MB_ICONEXCLAMATION | MB_OK); return FALSE; } #ifdef LOGINCFG if(bReadLoginConfigFile("login.cfg") == FALSE) { MessageBox(m_hWnd, MSG_NOTIFY_LOGIN,"ERROR",MB_ICONEXCLAMATION | MB_OK); return FALSE; } #endif if(bReadItemNameConfigFile() == FALSE) { MessageBox(m_hWnd, MSG_NOTIFY_ITEMNAME,"ERROR",MB_ICONEXCLAMATION | MB_OK); return FALSE; } if (bInitMagicCfgList() == FALSE) { MessageBox(m_hWnd, MSG_NOTIFY_MAGICCFG,"ERROR",MB_ICONEXCLAMATION | MB_OK); return FALSE; } // Skill if (bInitSkillCfgList() == FALSE) { MessageBox(m_hWnd, MSG_NOTIFY_SKILLCFG,"ERROR",MB_ICONEXCLAMATION | MB_OK); return FALSE; } if (m_DDraw.bInit(m_hWnd) == FALSE) { MessageBox(m_hWnd, MSG_NOTIFY_DIRECTX7,"ERROR",MB_ICONEXCLAMATION | MB_OK); return FALSE; } if (m_DInput.bInit(hWnd, hInst) == FALSE) { MessageBox(m_hWnd, MSG_NOTIFY_DIRECTX7,"ERROR",MB_ICONEXCLAMATION | MB_OK); return FALSE; } m_hPakFile = CreateFile("sprites\\lgn_dialog.lpk", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); m_pSprite[SPRID_INTERFACE_ND_LOADING] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_dialog", 0, FALSE); CloseHandle(m_hPakFile); m_hPakFile = CreateFile("sprites\\interface2.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); m_pSprite[SPRID_INTERFACE_ADDINTERFACE] = new class CSprite(m_hPakFile, &m_DDraw, "interface2", 0, FALSE); m_pSprite[SPRID_INTERFACE_CRAFTING] = new class CSprite(m_hPakFile, &m_DDraw, "interface2", 3, FALSE); CloseHandle(m_hPakFile); // CLEROTH - LOAD FONTS BEFORE MAIN LOADING m_hPakFile = CreateFile("sprites\\interface2.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { m_pSprite[SPRID_INTERFACE_SPRFONTS2] = new class CSprite(m_hPakFile, &m_DDraw, "interface2", 1, FALSE); m_pSprite[SPRID_INTERFACE_F1HELPWINDOWS] = new class CSprite(m_hPakFile, &m_DDraw, "interface2", 2, FALSE); CloseHandle(m_hPakFile); } m_hPakFile = CreateFile("sprites\\sprfonts.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { m_pSprite[SPRID_INTERFACE_FONT1] = new class CSprite(m_hPakFile, &m_DDraw, "sprfonts", 0, FALSE); m_pSprite[SPRID_INTERFACE_FONT2] = new class CSprite(m_hPakFile, &m_DDraw, "sprfonts", 1, FALSE); CloseHandle(m_hPakFile); } m_stMCursor.sX = 0; m_stMCursor.sY = 0; m_pMapData = new class CMapData(this); ZeroMemory(m_cPlayerName, sizeof(m_cPlayerName)); ZeroMemory(m_cAccountName, sizeof(m_cAccountName)); ZeroMemory(m_cAccountPassword, sizeof(m_cAccountPassword)); m_sPlayerType = 2; m_cPlayerTurn = 0; // Snoopy: fixed here m_cDialogBoxOrder[60] = 29; m_cDialogBoxOrder[59] = 30; m_cMenuDir = 4; m_cMenuDirCnt = 0; m_cMenuFrame = 0; m_cSoundVolume = 100; m_cMusicVolume = 100; m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 70, 70, 80), &m_wWR[1], &m_wWG[1], &m_wWB[1]); // Light-blue m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 70, 70, 80), &m_wWR[2], &m_wWG[2], &m_wWB[2]); // light-blue m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 70, 70, 80), &m_wWR[3], &m_wWG[3], &m_wWB[3]); // light-blue m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 70, 100, 70), &m_wWR[4], &m_wWG[4], &m_wWB[4]); // Green m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 130, 90, 10), &m_wWR[5], &m_wWG[5], &m_wWB[5]); // Critical m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 42, 53, 111), &m_wWR[6], &m_wWG[6], &m_wWB[6]); // Heavy-blue m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 145, 145, 145), &m_wWR[7], &m_wWG[7], &m_wWB[7]); // White m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 120, 100, 120), &m_wWR[8], &m_wWG[8], &m_wWB[8]); m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 75, 10, 10), &m_wWR[9], &m_wWG[9], &m_wWB[9]); // Heavy-Red m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 135, 104, 30), &m_wWR[10],&m_wWG[10],&m_wWB[10]); // Gold m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 200/2, 200/2, 200/2), &m_wR[0], &m_wG[0], &m_wB[0]); m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB(0x50/2, 0x50/2, 0xC0/2), &m_wR[1], &m_wG[1], &m_wB[1]); // Indigo Blue m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 79, 79, 62), &m_wR[2], &m_wG[2], &m_wB[2]); // Custom-Weapon Color m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 135, 104, 30), &m_wR[3], &m_wG[3], &m_wB[3]); // Gold m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 255/2, 36/2, 0), &m_wR[4], &m_wG[4], &m_wB[4]); // Crimson m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 10, 60, 10), &m_wR[5], &m_wG[5], &m_wB[5]); // Green m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB(0x50/2, 0x50/2, 0x50/2), &m_wR[6], &m_wG[6], &m_wB[6]); // Gray m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB(0x5F/2, 0x9E/2, 0xA0/2), &m_wR[7], &m_wG[7], &m_wB[7]); // Aqua m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB(0xFF/2, 0x69/2, 0xB4/2), &m_wR[8], &m_wG[8], &m_wB[8]); // Pink m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 90, 60, 90), &m_wR[9], &m_wG[9], &m_wB[9]); m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 0, 35, 60), &m_wR[10], &m_wG[10], &m_wB[10]); // Blue m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB(0xD2/2, 0xB4/2, 0x8C/2), &m_wR[11], &m_wG[11], &m_wB[11]); // Tan m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB(0xBD/2, 0xB7/2, 0x6B/2), &m_wR[12], &m_wG[12], &m_wB[12]); // Khaki m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 85, 85, 8), &m_wR[13], &m_wG[13], &m_wB[13]); // Yellow m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 75, 10, 10), &m_wR[14], &m_wG[14], &m_wB[14]); // Red m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB( 12, 20, 30), &m_wR[15], &m_wG[15], &m_wB[15]); // Black ZeroMemory(m_cWorldServerName, sizeof(m_cWorldServerName)); return TRUE; } void CGame::Quit() {int i; WriteSettings(); ChangeGameMode(GAMEMODE_NULL); for (i = 0; i < MAXSPRITES; i++) if (m_pSprite[i] != NULL) delete m_pSprite[i]; for (i = 0; i < MAXTILES; i++) if (m_pTileSpr[i] != NULL) delete m_pTileSpr[i]; for (i = 0; i < MAXEFFECTSPR; i++) if (m_pEffectSpr[i] != NULL) delete m_pEffectSpr[i]; for (i = 0; i < MAXSOUNDEFFECTS; i++) { if (m_pCSound[i] != NULL) delete m_pCSound[i]; if (m_pMSound[i] != NULL) delete m_pMSound[i]; if (m_pESound[i] != NULL) delete m_pESound[i]; } if (m_pBGM != NULL) delete m_pBGM; for (i = 0; i < 4; i++) if (m_pCharList[i] != NULL) delete m_pCharList[i]; for (i = 0; i < MAXITEMS; i++) if (m_pItemList[i] != NULL) delete m_pItemList[i]; for (i = 0; i < MAXBANKITEMS; i++) if (m_pBankList[i] != NULL) delete m_pBankList[i]; for (i = 0; i < MAXEFFECTS; i++) if (m_pEffectList[i] != NULL) delete m_pEffectList[i]; for (i = 0; i < MAXCHATMSGS; i++) if (m_pChatMsgList[i] != NULL) delete m_pChatMsgList[i]; for (i = 0; i < MAXCHATSCROLLMSGS; i++) if (m_pChatScrollList[i] != NULL) delete m_pChatScrollList[i]; for (i = 0; i < MAXWHISPERMSG; i++) if (m_pWhisperMsg[i] != NULL) delete m_pWhisperMsg[i]; for (i = 0; i < MAXMENUITEMS; i++) if (m_pItemForSaleList[i] != NULL) delete m_pItemForSaleList[i]; for (i = 0; i < MAXMAGICTYPE; i++) if (m_pMagicCfgList[i] != NULL) delete m_pMagicCfgList[i]; for (i = 0; i < MAXSKILLTYPE; i++) if (m_pSkillCfgList[i] != NULL) delete m_pSkillCfgList[i]; for (i = 0; i < TEXTDLGMAXLINES; i++) { if (m_pMsgTextList[i] != NULL) delete m_pMsgTextList[i]; if (m_pMsgTextList2[i] != NULL) delete m_pMsgTextList2[i]; if (m_pAgreeMsgTextList[i] != NULL) delete m_pAgreeMsgTextList[i]; } for (i = 0; i < MAXBUILDITEMS; i++) if (m_pBuildItemList[i] != NULL) delete m_pBuildItemList[i]; for (i = 0; i < MAXBUILDITEMS; i++) if (m_pDispBuildItemList[i] != NULL) delete m_pDispBuildItemList[i]; // Crafting: for (i = 0; i < MAXBUILDITEMS; i++) if (m_pCraftItemList[i] != NULL) delete m_pCraftItemList[i]; for (i = 0; i < MAXBUILDITEMS; i++) if (m_pDispCraftItemList[i] != NULL) delete m_pDispCraftItemList[i]; for (i = 0; i < MAXITEMNAMES; i++) if (m_pItemNameList[i] != NULL) delete m_pItemNameList[i]; delete m_pMapData; if (m_pGSock != NULL) delete m_pGSock; if (m_pLSock != NULL) delete m_pLSock; if (G_pCalcSocket != NULL) delete G_pCalcSocket; } void CGame::UpdateScreen() { G_dwGlobalTime = timeGetTime(); switch (m_cGameMode) { #ifdef MAKE_ACCOUNT case GAMEMODE_ONAGREEMENT: // UpdateScreen_OnAgreement(); //unused by HBx server.. break; case GAMEMODE_ONCREATENEWACCOUNT: UpdateScreen_OnCreateNewAccount(); break; #endif case GAMEMODE_ONVERSIONNOTMATCH: UpdateScreen_OnVersionNotMatch(); break; case GAMEMODE_ONCONNECTING: UpdateScreen_OnConnecting(); break; case GAMEMODE_ONMAINMENU: UpdateScreen_OnMainMenu(); break; case GAMEMODE_ONLOADING: UpdateScreen_OnLoading(TRUE); break; case GAMEMODE_ONMAINGAME: UpdateScreen_OnGame(); break; case GAMEMODE_ONWAITINGINITDATA: UpdateScreen_OnWaitInitData(); break; case GAMEMODE_ONCONNECTIONLOST: UpdateScreen_OnConnectionLost(); break; case GAMEMODE_ONMSG: UpdateScreen_OnMsg(); break; case GAMEMODE_ONLOGIN: UpdateScreen_OnLogin(); break; case GAMEMODE_ONSELECTSERVER: UpdateScreen_OnSelectServer(); break; case GAMEMODE_ONQUIT: UpdateScreen_OnQuit(); break; case GAMEMODE_ONQUERYFORCELOGIN: UpdateScreen_OnQueryForceLogin(); break; case GAMEMODE_ONSELECTCHARACTER: UpdateScreen_OnSelectCharacter(); break; case GAMEMODE_ONCREATENEWCHARACTER: UpdateScreen_OnCreateNewCharacter(); break; case GAMEMODE_ONWAITINGRESPONSE: UpdateScreen_OnWaitingResponse(); break; case GAMEMODE_ONQUERYDELETECHARACTER: UpdateScreen_OnQueryDeleteCharacter(); break; case GAMEMODE_ONLOGRESMSG: UpdateScreen_OnLogResMsg(); break; case GAMEMODE_ONCHANGEPASSWORD: UpdateScreen_OnChangePassword(); break; } #ifdef USING_WIN_IME if (GetAsyncKeyState(VK_RETURN) != NULL) m_cEnterCheck = 1; if ((m_cEnterCheck == 1) && (GetAsyncKeyState(VK_RETURN) == NULL)) { m_bEnterPressed = TRUE; m_cEnterCheck = NULL; } if (GetAsyncKeyState(VK_TAB) != NULL) m_cTabCheck = 1; if ((m_cTabCheck == 1) && (GetAsyncKeyState(VK_TAB) == NULL)) { m_cCurFocus++; if( m_cCurFocus > m_cMaxFocus) m_cCurFocus = 1; if (m_cGameMode == GAMEMODE_ONMAINGAME) bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TOGGLECOMBATMODE, NULL, NULL, NULL, NULL, NULL); m_cTabCheck = NULL; } if( m_bInputStatus ) { if (GetAsyncKeyState(VK_LEFT) != NULL) m_cLeftArrowCheck = 1; if ((m_cLeftArrowCheck == 1) && (GetAsyncKeyState(VK_LEFT) == NULL)) { m_cLeftArrowCheck = NULL; if( G_hEditWnd != NULL ) { int iStrLen = strlen(m_pInputBuffer); SendMessage( G_hEditWnd, EM_SETSEL, iStrLen, iStrLen ); } } } #endif } void CGame::CalcViewPoint() { short dX, dY; dX = m_sViewPointX - m_sViewDstX; dY = m_sViewPointY - m_sViewDstY; if (abs(dX) < abs(m_sViewDX)) { m_sViewPointX = m_sViewDstX; m_sViewDX = 0; }else { if (dX > 0) m_sViewDX--; if (dX < 0) m_sViewDX++; if (dX == 0) m_sViewDX = 0; if (abs(dX) < 40) { if (m_sViewDX > 4) m_sViewDX = 4; else if (m_sViewDX < -4) m_sViewDX = -4; } m_sViewPointX += m_sViewDX; } if (abs(dY) < abs(m_sViewDY)) { m_sViewPointY = m_sViewDstY; m_sViewDY = 0; }else { if (dY > 0) m_sViewDY--; if (dY < 0) m_sViewDY++; if (dY == 0) m_sViewDY = 0; if (abs(dY) < 40) { if (m_sViewDY > 4) m_sViewDY = 4; else if (m_sViewDY < -4) m_sViewDY = -4; } m_sViewPointY += m_sViewDY; } } void CGame::OnGameSocketEvent(WPARAM wParam, LPARAM lParam) {int iRet; char * pData; DWORD dwMsgSize; if (m_pGSock == NULL) return; iRet = m_pGSock->iOnSocketEvent(wParam, lParam); switch (iRet) { case XSOCKEVENT_CONNECTIONESTABLISH: ConnectionEstablishHandler(SERVERTYPE_GAME); break; case XSOCKEVENT_READCOMPLETE: pData = m_pGSock->pGetRcvDataPointer(&dwMsgSize); GameRecvMsgHandler(dwMsgSize, pData); m_dwTime = G_dwGlobalTime; break; case XSOCKEVENT_SOCKETCLOSED: ChangeGameMode(GAMEMODE_ONCONNECTIONLOST); delete m_pGSock; m_pGSock = NULL; break; case XSOCKEVENT_SOCKETERROR: ChangeGameMode(GAMEMODE_ONCONNECTIONLOST); delete m_pGSock; m_pGSock = NULL; break; case XSOCKEVENT_CRITICALERROR: delete m_pGSock; m_pGSock = NULL; if (G_pCalcSocket != NULL) { delete G_pCalcSocket; G_pCalcSocket = NULL; } break; } } void CGame::RestoreSprites() { for (int i = 0; i < MAXSPRITES; i++) if (m_pSprite[i] != NULL) m_pSprite[i]->iRestore(); } char _tmp_cTmpDirX[9] = { 0,0,1,1,1,0,-1,-1,-1 }; char _tmp_cTmpDirY[9] = { 0,-1,-1,0,1,1,1,0,-1 }; char CGame::cGetNextMoveDir(short sX, short sY, short dstX, short dstY, BOOL bMoveCheck, BOOL isMIM) { char cDir, cTmpDir; //int aX, aY, aX2, aY2, dX, dY; int aX, aY, dX, dY; int i; if ((sX == dstX) && (sY == dstY)) return 0; dX = sX; dY = sY; if (isMIM == FALSE) cDir = m_Misc.cGetNextMoveDir(dX, dY, dstX, dstY); else cDir = m_Misc.cGetNextMoveDir(dstX, dstY, dX, dY); if (m_cPlayerTurn == 0) for (i = cDir; i <= cDir + 2;i++) { cTmpDir = i; if (cTmpDir > 8) cTmpDir -= 8; aX = _tmp_cTmpDirX[cTmpDir]; aY = _tmp_cTmpDirY[cTmpDir]; if (((dX + aX) == m_iPrevMoveX) && ((dY + aY) == m_iPrevMoveY) && (m_bIsPrevMoveBlocked == TRUE) && (bMoveCheck == TRUE)) { m_bIsPrevMoveBlocked = FALSE; }else if (m_pMapData->bGetIsLocateable(dX + aX, dY + aY) == TRUE) { if( m_pMapData->bIsTeleportLoc(dX + aX, dY + aY) == TRUE ) { if( _bCheckMoveable(dX + aX, dY + aY) == TRUE ) return cTmpDir; else { SetTopMsg( MSG_GETNEXTMOVEDIR, 5 ); } }else return cTmpDir; } } if (m_cPlayerTurn == 1) for (i = cDir; i >= cDir - 2;i--) { cTmpDir = i; if (cTmpDir < 1) cTmpDir += 8; aX = _tmp_cTmpDirX[cTmpDir]; aY = _tmp_cTmpDirY[cTmpDir]; if (((dX + aX) == m_iPrevMoveX) && ((dY + aY) == m_iPrevMoveY) && (m_bIsPrevMoveBlocked == TRUE) && (bMoveCheck == TRUE)) { m_bIsPrevMoveBlocked = FALSE; }else if (m_pMapData->bGetIsLocateable(dX + aX, dY + aY) == TRUE) { if( m_pMapData->bIsTeleportLoc(dX + aX, dY + aY) == TRUE ) { if( _bCheckMoveable(dX + aX, dY + aY) == TRUE ) return cTmpDir; else { SetTopMsg( MSG_GETNEXTMOVEDIR, 5 ); } }else return cTmpDir; } } return 0; } BOOL CGame::_bCheckMoveable( short sx, short sy ) { // Snoopy: This function prevents the client from asking at TP from some maps to // ML or PL if not citizen // Incomplete function and useless (the server will handle such cases) /* if( m_bIsCrusadeMode ) return TRUE; if( m_bHunter == FALSE ) return TRUE; if( m_side == NEUTRAL ) return TRUE; if( m_side == ARESDEN && m_cMapIndex == 11 ) { if( sy == 20 ) { if( (sx>=39) && (sx<=47) ) return FALSE; if( (sx>=360) && (sx<=368) ) return FALSE; } } if( m_side == ELVINE && m_cMapIndex == 3 ) { if( sy == 373 ) { if( (sx>=27) && (sx<=32) ) return FALSE; } if( sy == 374 ) { if( (sx>=298) && (sx<=305) ) return FALSE; } }*/ return TRUE; } BOOL CGame::bSendCommand(DWORD dwMsgID, WORD wCommand, char cDir, int iV1, int iV2, int iV3, char * pString, int iV4) {char * cp, cMsg[300], cTxt[256], cKey; WORD * wp; DWORD * dwp, dwTime; short * sp; int * ip, iRet, i, * fightzonenum ; if ((m_pGSock == NULL) && (m_pLSock == NULL)) return FALSE; dwTime = timeGetTime(); ZeroMemory(cMsg, sizeof(cMsg)); cKey = (char)(rand() % 255) +1; dwp = (DWORD *)(cMsg + INDEX4_MSGID); *dwp = dwMsgID; wp = (WORD *)(cMsg + INDEX2_MSGTYPE); *wp = NULL; switch (dwMsgID) { case MSGID_REQUEST_ANGEL: // to Game Server cp = (char*)(cMsg + 6); memset( cp, 0, 20 ); memcpy((char *)cp, pString, strlen(pString) + 1); cp += 20; ip = (int *)cp; *ip = iV1; // Angel ID iRet = m_pGSock->iSendMsg(cMsg, 30, cKey); break; case MSGID_REQUEST_DKITEM: // to Game Server cp = (char*)(cMsg + 6); memset( cp, 0, 20 ); memcpy((char *)cp, pString, strlen(pString) + 1); cp += 20; ip = (int *)cp; *ip = iV1; // DK Item ID iRet = m_pGSock->iSendMsg(cMsg, 30, cKey); break; case MSGID_REQUEST_RESURRECTPLAYER_YES: // By snoopy case MSGID_REQUEST_RESURRECTPLAYER_NO: // By snoopy iRet = m_pGSock->iSendMsg(cMsg, 6, cKey); break; case MSGID_REQUEST_HELDENIAN_SCROLL:// By snoopy cp = (char*)(cMsg + 6); memset( cp, 0, 20 ); memcpy((char *)cp, pString, strlen(pString) + 1); cp += 20; wp = (WORD *)cp; *wp = wCommand; // Item ID iRet = m_pGSock->iSendMsg(cMsg, 28, cKey); break; case MSGID_REQUEST_TELEPORT_LIST: cp = (char*)(cMsg + 6); memset( cp, 0, 20 ); strcpy( cp, pString); iRet = m_pGSock->iSendMsg(cMsg, 26, cKey); break; case MSGID_REQUEST_CHARGED_TELEPORT: ip = (int *)(cMsg + INDEX2_MSGTYPE + 2); *ip = iV1; iRet = m_pGSock->iSendMsg(cMsg, 10, cKey); break; case MSGID_REQUEST_SELLITEMLIST: cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); for (i = 0; i < MAXSELLLIST; i++) { *cp = m_stSellItemList[i].iIndex; cp++; ip = (int *)cp; *ip = m_stSellItemList[i].iAmount; cp += 4; } iRet = m_pGSock->iSendMsg(cMsg, 70, cKey); break; case MSGID_REQUEST_RESTART: iRet = m_pGSock->iSendMsg(cMsg, 6, cKey); break; case MSGID_REQUEST_PANNING: cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); *cp = cDir; cp++; iRet = m_pGSock->iSendMsg(cMsg, 7, cKey); break; case MSGID_REQUEST_CHANGEPASSWORD: cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cAccountName, 10); memcpy(cp, cTxt, 10); cp += 10; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cAccountPassword, 10); memcpy(cp, cTxt, 10); cp += 10; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cNewPassword, 10); memcpy(cp, cTxt, 10); cp += 10; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cNewPassConfirm, 10); memcpy(cp, cTxt, 10); cp += 10; iRet = m_pLSock->iSendMsg(cMsg, 46, cKey); break; case MSGID_REQUEST_CREATENEWACCOUNT: // to Log Server cp = (char *)(cMsg + 6); ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cAccountName, 10); memcpy(cp, cTxt, 10); cp += 10; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cAccountPassword, 10); memcpy(cp, cTxt, 10); cp += 10; memcpy(cp, m_cEmailAddr, 50); cp += 50; memcpy(cp, m_cAccountQuiz, 45); cp += 45; memcpy(cp, m_cAccountAnswer, 20); cp += 20; iRet = m_pLSock->iSendMsg(cMsg, 151, cKey); break; case MSGID_GETMINIMUMLOADGATEWAY: case MSGID_REQUEST_LOGIN: // to Log Server cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cAccountName, 10); memcpy(cp, cTxt, 10); cp += 10; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cAccountPassword, 10); memcpy(cp, cTxt, 10); cp += 10; memcpy(cp, m_cWorldServerName, 30); cp += 30; iRet = m_pLSock->iSendMsg(cMsg, 56, cKey); break; case MSGID_REQUEST_CREATENEWCHARACTER: // to Log Server cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); memcpy(cp, m_cPlayerName, 10); cp += 10; memcpy(cp, m_cAccountName, 10); cp += 10; memcpy(cp, m_cAccountPassword, 10); cp += 10; memcpy(cp, m_cWorldServerName, 30); cp += 30; *cp = m_cGender; cp++; *cp = m_cSkinCol; cp++; *cp = m_cHairStyle; cp++; *cp = m_cHairCol; cp++; *cp = m_cUnderCol; cp++; *cp = (char)m_createStat[STAT_STR]; cp++; *cp = (char)m_createStat[STAT_VIT]; cp++; *cp = (char)m_createStat[STAT_DEX]; cp++; *cp = (char)m_createStat[STAT_INT]; cp++; *cp = (char)m_createStat[STAT_MAG]; cp++; *cp = (char)m_createStat[STAT_CHR]; cp++; iRet = m_pLSock->iSendMsg(cMsg, 77, cKey); break; case MSGID_REQUEST_ENTERGAME: // to Log Server *wp = (WORD)m_wEnterGameType; cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cPlayerName, 10); memcpy(cp, cTxt, 10); cp += 10; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cMapName, 10); memcpy(cp, cTxt, 10); cp += 10; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cAccountName, 10); memcpy(cp, cTxt, 10); cp += 10; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cAccountPassword, 10); memcpy(cp, cTxt, 10); cp += 10; ip = (int *)cp; *ip = m_iLevel; cp += 4; memcpy(cp, m_cWorldServerName, 30); cp += 30; memcpy(cp, G_cCmdLineTokenA, 120); cp += 120; iRet = m_pLSock->iSendMsg(cMsg, 200, cKey); break; case MSGID_REQUEST_DELETECHARACTER: // to Log Server *wp = (WORD)m_wEnterGameType; cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); memcpy(cp, m_pCharList[m_wEnterGameType - 1]->m_cName, 10); cp += 10; memcpy(cp, m_cAccountName, 10); cp += 10; memcpy(cp, m_cAccountPassword, 10); cp += 10; memcpy(cp, m_cWorldServerName, 30); cp += 30; iRet = m_pLSock->iSendMsg(cMsg, 66, cKey); break; case MSGID_REQUEST_SETITEMPOS: // to Game Server cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); *cp = cDir; cp++; sp = (short *)cp; *sp = (short)iV1; cp += 2; sp = (short *)cp; *sp = (short)iV2; cp += 2; iRet = m_pGSock->iSendMsg(cMsg, 11); break; case MSGID_COMMAND_CHECKCONNECTION: cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); dwp = (DWORD *)cp; *dwp = dwTime; cp += 4; iRet = m_pGSock->iSendMsg(cMsg, 10, cKey); break; case MSGID_REQUEST_INITDATA: case MSGID_REQUEST_INITPLAYER: // to Game Server cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cPlayerName, 10); memcpy(cp, cTxt, 10); cp += 10; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cAccountName, 10); memcpy(cp, cTxt, 10); cp += 10; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cAccountPassword, 10); memcpy(cp, cTxt, 10); cp += 10; *cp = (char)m_bIsObserverMode; cp++; memcpy(cp, m_cGameServerName, 20); cp += 20; iRet = m_pGSock->iSendMsg(cMsg, 37 +21, cKey); //m_bIsObserverMode = FALSE; break; case MSGID_LEVELUPSETTINGS: // CLEROTH //if ((m_luStat[STAT_STR] + m_luStat[STAT_VIT] + m_luStat[STAT_DEX] + m_luStat[STAT_INT] + m_luStat[STAT_MAG] + m_luStat[STAT_CHR]) > 3) return FALSE; cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); *cp = m_luStat[STAT_STR]; cp++; *cp = m_luStat[STAT_VIT]; cp++; *cp = m_luStat[STAT_DEX]; cp++; *cp = m_luStat[STAT_INT]; cp++; *cp = m_luStat[STAT_MAG]; cp++; *cp = m_luStat[STAT_CHR]; cp++; iRet = m_pGSock->iSendMsg(cMsg, 12); break; case MSGID_COMMAND_CHATMSG: if (m_bIsTeleportRequested == TRUE) return FALSE; // to Game Server cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); sp = (short *)cp; *sp = m_sPlayerX; cp += 2; sp = (short *)cp; *sp = m_sPlayerY; cp += 2; memcpy(cp, m_cPlayerName, 10); cp += 10; *cp = (char)iV1; cp++; if (bCheckLocalChatCommand(pString) == TRUE) return FALSE; memcpy((char *)cp, pString, strlen(pString) + 1); iRet = m_pGSock->iSendMsg(cMsg, 22 + strlen(pString)); break; case MSGID_COMMAND_COMMON: if (m_bIsTeleportRequested == TRUE) return FALSE; *wp = wCommand; cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); sp = (short *)cp; *sp = m_sPlayerX; cp += 2; sp = (short *)cp; *sp = m_sPlayerY; cp += 2; *cp = cDir; cp++; switch (wCommand) { case COMMONTYPE_BUILDITEM: memcpy(cp, pString, 20); cp += 20; *cp = (char)m_stDialogBoxInfo[26].sV1; cp++; *cp = (char)m_stDialogBoxInfo[26].sV2; cp++; *cp = (char)m_stDialogBoxInfo[26].sV3; cp++; *cp = (char)m_stDialogBoxInfo[26].sV4; cp++; *cp = (char)m_stDialogBoxInfo[26].sV5; cp++; *cp = (char)m_stDialogBoxInfo[26].sV6; cp++; iRet = m_pGSock->iSendMsg(cMsg, 37); break; case COMMONTYPE_REQ_CREATEPOTION: *cp = (char)m_stDialogBoxInfo[26].sV1; cp++; *cp = (char)m_stDialogBoxInfo[26].sV2; cp++; *cp = (char)m_stDialogBoxInfo[26].sV3; cp++; *cp = (char)m_stDialogBoxInfo[26].sV4; cp++; *cp = (char)m_stDialogBoxInfo[26].sV5; cp++; *cp = (char)m_stDialogBoxInfo[26].sV6; cp++; iRet = m_pGSock->iSendMsg(cMsg, 18); break; //Crafting case COMMONTYPE_CRAFTITEM: memcpy(cp, " ", 20); cp += 20; *cp = (char)m_stDialogBoxInfo[26].sV1; cp++; *cp = (char)m_stDialogBoxInfo[26].sV2; cp++; *cp = (char)m_stDialogBoxInfo[26].sV3; cp++; *cp = (char)m_stDialogBoxInfo[26].sV4; cp++; *cp = (char)m_stDialogBoxInfo[26].sV5; cp++; *cp = (char)m_stDialogBoxInfo[26].sV6; cp++; iRet = m_pGSock->iSendMsg(cMsg, 37); break; // Create Slate Request - Diuuude case COMMONTYPE_REQ_CREATESLATE: *cp = (char)m_stDialogBoxInfo[40].sV1; cp++; *cp = (char)m_stDialogBoxInfo[40].sV2; cp++; *cp = (char)m_stDialogBoxInfo[40].sV3; cp++; *cp = (char)m_stDialogBoxInfo[40].sV4; cp++; *cp = (char)m_stDialogBoxInfo[40].sV5; cp++; *cp = (char)m_stDialogBoxInfo[40].sV6; cp++; iRet = m_pGSock->iSendMsg(cMsg, 18); break; default: if (pString == NULL) { ip = (int *)cp; *ip = iV1; cp += 4; ip = (int *)cp; *ip = iV2; cp += 4; ip = (int *)cp; *ip = iV3; cp += 4; dwp = (DWORD *)cp; *dwp = dwTime; cp += 4; iRet = m_pGSock->iSendMsg(cMsg, 23 +4); }else { ip = (int *)cp; *ip = iV1; cp += 4; ip = (int *)cp; *ip = iV2; cp += 4; ip = (int *)cp; *ip = iV3; cp += 4; memcpy(cp, pString, 30); cp += 30; ip = (int *)cp; *ip = iV4; cp += 4; iRet = m_pGSock->iSendMsg(cMsg, 23 + 34); } break; } break; case MSGID_REQUEST_CREATENEWGUILD: case MSGID_REQUEST_DISBANDGUILD: // to Game Server *wp = MSGTYPE_CONFIRM; cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cPlayerName, 10); memcpy(cp, cTxt, 10); cp += 10; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cAccountName, 10); memcpy(cp, cTxt, 10); cp += 10; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, m_cAccountPassword, 10); memcpy(cp, cTxt, 10); cp += 10; char cTemp[21]; ZeroMemory(cTemp, sizeof(cTemp)); memcpy(cTemp, m_cGuildName, 20); m_Misc.ReplaceString(cTemp, ' ', '_'); memcpy(cp, cTemp, 20); cp += 20; iRet = m_pGSock->iSendMsg(cMsg, 56, cKey); break; case MSGID_REQUEST_TELEPORT: *wp = MSGTYPE_CONFIRM; iRet = m_pGSock->iSendMsg(cMsg, 6); m_bIsTeleportRequested = TRUE; break; case MSGID_REQUEST_CIVILRIGHT: *wp = MSGTYPE_CONFIRM; iRet = m_pGSock->iSendMsg(cMsg, 6); break; case MSGID_REQUEST_RETRIEVEITEM: *wp = MSGTYPE_CONFIRM; cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); *cp = (char)iV1; iRet = m_pGSock->iSendMsg(cMsg, 7); break; case MSGID_REQUEST_NOTICEMENT: cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); ip = (int *)cp; *ip = iV1; cp += 4; iRet = m_pGSock->iSendMsg(cMsg, 10, cKey); break; case MSGID_REQUEST_FIGHTZONE_RESERVE: cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); fightzonenum = (int *)cp; *fightzonenum = iV1; cp += 4; iRet = m_pGSock->iSendMsg(cMsg, 10); break; case MSGID_STATECHANGEPOINT: // Diuuude cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); *cp = cStateChange1; cp++; *cp = cStateChange2; cp++; *cp = cStateChange3; cp++; iRet = m_pGSock->iSendMsg(cMsg, 9); break; case MSGID_REQUEST_UPDATE_FRIENDS: cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); memcpy((char *)cp, pString, strlen(pString) + 1); iRet = m_pGSock->iSendMsg(cMsg, 6 + strlen(pString)); break; case MSGID_REQUEST_LGNPTS: case MSGID_REQUEST_LGNSVC: *wp = wCommand; iRet = m_pGSock->iSendMsg(cMsg, 6); break; case MSGID_REQUEST_SETRECALLPNT: dwp = (DWORD *)(cMsg + INDEX4_MSGID); *dwp = dwMsgID; cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); *cp = (char)iV1; iRet = m_pGSock->iSendMsg(cMsg, 7); break; case MSGID_COMMAND_MOTION: if (m_bIsTeleportRequested == TRUE) return FALSE; *wp = wCommand; cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); sp = (short *)cp; *sp = m_sPlayerX; cp += 2; sp = (short *)cp; *sp = m_sPlayerY; cp += 2; *cp = cDir; cp++; dwp = (DWORD *)cp; *dwp = dwTime; cp += 4; sp = (short *)cp; *sp = (short)iV1; cp += 2; sp = (short *)cp; *sp = (short)iV2; cp += 2; sp = (short *)cp; *sp = (short)iV3; cp += 2; sp = (short *)cp; *sp = (short)iV4; cp += 2; int dataLength; switch (wCommand) { case OBJECTGETITEM: case OBJECTRUN: case OBJECTMOVE: case OBJECTDAMAGEMOVE: dataLength = 17; break; case OBJECTMAGIC: dataLength = 19; break; case OBJECTATTACK: case OBJECTATTACKMOVE: dataLength = 23; break; default: dataLength = 21; break; } iRet = m_pGSock->iSendMsg(cMsg, dataLength); m_cCommandCount++; break; default: if (m_bIsTeleportRequested == TRUE) return FALSE; *wp = wCommand; cp = (char *)(cMsg + INDEX2_MSGTYPE + 2); sp = (short *)cp; *sp = m_sPlayerX; cp += 2; sp = (short *)cp; *sp = m_sPlayerY; cp += 2; *cp = cDir; cp++; sp = (short *)cp; *sp = (short)iV1; cp += 2; sp = (short *)cp; *sp = (short)iV2; cp += 2; sp = (short *)cp; *sp = (short)iV3; cp += 2; if (wCommand == OBJECTATTACK || wCommand == OBJECTATTACKMOVE) { sp = (short *)cp; *sp = (short)iV4; cp += 2; dwp = (DWORD *)cp; *dwp = dwTime; cp += 4; iRet = m_pGSock->iSendMsg(cMsg, 19 +4); } else { dwp = (DWORD *)cp; *dwp = dwTime; cp += 4; iRet = m_pGSock->iSendMsg(cMsg, 17 +4); } m_cCommandCount++; break; } switch (iRet) { case XSOCKEVENT_SOCKETCLOSED: case XSOCKEVENT_SOCKETERROR: case XSOCKEVENT_QUENEFULL: ChangeGameMode(GAMEMODE_ONCONNECTIONLOST); delete m_pGSock; m_pGSock = NULL; break; case XSOCKEVENT_CRITICALERROR: delete m_pGSock; m_pGSock = NULL; if (G_pCalcSocket != NULL) { delete G_pCalcSocket; G_pCalcSocket = NULL; } SendMessage(m_hWnd, WM_DESTROY, NULL, NULL); break; } return TRUE; } void CGame::DrawObjects(short sPivotX, short sPivotY, short sDivX, short sDivY, short sModX, short sModY, short msX, short msY) { int ix, iy, indexX, indexY, dX, dY, iDvalue; char cItemColor; BOOL bIsPlayerDrawed = FALSE; BOOL bContact = FALSE; BOOL bRet = FALSE; short sItemSprite, sItemSpriteFrame, sObjSpr, sObjSprFrame, sDynamicObject, sDynamicObjectFrame; static DWORD dwMCAnimTime = G_dwGlobalTime; static short sMCAnimFrame = 1; // Xmas static int ix1[100]; static int iy2[100]; static int iXmasTreeBulbDelay = 76; int idelay = 75; uint32 groundPivotPoint = (m_bigItems) ? SPRID_ITEMPACK_PIVOTPOINT : SPRID_ITEMGROUND_PIVOTPOINT; if( sDivY < 0 || sDivX < 0) return ; m_sMCX = NULL; m_sMCY = NULL; ZeroMemory(m_cMCName, sizeof(m_cMCName)); //dwTime = G_dwGlobalTime; DWORD dwTime = m_dwCurTime; m_stMCursor.sCursorFrame = 0; indexY = sDivY + sPivotY - 7; for (iy = -sModY-224; iy <= 427+352; iy += 32) { indexX = sDivX + sPivotX-4; for (ix = -sModX-128 ; ix <= 640 + 128; ix += 32) { sDynamicObject = NULL; bRet = FALSE; if ((ix >= -sModX) && (ix <= 640+16) && (iy >= -sModY) && (iy <= 427+32+16)) { _tmp_wObjectID = _tmp_sOwnerType = _tmp_sAppr1 = _tmp_sAppr2 = _tmp_sAppr3 = _tmp_sAppr4 = _tmp_iStatus = NULL; _tmp_cDir = _tmp_cFrame = 0; _tmp_iEffectType = _tmp_iEffectFrame = _tmp_iChatIndex = 0; ZeroMemory(_tmp_cName, sizeof(_tmp_cName)); if ((indexX < m_pMapData->m_sPivotX) || (indexX > m_pMapData->m_sPivotX + MAPDATASIZEX) || (indexY < m_pMapData->m_sPivotY) || (indexY > m_pMapData->m_sPivotY + MAPDATASIZEY)) { sItemSprite = NULL; sItemSpriteFrame = NULL; bRet = FALSE; cItemColor = NULL; }else { _tmp_dX = dX = indexX - m_pMapData->m_sPivotX; _tmp_dY = dY = indexY - m_pMapData->m_sPivotY; _tmp_wObjectID = m_pMapData->m_pData[dX][dY].m_wDeadObjectID; _tmp_sOwnerType = m_pMapData->m_pData[dX][dY].m_sDeadOwnerType; _tmp_cDir = m_pMapData->m_pData[dX][dY].m_cDeadDir; _tmp_sAppr1 = m_pMapData->m_pData[dX][dY].m_sDeadAppr1; _tmp_sAppr2 = m_pMapData->m_pData[dX][dY].m_sDeadAppr2; _tmp_sAppr3 = m_pMapData->m_pData[dX][dY].m_sDeadAppr3; _tmp_sAppr4 = m_pMapData->m_pData[dX][dY].m_sDeadAppr4; _tmp_iApprColor = m_pMapData->m_pData[dX][dY].m_iDeadApprColor; _tmp_cFrame = m_pMapData->m_pData[dX][dY].m_cDeadOwnerFrame; _tmp_iChatIndex = m_pMapData->m_pData[dX][dY].m_iDeadChatMsg; _tmp_iStatus = m_pMapData->m_pData[dX][dY].m_iDeadStatus; strcpy(_tmp_cName, m_pMapData->m_pData[dX][dY].m_cDeadOwnerName); sItemSprite = m_pMapData->m_pData[dX][dY].m_sItemSprite; sItemSpriteFrame = m_pMapData->m_pData[dX][dY].m_sItemSpriteFrame; cItemColor = m_pMapData->m_pData[dX][dY].m_cItemColor; sDynamicObject = m_pMapData->m_pData[dX][dY].m_sDynamicObjectType; sDynamicObjectFrame = (short)m_pMapData->m_pData[dX][dY].m_cDynamicObjectFrame; cDynamicObjectData1 = m_pMapData->m_pData[dX][dY].m_cDynamicObjectData1; cDynamicObjectData2 = m_pMapData->m_pData[dX][dY].m_cDynamicObjectData2; cDynamicObjectData3 = m_pMapData->m_pData[dX][dY].m_cDynamicObjectData3; cDynamicObjectData4 = m_pMapData->m_pData[dX][dY].m_cDynamicObjectData4; bRet = TRUE; } if ((bRet == TRUE) && (sItemSprite != 0) && !m_altPressed) { if (cItemColor == 0) m_pSprite[groundPivotPoint + sItemSprite]->PutSpriteFast(ix, iy, sItemSpriteFrame, dwTime); else { switch (sItemSprite) { case 1: // Swds case 2: // Bows case 3: // Shields case 15: // Axes hammers m_pSprite[groundPivotPoint + sItemSprite]->PutSpriteRGB(ix, iy , sItemSpriteFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], dwTime); break; default: m_pSprite[groundPivotPoint + sItemSprite]->PutSpriteRGB(ix, iy , sItemSpriteFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], dwTime); break; } } if ((ix - 13 < msX) && (ix + 13 > msX) && (iy - 13 < msY) && (iy + 13 > msY)) { if ((dwTime - dwMCAnimTime) > 200) { dwMCAnimTime = dwTime; if (sMCAnimFrame == 1) sMCAnimFrame = 2; else sMCAnimFrame = 1; } m_stMCursor.sCursorFrame = sMCAnimFrame; } } if ((bRet == TRUE) && (_tmp_wObjectID != NULL)) { bContact = DrawObject_OnDead(indexX, indexY, ix, iy, FALSE, dwTime, msX, msY); } if ((bRet == TRUE) && (sItemSprite != 0) && m_altPressed) { if (cItemColor == 0) m_pSprite[groundPivotPoint + sItemSprite]->PutSpriteFast(ix, iy, sItemSpriteFrame, dwTime); else { switch (sItemSprite) { case 1: // Swds case 2: // Bows case 3: // Shields case 15: // Axes hammers m_pSprite[groundPivotPoint + sItemSprite]->PutSpriteRGB(ix, iy , sItemSpriteFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], dwTime); break; default: m_pSprite[groundPivotPoint + sItemSprite]->PutSpriteRGB(ix, iy , sItemSpriteFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], dwTime); break; } } if ((ix - 13 < msX) && (ix + 13 > msX) && (iy - 13 < msY) && (iy + 13 > msY)) { if ((dwTime - dwMCAnimTime) > 200) { dwMCAnimTime = dwTime; if (sMCAnimFrame == 1) sMCAnimFrame = 2; else sMCAnimFrame = 1; } m_stMCursor.sCursorFrame = sMCAnimFrame; } } if ((bContact == TRUE) && (msY <= 431)) { m_sMCX = indexX; m_sMCY = indexY; sFocusX = ix; sFocusY = iy; sFocusOwnerType = _tmp_sOwnerType; cFocusAction = OBJECTDEAD; wFocusObjectID = _tmp_wObjectID; cFocusFrame = _tmp_cFrame; cFocusDir = _tmp_cDir; sFocusAppr1 = _tmp_sAppr1; sFocusAppr2 = _tmp_sAppr2; sFocusAppr3 = _tmp_sAppr3; sFocusAppr4 = _tmp_sAppr4; iFocusApprColor = _tmp_iApprColor; iFocuiStatus = _tmp_iStatus; ZeroMemory(cFocusName, sizeof(cFocusName)); strcpy(cFocusName, _tmp_cName); ZeroMemory(m_cMCName, sizeof(m_cMCName)); strcpy(m_cMCName, _tmp_cName); sFocus_dX = _tmp_dX; sFocus_dY = _tmp_dY; bContact = FALSE; } _tmp_wObjectID = _tmp_sOwnerType = _tmp_sAppr1 = _tmp_sAppr2 = _tmp_sAppr3 = _tmp_sAppr4 = _tmp_iStatus = NULL; _tmp_cFrame = _tmp_cDir = 0; _tmp_iEffectType = _tmp_iEffectFrame = _tmp_iApprColor = _tmp_iChatIndex = 0; ZeroMemory(_tmp_cName, sizeof(_tmp_cName)); if ((indexX < m_pMapData->m_sPivotX) || (indexX > m_pMapData->m_sPivotX + MAPDATASIZEX) || (indexY < m_pMapData->m_sPivotY) || (indexY > m_pMapData->m_sPivotY + MAPDATASIZEY)) { sItemSprite = NULL; bRet = FALSE; }else { _tmp_dX = dX = indexX - m_pMapData->m_sPivotX; _tmp_dY = dY = indexY - m_pMapData->m_sPivotY; _tmp_wObjectID = m_pMapData->m_pData[dX][dY].m_wObjectID; _tmp_sOwnerType = m_pMapData->m_pData[dX][dY].m_sOwnerType; _tmp_cAction = m_pMapData->m_pData[dX][dY].m_cOwnerAction; _tmp_iStatus = m_pMapData->m_pData[dX][dY].m_iStatus; _tmp_cDir = m_pMapData->m_pData[dX][dY].m_cDir; _tmp_sAppr1 = m_pMapData->m_pData[dX][dY].m_sAppr1; _tmp_sAppr2 = m_pMapData->m_pData[dX][dY].m_sAppr2; _tmp_sAppr3 = m_pMapData->m_pData[dX][dY].m_sAppr3; _tmp_sAppr4 = m_pMapData->m_pData[dX][dY].m_sAppr4; _tmp_iApprColor = m_pMapData->m_pData[dX][dY].m_iApprColor; _tmp_cFrame = m_pMapData->m_pData[dX][dY].m_cOwnerFrame; _tmp_iChatIndex = m_pMapData->m_pData[dX][dY].m_iChatMsg; _tmp_iEffectType = m_pMapData->m_pData[dX][dY].m_iEffectType; _tmp_iEffectFrame = m_pMapData->m_pData[dX][dY].m_iEffectFrame; strcpy(_tmp_cName, m_pMapData->m_pData[dX][dY].m_cOwnerName); bRet = TRUE; if (m_iIlusionOwnerH != NULL) { if ((strcmp(_tmp_cName, m_cPlayerName) != 0) && (_tmp_sOwnerType < 10)) { _tmp_sOwnerType = m_cIlusionOwnerType; if(_tmp_iStatus & STATUS_INVISIBILITY){ _tmp_iStatus = m_iStatus_IE; _tmp_iStatus |= STATUS_INVISIBILITY; }else{ _tmp_iStatus = m_iStatus_IE; } _tmp_sAppr1 = m_sAppr1_IE; _tmp_sAppr2 = m_cIlusionOwnerType ? m_sAppr2_IE : 0xF000; _tmp_sAppr3 = m_sAppr3_IE; _tmp_sAppr4 = m_sAppr4_IE; _tmp_iApprColor = m_iApprColor_IE; } } } if ((bRet == TRUE) && (strlen(_tmp_cName) > 0)) { _tmp_dx = 0; _tmp_dy = 0; switch (_tmp_cAction) { case OBJECTSTOP: bContact = DrawObject_OnStop(indexX, indexY, ix, iy, FALSE, dwTime, msX, msY); break; case OBJECTMOVE: bContact = DrawObject_OnMove(indexX, indexY, ix, iy, FALSE, dwTime, msX, msY); break; case OBJECTDAMAGEMOVE: bContact = DrawObject_OnDamageMove(indexX, indexY, ix, iy, FALSE, dwTime, msX, msY); break; case OBJECTRUN: bContact = DrawObject_OnRun(indexX, indexY, ix, iy, FALSE, dwTime, msX, msY); break; case OBJECTATTACK: bContact = DrawObject_OnAttack(indexX, indexY, ix, iy, FALSE, dwTime, msX, msY); break; case OBJECTATTACKMOVE: bContact = DrawObject_OnAttackMove(indexX, indexY, ix, iy, FALSE, dwTime, msX, msY); break; case OBJECTMAGIC: bContact = DrawObject_OnMagic(indexX, indexY, ix, iy, FALSE, dwTime, msX, msY); break; case OBJECTGETITEM: bContact = DrawObject_OnGetItem(indexX, indexY, ix, iy, FALSE, dwTime, msX, msY); break; case OBJECTDAMAGE: bContact = DrawObject_OnDamage(indexX, indexY, ix, iy, FALSE, dwTime, msX, msY); break; case OBJECTDYING: bContact = DrawObject_OnDying(indexX, indexY, ix, iy, FALSE, dwTime, msX, msY); break; } if ((bContact == TRUE) && (msY <= 431)) { m_sMCX = indexX; m_sMCY = indexY; sFocusX = ix; sFocusY = iy; wFocusObjectID = _tmp_wObjectID; sFocusOwnerType = _tmp_sOwnerType; cFocusAction = _tmp_cAction; cFocusFrame = _tmp_cFrame; cFocusDir = _tmp_cDir; sFocusAppr1 = _tmp_sAppr1; sFocusAppr2 = _tmp_sAppr2; sFocusAppr3 = _tmp_sAppr3; sFocusAppr4 = _tmp_sAppr4; iFocusApprColor = _tmp_iApprColor; iFocuiStatus = _tmp_iStatus; ZeroMemory(cFocusName, sizeof(cFocusName)); strcpy(cFocusName, _tmp_cName); ZeroMemory(m_cMCName, sizeof(m_cMCName)); strcpy(m_cMCName, _tmp_cName); sFocus_dX = _tmp_dX; sFocus_dY = _tmp_dY; bContact = FALSE; } if (memcmp(m_cPlayerName, _tmp_cName, 10) == 0) { if (m_bIsObserverMode == FALSE) { m_sViewDstX = (indexX*32) - 288 - 32; m_sViewDstY = (indexY*32) - 224; } SetRect(&m_rcPlayerRect, m_rcBodyRect.left, m_rcBodyRect.top, m_rcBodyRect.right, m_rcBodyRect.bottom); bIsPlayerDrawed = TRUE; } } } // CLEROTH sObjSpr = m_pMapData->m_tile[indexX][indexY].m_sObjectSprite; sObjSprFrame = m_pMapData->m_tile[indexX][indexY].m_sObjectSpriteFrame; if (sObjSpr != 0) { if ((sObjSpr < 100) || (sObjSpr >= 200)) { switch (sObjSpr) { case 200: case 223: m_pTileSpr[sObjSpr]->PutShadowSprite(ix - 16, iy - 16, sObjSprFrame, dwTime); break; case 224: switch (sObjSprFrame) { case 24: case 34: case 35: case 36: case 37: case 38: break; default: m_pTileSpr[sObjSpr]->PutShadowSprite(ix - 16, iy - 16, sObjSprFrame, dwTime); break; } } if (m_cDetailLevel == 0) // Special Grass & Flowers { if ((sObjSpr != 6) && (sObjSpr != 9)) m_pTileSpr[sObjSpr]->PutSpriteFast(ix - 16, iy - 16, sObjSprFrame, dwTime); }else { m_pTileSpr[sObjSpr]->PutSpriteFast(ix - 16, iy - 16, sObjSprFrame, dwTime); } switch (sObjSpr) { case 200: if (sObjSprFrame == 32) { if (G_cSpriteAlphaDegree == 2) { int iDvalue1 = -1*(rand() % 5); m_pEffectSpr[0]->PutTransSpriteRGB(ix-2, iy - 75, 1, iDvalue1, iDvalue1, iDvalue1, dwTime); } } break; case 223: if (sObjSprFrame == 4) { if (G_cSpriteAlphaDegree == 2) //nuit { int iDvalue1 = -1*(rand() % 5); int iDvalue2 = -1*(rand() % 5); int iDvalue3 = -1*(rand() % 5); m_pEffectSpr[0]->PutTransSpriteRGB(ix-2, iy - 150, 1, iDvalue1, iDvalue1, iDvalue1, dwTime); m_pEffectSpr[0]->PutTransSpriteRGB(ix+16, iy - 96, 1, iDvalue2, iDvalue2, iDvalue2, dwTime); m_pEffectSpr[0]->PutTransSpriteRGB(ix-19, iy - 126, 1, iDvalue3, iDvalue3, iDvalue3, dwTime); } } break; case 370: // nuit if ( ((dwTime - m_dwEnvEffectTime) > 400) && (sObjSprFrame == 9) && (G_cSpriteAlphaDegree == 2)) bAddNewEffect(65, m_sViewPointX + ix -16 +30, m_sViewPointY + iy -16 -334, NULL, NULL, NULL, 0); if ( ((dwTime - m_dwEnvEffectTime) > 400) && (sObjSprFrame == 11) && (G_cSpriteAlphaDegree == 2)) bAddNewEffect(65, m_sViewPointX +ix -16 +17, m_sViewPointY + iy -16 -300, NULL, NULL, NULL, 0); break; case 374: // nuit if ( ((dwTime - m_dwEnvEffectTime) > 400) && (sObjSprFrame == 2) && (G_cSpriteAlphaDegree == 2)) bAddNewEffect(65, m_sViewPointX + ix -7, m_sViewPointY + iy -122, NULL, NULL, NULL, 0); if ( ((dwTime - m_dwEnvEffectTime) > 400) && (sObjSprFrame == 6) && (G_cSpriteAlphaDegree == 2)) bAddNewEffect(65, m_sViewPointX + ix -14, m_sViewPointY + iy -321, NULL, NULL, NULL, 0); if ( ((dwTime - m_dwEnvEffectTime) > 400) && (sObjSprFrame == 7) && (G_cSpriteAlphaDegree == 2)) bAddNewEffect(65, m_sViewPointX +ix +7, m_sViewPointY + iy -356, NULL, NULL, NULL, 0); break; case 376: // nuit if ( ((dwTime - m_dwEnvEffectTime) > 400) && (sObjSprFrame == 12) && (G_cSpriteAlphaDegree == 2)) { bAddNewEffect(65, m_sViewPointX + ix -16, m_sViewPointY + iy -346, NULL, NULL, NULL, 0); bAddNewEffect(65, m_sViewPointX + ix +11, m_sViewPointY + iy -308, NULL, NULL, NULL, 0); } break; case 378: // nuit if ( ((dwTime - m_dwEnvEffectTime) > 400) && (sObjSprFrame == 11) && (G_cSpriteAlphaDegree == 2)) bAddNewEffect(65, m_sViewPointX + ix, m_sViewPointY + iy -91, NULL, NULL, NULL, 0); break; case 382: // nuit if ( ((dwTime - m_dwEnvEffectTime) > 400) && (sObjSprFrame == 9) && (G_cSpriteAlphaDegree == 2)) { bAddNewEffect(65, m_sViewPointX + ix +73, m_sViewPointY + iy -264, NULL, NULL, NULL, 0); bAddNewEffect(65, m_sViewPointX + ix +23, m_sViewPointY + iy -228, NULL, NULL, NULL, 0); } break; case 429: if ( ((dwTime - m_dwEnvEffectTime) > 400) && (sObjSprFrame == 2)) bAddNewEffect(65, m_sViewPointX + ix -15, m_sViewPointY + iy -224, NULL, NULL, NULL, 0); break; } }else // sprites 100..199: Trees and tree shadows { m_pTileSpr[sObjSpr]->_GetSpriteRect(ix - 16, iy - 16, sObjSprFrame); if (m_cDetailLevel==0) { if( sObjSpr < 100 + 11 ) m_pTileSpr[100 + 4]->PutSpriteFast(ix - 16, iy - 16, sObjSprFrame, dwTime); else if( sObjSpr < 100 + 23 ) m_pTileSpr[100 + 9]->PutSpriteFast(ix - 16, iy - 16, sObjSprFrame, dwTime); else if( sObjSpr < 100 + 32 ) m_pTileSpr[100 + 23]->PutSpriteFast(ix - 16, iy - 16, sObjSprFrame, dwTime); else m_pTileSpr[100 + 32]->PutSpriteFast(ix - 16, iy - 16, sObjSprFrame, dwTime); }else { if ((bIsPlayerDrawed == TRUE) && (m_pTileSpr[sObjSpr]->m_rcBound.top <= m_rcPlayerRect.top) && (m_pTileSpr[sObjSpr]->m_rcBound.bottom >= m_rcPlayerRect.bottom) && (m_cDetailLevel >= 2) && (m_pTileSpr[sObjSpr]->m_rcBound.left <= m_rcPlayerRect.left) && (m_pTileSpr[sObjSpr]->m_rcBound.right >= m_rcPlayerRect.right)) { m_pTileSpr[sObjSpr + 50]->PutFadeSprite(ix , iy , sObjSprFrame, dwTime); m_pTileSpr[sObjSpr]->PutTransSprite2(ix - 16, iy - 16, sObjSprFrame, dwTime); }else { m_pTileSpr[sObjSpr + 50]->PutSpriteFast(ix , iy , sObjSprFrame, dwTime); m_pTileSpr[sObjSpr]->PutSpriteFast(ix - 16, iy - 16, sObjSprFrame, dwTime); } if (m_bIsXmas == TRUE) { if (G_cSpriteAlphaDegree == 2) // nuit { if( iXmasTreeBulbDelay < 0 || iXmasTreeBulbDelay > idelay + 1) iXmasTreeBulbDelay = 0; if( iXmasTreeBulbDelay > idelay ) { for (int i = 0; i < 100; i++) { ix1[i] = 1*(rand() % 400)-200; iy2[i] = -1*(rand() % 300); } iXmasTreeBulbDelay = 0; } else iXmasTreeBulbDelay++; for (int j = 0; j < 100; j++) { if( m_pTileSpr[sObjSpr]->_bCheckCollison(ix-16, iy-16, sObjSprFrame, ix + ix1[j], iy + iy2[j]) ) { m_pEffectSpr[66+(j%6)]->PutTransSprite(ix + ix1[j], iy + iy2[j], (iXmasTreeBulbDelay>>2), dwTime); } } } } } } } // Dynamic Object if ( (bRet == TRUE) && (sDynamicObject != NULL) ) { switch (sDynamicObject) { case DYNAMICOBJECT_PCLOUD_BEGIN: // 10 if (sDynamicObjectFrame >= 0) m_pEffectSpr[23]->PutTransSprite50_NoColorKey(ix+(rand() % 2), iy+(rand() % 2), sDynamicObjectFrame, dwTime); break; case DYNAMICOBJECT_PCLOUD_LOOP: // 11 m_pEffectSpr[23]->PutTransSprite50_NoColorKey(ix+(rand() % 2), iy+(rand() % 2), sDynamicObjectFrame+8, dwTime); break; case DYNAMICOBJECT_PCLOUD_END: // 12 m_pEffectSpr[23]->PutTransSprite50_NoColorKey(ix+(rand() % 2), iy+(rand() % 2), sDynamicObjectFrame+16, dwTime); break; case DYNAMICOBJECT_ICESTORM: // 8 iDvalue = (rand() % 5)*(-1); m_pEffectSpr[0]->PutTransSpriteRGB(ix, iy, 1, iDvalue, iDvalue, iDvalue, dwTime); m_pEffectSpr[13]->PutTransSprite70_NoColorKey(ix, iy, sDynamicObjectFrame, dwTime); break; case DYNAMICOBJECT_FIRE: // 1 case DYNAMICOBJECT_FIRE3: // 14 switch (rand() % 3) { case 0: m_pEffectSpr[0]->PutTransSprite25_NoColorKey(ix, iy, 1, dwTime); break; case 1: m_pEffectSpr[0]->PutTransSprite50_NoColorKey(ix, iy, 1, dwTime); break; case 2: m_pEffectSpr[0]->PutTransSprite70_NoColorKey(ix, iy, 1, dwTime); break; } m_pEffectSpr[9]->PutTransSprite70_NoColorKey(ix, iy, sDynamicObjectFrame/3, dwTime); break; case DYNAMICOBJECT_FIRE2: // 13 switch (rand() % 3) { case 0: m_pEffectSpr[0]->PutTransSprite25_NoColorKey(ix, iy, 1, dwTime); break; case 1: m_pEffectSpr[0]->PutTransSprite50_NoColorKey(ix, iy, 1, dwTime); break; case 2: m_pEffectSpr[0]->PutTransSprite70_NoColorKey(ix, iy, 1, dwTime); break; } break; case DYNAMICOBJECT_FISH: // 2 { char cTmpDOdir, cTmpDOframe; cTmpDOdir = m_Misc.cCalcDirection(cDynamicObjectData1, cDynamicObjectData2, cDynamicObjectData1 + cDynamicObjectData3, cDynamicObjectData2 + cDynamicObjectData4); cTmpDOframe = ((cTmpDOdir-1) * 4) + (rand() % 4); m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+0]->PutTransSprite2(ix + cDynamicObjectData1, iy + cDynamicObjectData2, cTmpDOframe, dwTime); } break; case DYNAMICOBJECT_MINERAL1: // 4 if (m_cDetailLevel != 0) m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+1]->PutShadowSprite(ix, iy, 0, dwTime); m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+1]->PutSpriteFast(ix, iy, 0, dwTime); if ( (m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+1]->m_rcBound.top != -1) && (m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+1]->m_rcBound.top < msY) && (m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+1]->m_rcBound.bottom > msY) && (m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+1]->m_rcBound.left < msX) && (m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+1]->m_rcBound.right > msX) ) { m_sMCX = indexX; m_sMCY = indexY; iFocuiStatus = NULL; ZeroMemory(cFocusName, sizeof(cFocusName)); ZeroMemory(m_cMCName, sizeof(m_cMCName)); } break; case DYNAMICOBJECT_MINERAL2: // 5 if (m_cDetailLevel != 0) m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+1]->PutShadowSprite(ix, iy, 1, dwTime); m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+1]->PutSpriteFast(ix, iy, 1, dwTime); if ( (m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+1]->m_rcBound.top != -1) && (m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+1]->m_rcBound.top < msY) && (m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+1]->m_rcBound.bottom > msY) && (m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+1]->m_rcBound.left < msX) && (m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+1]->m_rcBound.right > msX) ) { m_sMCX = indexX; m_sMCY = indexY; iFocuiStatus = NULL; ZeroMemory(cFocusName, sizeof(cFocusName)); ZeroMemory(m_cMCName, sizeof(m_cMCName)); } break; case DYNAMICOBJECT_SPIKE: // 9 m_pEffectSpr[17]->PutTransSprite70_NoColorKey(ix, iy, sDynamicObjectFrame, dwTime); break; case DYNAMICOBJECT_ARESDENFLAG: // 6 case DYNAMICOBJECT_ELVINEFLAG: // 7 m_pSprite[SPRID_ITEMDYNAMIC_PIVOTPOINT+2]->PutSpriteFast(ix, iy, sDynamicObjectFrame, dwTime); break; } } indexX++; } indexY++; } if ((dwTime - m_dwEnvEffectTime) > 400) m_dwEnvEffectTime = dwTime; if (m_sMCX != NULL) // CLEROTH - STATUS { if( _iGetFOE(iFocuiStatus) < 0 ) m_stMCursor.sCursorFrame = 3; else m_stMCursor.sCursorFrame = 6; _tmp_wObjectID = wFocusObjectID; _tmp_sOwnerType = sFocusOwnerType; _tmp_cAction = cFocusAction; _tmp_cFrame = cFocusFrame; _tmp_cDir = cFocusDir; _tmp_sAppr1 = sFocusAppr1; _tmp_sAppr2 = sFocusAppr2; _tmp_sAppr3 = sFocusAppr3; _tmp_sAppr4 = sFocusAppr4; _tmp_iApprColor = iFocusApprColor; _tmp_iStatus = iFocuiStatus; strcpy(_tmp_cName, cFocusName); _tmp_dX = sFocus_dX; _tmp_dY = sFocus_dY; if ( (_tmp_cAction != OBJECTDEAD) && (_tmp_cFrame < 0) ) return; switch (_tmp_cAction) { case OBJECTSTOP: DrawObject_OnStop(m_sMCX, m_sMCY, sFocusX, sFocusY, TRUE, dwTime, msX, msY); break; case OBJECTMOVE: switch (_tmp_sOwnerType) { case 1: case 2: case 3: // Human M case 4: case 5: case 6: // Human F case 28: // Troll. case 29: // Ogre case 30: // Liche case 31: // DD case 32: // Uni case 33: // WW case 43: // LWB case 44: // GHK case 45: // GHKABS case 46: // TK case 47: // BG case 48: // SK case 49: // HC case 50: // TW case 51: // CP case 52: // GG case 53: // BB case 54: // DE case 55: // Rabbit case 56: // Cat case 57: // Frog case 58: // MG case 59: // Ettin case 60: // Plant case 61: // Rudolph case 62: // DireBoar case 63: // Frost case 65: // Ice-Golem case 66: // Wyvern case 70: // Dragon..........Ajouts par Snoopy case 71: // Centaur case 72: // ClawTurtle case 73: // FireWyvern case 74: // GiantCrayfish case 75: // Gi Lizard case 76: // Gi Tree case 77: // Master Orc case 78: // Minaus case 79: // Nizie case 80: // Tentocle case 81: // Abaddon case 82: // Sorceress case 83: // ATK case 84: // MasterElf case 85: // DSK case 86: // HBT case 87: // CT case 88: // Barbarian case 89: // AGC case 91: // Gate /* case 15: // ShopKeeper // Ils ont 8 sprites Stop case 19: // Gandalf case 20: // Howard case 24: // Tom case 25: // William case 26: // Kenedy case 90: // Gail*/ break; default: // 10..27 _tmp_cFrame = _tmp_cFrame * 2; // break; } DrawObject_OnMove(m_sMCX, m_sMCY, sFocusX, sFocusY, TRUE, dwTime, msX, msY); break; case OBJECTDAMAGEMOVE: DrawObject_OnDamageMove(m_sMCX, m_sMCY, sFocusX, sFocusY, TRUE, dwTime, msX, msY); break; case OBJECTRUN: DrawObject_OnRun(m_sMCX, m_sMCY, sFocusX, sFocusY, TRUE, dwTime, msX, msY); break; case OBJECTATTACK: DrawObject_OnAttack(m_sMCX, m_sMCY, sFocusX, sFocusY, TRUE, dwTime, msX, msY); break; case OBJECTATTACKMOVE: DrawObject_OnAttackMove(m_sMCX, m_sMCY, sFocusX, sFocusY, TRUE, dwTime, msX, msY); break; case OBJECTMAGIC: DrawObject_OnMagic(m_sMCX, m_sMCY, sFocusX, sFocusY, TRUE, dwTime, msX, msY); break; case OBJECTDAMAGE: DrawObject_OnDamage(m_sMCX, m_sMCY, sFocusX, sFocusY, TRUE, dwTime, msX, msY); break; case OBJECTDYING: //10 DrawObject_OnDying(m_sMCX, m_sMCY, sFocusX, sFocusY, TRUE, dwTime, msX, msY); break; case OBJECTDEAD: //101 DrawObject_OnDead(m_sMCX, m_sMCY, sFocusX, sFocusY, TRUE, dwTime, msX, msY); break; } } if (m_bIsGetPointingMode == TRUE) { if ( (m_iPointCommandType >= 100) && (m_iPointCommandType < 200) ) // spell { if (m_bCommandAvailable == TRUE) { if( m_sMCX != NULL ) { if( _iGetFOE(iFocuiStatus) < 0 ) m_stMCursor.sCursorFrame = 5; // Red enemi for spell else m_stMCursor.sCursorFrame = 4; // Blue friend for spell }else m_stMCursor.sCursorFrame = 4; // Blue friend for spell }else m_stMCursor.sCursorFrame = 8; }else if ( (m_iPointCommandType >= 0) && (m_iPointCommandType < 50) ) // item { m_stMCursor.sCursorFrame = 10; // hand to grap item } } } void CGame::GameRecvMsgHandler(DWORD dwMsgSize, char * pData) { DWORD * dwpMsgID; dwpMsgID = (DWORD *)(pData + INDEX4_MSGID); switch (*dwpMsgID) { case MSGID_RESPONSE_CHARGED_TELEPORT: ResponseChargedTeleport(pData); break; case MSGID_RESPONSE_TELEPORT_LIST: ResponseTeleportList(pData); break; case MSGID_RESPONSE_NOTICEMENT: NoticementHandler(pData); break; case MSGID_DYNAMICOBJECT: DynamicObjectHandler(pData); break; case MSGID_RESPONSE_INITPLAYER: InitPlayerResponseHandler(pData); break; case MSGID_RESPONSE_INITDATA: InitDataResponseHandler(pData); break; case MSGID_RESPONSE_MOTION: MotionResponseHandler(pData); break; case MSGID_EVENT_COMMON: CommonEventHandler(pData); break; case MSGID_EVENT_MOTION: MotionEventHandler(pData); break; case MSGID_EVENT_LOG: LogEventHandler(pData); break; case MSGID_COMMAND_CHATMSG: ChatMsgHandler(pData); break; case MSGID_PLAYERITEMLISTCONTENTS: InitItemList(pData); break; case MSGID_NOTIFY: NotifyMsgHandler(pData); break; case MSGID_RESPONSE_CREATENEWGUILD: CreateNewGuildResponseHandler(pData); break; case MSGID_RESPONSE_DISBANDGUILD: DisbandGuildResponseHandler(pData); break; case MSGID_PLAYERCHARACTERCONTENTS: InitPlayerCharacteristics(pData); break; case MSGID_RESPONSE_CIVILRIGHT: CivilRightAdmissionHandler(pData); break; case MSGID_RESPONSE_RETRIEVEITEM: RetrieveItemHandler(pData); break; case MSGID_RESPONSE_PANNING: ResponsePanningHandler(pData); break; case MSGID_RESPONSE_FIGHTZONE_RESERVE: ReserveFightzoneResponseHandler(pData); break; } } void CGame::ConnectionEstablishHandler(char cWhere) { ChangeGameMode(GAMEMODE_ONWAITINGRESPONSE); switch (cWhere) { case SERVERTYPE_GAME: bSendCommand(MSGID_REQUEST_INITPLAYER, NULL, NULL, NULL, NULL, NULL, NULL); break; case SERVERTYPE_LOG: switch (m_dwConnectMode) { case MSGID_REQUEST_LOGIN: bSendCommand(MSGID_REQUEST_LOGIN, NULL, NULL, NULL, NULL, NULL, NULL); break; case MSGID_REQUEST_CREATENEWACCOUNT: bSendCommand(MSGID_REQUEST_CREATENEWACCOUNT, NULL, NULL, NULL, NULL, NULL, NULL); break; case MSGID_REQUEST_CREATENEWCHARACTER: bSendCommand(MSGID_REQUEST_CREATENEWCHARACTER, NULL, NULL, NULL, NULL, NULL, NULL); break; case MSGID_REQUEST_ENTERGAME: bSendCommand(MSGID_REQUEST_ENTERGAME, NULL, NULL, NULL, NULL, NULL, NULL); break; case MSGID_REQUEST_DELETECHARACTER: bSendCommand(MSGID_REQUEST_DELETECHARACTER, NULL, NULL, NULL, NULL, NULL, NULL); break; case MSGID_REQUEST_CHANGEPASSWORD: bSendCommand(MSGID_REQUEST_CHANGEPASSWORD, NULL, NULL, NULL, NULL, NULL, NULL); break; case MSGID_REQUEST_INPUTKEYCODE: bSendCommand(MSGID_REQUEST_INPUTKEYCODE, NULL, NULL, NULL, NULL, NULL, NULL); break; } break; } } void CGame::InitPlayerResponseHandler(char * pData) { WORD * wp; wp = (WORD *)(pData + INDEX2_MSGTYPE); switch (*wp) { case MSGTYPE_CONFIRM: //bSendCommand(MSGID_REQUEST_INITDATA, NULL, NULL, NULL, NULL, NULL, NULL); ChangeGameMode(GAMEMODE_ONWAITINGINITDATA); break; case MSGTYPE_REJECT: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "3J"); break; } } void CGame::UpdateScreen_OnMainMenu() { short msX, msY, msZ; char cLB, cRB, cMB, cMIresult; int iMIbuttonNum; static class CMouseInterface * pMI; DWORD dwTime = G_dwGlobalTime; //StartBGM(); RECT buttons[3]; SetRect(&buttons[0], 275, 196, 365, 215); SetRect(&buttons[1], 275, 230, 365, 249); SetRect(&buttons[2], 275, 262, 365, 281); m_iItemDropCnt = 0; m_bItemDrop = FALSE; if (m_cGameModeCount == 0) { if (G_pCalcSocket != NULL) { delete G_pCalcSocket; G_pCalcSocket = NULL; } if ( m_pSprite[SPRID_INTERFACE_ND_LOADING] != NULL ) { delete m_pSprite[SPRID_INTERFACE_ND_LOADING]; m_pSprite[SPRID_INTERFACE_ND_LOADING] = NULL; } EndInputString(); pMI = new class CMouseInterface; for(int n=0; n < 3; n++) pMI->AddRect(buttons[n].left, buttons[n].top, buttons[n].right, buttons[n].bottom); //m_DInput.m_sX = 400; //m_DInput.m_sY = 240; m_cCurFocus = 1; m_cMaxFocus = 3; m_bEnterPressed = FALSE; m_cArrowPressed = 0; } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; m_DDraw.ClearBackB4(); DrawNewDialogBox(SPRID_INTERFACE_ND_MAINMENU, 0, 0, 0, TRUE); m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); //m_cCurFocus = 0; for(int n=0; n < 3; n++) if((msX >= buttons[n].left) && (msY >= buttons[n].top) && (msX <= buttons[n].right) && (msY <= buttons[n].bottom)) { m_cCurFocus = n+1; } if(m_cCurFocus) m_pSprite[SPRID_INTERFACE_ND_MAINMENU]->PutSpriteFast(buttons[m_cCurFocus-1].left , buttons[m_cCurFocus-1].top, m_cCurFocus, dwTime); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); //m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutTransSpriteRGB(msX, msY, 1, 0, 0, 0, dwTime); if (m_cArrowPressed != 0) { switch (m_cArrowPressed) { case 1: m_cCurFocus--; if (m_cCurFocus <= 0) m_cCurFocus = m_cMaxFocus; break; case 4: m_cCurFocus++; if (m_cCurFocus > m_cMaxFocus) m_cCurFocus = 1; break; } m_cArrowPressed = 0; } if (m_bEnterPressed == TRUE) { // Enter PlaySound('E', 14, 5); m_bEnterPressed = FALSE; switch (m_cCurFocus) { case 1: delete pMI; ChangeGameMode(GAMEMODE_ONSELECTSERVER); return; case 2: #ifdef MAKE_ACCOUNT ClearContents_OnSelectCharacter(); delete pMI; //ChangeGameMode(GAMEMODE_ONAGREEMENT); ChangeGameMode(GAMEMODE_ONCREATENEWACCOUNT); #else GoHomepage(); #endif return; case 3: delete pMI; ChangeGameMode(GAMEMODE_ONQUIT); return; } } DrawVersion(TRUE); iMIbuttonNum = pMI->iGetStatus(msX, msY, cLB, &cMIresult); if (cMIresult == MIRESULT_CLICK) { PlaySound('E', 14, 5); m_cCurFocus = iMIbuttonNum; switch (iMIbuttonNum) { case 1: ChangeGameMode(GAMEMODE_ONSELECTSERVER); delete pMI; return; case 2: #ifdef MAKE_ACCOUNT ClearContents_OnSelectCharacter(); delete pMI; //ChangeGameMode(GAMEMODE_ONAGREEMENT); ChangeGameMode(GAMEMODE_ONCREATENEWACCOUNT); #endif break;; case 3: delete pMI; ChangeGameMode(GAMEMODE_ONQUIT); return; } } if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } void CGame::MakeSprite( char* FileName, short sStart, short sCount, bool bAlphaEffect ) { int iTotalimage; DWORD nCount; char PathName[50]; std::vector<int> framePositions; wsprintf( PathName, "sprites\\%s.pak", FileName ); HANDLE m_hPakFile = CreateFile(PathName, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile == INVALID_HANDLE_VALUE ) return; ReadFramePositions(m_hPakFile, framePositions, sCount); SetFilePointer(m_hPakFile, 20, NULL, FILE_BEGIN); ReadFile(m_hPakFile, (char *)&iTotalimage, 4, &nCount, NULL); for( short i=0 ; i < sCount && i < iTotalimage; i++ ) { m_pSprite[i+sStart] = new class CSprite(m_hPakFile, &m_DDraw, FileName, i, bAlphaEffect, &framePositions); } CloseHandle(m_hPakFile); } void CGame::MakeLegionSprite( char* FileName, short sStart, short sCount, bool bAlphaEffect ) { int iTotalimage; DWORD nCount; char PathName[50]; std::vector<int> framePositions; wsprintf( PathName, "sprites\\%s.lpk", FileName ); HANDLE m_hPakFile = CreateFile(PathName, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile == INVALID_HANDLE_VALUE ) return; ReadFramePositions(m_hPakFile, framePositions, sCount); SetFilePointer(m_hPakFile, 20, NULL, FILE_BEGIN); ReadFile(m_hPakFile, (char *)&iTotalimage, 4, &nCount, NULL); iTotalimage ^= 712345; for( short i=0 ; i < sCount && i < iTotalimage; i++ ) { m_pSprite[i+sStart] = new class CSprite(m_hPakFile, &m_DDraw, FileName, i, bAlphaEffect, &framePositions); } CloseHandle(m_hPakFile); } void CGame::MakeTileSpr( char* FileName, short sStart, short sCount, bool bAlphaEffect ) { int iTotalimage; DWORD nCount; char PathName[28]; std::vector<int> framePositions; wsprintf( PathName, "sprites\\%s.pak", FileName ); HANDLE m_hPakFile = CreateFile(PathName, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile == INVALID_HANDLE_VALUE ) return; ReadFramePositions(m_hPakFile, framePositions, sCount); SetFilePointer(m_hPakFile, 20, NULL, FILE_BEGIN); ReadFile(m_hPakFile, (char *)&iTotalimage, 4, &nCount, NULL); for( short i=0 ; i < sCount && i < iTotalimage; i++ ) { m_pTileSpr[i+sStart] = new class CSprite(m_hPakFile, &m_DDraw, FileName, i, bAlphaEffect, &framePositions); } CloseHandle(m_hPakFile); } void CGame::MakeLegionTileSpr( char* FileName, short sStart, short sCount, bool bAlphaEffect ) { int iTotalimage; DWORD nCount; char PathName[28]; std::vector<int> framePositions; wsprintf( PathName, "sprites\\%s.lpk", FileName ); HANDLE m_hPakFile = CreateFile(PathName, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile == INVALID_HANDLE_VALUE ) return; ReadFramePositions(m_hPakFile, framePositions, sCount); SetFilePointer(m_hPakFile, 20, NULL, FILE_BEGIN); ReadFile(m_hPakFile, (char *)&iTotalimage, 4, &nCount, NULL); iTotalimage ^= 712345; for( short i=0 ; i < sCount && i < iTotalimage ; i++ ) { m_pTileSpr[i+sStart] = new class CSprite(m_hPakFile, &m_DDraw, FileName, i, bAlphaEffect, &framePositions); } CloseHandle(m_hPakFile); } void CGame::MakeEffectSpr( char* FileName, short sStart, short sCount, bool bAlphaEffect ) { int iTotalimage; DWORD nCount; char PathName[28]; std::vector<int> framePositions; wsprintf( PathName, "sprites\\%s.pak", FileName ); HANDLE m_hPakFile = CreateFile(PathName, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile == INVALID_HANDLE_VALUE ) return; ReadFramePositions(m_hPakFile, framePositions, sCount); SetFilePointer(m_hPakFile, 20, NULL, FILE_BEGIN); ReadFile(m_hPakFile, (char *)&iTotalimage, 4, &nCount, NULL); for( short i=0 ; i < sCount ; i++ ) { if( i < iTotalimage ) m_pEffectSpr[i+sStart] = new class CSprite(m_hPakFile, &m_DDraw, FileName, i, bAlphaEffect, &framePositions); } CloseHandle(m_hPakFile); } void CGame::UpdateScreen_OnLoading(bool bActive) { int i; std::vector<int> framePositions; if( bActive ) UpdateScreen_OnLoading_Progress(); switch( m_cLoading ) { case 0: { m_hPakFile = CreateFile("sprites\\interface.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 2); m_pSprite[SPRID_MOUSECURSOR] = new class CSprite(m_hPakFile, &m_DDraw, "interface", 0, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_SPRFONTS] = new class CSprite(m_hPakFile, &m_DDraw, "interface", 1, FALSE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } m_hPakFile = CreateFile("sprites\\Newmaps.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 5); m_pSprite[SPRID_INTERFACE_NEWMAPS1] = new class CSprite(m_hPakFile, &m_DDraw, "Newmaps", 0, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_NEWMAPS2] = new class CSprite(m_hPakFile, &m_DDraw, "Newmaps", 1, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_NEWMAPS3] = new class CSprite(m_hPakFile, &m_DDraw, "Newmaps", 2, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_NEWMAPS4] = new class CSprite(m_hPakFile, &m_DDraw, "Newmaps", 3, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_NEWMAPS5] = new class CSprite(m_hPakFile, &m_DDraw, "Newmaps", 4, FALSE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } m_hPakFile = CreateFile("sprites\\lgn_login.lpk", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 3); m_pSprite[SPRID_INTERFACE_ND_LOGIN] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_login", 0, FALSE, &framePositions); #ifdef MAKE_ACCOUNT m_pSprite[SPRID_INTERFACE_ND_NEWACCOUNT] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_login", 1, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_ND_AGREEMENT] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_login", 2, FALSE, &framePositions); #endif CloseHandle(m_hPakFile); framePositions.clear(); } #ifdef MAKE_ACCOUNT // CLEROTH - ACC - Snoopy: fixed to use without special pak m_hPakFile = CreateFile("sprites\\lgn_newacc.lpk", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { m_pSprite[SPRID_INTERFACE_ND_NEWACCOUNT] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_newacc", 0, FALSE); CloseHandle(m_hPakFile); }else { m_hPakFile = CreateFile("sprites\\lgn_dialog.lpk", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); m_pSprite[SPRID_INTERFACE_ND_NEWACCOUNT] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_dialog", 2, FALSE); CloseHandle(m_hPakFile); } #endif m_hPakFile = CreateFile("sprites\\lgn_dialog.lpk", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 3); m_pSprite[SPRID_INTERFACE_ND_MAINMENU] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_dialog", 1, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_ND_QUIT] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_dialog", 2, FALSE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } //m_hPakFile = CreateFile("sprites\\lgn_gamedialog.lpk", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); m_hPakFile = CreateFile("sprites\\gamedialog.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 11); m_pSprite[SPRID_INTERFACE_ND_GAME1] = new class CSprite(m_hPakFile, &m_DDraw, "gamedialog", 0, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_ND_GAME2] = new class CSprite(m_hPakFile, &m_DDraw, "gamedialog", 1, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_ND_GAME3] = new class CSprite(m_hPakFile, &m_DDraw, "gamedialog", 2, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_ND_GAME4] = new class CSprite(m_hPakFile, &m_DDraw, "gamedialog", 3, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_ND_CRUSADE] = new class CSprite(m_hPakFile, &m_DDraw, "gamedialog", 4, FALSE, &framePositions); //m_pSprite[SPRID_INTERFACE_GUIDEMAP] = new class CSprite(m_hPakFile, &m_DDraw, "gamedialog", 5, FALSE); m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL] = new class CSprite(m_hPakFile, &m_DDraw, "gamedialog", 6, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_ND_INVENTORY] = new class CSprite(m_hPakFile, &m_DDraw, "gamedialog", 7, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_ND_SELECTCHAR] = new class CSprite(m_hPakFile, &m_DDraw, "gamedialog", 8, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_ND_NEWCHAR] = new class CSprite(m_hPakFile, &m_DDraw, "gamedialog", 9, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_ND_NEWEXCHANGE] = new class CSprite(m_hPakFile, &m_DDraw, "gamedialog", 10, FALSE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } m_hPakFile = CreateFile("sprites\\DialogText.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 2); m_pSprite[SPRID_INTERFACE_ND_TEXT] = new class CSprite(m_hPakFile, &m_DDraw, "DialogText", 0, FALSE, &framePositions); m_pSprite[SPRID_INTERFACE_ND_BUTTON] = new class CSprite(m_hPakFile, &m_DDraw, "DialogText", 1, FALSE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } MakeLegionSprite( "lgn_minimap", SPRID_INTERFACE_GUIDEMAP, 32 , FALSE); MakeLegionSprite( "lgn_minimap2", SPRID_INTERFACE_GUIDEMAP+35, 11 , FALSE); MakeSprite( "monster", SPRID_INTERFACE_MONSTER, 1, FALSE); m_cLoading = 4; } break; case 4: { MakeTileSpr( "maptiles1", 0, 32, TRUE); MakeTileSpr( "structures1", 50, 20, TRUE); MakeTileSpr( "Sinside1", 70, 27, FALSE); MakeTileSpr( "Trees1", 100, 46, TRUE); MakeTileSpr( "TreeShadows", 150, 46, TRUE); MakeTileSpr( "objects1", 200, 10, TRUE); // snoopy: 8->10 MakeTileSpr( "objects2", 211, 5, TRUE); MakeTileSpr( "objects3", 216, 4, TRUE); MakeTileSpr( "objects4", 220, 2, TRUE); //snoopy: 1->2 m_cLoading = 8; } break; case 8: { MakeLegionTileSpr( "lgn_T223-225", 223, 3, TRUE); MakeTileSpr( "Tile226-229", 226, 4, TRUE); MakeTileSpr( "objects5", 230, 9, TRUE); // Snoopy MakeTileSpr( "objects6", 238, 4, TRUE); // Snoopy MakeTileSpr( "objects7", 242, 7, TRUE); // Snoopy MakeLegionTileSpr( "lgn_objects", 249, 1, TRUE); MakeTileSpr( "maptiles2", 300, 15, TRUE); MakeLegionTileSpr( "lgn_maptiles", 315, 5, TRUE); MakeTileSpr( "maptiles4", 320, 10, TRUE); MakeTileSpr( "maptiles5", 330, 19, TRUE); MakeTileSpr( "maptiles6", 349, 4, TRUE); MakeTileSpr( "maptiles353-361", 353, 9, TRUE); MakeTileSpr( "Tile363-366", 363, 4, TRUE); MakeTileSpr( "Tile367-367", 367, 1, TRUE); // Add by Snoopy (fountains) MakeTileSpr( "Tile370-381", 370, 12, TRUE);// Tile370~381 MakeTileSpr( "Tile382-387", 382, 6, TRUE); MakeTileSpr( "Tile388-402", 388, 15, TRUE); m_cLoading = 12; } break; case 12: { MakeTileSpr( "Tile403-405", 403, 3, TRUE); MakeTileSpr( "Tile406-421", 406, 16, TRUE); MakeTileSpr( "Tile422-429", 422, 8, TRUE); MakeTileSpr( "Tile430-443", 430, 14, TRUE); MakeTileSpr( "Tile444-444", 444, 1, TRUE); MakeTileSpr( "Tile445-461", 445, 17, TRUE); MakeTileSpr( "Tile462-473", 462, 12, TRUE); // Diuuude MakeTileSpr( "Tile474-478", 474, 5, TRUE); // Diuuude MakeTileSpr( "Tile479-488", 479, 10, TRUE); // Diuuude MakeTileSpr( "Tile489-522", 489, 34, TRUE); // Diuuude Drunken City MakeTileSpr( "Tile523-530", 523, 8, TRUE); // Diuuude Rampart MakeTileSpr( "Tile531-540", 531, 10, TRUE); // Diuuude GodH + Pont MakeTileSpr( "Tile541-545", 541, 5, TRUE); // Diuuude GodH // SPRID_ITEMPACK_PIVOTPOINT+0 MakeLegionSprite( "lgn_itempack", SPRID_ITEMPACK_PIVOTPOINT+1, 27, FALSE); m_hPakFile = CreateFile("sprites\\lgn_itempack.lpk", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 20); m_pSprite[SPRID_ITEMPACK_PIVOTPOINT+20] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itempack", 17, FALSE); // m_pSprite[SPRID_ITEMPACK_PIVOTPOINT+21] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itempack", 18, FALSE); // m_pSprite[SPRID_ITEMPACK_PIVOTPOINT+22] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itempack", 19, FALSE); // Angels CloseHandle(m_hPakFile); framePositions.clear(); } // SPRID_ITEMGROUND_PIVOTPOINT+1 MakeLegionSprite( "lgn_itemground", SPRID_ITEMGROUND_PIVOTPOINT+1, 19, FALSE); m_hPakFile = CreateFile("sprites\\lgn_itemground.lpk", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 20); m_pSprite[SPRID_ITEMGROUND_PIVOTPOINT+20] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemground", 17, FALSE, &framePositions); m_pSprite[SPRID_ITEMGROUND_PIVOTPOINT+21] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemground", 18, FALSE, &framePositions); m_pSprite[SPRID_ITEMGROUND_PIVOTPOINT+22] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemground", 19, FALSE, &framePositions);//Angels CloseHandle(m_hPakFile); framePositions.clear(); } MakeSprite( "item-dynamic", SPRID_ITEMDYNAMIC_PIVOTPOINT, 3, FALSE); m_cLoading = 16; } break; case 16: { m_hPakFile = CreateFile("sprites\\lgn_itemequipM.lpk", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 15); m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 0] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 0, FALSE, &framePositions); // body m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 1] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 1, FALSE, &framePositions); // 1-swords m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 2] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 2, FALSE, &framePositions); // 2-bows m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 3] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 3, FALSE, &framePositions); // 3-shields m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 4] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 4, FALSE, &framePositions); // 4-tunics m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 5] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 5, FALSE, &framePositions); // 5-shoes m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 7] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 6, FALSE, &framePositions); // 6-berk m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 8] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 7, FALSE, &framePositions); // 7-hoses m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 9] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 8, FALSE, &framePositions); // 8-bodyarmor m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 15] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 11, FALSE, &framePositions); // Axe hammer m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 17] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 12, FALSE, &framePositions); // Wands m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 18] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 9, FALSE, &framePositions); // hair m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 19] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 10, FALSE, &framePositions); // undies m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 20] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 13, FALSE, &framePositions); // capes m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 21] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipM", 14, FALSE, &framePositions); // helm CloseHandle(m_hPakFile); framePositions.clear(); } m_hPakFile = CreateFile("sprites\\lgn_itempack.lpk", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 16] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itempack", 15); // Necks //Snoopy: Angels pandents m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 22] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itempack", 19); // Angels CloseHandle(m_hPakFile); } m_hPakFile = CreateFile("sprites\\lgn_itemequipW.lpk", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 15); m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 40] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 0, FALSE, &framePositions); // body m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 41] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 1, FALSE, &framePositions); // 1-swords m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 42] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 2, FALSE, &framePositions); // 2-bows m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 43] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 3, FALSE, &framePositions); // 3-shields m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 45] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 4, FALSE, &framePositions); // 4-shoes m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 50] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 5, FALSE, &framePositions); // 5-Soustif m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 51] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 6, FALSE, &framePositions); // 6 berk m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 52] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 7, FALSE, &framePositions); // 7 hose m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 53] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 8, FALSE, &framePositions); // 8-hoses m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 55] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 11, FALSE, &framePositions); // Axe hammer m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 57] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 12, FALSE, &framePositions); // Wands m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 58] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 9, FALSE, &framePositions); // hair m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 59] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 10, FALSE, &framePositions);// undies m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 60] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 13, FALSE, &framePositions);// capes m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 61] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itemequipW", 14, FALSE, &framePositions);// helm CloseHandle(m_hPakFile); framePositions.clear(); } m_hPakFile = CreateFile("sprites\\lgn_itempack.lpk", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 56] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itempack", 15);// necks //Snoopy: Angels pandents m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 62] = new class CSprite(m_hPakFile, &m_DDraw, "lgn_itempack", 19); // Angels CloseHandle(m_hPakFile); } MakeSprite( "Bm", 500 + 15*8*0, 96, TRUE);// Black Man (Type: 1) MakeSprite( "Wm", 500 + 15*8*1, 96, TRUE);// White Man (Type: 2) MakeSprite( "Ym", 500 + 15*8*2, 96, TRUE);// Yellow Man (Type: 3) m_cLoading = 20; } break; case 20: { MakeSprite( "TutelarAngel1", SPRID_TUTELARYANGELS_PIVOTPOINT + 50*0, 48, FALSE);//(STR) MakeSprite( "TutelarAngel2", SPRID_TUTELARYANGELS_PIVOTPOINT + 50*1, 48, FALSE);//(DEX) MakeSprite( "TutelarAngel3", SPRID_TUTELARYANGELS_PIVOTPOINT + 50*2, 48, FALSE);//(INT) MakeSprite( "TutelarAngel4", SPRID_TUTELARYANGELS_PIVOTPOINT + 50*3, 48, FALSE);//(MAG) MakeSprite( "Bw", 500 + 15*8*3, 96, TRUE);// Black Woman (Type: 4) MakeSprite( "Ww", 500 + 15*8*4, 96, TRUE);// White Woman (Type: 5) MakeSprite( "Yw", 500 + 15*8*5, 96, TRUE);// Yellow Woman (Type: 6) m_cLoading = 24; } break; case 24: { MakeSprite( "slm", SPRID_MOB + 7*8*0, 40, TRUE);// Slime (Type: 10) MakeSprite( "ske", SPRID_MOB + 7*8*1, 40, TRUE);// Skeleton (Type: 11) MakeSprite( "Gol", SPRID_MOB + 7*8*2, 40, TRUE);// Stone-Golem (Type: 12) MakeSprite( "Cyc", SPRID_MOB + 7*8*3, 40, TRUE);// Cyclops (Type: 13) MakeSprite( "Orc", SPRID_MOB + 7*8*4, 40, TRUE);// Orc (Type: 14) MakeSprite( "Shopkpr", SPRID_MOB + 7*8*5, 8); // ShopKeeper-Woman (Type: 15) MakeSprite( "Ant", SPRID_MOB + 7*8*6, 40, TRUE);// Giant-Ant (Type: 16) MakeSprite( "Scp", SPRID_MOB + 7*8*7, 40, TRUE);// Scorpion (Type: 17) MakeSprite( "Zom", SPRID_MOB + 7*8*8, 40, TRUE);// Zombie (Type: 18) MakeSprite( "Gandlf", SPRID_MOB + 7*8*9, 8, TRUE); MakeSprite( "Howard", SPRID_MOB + 7*8*10, 8, TRUE); MakeSprite( "Guard", SPRID_MOB + 7*8*11, 40, TRUE);// Guard (Type: 21) MakeSprite( "Amp", SPRID_MOB + 7*8*12, 40, TRUE);// Amphis (Type: 22) MakeSprite( "Cla", SPRID_MOB + 7*8*13, 40, TRUE);// Clay-Golem (Type: 23) MakeSprite( "tom", SPRID_MOB + 7*8*14, 8, TRUE);// Tom (Type: 24) MakeSprite( "William", SPRID_MOB + 7*8*15, 8, TRUE);// William (Type: 25) m_cLoading = 28; } break; case 28: { MakeSprite( "Kennedy", SPRID_MOB + 7*8*16, 8, TRUE);// Kennedy (Type: 26) MakeSprite( "Helb", SPRID_MOB + 7*8*17, 40, TRUE);// Hellbound (Type: 27) MakeSprite( "Troll", SPRID_MOB + 7*8*18, 40, TRUE);// Troll (Type: 28) MakeSprite( "Orge", SPRID_MOB + 7*8*19, 40, TRUE);// Orge (Type: 29) MakeSprite( "Liche", SPRID_MOB + 7*8*20, 40, TRUE);// Liche (Type: 30) MakeSprite( "Demon", SPRID_MOB + 7*8*21, 40, TRUE);// Demon (Type: 31) MakeSprite( "Unicorn", SPRID_MOB + 7*8*22, 40, TRUE);// Unicorn (Type: 32) MakeSprite( "WereWolf", SPRID_MOB + 7*8*23, 40, TRUE);// WereWolf (Type: 33) MakeSprite( "Dummy", SPRID_MOB + 7*8*24, 40, TRUE);// Dummy (Type: 34) m_hPakFile = CreateFile("sprites\\Effect5.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); // Energy-Ball (Type: 35) if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 1); for (i = 0; i < 40; i++) m_pSprite[ SPRID_MOB + i + 7*8*25] = new class CSprite(m_hPakFile, &m_DDraw, "Effect5", 0, TRUE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } m_cLoading = 32; } break; case 32: {MakeSprite( "GT-Arrow", SPRID_MOB + 7*8*26, 40, TRUE);// Arrow-GuardTower (Type: 36) MakeSprite( "GT-Cannon", SPRID_MOB + 7*8*27, 40, TRUE);// Cannon-GuardTower (Type: 37) MakeSprite( "ManaCollector", SPRID_MOB + 7*8*28, 40, TRUE);// Mana Collector (Type: 38) MakeSprite( "Detector", SPRID_MOB + 7*8*29, 40, TRUE);// Detector (Type: 39) MakeSprite( "ESG", SPRID_MOB + 7*8*30, 40, TRUE);// ESG (Type: 40) MakeSprite( "GMG", SPRID_MOB + 7*8*31, 40, TRUE);// GMG (Type: 41) MakeSprite( "ManaStone", SPRID_MOB + 7*8*32, 40, TRUE);// ManaStone (Type: 42) MakeSprite( "LWB", SPRID_MOB + 7*8*33, 40, TRUE);// Light War Beetle (Type: 43) MakeSprite( "GHK", SPRID_MOB + 7*8*34, 40, TRUE);// God's Hand Knight (Type: 44) MakeSprite( "GHKABS", SPRID_MOB + 7*8*35, 40, TRUE);// God's Hand Knight with Armored Battle Steed (Type: 45) MakeSprite( "TK", SPRID_MOB + 7*8*36, 40, TRUE);// Temple Knight (Type: 46) MakeSprite( "BG", SPRID_MOB + 7*8*37, 40, TRUE);// Battle Golem (Type: 47) m_cLoading = 36; } break; case 36: { MakeSprite( "Stalker", SPRID_MOB + 7*8*38, 40, TRUE);// Stalker (Type: 48) MakeSprite( "Hellclaw", SPRID_MOB + 7*8*39, 40, TRUE);// Hellclaw (Type: 49) MakeSprite( "Tigerworm", SPRID_MOB + 7*8*40, 40, TRUE);// Tigerworm (Type: 50) MakeSprite( "Catapult", SPRID_MOB + 7*8*41, 40, TRUE);// Catapult (Type: 51) MakeSprite( "Gagoyle", SPRID_MOB + 7*8*42, 40, TRUE);// Gargoyle (Type: 52) MakeSprite( "Beholder", SPRID_MOB + 7*8*43, 40, TRUE);// Beholder (Type: 53) MakeSprite( "DarkElf", SPRID_MOB + 7*8*44, 40, TRUE);// Dark-Elf (Type: 54) MakeSprite( "Bunny", SPRID_MOB + 7*8*45, 40, TRUE);// Bunny (Type: 55) MakeSprite( "Cat", SPRID_MOB + 7*8*46, 40, TRUE);// Cat (Type: 56) MakeSprite( "GiantFrog", SPRID_MOB + 7*8*47, 40, TRUE);// GiantFrog (Type: 57) MakeSprite( "MTGiant", SPRID_MOB + 7*8*48, 40, TRUE);// Mountain Giant (Type: 58) m_cLoading = 40; } break; case 40: { MakeSprite( "Ettin", SPRID_MOB + 7*8*49, 40, TRUE);// Ettin (Type: 59) MakeSprite( "CanPlant", SPRID_MOB + 7*8*50, 40, TRUE);// Cannibal Plant (Type: 60) MakeSprite( "Rudolph", SPRID_MOB + 7*8*51, 40, TRUE);// Rudolph (Type: 61) MakeSprite( "DireBoar", SPRID_MOB + 7*8*52, 40, TRUE);// Boar (Type: 62) MakeSprite( "frost", SPRID_MOB + 7*8*53, 40, TRUE);// Frost (Type: 63) MakeSprite( "Crop", SPRID_MOB + 7*8*54, 40, TRUE);// Crop(Type: 64) MakeSprite( "IceGolem", SPRID_MOB + 7*8*55, 40, TRUE);// IceGolem (Type: 65) MakeSprite( "Wyvern", SPRID_MOB + 7*8*56, 24, TRUE);// Wyvern (Type: 66) MakeSprite( "McGaffin", SPRID_MOB + 7*8*57, 16, TRUE);// McGaffin (Type: 67) MakeSprite( "Perry", SPRID_MOB + 7*8*58, 16, TRUE);// Perry (Type: 68) MakeSprite( "Devlin", SPRID_MOB + 7*8*59, 16, TRUE);// Devlin (Type: 69) MakeSprite( "Barlog", SPRID_MOB + 7*8*60, 40, TRUE);// Barlog (Type: 70) MakeSprite( "Centaurus", SPRID_MOB + 7*8*61, 40, TRUE);// Centaurus (Type: 71) MakeSprite( "ClawTurtle", SPRID_MOB + 7*8*62, 40, TRUE);// Claw-Turtle (Type: 72) MakeSprite( "FireWyvern", SPRID_MOB + 7*8*63, 24, TRUE);// Fire-Wyvern (Type: 73) MakeSprite( "GiantCrayfish", SPRID_MOB + 7*8*64, 40, TRUE);// Giant-Crayfish (Type: 74) MakeSprite( "GiantLizard", SPRID_MOB + 7*8*65, 40, TRUE);// Giant-Lizard (Type: 75) m_cLoading = 44; } break; case 44: { // New NPCs - Diuuude - fixed by Snoopy MakeSprite( "GiantPlant", SPRID_MOB + 7*8*66, 40, TRUE);// Giant-Plant (Type: 76) MakeSprite( "MasterMageOrc", SPRID_MOB + 7*8*67, 40, TRUE);// MasterMage-Orc (Type: 77) MakeSprite( "Minotaurs", SPRID_MOB + 7*8*68, 40, TRUE);// Minotaurs (Type: 78) MakeSprite( "Nizie", SPRID_MOB + 7*8*69, 40, TRUE);// Nizie (Type: 79) MakeSprite( "Tentocle", SPRID_MOB + 7*8*70, 40, TRUE);// Tentocle (Type: 80) MakeSprite( "yspro", SPRID_MOB + 7*8*71, 32, TRUE);// Abaddon (Type: 81) MakeSprite( "Sorceress", SPRID_MOB + 7*8*72, 40, TRUE);// Sorceress (Type: 82) MakeSprite( "TPKnight", SPRID_MOB + 7*8*73, 40, TRUE);// TPKnight (Type: 83) MakeSprite( "ElfMaster", SPRID_MOB + 7*8*74, 40, TRUE);// ElfMaster (Type: 84) MakeSprite( "DarkKnight", SPRID_MOB + 7*8*75, 40, TRUE);// DarkKnight (Type: 85) MakeSprite( "HBTank", SPRID_MOB + 7*8*76, 32, TRUE);// HeavyBattleTank (Type: 86) MakeSprite( "CBTurret", SPRID_MOB + 7*8*77, 32, TRUE);// CBTurret (Type: 87) MakeSprite( "Babarian", SPRID_MOB + 7*8*78, 40, TRUE);// Babarian (Type: 88) MakeSprite( "ACannon", SPRID_MOB + 7*8*79, 32, TRUE);// ACannon (Type: 89) m_cLoading = 48; } break; case 48: { MakeSprite( "Gail", SPRID_MOB + 7*8*80, 8, TRUE); // Gail (Type: 90) MakeSprite( "Gate", SPRID_MOB + 7*8*81, 24, TRUE);// Heldenian Gate (Type: 91)/**/ MakeSprite( "Scarecrow", SPRID_MOB + 7*8*82, 40, TRUE); MakeLegionSprite( "lgn_Princess", SPRID_MOB + 7*8*92, 8, TRUE);// Princess 102 m_hPakFile = CreateFile("sprites\\Mpt.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 96); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_M + i + 15*0] = new class CSprite(m_hPakFile, &m_DDraw, "Mpt", i + 12*0, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_M + i + 15*1] = new class CSprite(m_hPakFile, &m_DDraw, "Mpt", i + 12*1, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_M + i + 15*2] = new class CSprite(m_hPakFile, &m_DDraw, "Mpt", i + 12*2, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_M + i + 15*3] = new class CSprite(m_hPakFile, &m_DDraw, "Mpt", i + 12*3, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_M + i + 15*4] = new class CSprite(m_hPakFile, &m_DDraw, "Mpt", i + 12*4, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_M + i + 15*5] = new class CSprite(m_hPakFile, &m_DDraw, "Mpt", i + 12*5, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_M + i + 15*6] = new class CSprite(m_hPakFile, &m_DDraw, "Mpt", i + 12*6, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_M + i + 15*7] = new class CSprite(m_hPakFile, &m_DDraw, "Mpt", i + 12*7, TRUE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } m_cLoading = 52; } break; case 52: { m_hPakFile = CreateFile("sprites\\Mhr.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 96); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_M + i + 15*0] = new class CSprite(m_hPakFile, &m_DDraw, "Mhr", i + 12*0, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_M + i + 15*1] = new class CSprite(m_hPakFile, &m_DDraw, "Mhr", i + 12*1, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_M + i + 15*2] = new class CSprite(m_hPakFile, &m_DDraw, "Mhr", i + 12*2, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_M + i + 15*3] = new class CSprite(m_hPakFile, &m_DDraw, "Mhr", i + 12*3, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_M + i + 15*4] = new class CSprite(m_hPakFile, &m_DDraw, "Mhr", i + 12*4, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_M + i + 15*5] = new class CSprite(m_hPakFile, &m_DDraw, "Mhr", i + 12*5, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_M + i + 15*6] = new class CSprite(m_hPakFile, &m_DDraw, "Mhr", i + 12*6, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_M + i + 15*7] = new class CSprite(m_hPakFile, &m_DDraw, "Mhr", i + 12*7, TRUE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } MakeSprite( "MLArmor", SPRID_BODYARMOR_M + 15*1, 12, TRUE); MakeSprite( "MCMail", SPRID_BODYARMOR_M + 15*2, 12, TRUE); MakeSprite( "MSMail", SPRID_BODYARMOR_M + 15*3, 12, TRUE); MakeSprite( "MPMail", SPRID_BODYARMOR_M + 15*4, 12, TRUE); MakeSprite( "Mtunic", SPRID_BODYARMOR_M + 15*5, 12, TRUE); MakeSprite( "MRobe1", SPRID_BODYARMOR_M + 15*6, 12, TRUE); MakeSprite( "MSanta", SPRID_BODYARMOR_M + 15*7, 12, TRUE); MakeSprite( "MHPMail1", SPRID_BODYARMOR_M + 15*8, 12, TRUE); //hero MakeSprite( "MHPMail2", SPRID_BODYARMOR_M + 15*9, 12, TRUE); //hero MakeSprite( "MHRobe1", SPRID_BODYARMOR_M + 15*10, 12, TRUE); //hero MakeSprite( "MHRobe2", SPRID_BODYARMOR_M + 15*11, 12, TRUE); //hero MakeSprite( "MHPMail3", SPRID_BODYARMOR_M + 15*12, 12, TRUE); //hero MakeSprite( "MHRobe3", SPRID_BODYARMOR_M + 15*13, 12, TRUE); //hero MakeSprite( "MShirt", SPRID_BERK_M + 15*1, 12, TRUE); MakeSprite( "MHauberk", SPRID_BERK_M + 15*2, 12, TRUE); MakeSprite( "MHHauberk1", SPRID_BERK_M + 15*3, 12, TRUE); MakeSprite( "MHHauberk2", SPRID_BERK_M + 15*4, 12, TRUE); MakeSprite( "MHHauberk3", SPRID_BERK_M + 15*5, 12, TRUE); m_cLoading = 56; } break; case 56: { MakeSprite( "MTrouser", SPRID_LEGG_M + 15*1, 12, TRUE); MakeSprite( "MHTrouser",SPRID_LEGG_M + 15*2, 12, TRUE); MakeSprite( "MCHoses", SPRID_LEGG_M + 15*3, 12, TRUE); MakeSprite( "MLeggings",SPRID_LEGG_M + 15*4, 12, TRUE); MakeSprite( "MHLeggings1", SPRID_LEGG_M + 15*5, 12, TRUE); // hero MakeSprite( "MHLeggings2",SPRID_LEGG_M + 15*6, 12, TRUE); // hero MakeSprite( "MHLeggings3",SPRID_LEGG_M + 15*7, 12, TRUE); // hero MakeSprite( "MShoes", SPRID_BOOT_M + 15*1, 12, TRUE); MakeSprite( "MLBoots", SPRID_BOOT_M + 15*2, 12, TRUE); m_hPakFile = CreateFile("sprites\\Msw.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 672); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_M + i + 64*1] = new class CSprite(m_hPakFile, &m_DDraw, "Msw", i + 56*0, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_M + i + 64*2] = new class CSprite(m_hPakFile, &m_DDraw, "Msw", i + 56*1, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_M + i + 64*3] = new class CSprite(m_hPakFile, &m_DDraw, "Msw", i + 56*2, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_M + i + 64*4] = new class CSprite(m_hPakFile, &m_DDraw, "Msw", i + 56*3, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_M + i + 64*6] = new class CSprite(m_hPakFile, &m_DDraw, "Msw", i + 56*5, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_M + i + 64*7] = new class CSprite(m_hPakFile, &m_DDraw, "Msw", i + 56*6, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_M + i + 64*8] = new class CSprite(m_hPakFile, &m_DDraw, "Msw", i + 56*7, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_M + i + 64*9] = new class CSprite(m_hPakFile, &m_DDraw, "Msw", i + 56*8, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_M + i + 64*10] = new class CSprite(m_hPakFile, &m_DDraw, "Msw", i + 56*9, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_M + i + 64*11] = new class CSprite(m_hPakFile, &m_DDraw, "Msw", i + 56*10, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_M + i + 64*12] = new class CSprite(m_hPakFile, &m_DDraw, "Msw", i + 56*11, TRUE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } m_cLoading = 60; } break; case 60: { MakeSprite( "Mswx", SPRID_WEAPON_M + 64*5, 56, TRUE); MakeSprite( "Msw2", SPRID_WEAPON_M + 64*13, 56, TRUE); MakeSprite( "Msw3", SPRID_WEAPON_M + 64*14, 56, TRUE); MakeSprite( "MStormBringer",SPRID_WEAPON_M + 64*15, 56, TRUE); MakeSprite( "MDarkExec", SPRID_WEAPON_M + 64*16, 56, TRUE); MakeSprite( "MKlonessBlade",SPRID_WEAPON_M + 64*17, 56, TRUE); MakeSprite( "MKlonessAstock",SPRID_WEAPON_M + 64*18, 56, TRUE); MakeSprite( "MDebastator", SPRID_WEAPON_M + 64*19, 56, TRUE); MakeSprite( "MAxe1", SPRID_WEAPON_M + 64*20, 56, TRUE);// Axe MakeSprite( "MAxe2", SPRID_WEAPON_M + 64*21, 56, TRUE); MakeSprite( "MAxe3", SPRID_WEAPON_M + 64*22, 56, TRUE); MakeSprite( "MAxe4", SPRID_WEAPON_M + 64*23, 56, TRUE); MakeSprite( "MAxe5", SPRID_WEAPON_M + 64*24, 56, TRUE); MakeSprite( "MPickAxe1", SPRID_WEAPON_M + 64*25, 56, TRUE); MakeSprite( "MAxe6", SPRID_WEAPON_M + 64*26, 56, TRUE); MakeSprite( "Mhoe", SPRID_WEAPON_M + 64*27, 56, TRUE); MakeSprite( "MKlonessAxe", SPRID_WEAPON_M + 64*28, 56, TRUE); MakeSprite( "MLightBlade", SPRID_WEAPON_M + 64*29, 56, TRUE); m_cLoading = 64; } break; case 64: { MakeSprite( "MHammer", SPRID_WEAPON_M + 64*30, 56, TRUE); MakeSprite( "MBHammer", SPRID_WEAPON_M + 64*31, 56, TRUE); MakeSprite( "MBabHammer", SPRID_WEAPON_M + 64*32, 56, TRUE); MakeSprite( "MBShadowSword",SPRID_WEAPON_M + 64*33, 56, TRUE); MakeSprite( "MBerserkWand", SPRID_WEAPON_M + 64*34, 56, TRUE); MakeSprite( "Mstaff1", SPRID_WEAPON_M + 64*35, 56, TRUE);// Staff MakeSprite( "Mstaff2", SPRID_WEAPON_M + 64*36, 56, TRUE); MakeSprite( "MStaff3", SPRID_WEAPON_M + 64*37, 56, TRUE); MakeSprite( "MReMagicWand", SPRID_WEAPON_M + 64*38, 56, TRUE); MakeSprite( "MKlonessWand", SPRID_WEAPON_M + 64*39, 56, TRUE); MakeLegionSprite( "lgn_Staff4M", SPRID_WEAPON_M + 64*40, 56, TRUE); // Bows 40 41 below MakeSprite( "MDirectBow", SPRID_WEAPON_M + 64*43, 56, TRUE); MakeSprite( "MFireBow", SPRID_WEAPON_M + 64*44, 56, TRUE); m_cLoading = 68; } break; case 68: { MakeSprite( "Mbo", SPRID_WEAPON_M + 64*41, 56, TRUE); m_hPakFile = CreateFile("sprites\\Mbo.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 112); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_M + i + 64*42] = new class CSprite(m_hPakFile, &m_DDraw, "Mbo", i + 56*1, TRUE); CloseHandle(m_hPakFile); framePositions.clear(); } m_hPakFile = CreateFile("sprites\\Msh.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 63); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_M + i + 8*1] = new class CSprite(m_hPakFile, &m_DDraw, "Msh", i + 7*0, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_M + i + 8*2] = new class CSprite(m_hPakFile, &m_DDraw, "Msh", i + 7*1, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_M + i + 8*3] = new class CSprite(m_hPakFile, &m_DDraw, "Msh", i + 7*2, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_M + i + 8*4] = new class CSprite(m_hPakFile, &m_DDraw, "Msh", i + 7*3, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_M + i + 8*5] = new class CSprite(m_hPakFile, &m_DDraw, "Msh", i + 7*4, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_M + i + 8*6] = new class CSprite(m_hPakFile, &m_DDraw, "Msh", i + 7*5, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_M + i + 8*7] = new class CSprite(m_hPakFile, &m_DDraw, "Msh", i + 7*6, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_M + i + 8*8] = new class CSprite(m_hPakFile, &m_DDraw, "Msh", i + 7*7, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_M + i + 8*9] = new class CSprite(m_hPakFile, &m_DDraw, "Msh", i + 7*8, TRUE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } m_cLoading = 72; } break; case 72: { MakeSprite( "Mmantle01", SPRID_MANTLE_M + 15*1, 12, TRUE); MakeSprite( "Mmantle02", SPRID_MANTLE_M + 15*2, 12, TRUE); MakeSprite( "Mmantle03", SPRID_MANTLE_M + 15*3, 12, TRUE); MakeSprite( "Mmantle04", SPRID_MANTLE_M + 15*4, 12, TRUE); MakeSprite( "Mmantle05", SPRID_MANTLE_M + 15*5, 12, TRUE); MakeSprite( "Mmantle06", SPRID_MANTLE_M + 15*6, 12, TRUE); MakeSprite( "Mmantle07", SPRID_MANTLE_M + 15*7, 12, TRUE); MakeSprite( "Mmantle08", SPRID_MANTLE_M + 15*8, 12, TRUE); MakeSprite( "MHelm1", SPRID_HEAD_M + 15*1, 12, TRUE); MakeSprite( "MHelm2", SPRID_HEAD_M + 15*2, 12, TRUE); MakeSprite( "MHelm3", SPRID_HEAD_M + 15*3, 12, TRUE); MakeSprite( "MHelm4", SPRID_HEAD_M + 15*4, 12, TRUE); MakeSprite( "NMHelm1", SPRID_HEAD_M + 15*5, 12, TRUE); MakeSprite( "NMHelm2", SPRID_HEAD_M + 15*6, 12, TRUE); MakeSprite( "NMHelm3", SPRID_HEAD_M + 15*7, 12, TRUE); MakeSprite( "NMHelm4", SPRID_HEAD_M + 15*8, 12, TRUE); MakeSprite( "MHHelm1", SPRID_HEAD_M + 15*9, 12, TRUE); MakeSprite( "MHHelm2", SPRID_HEAD_M + 15*10, 12, TRUE); MakeSprite( "MHCap1", SPRID_HEAD_M + 15*11, 12, TRUE); MakeSprite( "MHCap2", SPRID_HEAD_M + 15*12, 12, TRUE); MakeSprite( "MHHelm3", SPRID_HEAD_M + 15*13, 12, TRUE); MakeSprite( "MHCap3", SPRID_HEAD_M + 15*14, 12, TRUE); m_cLoading = 76; } break; case 76: { m_hPakFile = CreateFile("sprites\\Wpt.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 96); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_W + i + 15*0] = new class CSprite(m_hPakFile, &m_DDraw, "Wpt", i, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_W + i + 15*1] = new class CSprite(m_hPakFile, &m_DDraw, "Wpt", i + 12, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_W + i + 15*2] = new class CSprite(m_hPakFile, &m_DDraw, "Wpt", i + 12*2, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_W + i + 15*3] = new class CSprite(m_hPakFile, &m_DDraw, "Wpt", i + 12*3, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_W + i + 15*4] = new class CSprite(m_hPakFile, &m_DDraw, "Wpt", i + 12*4, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_W + i + 15*5] = new class CSprite(m_hPakFile, &m_DDraw, "Wpt", i + 12*5, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_W + i + 15*6] = new class CSprite(m_hPakFile, &m_DDraw, "Wpt", i + 12*6, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_UNDIES_W + i + 15*7] = new class CSprite(m_hPakFile, &m_DDraw, "Wpt", i + 12*7, TRUE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } m_hPakFile = CreateFile("sprites\\Whr.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 96); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_W + i + 15*0] = new class CSprite(m_hPakFile, &m_DDraw, "Whr", i + 0, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_W + i + 15*1] = new class CSprite(m_hPakFile, &m_DDraw, "Whr", i + 12, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_W + i + 15*2] = new class CSprite(m_hPakFile, &m_DDraw, "Whr", i + 12*2, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_W + i + 15*3] = new class CSprite(m_hPakFile, &m_DDraw, "Whr", i + 12*3, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_W + i + 15*4] = new class CSprite(m_hPakFile, &m_DDraw, "Whr", i + 12*4, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_W + i + 15*5] = new class CSprite(m_hPakFile, &m_DDraw, "Whr", i + 12*5, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_W + i + 15*6] = new class CSprite(m_hPakFile, &m_DDraw, "Whr", i + 12*6, TRUE, &framePositions); for (i = 0; i < 12; i++) m_pSprite[SPRID_HAIR_W + i + 15*7] = new class CSprite(m_hPakFile, &m_DDraw, "Whr", i + 12*7, TRUE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } m_cLoading = 80; } break; case 80: { MakeSprite( "WBodice1", SPRID_BODYARMOR_W + 15*1, 12, TRUE); MakeSprite( "WBodice2", SPRID_BODYARMOR_W + 15*2, 12, TRUE); MakeSprite( "WLArmor", SPRID_BODYARMOR_W + 15*3, 12, TRUE); MakeSprite( "WCMail", SPRID_BODYARMOR_W + 15*4, 12, TRUE); MakeSprite( "WSMail", SPRID_BODYARMOR_W + 15*5, 12, TRUE); MakeSprite( "WPMail", SPRID_BODYARMOR_W + 15*6, 12, TRUE); MakeSprite( "WRobe1", SPRID_BODYARMOR_W + 15*7, 12, TRUE); MakeSprite( "WSanta", SPRID_BODYARMOR_W + 15*8, 12, TRUE); MakeSprite( "WHPMail1", SPRID_BODYARMOR_W + 15*9, 12, TRUE); //hero MakeSprite( "WHPMail2", SPRID_BODYARMOR_W + 15*10, 12, TRUE); //hero MakeSprite( "WHRobe1", SPRID_BODYARMOR_W + 15*11, 12, TRUE); // hero MakeSprite( "WHRobe2", SPRID_BODYARMOR_W + 15*12, 12, TRUE); // hero MakeSprite( "WHPMail3", SPRID_BODYARMOR_W + 15*13, 12, TRUE); //hero MakeSprite( "WHRobe3", SPRID_BODYARMOR_W + 15*14, 12, TRUE); // hero MakeSprite( "WChemiss", SPRID_BERK_W + 15*1, 12, TRUE); MakeSprite( "WShirt", SPRID_BERK_W + 15*2, 12, TRUE); MakeSprite( "WHauberk", SPRID_BERK_W + 15*3, 12, TRUE); MakeSprite( "WHHauberk1",SPRID_BERK_W + 15*4, 12, TRUE); MakeSprite( "WHHauberk2",SPRID_BERK_W + 15*5, 12, TRUE); MakeSprite( "WHHauberk3",SPRID_BERK_W + 15*6, 12, TRUE); MakeSprite( "WSkirt", SPRID_LEGG_W + 15*1, 12, TRUE); MakeSprite( "WTrouser", SPRID_LEGG_W + 15*2, 12, TRUE); MakeSprite( "WHTrouser", SPRID_LEGG_W + 15*3, 12, TRUE); MakeSprite( "WCHoses", SPRID_LEGG_W + 15*4, 12, TRUE); MakeSprite( "WLeggings", SPRID_LEGG_W + 15*5, 12, TRUE); MakeSprite( "WHLeggings1", SPRID_LEGG_W + 15*6, 12, TRUE); MakeSprite( "WHLeggings2", SPRID_LEGG_W + 15*7, 12, TRUE); MakeSprite( "WHLeggings3", SPRID_LEGG_W + 15*8, 12, TRUE); MakeSprite( "WShoes", SPRID_BOOT_W + 15*1, 12, TRUE); MakeSprite( "WLBoots", SPRID_BOOT_W + 15*2, 12, TRUE); m_cLoading = 84; } break; case 84: { m_hPakFile = CreateFile("sprites\\Wsw.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 672); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_W + i + 64*1] = new class CSprite(m_hPakFile, &m_DDraw, "Wsw", i + 56*0, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_W + i + 64*2] = new class CSprite(m_hPakFile, &m_DDraw, "Wsw", i + 56*1, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_W + i + 64*3] = new class CSprite(m_hPakFile, &m_DDraw, "Wsw", i + 56*2, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_W + i + 64*4] = new class CSprite(m_hPakFile, &m_DDraw, "Wsw", i + 56*3, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_W + i + 64*6] = new class CSprite(m_hPakFile, &m_DDraw, "Wsw", i + 56*5, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_W + i + 64*7] = new class CSprite(m_hPakFile, &m_DDraw, "Wsw", i + 56*6, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_W + i + 64*8] = new class CSprite(m_hPakFile, &m_DDraw, "Wsw", i + 56*7, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_W + i + 64*9] = new class CSprite(m_hPakFile, &m_DDraw, "Wsw", i + 56*8, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_W + i + 64*10] = new class CSprite(m_hPakFile, &m_DDraw, "Wsw", i + 56*9, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_W + i + 64*11] = new class CSprite(m_hPakFile, &m_DDraw, "Wsw", i + 56*10, TRUE, &framePositions); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_W + i + 64*12] = new class CSprite(m_hPakFile, &m_DDraw, "Wsw", i + 56*11, TRUE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } MakeSprite( "Wswx", SPRID_WEAPON_W + 64*5, 56, TRUE); MakeSprite( "Wsw2", SPRID_WEAPON_W + 64*13, 56, TRUE); MakeSprite( "Wsw3", SPRID_WEAPON_W + 64*14, 56, TRUE); // TheVampire MakeSprite( "WStormBringer",SPRID_WEAPON_W + 64*15, 56, TRUE); MakeSprite( "WDarkExec", SPRID_WEAPON_W + 64*16, 56, TRUE); MakeSprite( "WKlonessBlade",SPRID_WEAPON_W + 64*17, 56, TRUE); MakeSprite( "WKlonessAstock",SPRID_WEAPON_W + 64*18, 56, TRUE); MakeSprite( "WDebastator", SPRID_WEAPON_W + 64*19, 56, TRUE); m_cLoading = 88; } break; case 88: { MakeSprite( "WAxe1", SPRID_WEAPON_W + 64*20, 56, TRUE);// Axe MakeSprite( "WAxe2", SPRID_WEAPON_W + 64*21, 56, TRUE); MakeSprite( "WAxe3", SPRID_WEAPON_W + 64*22, 56, TRUE); MakeSprite( "WAxe4", SPRID_WEAPON_W + 64*23, 56, TRUE); MakeSprite( "WAxe5", SPRID_WEAPON_W + 64*24, 56, TRUE); MakeSprite( "WpickAxe1", SPRID_WEAPON_W + 64*25, 56, TRUE); MakeSprite( "WAxe6", SPRID_WEAPON_W + 64*26, 56, TRUE); MakeSprite( "Whoe", SPRID_WEAPON_W + 64*27, 56, TRUE); MakeSprite( "WKlonessAxe", SPRID_WEAPON_W + 64*28, 56, TRUE); MakeSprite( "WLightBlade", SPRID_WEAPON_W + 64*29, 56, TRUE); MakeSprite( "WHammer", SPRID_WEAPON_W + 64*30, 56, TRUE); MakeSprite( "WBHammer", SPRID_WEAPON_W + 64*31, 56, TRUE); MakeSprite( "WBabHammer", SPRID_WEAPON_W + 64*32, 56, TRUE); MakeSprite( "WBShadowSword",SPRID_WEAPON_W + 64*33, 56, TRUE); MakeSprite( "WBerserkWand", SPRID_WEAPON_W + 64*34, 56, TRUE); MakeSprite( "Wstaff1", SPRID_WEAPON_W + 64*35, 56, TRUE); MakeSprite( "Wstaff2", SPRID_WEAPON_W + 64*36, 56, TRUE); MakeSprite( "WStaff3", SPRID_WEAPON_W + 64*37, 56, TRUE); MakeSprite( "WKlonessWand", SPRID_WEAPON_W + 64*39, 56, TRUE); MakeSprite( "WReMagicWand", SPRID_WEAPON_W + 64*38, 56, TRUE); MakeLegionSprite( "lgn_Staff4W", SPRID_WEAPON_W + 64*40, 56, TRUE); // bows 40 41 below MakeSprite( "WDirectBow", SPRID_WEAPON_W + 64*43, 56, TRUE); MakeSprite( "WFireBow", SPRID_WEAPON_W + 64*44, 56, TRUE); m_cLoading = 92; } break; case 92: { MakeSprite( "Wmantle01", SPRID_MANTLE_W + 15*1, 12, TRUE); MakeSprite( "Wmantle02", SPRID_MANTLE_W + 15*2, 12, TRUE); MakeSprite( "Wmantle03", SPRID_MANTLE_W + 15*3, 12, TRUE); MakeSprite( "Wmantle04", SPRID_MANTLE_W + 15*4, 12, TRUE); MakeSprite( "Wmantle05", SPRID_MANTLE_W + 15*5, 12, TRUE); MakeSprite( "Wmantle06", SPRID_MANTLE_W + 15*6, 12, TRUE); MakeSprite( "Wmantle07", SPRID_MANTLE_W + 15*7, 12, TRUE); MakeSprite( "Wmantle08", SPRID_MANTLE_W + 15*8, 12, TRUE); MakeSprite( "WHelm1", SPRID_HEAD_W + 15*1, 12, TRUE); MakeSprite( "WHelm4", SPRID_HEAD_W + 15*4, 12, TRUE); MakeSprite( "NWHelm1", SPRID_HEAD_W + 15*5, 12, TRUE); MakeSprite( "NWHelm2", SPRID_HEAD_W + 15*6, 12, TRUE); MakeSprite( "NWHelm3", SPRID_HEAD_W + 15*7, 12, TRUE); MakeSprite( "NWHelm4", SPRID_HEAD_W + 15*8, 12, TRUE); MakeSprite( "WHHelm1", SPRID_HEAD_W + 15*9, 12, TRUE); MakeSprite( "WHHelm2", SPRID_HEAD_W + 15*10, 12, TRUE); MakeSprite( "WHCap1", SPRID_HEAD_W + 15*11, 12, TRUE); MakeSprite( "WHCap2", SPRID_HEAD_W + 15*12, 12, TRUE); MakeSprite( "WHHelm3", SPRID_HEAD_W + 15*13, 12, TRUE); MakeSprite( "WHCap3", SPRID_HEAD_W + 15*14, 12, TRUE); m_cLoading = 96; } break; case 96: { MakeSprite( "Wbo", SPRID_WEAPON_W + 64*41, 56, TRUE);// Bow m_hPakFile = CreateFile("sprites\\Wbo.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 112); for (i = 0; i < 56; i++) m_pSprite[SPRID_WEAPON_W + i + 64*42] = new class CSprite(m_hPakFile, &m_DDraw, "Wbo", i + 56*1, TRUE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } m_hPakFile = CreateFile("sprites\\Wsh.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 63); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_W + i + 8*1] = new class CSprite(m_hPakFile, &m_DDraw, "Wsh", i + 7*0, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_W + i + 8*2] = new class CSprite(m_hPakFile, &m_DDraw, "Wsh", i + 7*1, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_W + i + 8*3] = new class CSprite(m_hPakFile, &m_DDraw, "Wsh", i + 7*2, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_W + i + 8*4] = new class CSprite(m_hPakFile, &m_DDraw, "Wsh", i + 7*3, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_W + i + 8*5] = new class CSprite(m_hPakFile, &m_DDraw, "Wsh", i + 7*4, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_W + i + 8*6] = new class CSprite(m_hPakFile, &m_DDraw, "Wsh", i + 7*5, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_W + i + 8*7] = new class CSprite(m_hPakFile, &m_DDraw, "Wsh", i + 7*6, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_W + i + 8*8] = new class CSprite(m_hPakFile, &m_DDraw, "Wsh", i + 7*7, TRUE, &framePositions); for (i = 0; i < 7; i++) m_pSprite[SPRID_SHIELD_W + i + 8*9] = new class CSprite(m_hPakFile, &m_DDraw, "Wsh", i + 7*8, TRUE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } m_cLoading = 100; } break; case 100: { MakeEffectSpr( "effect", 0, 10, FALSE); MakeEffectSpr( "effect2", 10, 3, FALSE); MakeEffectSpr( "effect3", 13, 6, FALSE); MakeEffectSpr( "effect4", 19, 5, FALSE); m_hPakFile = CreateFile("sprites\\effect5.pak", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( m_hPakFile != INVALID_HANDLE_VALUE ) { ReadFramePositions(m_hPakFile, framePositions, 8); for (i = 0; i <= 6; i++) m_pEffectSpr[i+ 24] = new class CSprite(m_hPakFile, &m_DDraw, "effect5", i+1, FALSE, &framePositions); CloseHandle(m_hPakFile); framePositions.clear(); } MakeEffectSpr( "CruEffect1", 31, 9, FALSE); MakeEffectSpr( "effect6", 40, 5, FALSE); MakeEffectSpr( "effect7", 45, 12, FALSE); MakeEffectSpr( "effect8", 57, 9, FALSE); MakeEffectSpr( "effect9", 66, 21, FALSE); MakeEffectSpr( "effect10", 87, 2, FALSE); // Effets Hero items MakeEffectSpr( "effect11", 89, 14, FALSE); // Cancel, stormBlade, resu, GateHeldenian....etc //NB: Charge 15 du client 3.51, mais il n'y a que 14 ds le PAK MakeEffectSpr( "effect11s", 104, 1, FALSE); // effet sort mais je ne sais pas lequel // Manque des effets ici ..... // MakeEffectSpr( "effect13", 108, 2, FALSE); // not loaded by client 351 (Heldenian gates death) //MakeEffectSpr( "yseffect2", 141, 8, FALSE); // Wrong in 351 client... MakeEffectSpr( "yseffect2", 140, 8, FALSE); // Abaddon's death MakeEffectSpr( "effect12", 148, 4, FALSE); // Slates auras MakeEffectSpr( "yseffect3", 152,16, FALSE); // Fumerolles ou ame qui s'envole //MakeEffectSpr( "yseffect4", 167, 7, FALSE); // Wrong in 351 client MakeEffectSpr( "yseffect4", 133, 7, FALSE); // Abaddon's map thunder. if (m_bSoundFlag) // Attention il y a un autre systeme de chargement ds la v351 { for (i = 1; i <= 24; i++) { wsprintf(G_cTxt, "sounds\\C%d.wav", i); m_pCSound[i] = new class CSoundBuffer(m_DSound.m_lpDS, m_DSound.m_DSCaps, G_cTxt); } for (i = 1; i <= 156; i++) { wsprintf(G_cTxt, "sounds\\M%d.wav", i); m_pMSound[i] = new class CSoundBuffer(m_DSound.m_lpDS, m_DSound.m_DSCaps, G_cTxt); } for (i = 1; i <= 53; i++) { wsprintf(G_cTxt, "sounds\\E%d.wav", i); m_pESound[i] = new class CSoundBuffer(m_DSound.m_lpDS, m_DSound.m_DSCaps, G_cTxt); } } ChangeGameMode(GAMEMODE_ONMAINMENU); } break; } } void CGame::UpdateScreen_OnLoading_Progress() { m_DDraw.ClearBackB4(); DrawNewDialogBox(SPRID_INTERFACE_ND_LOADING, 0,0,0, TRUE); DrawVersion(TRUE); int iBarWidth; iBarWidth= (int)m_cLoading * (m_pSprite[SPRID_INTERFACE_ND_LOADING]->m_stBrush[1].szx / 100); m_pSprite[SPRID_INTERFACE_ND_LOADING]->PutSpriteFastWidth(391,434, 1, iBarWidth, G_dwGlobalTime); //PutString(239, 196, "Helbreath Legion is loading...", RGB(60,60,60)); //PutString(238, 195, "Helbreath Legion is loading...", RGB(230,230,230)); //PutString(249, 261, "www.helbreathlegion.net", RGB(60,20,0)); //PutString(248, 260, "www.helbreathlegion.net", RGB(255,245,0)); m_DDraw.iFlip(); } void CGame::OnTimer() { if( m_cGameMode < 0 ) return; DWORD dwTime = timeGetTime(); if (m_cGameMode != GAMEMODE_ONLOADING) { if ((dwTime - m_dwCheckSprTime) > 8000 ) { m_dwCheckSprTime = dwTime; if( m_bIsProgramActive ) ReleaseUnusedSprites(); if ((m_pGSock != NULL) && (m_pGSock->m_bIsAvailable == TRUE)) bSendCommand(MSGID_COMMAND_CHECKCONNECTION, MSGTYPE_CONFIRM, NULL, NULL, NULL, NULL, NULL); } } if (m_cGameMode == GAMEMODE_ONMAINGAME) { if ((dwTime - m_dwCheckConnTime) > 5000) { m_dwCheckConnTime = dwTime; if ((m_bIsCrusadeMode) && (m_iCrusadeDuty == NULL)) EnableDialogBox(33, 1, NULL, NULL); } if (m_ekSSTime != 0 && dwTime > m_ekSSTime){ m_ekSSTime = 0; CreateScreenShot(); } if ((dwTime - m_dwCheckChatTime) > 2000) { m_dwCheckChatTime = m_dwTime; ReleaseTimeoverChatMsg(); if (m_cCommandCount >= 6) { m_iNetLagCount++; if (m_iNetLagCount >= 7) { ChangeGameMode(GAMEMODE_ONCONNECTIONLOST); delete m_pGSock; m_pGSock = NULL; return; } }else m_iNetLagCount = NULL; } if ((G_bIsCalcSocketConnected == FALSE) && ((dwTime - G_dwCalcSocketTime) > 5000)) { delete m_pGSock; m_pGSock = NULL; ChangeGameMode(GAMEMODE_ONQUIT); m_bEscPressed = FALSE; PlaySound('E', 14, 5); if (m_bSoundFlag) m_pESound[38]->bStop(); if ((m_bSoundFlag) && (m_bMusicStat == TRUE)) { if (m_pBGM != NULL) m_pBGM->bStop(); } return; } if ((G_pCalcSocket != NULL) && (G_bIsCalcSocketConnected == TRUE)) { if ((dwTime - G_dwCalcSocketSendTime) > 1000*5) { if (memcmp(G_cCmdLineTokenA_Lowercase, "wisetop", 7) == 0) {}else { char cPacket[120]; int iSended; WORD * wp; ZeroMemory(cPacket, sizeof(cPacket)); cPacket[0] = 0; // Key wp = (WORD *)(cPacket +1); *wp = 5; iSended = G_pCalcSocket->iSendMsgBlockingMode(cPacket, 5); } G_dwCalcSocketSendTime = dwTime; } } } } BOOL CGame::_bCheckDlgBoxClick(short msX, short msY) {int i; char cDlgID; m_DInput.m_sZ = 0; // Snoopy: 41->61 for (i = 0; i < 61; i++) // Snoopy: 40->60 if (m_cDialogBoxOrder[60 - i] != NULL) { // Snoopy: 40->60 cDlgID = m_cDialogBoxOrder[60 - i]; if ((m_stDialogBoxInfo[cDlgID].sX < msX) && ((m_stDialogBoxInfo[cDlgID].sX + m_stDialogBoxInfo[cDlgID].sSizeX) > msX) && (m_stDialogBoxInfo[cDlgID].sY < msY) && ((m_stDialogBoxInfo[cDlgID].sY + m_stDialogBoxInfo[cDlgID].sSizeY) > msY) ) { switch (cDlgID) { case 1: DlgBoxClick_Character(msX, msY); break; case 2: DlgBoxClick_Inventory(msX, msY); break; case 3: DlgBoxClick_Magic(msX, msY); break; case 4: DlgBoxClick_ItemDrop(msX, msY); break; case 5: DlgBoxClick_15AgeMsg(msX, msY); break; case 6: DlgBoxClick_WarningMsg(msX, msY); break; case 7: DlgBoxClick_GuildMenu(msX, msY); break; case 8: DlgBoxClick_GuildOp(msX, msY); break; case 9: DlgBoxClick_GuideMap(msX, msY); break; case 11: DlgBoxClick_Shop(msX, msY); break; case 12: DlgBoxClick_LevelUpSettings(msX, msY); break; case 13: DlgBoxClick_CityhallMenu(msX, msY); break; case 14: DlgBoxClick_Bank(msX, msY); break; case 15: DlgBoxClick_Skill(msX, msY); break; case 16: DlgBoxClick_MagicShop(msX, msY); break; case 18: DlgBoxClick_Text(msX, msY); break; case 19: DlgBoxClick_SysMenu(msX, msY); break; case 20: DlgBoxClick_NpcActionQuery(msX, msY); break; case 21: DlgBoxClick_NpcTalk(msX, msY); break; case 23: DlgBoxClick_ItemSellorRepair(msX, msY); break; case 24: DlgBoxClick_Fish(msX, msY); break; case 25: DlgBoxClick_ShutDownMsg(msX, msY); break; case 26: DlgBoxClick_SkillDlg(msX, msY); break; case 27: DlgBoxClick_Exchange(msX, msY); break; case 28: DlgBoxClick_Quest(msX, msY); break; case 30: DlgBoxClick_IconPannel(msX, msY); break; case 31: DlgBoxClick_SellList(msX, msY); break; case 32: DlgBoxClick_Party(msX, msY); break; case 33: DlgBoxClick_CrusadeJob(msX, msY); break; case 34: DlgBoxClick_ItemUpgrade(msX, msY); break; case 35: DlgBoxClick_Help(msX, msY); break; case 36: DlgBoxClick_Commander(msX, msY); break; case 37: DlgBoxClick_Constructor(msX, msY); break; case 38: DlgBoxClick_Soldier(msX, msY); break; case 40: DlgBoxClick_Slates(msX, msY); break; // Snoopy: Boite de dialogue de confirmation d'échange case 41: DlgBoxClick_ConfirmExchange(msX, msY); break; case 42: DlgBoxClick_ChangeStatsMajestic(msX, msY); break; case 50: DlgBoxClick_Resurect(msX, msY); break; case 51: DlgBoxClick_CMDHallMenu(msX, msY); break; case 53: DlgBoxClick_DKMenuWeapons(msX, msY); break; case 43: DlgBoxClick_FriendList(msX, msY); break; //case 55: //Quest Helper // DrawQuestHelper(); // break; } return TRUE; } } return FALSE; } BOOL CGame::_bCheckDlgBoxDoubleClick(short msX, short msY) { int i; char cDlgID; // if (m_iHP <= 0) return FALSE; //Snoopy: 41->61 for (i = 0; i < 61; i++) //Snoopy: 40->60 if (m_cDialogBoxOrder[60 - i] != NULL) { //Snoopy: 40->60 cDlgID = m_cDialogBoxOrder[60 - i]; if ((m_stDialogBoxInfo[cDlgID].sX < msX) && ((m_stDialogBoxInfo[cDlgID].sX + m_stDialogBoxInfo[cDlgID].sSizeX) > msX) && (m_stDialogBoxInfo[cDlgID].sY < msY) && ((m_stDialogBoxInfo[cDlgID].sY + m_stDialogBoxInfo[cDlgID].sSizeY) > msY) ) { switch (cDlgID) { case 1: DlbBoxDoubleClick_Character(msX, msY); break; case 2: DlbBoxDoubleClick_Inventory(msX, msY); break; case 9: DlbBoxDoubleClick_GuideMap(msX, msY); break; } return TRUE; } } return FALSE; } BOOL CGame::bDlgBoxPress_Inventory(short msX, short msY) {int i; char cItemID; short sX, sY, x1, x2, y1, y2; #ifdef _DEBUG AddEventList("Press Inventory", 10); #endif if (m_bIsDialogEnabled[2] == FALSE) return FALSE; if (m_bIsDialogEnabled[17] == TRUE) return FALSE; if (m_bIsDialogEnabled[4] == TRUE) return FALSE; sX = m_stDialogBoxInfo[2].sX; sY = m_stDialogBoxInfo[2].sY; for (i = 0; i < MAXITEMS; i++) if (m_cItemOrder[MAXITEMS - 1 - i] != -1) { cItemID = m_cItemOrder[MAXITEMS - 1 - i]; if (m_pItemList[cItemID] != NULL) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + 32 + m_pItemList[cItemID]->m_sX, sY + 44 + m_pItemList[cItemID]->m_sY, m_pItemList[cItemID]->m_sSpriteFrame); x1 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.left; y1 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.top; x2 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.right; y2 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.bottom; if ( (m_bIsItemDisabled[cItemID] == FALSE) && (m_bIsItemEquipped[cItemID] == FALSE) && (msX > x1) && (msX < x2) && (msY > y1) && (msY < y2) ) { if (m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_bCheckCollison(sX + 32 + m_pItemList[cItemID]->m_sX, sY + 44 + m_pItemList[cItemID]->m_sY, m_pItemList[cItemID]->m_sSpriteFrame, msX, msY) == TRUE) { _SetItemOrder(0, cItemID); if ( (m_bIsGetPointingMode == TRUE) && (m_iPointCommandType < 100) && (m_iPointCommandType >= 0 ) && (m_pItemList[m_iPointCommandType] != NULL) && (m_pItemList[m_iPointCommandType]->m_cItemType == ITEMTYPE_USE_DEPLETE_DEST) && (m_iPointCommandType != cItemID) ) { PointCommandHandler(NULL, NULL, cItemID); //m_bCommandAvailable = FALSE; m_bIsGetPointingMode = FALSE; }else { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = cItemID; m_stMCursor.sDistX = msX - x1 + (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_sPivotX; m_stMCursor.sDistY = msY - y1 + (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_sPivotY; } return TRUE; } } } } return FALSE; } void CGame::_SetItemOrder(char cWhere, char cItemID) { int i; switch (cWhere) { case 0: for (i = 0; i < MAXITEMS; i++) if (m_cItemOrder[i] == cItemID) m_cItemOrder[i] = -1; for (i = 1; i < MAXITEMS; i++) if ((m_cItemOrder[i-1] == -1) && (m_cItemOrder[i] != -1)) { m_cItemOrder[i-1] = m_cItemOrder[i]; m_cItemOrder[i] = -1; } for (i = 0; i < MAXITEMS; i++) if (m_cItemOrder[i] == -1) { m_cItemOrder[i] = cItemID; return; } break; } } BOOL CGame::_bCheckDraggingItemRelease(short msX, short msY) {int i; char cDlgID; //Snoopy: 41->61 for (i = 0; i < 61; i++) //Snoopy: 40->60 if (m_cDialogBoxOrder[60 - i] != NULL) { //Snoopy: 40->60 cDlgID = m_cDialogBoxOrder[60 - i]; if ( (m_stDialogBoxInfo[cDlgID].sX < msX) && ((m_stDialogBoxInfo[cDlgID].sX + m_stDialogBoxInfo[cDlgID].sSizeX) > msX) && (m_stDialogBoxInfo[cDlgID].sY < msY) && ((m_stDialogBoxInfo[cDlgID].sY + m_stDialogBoxInfo[cDlgID].sSizeY) > msY) ) { EnableDialogBox(cDlgID, NULL, NULL, NULL); switch (cDlgID) { case 1: bItemDrop_Character(); break; case 2: bItemDrop_Inventory(msX, msY); break; case 14: bItemDrop_Bank(msX, msY); break; case 26: // Alchim / Manuf bItemDrop_SkillDialog(); break; case 27: bItemDrop_ExchangeDialog(msX, msY); break; case 30: bItemDrop_IconPannel(msX, msY); break; case 31: bItemDrop_SellList(msX, msY); break; case 34: bItemDrop_ItemUpgrade(); break; case 40: bItemDrop_Slates(); break; } return TRUE; } } bItemDrop_ExternalScreen((char)m_stMCursor.sSelectedObjectID, msX, msY); return FALSE; } void CGame::bItemDrop_ExternalScreen(char cItemID, short msX, short msY) {char cName[21]; short sType, tX, tY; int iStatus; if (bCheckItemOperationEnabled(cItemID) == FALSE) return; if ((m_sMCX != 0) && (m_sMCY != 0) && (abs(m_sPlayerX - m_sMCX) <= 8) && (abs(m_sPlayerY - m_sMCY) <= 8)) { ZeroMemory(cName, sizeof(cName)); m_pMapData->bGetOwner(m_sMCX, m_sMCY, cName, &sType, &iStatus, &m_wCommObjectID); if (memcmp(m_cPlayerName, cName, 10) == 0) {}else { if ( ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_ARROW)) && (m_pItemList[cItemID]->m_dwCount > 1)) { m_stDialogBoxInfo[17].sX = msX - 140; m_stDialogBoxInfo[17].sY = msY - 70; if (m_stDialogBoxInfo[17].sY < 0) m_stDialogBoxInfo[17].sY = 0; m_stDialogBoxInfo[17].sV1 = m_sMCX; m_stDialogBoxInfo[17].sV2 = m_sMCY; m_stDialogBoxInfo[17].sV3 = sType; m_stDialogBoxInfo[17].sV4 = m_wCommObjectID; ZeroMemory(m_stDialogBoxInfo[17].cStr, sizeof(m_stDialogBoxInfo[17].cStr)); if (sType < 10) memcpy(m_stDialogBoxInfo[17].cStr, cName, 10); else { GetNpcName(sType, m_stDialogBoxInfo[17].cStr); } EnableDialogBox(17, cItemID, m_pItemList[cItemID]->m_dwCount, NULL); }else { switch (sType) { case 1: case 2: case 3: case 4: case 5: case 6: EnableDialogBox(20, 1, cItemID, sType); m_stDialogBoxInfo[20].sV3 = 1; m_stDialogBoxInfo[20].sV4 = m_wCommObjectID; m_stDialogBoxInfo[20].sV5 = m_sMCX; m_stDialogBoxInfo[20].sV6 = m_sMCY; tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; ZeroMemory(m_stDialogBoxInfo[20].cStr, sizeof(m_stDialogBoxInfo[20].cStr)); strcpy(m_stDialogBoxInfo[20].cStr, cName); //bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_GIVEITEMTOCHAR, cItemID, 1, m_sMCX, m_sMCY, m_pItemList[cItemID]->m_cName); //v1.4 break; case 20: // Howard EnableDialogBox(20, 3, cItemID, sType); m_stDialogBoxInfo[20].sV3 = 1; m_stDialogBoxInfo[20].sV4 = m_wCommObjectID; m_stDialogBoxInfo[20].sV5 = m_sMCX; m_stDialogBoxInfo[20].sV6 = m_sMCY; tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; ZeroMemory(m_stDialogBoxInfo[20].cStr, sizeof(m_stDialogBoxInfo[20].cStr)); GetNpcName(sType, m_stDialogBoxInfo[20].cStr); //bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_GIVEITEMTOCHAR, cItemID, 1, m_sMCX, m_sMCY, m_pItemList[cItemID]->m_cName); break; case 15: // ShopKeeper-W case 24: // Tom EnableDialogBox(20, 2, cItemID, sType); m_stDialogBoxInfo[20].sV3 = 1; m_stDialogBoxInfo[20].sV4 = m_wCommObjectID; m_stDialogBoxInfo[20].sV5 = m_sMCX; m_stDialogBoxInfo[20].sV6 = m_sMCY; tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; ZeroMemory(m_stDialogBoxInfo[20].cStr, sizeof(m_stDialogBoxInfo[20].cStr)); GetNpcName(sType, m_stDialogBoxInfo[20].cStr); break; default: bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_GIVEITEMTOCHAR, cItemID, 1, m_sMCX, m_sMCY, m_pItemList[cItemID]->m_cName); break; } //m_bIsItemDisabled[cItemID] = TRUE; } m_bIsItemDisabled[cItemID] = TRUE; } }else { if ( ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_ARROW)) && (m_pItemList[cItemID]->m_dwCount > 1)) { m_stDialogBoxInfo[17].sX = msX - 140; m_stDialogBoxInfo[17].sY = msY - 70; if (m_stDialogBoxInfo[17].sY < 0) m_stDialogBoxInfo[17].sY = 0; m_stDialogBoxInfo[17].sV1 = NULL; m_stDialogBoxInfo[17].sV2 = NULL; m_stDialogBoxInfo[17].sV3 = NULL; m_stDialogBoxInfo[17].sV4 = NULL; ZeroMemory(m_stDialogBoxInfo[17].cStr, sizeof(m_stDialogBoxInfo[17].cStr)); EnableDialogBox(17, cItemID, m_pItemList[cItemID]->m_dwCount, NULL); }else { if(_ItemDropHistory(m_pItemList[cItemID]->m_cName)) { m_stDialogBoxInfo[4].sX = msX - 140; m_stDialogBoxInfo[4].sY = msY - 70; if (m_stDialogBoxInfo[4].sY < 0) m_stDialogBoxInfo[4].sY = 0; m_stDialogBoxInfo[4].sV1 = NULL; m_stDialogBoxInfo[4].sV2 = NULL; m_stDialogBoxInfo[4].sV3 = 1; m_stDialogBoxInfo[4].sV4 = NULL; m_stDialogBoxInfo[4].sV5 = cItemID; ZeroMemory(m_stDialogBoxInfo[4].cStr, sizeof(m_stDialogBoxInfo[4].cStr)); EnableDialogBox(4, cItemID, m_pItemList[cItemID]->m_dwCount, NULL); }else { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_ITEMDROP, NULL, cItemID, 1, NULL, m_pItemList[cItemID]->m_cName); } } m_bIsItemDisabled[cItemID] = TRUE; } } void CGame::CommonEventHandler(char * pData) { WORD * wp, wEventType; short * sp, sX, sY, sV1, sV2, sV3, sV4; char * cp; wp = (WORD *)(pData + INDEX2_MSGTYPE); wEventType = *wp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sX = *sp; cp += 2; sp = (short *)cp; sY = *sp; cp += 2; sp = (short *)cp; sV1 = *sp; cp += 2; sp = (short *)cp; sV2 = *sp; cp += 2; sp = (short *)cp; sV3 = *sp; cp += 2; sp = (short *)cp; sV4 = *sp; cp += 2; switch (wEventType) { case COMMONTYPE_ITEMDROP: if ((sV1 == 6) && (sV2 == 0)) { bAddNewEffect(4, sX, sY, NULL, NULL, 0); } m_pMapData->bSetItem(sX, sY, sV1, sV2, (char)sV3); break; case COMMONTYPE_SETITEM: m_pMapData->bSetItem(sX, sY, sV1, sV2, (char)sV3, FALSE); break; case COMMONTYPE_MAGIC: bAddNewEffect(sV3, sX, sY, sV1, sV2, 0, sV4); break; case COMMONTYPE_CLEARGUILDNAME: ClearGuildNameList(); break; } } void CGame::ClearGuildNameList() { for (int i = 0; i < MAXGUILDNAMES; i++) { m_stGuildName[i].dwRefTime = 0; m_stGuildName[i].iGuildRank = -1; ZeroMemory(m_stGuildName[i].cCharName, sizeof(m_stGuildName[i].cCharName)); ZeroMemory(m_stGuildName[i].cGuildName, sizeof(m_stGuildName[i].cGuildName)); } } void CGame::InitGameSettings() { int i; m_bIllusionMVT = FALSE; m_bForceAttack = FALSE; m_dwCommandTime = 0; m_bInputStatus = FALSE; m_pInputBuffer = NULL; m_iPDBGSdivX = 0; m_iPDBGSdivY = 0; m_bIsRedrawPDBGS = TRUE; m_iCameraShakingDegree = 0; m_cCommand = OBJECTSTOP; m_cCommandCount = 0; m_bIsGetPointingMode = FALSE; m_iPointCommandType = -1; //v2.15 NULL -> -1 m_bIsCombatMode = FALSE; m_bRunningMode = FALSE; m_stMCursor.cPrevStatus = CURSORSTATUS_NULL; m_stMCursor.dwSelectClickTime = NULL; m_bSkillUsingStatus = FALSE; m_bItemUsingStatus = FALSE; m_bUsingSlate = FALSE; m_bIsWhetherEffect = FALSE; m_cWhetherEffectType = NULL; m_iDownSkillIndex = -1; m_stDialogBoxInfo[15].bFlag = FALSE; m_bIsConfusion = FALSE; m_iIlusionOwnerH = NULL; m_cIlusionOwnerType = NULL; m_iDrawFlag = 0; m_bDrawFlagDir = FALSE; m_bIsAstoriaMode = FALSE; m_relicOwnedTime = 0; for(int i=0; i < MAXSIDES; i++) { m_astoriaStats[i].deaths = 0; m_astoriaStats[i].kills = 0; } m_bIsCrusadeMode = FALSE; m_iCrusadeDuty = NULL; m_bIsAvatarMode = FALSE; m_bIsAvatarMessenger = FALSE; m_iNetLagCount = NULL; m_dwEnvEffectTime = timeGetTime(); for (i = 0; i < MAXGUILDNAMES; i++) { m_stGuildName[i].dwRefTime = 0; m_stGuildName[i].iGuildRank = -1; ZeroMemory(m_stGuildName[i].cCharName, sizeof(m_stGuildName[i].cCharName)); ZeroMemory(m_stGuildName[i].cGuildName, sizeof(m_stGuildName[i].cGuildName)); } //Snoopy: 61 for (i = 0; i < 61; i++) m_bIsDialogEnabled[i] = FALSE; //Snoopy: 58 because 2 last ones alreaddy defined for (i = 0; i < 58; i++) m_cDialogBoxOrder[i] = NULL; for (i = 0; i < MAXEFFECTS; i++) { if (m_pEffectList[i] != NULL) delete m_pEffectList[i]; m_pEffectList[i] = NULL; } for (i = 0; i < MAXCHATMSGS; i++) { if (m_pChatMsgList[i] != NULL) delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } for (i = 0; i < MAXCHATSCROLLMSGS; i++) { if (m_pChatScrollList[i] != NULL) delete m_pChatScrollList[i]; m_pChatScrollList[i] = NULL; } for (i = 0; i < MAXWHISPERMSG; i++) { if (m_pWhisperMsg[i] != NULL) delete m_pWhisperMsg[i]; m_pWhisperMsg[i] = NULL; } ZeroMemory(m_cLocation, sizeof(m_cLocation)); ZeroMemory(m_cGuildName, sizeof(m_cGuildName)); m_iGuildRank = -1; m_iTotalGuildsMan = 0; for (i = 0; i < 100; i++) { m_stGuildOpList[i].cOpMode = NULL; ZeroMemory(m_stGuildOpList[i].cName, sizeof(m_stGuildOpList[i].cName)); } for (i = 0; i < 6; i++) { ZeroMemory(m_stEventHistory[i].cTxt, sizeof(m_stEventHistory[i].cTxt)); m_stEventHistory[i].dwTime = G_dwGlobalTime; ZeroMemory(m_stEventHistory2[i].cTxt, sizeof(m_stEventHistory2[i].cTxt)); m_stEventHistory2[i].dwTime = G_dwGlobalTime; } for (i = 0; i < MAXMENUITEMS; i++) { if (m_pItemForSaleList[i] != NULL) delete m_pItemForSaleList[i]; m_pItemForSaleList[i] = NULL; } for (i = 0; i < 41; i++) { m_stDialogBoxInfo[i].bFlag = FALSE; m_stDialogBoxInfo[i].sView = 0; m_stDialogBoxInfo[i].bIsScrollSelected = FALSE; } for (i = 0; i < MAXITEMS; i++) if (m_pItemList[i] != NULL) { delete m_pItemList[i]; m_pItemList[i] = NULL; } for (i = 0; i < MAXSELLLIST; i++) { m_stSellItemList[i].iIndex = -1; m_stSellItemList[i].iAmount = 0; } for (i = 0; i < MAXBANKITEMS; i++) if (m_pBankList[i] != NULL) { delete m_pBankList[i]; m_pBankList[i] = NULL; } for (i = 0; i < MAXMAGICTYPE; i++) m_cMagicMastery[i] = NULL; for (i = 0; i < MAXSKILLTYPE; i++) m_cSkillMastery[i] = NULL; for (i = 0; i < TEXTDLGMAXLINES; i++) { if (m_pMsgTextList[i] != NULL) delete m_pMsgTextList[i]; m_pMsgTextList[i] = NULL; if (m_pMsgTextList2[i] != NULL) delete m_pMsgTextList2[i]; m_pMsgTextList2[i] = NULL; if (m_pAgreeMsgTextList[i] != NULL) delete m_pAgreeMsgTextList[i]; m_pAgreeMsgTextList[i] = NULL; } m_stPartyMember.clear(); m_stPartyMember.reserve(MAXPARTYMEMBERS); m_iLU_Point = 0; m_luStat[STAT_STR] = m_luStat[STAT_VIT] = m_luStat[STAT_DEX] = m_luStat[STAT_INT] = m_luStat[STAT_MAG] = m_luStat[STAT_CHR] = 0; m_bDialogTrans = FALSE; m_cWhetherStatus = NULL; m_cLogOutCount = -1; m_dwLogOutCountTime = NULL; m_iSuperAttackLeft = 0; m_bSuperAttackMode = FALSE; m_iFightzoneNumber = 0 ; ZeroMemory(m_cBGMmapName, sizeof(m_cBGMmapName)); m_dwWOFtime = 0; m_stQuest.sWho = NULL; m_stQuest.sQuestType = NULL; m_stQuest.sContribution = NULL; m_stQuest.sTargetType = NULL; m_stQuest.sTargetCount = NULL; m_stQuest.sCurrentCount = NULL; m_stQuest.sX = NULL; m_stQuest.sY = NULL; m_stQuest.sRange = NULL; m_stQuest.bIsQuestCompleted = FALSE; ZeroMemory(m_stQuest.cTargetName, sizeof(m_stQuest.cTargetName)); m_bIsObserverMode = FALSE; m_bIsObserverCommanded = FALSE; m_bIsPoisoned = FALSE; m_bIsPrevMoveBlocked = FALSE; m_iPrevMoveX = m_iPrevMoveY = -1; m_sDamageMove = 0; m_sDamageMoveAmount = 0; m_bForceDisconn = FALSE; m_bIsSpecialAbilityEnabled = FALSE; m_iSpecialAbilityType = 0; m_dwSpecialAbilitySettingTime = NULL; m_iSpecialAbilityTimeLeftSec = NULL; m_stMCursor.cSelectedObjectType = NULL; m_bIsF1HelpWindowEnabled = FALSE; m_bIsTeleportRequested = FALSE; for (i = 0; i < MAXCRUSADESTRUCTURES; i++) { m_stCrusadeStructureInfo[i].cType = NULL; m_stCrusadeStructureInfo[i].cSide = NULL; m_stCrusadeStructureInfo[i].sX = NULL; m_stCrusadeStructureInfo[i].sY = NULL; } ZeroMemory(m_cStatusMapName, sizeof(m_cStatusMapName)); m_dwCommanderCommandRequestedTime = NULL; ZeroMemory(m_cTopMsg, sizeof(m_cTopMsg)); m_iTopMsgLastSec = NULL; m_dwTopMsgTime = NULL; m_iConstructionPoint = NULL; m_iWarContribution = NULL; ZeroMemory(m_cTeleportMapName, sizeof(m_cTeleportMapName)); m_iTeleportLocX = m_iTeleportLocY = -1; ZeroMemory(m_cConstructMapName, sizeof(m_cConstructMapName)); m_iConstructLocX = m_iConstructLocY = -1; //Snoopy: Apocalypse Gate ZeroMemory(m_cGateMapName, sizeof(m_cGateMapName)); m_iGatePositX = m_iGatePositY = -1; m_bIsHeldenianMode = FALSE; m_bIsHeldenianMap = FALSE; m_iHeldenianAresdenLeftTower = -1; m_iHeldenianElvineLeftTower = -1; m_iHeldenianAresdenFlags = -1; m_iHeldenianElvineFlags = -1; m_iHeldenianAresdenDead = -1; m_iHeldenianElvineDead = -1; m_iHeldenianAresdenKill = -1; m_bIsXmas = FALSE; m_iPartyStatus = 0; m_iGizonItemUpgradeLeft = 0; cStateChange1 = 0; cStateChange2 = 0; cStateChange3 = 0; EnableDialogBox(9, 0, 0, 0 ); } void CGame::_GetHairColorRGB(int iColorType, int * pR, int * pG, int * pB) { switch (iColorType) { case 0: // rouge foncé *pR = 14; *pG = -5; *pB = -5; break; case 1: // Orange *pR = 20; *pG = 0; *pB = 0; break; case 2: // marron tres clair *pR = 22; *pG = 13; *pB = -10; break; case 3: *pR = 0; *pG = 10; *pB = 0; break; case 4: // Bleu flashy *pR = 0; *pG = 0; *pB = 22; break; case 5: // Bleu foncé *pR = -5; *pG = -5; *pB = 15; break; case 6: //Mauve *pR = 15; *pG = -5; *pB = 16; break; case 7: // Noir *pR = -6; *pG = -6; *pB = -6; break; case 8: *pR = 10; *pG = 3; *pB = 10; break; case 9: *pR = 10; *pG = 3; *pB = -10; break; case 10: *pR = -10; *pG = 3; *pB = 10; break; case 11: *pR = 10; *pG = 3; *pB = 20; break; case 12: *pR = 21; *pG = 3; *pB = 3; break; case 13: *pR = 3; *pG = 3; *pB = 25; break; case 14: *pR = 3; *pG = 11; *pB = 3; break; case 15: *pR = 6; *pG = 8; *pB = 0; break; } } void CGame::DlgBoxClick_GuildMenu(short msX, short msY) {short sX, sY; char cTemp[21]; int iAdjX , iAdjY ; sX = m_stDialogBoxInfo[7].sX; sY = m_stDialogBoxInfo[7].sY ; iAdjX = -13; iAdjY = 30; switch (m_stDialogBoxInfo[7].cMode) { case 0: if ((msX > sX + iAdjX + 80) && (msX < sX + iAdjX + 210) && (msY > sY + iAdjY + 63) && (msY < sY + iAdjY + 78)) { if (m_iGuildRank != -1) return; if (m_stat[STAT_CHR] < 20) return; if (m_iLevel < 20) return; if (m_bIsCrusadeMode) return; EndInputString(); StartInputString(sX + 75, sY + 140, 21, m_cGuildName); m_stDialogBoxInfo[7].cMode = 1; PlaySound('E', 14, 5); } if ((msX > sX + iAdjX + 72) && (msX < sX + iAdjX + 222) && (msY > sY + iAdjY + 82) && (msY < sY + iAdjY + 99)) { if (m_iGuildRank != 0) return; if (m_bIsCrusadeMode) return; m_stDialogBoxInfo[7].cMode = 5; PlaySound('E', 14, 5); } if ((msX > sX + iAdjX + 61) && (msX < sX + iAdjX + 226) && (msY > sY + iAdjY + 103) && (msY < sY + iAdjY + 120)) { m_stDialogBoxInfo[7].cMode = 9; PlaySound('E', 14, 5); } if ((msX > sX + iAdjX + 60) && (msX < sX + iAdjX + 227) && (msY > sY + iAdjY + 123) && (msY < sY + iAdjY + 139)) { m_stDialogBoxInfo[7].cMode = 11; PlaySound('E', 14, 5); } if( m_iFightzoneNumber < 0 ) break ; if ((msX > sX + iAdjX + 72) && (msX < sX + iAdjX + 228) && (msY > sY + iAdjY + 143) && (msY < sY + iAdjY + 169)) { if (m_iGuildRank != 0) return; if (m_iFightzoneNumber == 0 ) m_stDialogBoxInfo[7].cMode = 13; else m_stDialogBoxInfo[7].cMode = 19; PlaySound('E', 14, 5); } break; case 1: if ((msX >= sX + 30) && (msX <= sX + 30 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Submit if (strcmp(m_cGuildName, "NONE") == 0) return; if (strlen(m_cGuildName) == 0) return; bSendCommand(MSGID_REQUEST_CREATENEWGUILD, MSGTYPE_CONFIRM, NULL, NULL, NULL, NULL, NULL); m_stDialogBoxInfo[7].cMode = 2; EndInputString(); PlaySound('E', 14, 5); } if ((msX >= sX + 154) && (msX <= sX + 154 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Cancel m_stDialogBoxInfo[7].cMode = 0; EndInputString(); PlaySound('E', 14, 5); } break; case 3: case 4: case 7: case 8: case 10: case 12: if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { m_stDialogBoxInfo[7].cMode = 0; PlaySound('E', 14, 5); } break; case 9: if ((msX >= sX + 30) && (msX <= sX + 30 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { ZeroMemory(cTemp, sizeof(cTemp)); strcpy(cTemp,"GuildAdmissionTicket"); bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_PURCHASEITEM, NULL, 1, NULL, NULL, cTemp); m_stDialogBoxInfo[7].cMode = 0; PlaySound('E', 14, 5); } if ((msX >= sX + 154) && (msX <= sX + 154 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Cancel m_stDialogBoxInfo[7].cMode = 0; PlaySound('E', 14, 5); } break; case 11: if ((msX >= sX + 30) && (msX <= sX + 30 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Purchase ZeroMemory(cTemp, sizeof(cTemp)); strcpy(cTemp,"GuildSecessionTicket"); bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_PURCHASEITEM, NULL, 1, NULL, NULL, cTemp); m_stDialogBoxInfo[7].cMode = 0; PlaySound('E', 14, 5); } if ((msX >= sX + 154) && (msX <= sX + 154 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Cancel m_stDialogBoxInfo[7].cMode = 0; PlaySound('E', 14, 5); } break; case 5: if ((msX >= sX + 30) && (msX <= sX + 30 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Confirm bSendCommand(MSGID_REQUEST_DISBANDGUILD, MSGTYPE_CONFIRM, NULL, NULL, NULL, NULL, NULL); m_stDialogBoxInfo[7].cMode = 6; PlaySound('E', 14, 5); } if ((msX >= sX + 154) && (msX <= sX + 154 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Cancel m_stDialogBoxInfo[7].cMode = 0; PlaySound('E', 14, 5); } break; case 13: if ((msX > sX + iAdjX + 65) && (msX < sX + iAdjX + 137) && (msY > sY + iAdjY + 168) && (msY < sY + iAdjY + 185)) { bSendCommand(MSGID_REQUEST_FIGHTZONE_RESERVE, NULL, NULL, 1, NULL, NULL, NULL); m_stDialogBoxInfo[7].cMode = 18; m_iFightzoneNumberTemp = 1; PlaySound('E', 14, 5); } if ((msX > sX + iAdjX + 150) && (msX < sX + iAdjX + 222) && (msY > sY + iAdjY + 168) && (msY < sY + iAdjY + 185)) { bSendCommand(MSGID_REQUEST_FIGHTZONE_RESERVE, NULL, NULL, 2, NULL, NULL, NULL); m_stDialogBoxInfo[7].cMode = 18; m_iFightzoneNumberTemp = 2; PlaySound('E', 14, 5); } if ((msX > sX + iAdjX + 65) && (msX < sX + iAdjX + 137) && (msY > sY + iAdjY + 188) && (msY < sY + iAdjY + 205)) { bSendCommand(MSGID_REQUEST_FIGHTZONE_RESERVE, NULL, NULL, 3, NULL, NULL, NULL); m_stDialogBoxInfo[7].cMode = 18; m_iFightzoneNumberTemp = 3; PlaySound('E', 14, 5); } if ((msX > sX + iAdjX + 150) && (msX < sX + iAdjX + 222) && (msY > sY + iAdjY + 188) && (msY < sY + iAdjY + 205)) { bSendCommand(MSGID_REQUEST_FIGHTZONE_RESERVE, NULL, NULL, 4, NULL, NULL, NULL); m_stDialogBoxInfo[7].cMode = 18; m_iFightzoneNumberTemp = 4; PlaySound('E', 14, 5); } if ((msX > sX + iAdjX + 65) && (msX < sX + iAdjX + 137) && (msY > sY + iAdjY + 208) && (msY < sY + iAdjY + 225)) { bSendCommand(MSGID_REQUEST_FIGHTZONE_RESERVE, NULL, NULL, 5, NULL, NULL, NULL); m_stDialogBoxInfo[7].cMode = 18; m_iFightzoneNumberTemp = 5; PlaySound('E', 14, 5); } if ((msX > sX + iAdjX + 150) && (msX < sX + iAdjX + 222) && (msY > sY + iAdjY + 208) && (msY < sY + iAdjY + 225)) { bSendCommand(MSGID_REQUEST_FIGHTZONE_RESERVE, NULL, NULL, 6, NULL, NULL, NULL); m_stDialogBoxInfo[7].cMode = 18; m_iFightzoneNumberTemp = 6; PlaySound('E', 14, 5); } if ((msX > sX + iAdjX + 65) && (msX < sX + iAdjX + 137) && (msY > sY + iAdjY + 228) && (msY < sY + iAdjY + 245)) { bSendCommand(MSGID_REQUEST_FIGHTZONE_RESERVE, NULL, NULL, 7, NULL, NULL, NULL); m_stDialogBoxInfo[7].cMode = 18; m_iFightzoneNumberTemp = 7; PlaySound('E', 14, 5); } if ((msX > sX + iAdjX + 150) && (msX < sX + iAdjX + 222) && (msY > sY + iAdjY + 228) && (msY < sY + iAdjY + 245)) { bSendCommand(MSGID_REQUEST_FIGHTZONE_RESERVE, NULL, NULL, 8, NULL, NULL, NULL); m_stDialogBoxInfo[7].cMode = 18; m_iFightzoneNumberTemp = 8; PlaySound('E', 14, 5); } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { // Cancel m_stDialogBoxInfo[7].cMode = 0; PlaySound('E', 14, 5); } break ; case 14:// case 15:// case 16:// case 17:// case 21:// case 22:// if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { // OK m_stDialogBoxInfo[7].cMode = 0; PlaySound('E', 14, 5); } break ; } } void CGame::CreateNewGuildResponseHandler(char * pData) {WORD * wpResult; wpResult = (WORD *)(pData + INDEX2_MSGTYPE); switch (*wpResult) { case MSGTYPE_CONFIRM: m_iGuildRank = 0; m_stDialogBoxInfo[7].cMode = 3; break; case MSGTYPE_REJECT: m_iGuildRank = -1; m_stDialogBoxInfo[7].cMode = 4; break; } } void CGame::InitPlayerCharacteristics(char * pData) { int * ip; char * cp; WORD * wp; for(int i=0;i < 6; i++) m_angelStat[i] = 0; cp = (char *)(pData + INDEX2_MSGTYPE + 2); ip = (int *)cp; m_iHP = *ip; cp += 4; ip = (int *)cp; m_iMP = *ip; cp += 4; ip = (int *)cp; m_iSP = *ip; cp += 4; ip = (int *)cp; m_iAC = *ip; cp += 4; ip = (int *)cp; m_iTHAC0 = *ip; cp += 4; ip = (int *)cp; m_iLevel = *ip; cp += 4; ip = (int *)cp; m_createStat[STAT_STR] = m_stat[STAT_STR] = *ip; cp += 4; ip = (int *)cp; m_createStat[STAT_INT] = m_stat[STAT_INT] = *ip; cp += 4; ip = (int *)cp; m_createStat[STAT_VIT] = m_stat[STAT_VIT] = *ip; cp += 4; ip = (int *)cp; m_createStat[STAT_DEX] = m_stat[STAT_DEX] = *ip; cp += 4; ip = (int *)cp; m_createStat[STAT_MAG] = m_stat[STAT_MAG] = *ip; cp += 4; ip = (int *)cp; m_createStat[STAT_CHR] = m_stat[STAT_CHR] = *ip; cp += 4; wp = (WORD *)cp; m_iLU_Point = (*wp - 3); cp += 2; ip = (int *)cp; m_iExp = *ip; cp += 4; ip = (int *)cp; m_iEnemyKillCount = *ip; cp += 4; ip = (int *)cp; m_iPKCount = *ip; cp += 4; ip = (int *)cp; m_iRewardGold = *ip; cp += 4; memcpy(m_cLocation, cp, 10); cp += 10; if (memcmp(m_cLocation, "are", 3) == 0) m_side = ARESDEN; else if (memcmp(m_cLocation, "elv", 3) == 0) m_side = ELVINE; else if (memcmp(m_cLocation, "ist", 3) == 0) m_side = ISTRIA; else m_side = NEUTRAL; cp = (char *)cp; memcpy(m_cGuildName, cp, 20); cp += 20; if (strcmp(m_cGuildName, "NONE") == 0) ZeroMemory(m_cGuildName, sizeof(m_cGuildName)); m_Misc.ReplaceString(m_cGuildName, '_', ' '); ip = (int *)cp; m_iGuildRank = *ip; cp += 4; m_iSuperAttackLeft = (int)*cp; cp++; ip = (int *)cp; m_iFightzoneNumber = *ip; cp += 4; } void CGame::DisbandGuildResponseHandler(char * pData) {WORD * wpResult; wpResult = (WORD *)(pData + INDEX2_MSGTYPE); switch (*wpResult) { case MSGTYPE_CONFIRM: ZeroMemory(m_cGuildName, sizeof(m_cGuildName)); m_iGuildRank = -1; m_stDialogBoxInfo[7].cMode = 7; break; case MSGTYPE_REJECT: m_stDialogBoxInfo[7].cMode = 8; break; } } void CGame::NotifyMsg_BanGuildMan(char * pData) { char * cp, cName[24], cLocation[12]; ZeroMemory(cName, sizeof(cName)); ZeroMemory(cLocation, sizeof(cLocation)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); memcpy(cName, cp, 20); cp += 20; cp += 2; memcpy(cLocation, cp, 10); cp += 10; ZeroMemory(m_cGuildName, sizeof(m_cGuildName)); m_iGuildRank = -1; ZeroMemory(m_cLocation, sizeof(m_cLocation)); memcpy(m_cLocation, cLocation, 10); if (memcmp(m_cLocation, "are", 3) == 0) m_side = ARESDEN; else if (memcmp(m_cLocation, "elv", 3) == 0) m_side = ELVINE; else if (memcmp(m_cLocation, "ist", 3) == 0) m_side = ISTRIA; else m_side = NEUTRAL; EnableDialogBox(8, NULL, NULL, NULL); _PutGuildOperationList(cName, 8); } void CGame::_PutGuildOperationList(char * pName, char cOpMode) {int i; for (i = 0; i < 100; i++) if (m_stGuildOpList[i].cOpMode == NULL) { m_stGuildOpList[i].cOpMode = cOpMode; ZeroMemory(m_stGuildOpList[i].cName, sizeof(m_stGuildOpList[i].cName)); memcpy(m_stGuildOpList[i].cName, pName, 20); return; } } void CGame::_ShiftGuildOperationList() {int i; ZeroMemory(m_stGuildOpList[0].cName ,sizeof(m_stGuildOpList[0].cName)); m_stGuildOpList[0].cOpMode = NULL; for (i = 1; i < 100; i++) if ((m_stGuildOpList[i-1].cOpMode == NULL) && (m_stGuildOpList[i].cOpMode != NULL)) { m_stGuildOpList[i-1].cOpMode = m_stGuildOpList[i].cOpMode; ZeroMemory(m_stGuildOpList[i-1].cName, sizeof(m_stGuildOpList[i-1].cName)); memcpy(m_stGuildOpList[i-1].cName, m_stGuildOpList[i].cName, 20); ZeroMemory(m_stGuildOpList[i].cName ,sizeof(m_stGuildOpList[i].cName)); m_stGuildOpList[i].cOpMode = NULL; } } void CGame::DlgBoxClick_GuildOp(short msX, short msY) { short sX, sY; char cName[12], cName20[24]; ZeroMemory(cName, sizeof(cName)); ZeroMemory(cName20, sizeof(cName20)); sX = m_stDialogBoxInfo[8].sX; sY = m_stDialogBoxInfo[8].sY; switch (m_stGuildOpList[0].cOpMode) { case 3: case 4: case 5: case 6: case 7: if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { _ShiftGuildOperationList(); if (m_stGuildOpList[0].cOpMode == NULL) DisableDialogBox(8); } return; } if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Approve PlaySound('E', 14, 5); switch (m_stGuildOpList[0].cOpMode) { case 1: strcpy(cName20, m_stGuildOpList[0].cName); bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_JOINGUILDAPPROVE, NULL, NULL, NULL, NULL, cName20); break; case 2: strcpy(cName20, m_stGuildOpList[0].cName); bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_DISMISSGUILDAPPROVE, NULL, NULL, NULL, NULL, cName20); break; } _ShiftGuildOperationList(); if (m_stGuildOpList[0].cOpMode == NULL) DisableDialogBox(8); } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Reject PlaySound('E', 14, 5); switch (m_stGuildOpList[0].cOpMode) { case 1: strcpy(cName20, m_stGuildOpList[0].cName); bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_JOINGUILDREJECT, NULL, NULL, NULL, NULL, cName20); break; case 2: strcpy(cName20, m_stGuildOpList[0].cName); bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_DISMISSGUILDREJECT, NULL, NULL, NULL, NULL, cName20); break; } _ShiftGuildOperationList(); if (m_stGuildOpList[0].cOpMode == NULL) DisableDialogBox(8); } } void CGame::SetItemCount(char * pItemName, DWORD dwCount) {int i; char cTmpName[21]; ZeroMemory(cTmpName, sizeof(cTmpName)); strcpy(cTmpName, pItemName); for (i = 0; i < MAXITEMS; i++) if ((m_pItemList[i] != NULL) && (memcmp(m_pItemList[i]->m_cName, cTmpName, 20) == 0)) { m_pItemList[i]->m_dwCount = dwCount; return; } } void CGame::AddEventList(char * pTxt, char cColor, BOOL bDupAllow) {int i; if ((bDupAllow == FALSE) && (strcmp(m_stEventHistory[5].cTxt, pTxt) == 0)) return; if (cColor == 10) { for (i = 1; i < 6; i++) { strcpy(m_stEventHistory2[i-1].cTxt, m_stEventHistory2[i].cTxt); m_stEventHistory2[i-1].cColor = m_stEventHistory2[i].cColor; m_stEventHistory2[i-1].dwTime = m_stEventHistory2[i].dwTime; } ZeroMemory(m_stEventHistory2[5].cTxt, sizeof(m_stEventHistory2[5].cTxt)); strcpy(m_stEventHistory2[5].cTxt, pTxt); m_stEventHistory2[5].cColor = cColor; m_stEventHistory2[5].dwTime = m_dwCurTime; }else { for (i = 1; i < 6; i++) { strcpy(m_stEventHistory[i-1].cTxt, m_stEventHistory[i].cTxt); m_stEventHistory[i-1].cColor = m_stEventHistory[i].cColor; m_stEventHistory[i-1].dwTime = m_stEventHistory[i].dwTime; } ZeroMemory(m_stEventHistory[5].cTxt, sizeof(m_stEventHistory[5].cTxt)); strcpy(m_stEventHistory[5].cTxt, pTxt); m_stEventHistory[5].cColor = cColor; m_stEventHistory[5].dwTime = m_dwCurTime; } } int _iAttackerHeight[] = {0, 35, 35,35,35,35,35, 0,0,0, 5, // Slime 35, // Skeleton 40, // Stone-Golem 45, // Cyclops 35,// OrcMage 35,// ShopKeeper 5, // GiantAnt 8, // Scorpion 35,// Zombie 35,// Gandalf 35,// Howard 35,// Guard 10,// Amphis 38,// Clay-Golem 35,// Tom 35,// William 35,// Kennedy 35,// Hellhound 50,// Troll 45,// Orge 55,// Liche 65,// Demon 46,// Unicorn 49,// WereWolf 55,// Dummy 35,// Energysphere 75,// Arrow Guard Tower 75,// Cannon Guard Tower 50,// Mana Collector 50,// Detector 50,// Energy Shield Generator 50,// Grand Magic Generator 50,// ManaStone 42 40,// Light War Beetle 35,// GHK 40,// GHKABS 35,// TK 60,// BG 40,// Stalker 70,// HellClaw 85,// Tigerworm 50,// Catapult 85,// Gargoyle 70,// Beholder 40,// Dark-Elf 20,// Bunny 20,// Cat 40,// Giant-Frog 80,// Mountain-Giant 85,// Ettin 50,// Cannibal-Plant 50, // Rudolph 61 //Snoopy.... 80, // Direboar 62 90, // Frost 63 40, // Crops 64 80, // IceGolem 65 190, // Wyvern 66 35, // npc 67 35, // npc 68 35, // npc 69 100, // Dragon 70 90, // Centaur 71 75, // ClawTurtle 72 200, // FireWyvern 73 80, // GiantCrayfish 74 120, // Gi Lizard 75 100, // Gi Tree 76 100, // Master Orc 77 80, // Minaus 78 100, // Nizie 79 25, // Tentocle 80 200, // Abaddon 81 60, // Sorceress 82 60, // ATK 83 70, // MasterElf 84 60, // DSK 85 50, // HBT 86 60, // CT 87 60, // Barbarian 88 60, // AGC 89 35, // ncp 90 Gail 35 // Gate 91 }; void CGame::bAddNewEffect(short sType, int sX, int sY, int dX, int dY, char cStartFrame, int iV1) {int i; short sAbsX, sAbsY, sDist; long lPan; int iV2 = 0; if (m_cDetailLevel == 0) // Detail Level Low { switch (sType) { case 8: case 9: case 11: case 12: case 14: case 15: return; } } if( m_bIsProgramActive == FALSE ) return; sAbsX = abs(((m_sViewPointX / 32) + 10) - dX); sAbsY = abs(((m_sViewPointY / 32) + 7) - dY); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; for (i = 0; i < MAXEFFECTS; i++) if (m_pEffectList[i] == NULL) { m_pEffectList[i] = new class CEffect; m_pEffectList[i]->m_sType = sType; m_pEffectList[i]->m_sX = sX; m_pEffectList[i]->m_sY = sY; m_pEffectList[i]->m_dX = dX; m_pEffectList[i]->m_dY = dY; m_pEffectList[i]->m_iV1 = iV1; m_pEffectList[i]->m_cFrame = cStartFrame; m_pEffectList[i]->m_dwTime = m_dwCurTime; switch (sType) { case 1: // coup normal m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32 - _iAttackerHeight[iV1]; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = 2; m_pEffectList[i]->m_dwFrameTime = 10; break; case 2: // Flêche qui vole m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32 - _iAttackerHeight[iV1]; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = 0; m_pEffectList[i]->m_dwFrameTime = 10; m_pEffectList[i]->m_cDir = m_Misc.cCalcDirection(sX, sY, dX, dY); PlaySound('C', 4, sDist); break; case 4: // Gold m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32; m_pEffectList[i]->m_cMaxFrame = 12; m_pEffectList[i]->m_dwFrameTime = 100; sAbsX = abs(((m_sViewPointX / 32) + 10) - sX); sAbsY = abs(((m_sViewPointY / 32) + 7) - sY); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; lPan = -(((m_sViewPointX / 32) + 10) - sX)*1000; PlaySound('E', 12, sDist, lPan); break; case 5: // FireBall Fire Explosion m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 11; m_pEffectList[i]->m_dwFrameTime = 10; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = -(((m_sViewPointX / 32) + 10) - sX)*1000; PlaySound('E', 4, sDist, lPan); SetCameraShakingEffect(sDist); break; case 6: // Energy Bolt case 10: // Lightning Arrow m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 14; m_pEffectList[i]->m_dwFrameTime = 10; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = -(320 - (sX - m_sViewPointX))*1000; PlaySound('E', 2, sDist, lPan); SetCameraShakingEffect(sDist); break; case 7: // Magic Missile Explosion m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 5; m_pEffectList[i]->m_dwFrameTime = 50; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = -(320 - (sX - m_sViewPointX))*1000; PlaySound('E', 3, sDist, lPan); break; case 8: // Burst m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 4; m_pEffectList[i]->m_dwFrameTime = 30; break; case 9: // Burst m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_rX = 6 - (rand() % 12); m_pEffectList[i]->m_rY = -8 - (rand() % 6); m_pEffectList[i]->m_cMaxFrame = 14; m_pEffectList[i]->m_dwFrameTime = 30; break; case 11: m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_rX = 6 - (rand() % 12); if (iV2 == 0) m_pEffectList[i]->m_rY = -2 - (rand() % 4); else m_pEffectList[i]->m_rY = -2 - (rand() % 10); m_pEffectList[i]->m_cMaxFrame = 8; m_pEffectList[i]->m_dwFrameTime = 30; break; case 12: // Burst m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_rX = 8 - (rand() % 16); m_pEffectList[i]->m_rY = 4 - (rand() % 12); m_pEffectList[i]->m_cMaxFrame = 10; m_pEffectList[i]->m_dwFrameTime = 30; break; case 13: // Bulles druncncity m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 18; m_pEffectList[i]->m_dwFrameTime = 20; break; case 14: // Traces de pas ou Tremor (pas en low detail) m_pEffectList[i]->m_mX = sX; if (m_pEffectList[i]->m_iV1 > 0) // Case if hit by an arrow { m_pEffectList[i]->m_mY = sY - (_iAttackerHeight[m_pEffectList[i]->m_iV1]/4 + rand()%(_iAttackerHeight[m_pEffectList[i]->m_iV1]/2) ); m_pEffectList[i]->m_mX = sX + (rand()%5) -2; }else m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 4; m_pEffectList[i]->m_dwFrameTime = 100; m_pEffectList[i]->m_iV1 = iV1; break; case 15: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 16; m_pEffectList[i]->m_dwFrameTime = 80; break; case 16: // m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32 - 40; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = NULL; m_pEffectList[i]->m_dwFrameTime = 20; break; case 17: m_pEffectList[i]->m_mX = sX + (rand() % 20) - 40; m_pEffectList[i]->m_mY = sY + (rand() % 20) - 40; m_pEffectList[i]->m_rX = 8 - (rand() % 16); m_pEffectList[i]->m_rY = 4 - (rand() % 12); m_pEffectList[i]->m_mX3 = sX; m_pEffectList[i]->m_mY3 = sY; m_pEffectList[i]->m_iV1 = 0; m_pEffectList[i]->m_dwFrameTime = 20; break; case 18: m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 10; m_pEffectList[i]->m_dwFrameTime = 50; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; SetCameraShakingEffect(sDist); break; case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27: // Critical strike with a weapon m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32 - 40; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = 0; m_pEffectList[i]->m_dwFrameTime = 10; m_pEffectList[i]->m_cDir = m_Misc.cCalcDirection(sX, sY, dX, dY); break; case 30: // Mass-Fire-Strike (called 1 time) m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 9; m_pEffectList[i]->m_dwFrameTime = 40; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = -(320 - (sX - m_sViewPointX))*1000; PlaySound('E', 4, sDist, lPan); SetCameraShakingEffect(sDist*2); break; case 31: // Mass-Fire-Strike (called 3 times) case 252: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 8; m_pEffectList[i]->m_dwFrameTime = 40; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = -(320 - (sX - m_sViewPointX))*1000; PlaySound('E', 4, sDist, lPan); SetCameraShakingEffect(sDist); break; case 32: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = 4; m_pEffectList[i]->m_dwFrameTime = 100; break; case 33: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 16; m_pEffectList[i]->m_dwFrameTime = 10; break; case 34: // m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32 - 40; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = NULL; m_pEffectList[i]->m_dwFrameTime = 20; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; SetCameraShakingEffect(sDist); break; case 35: // Snoopy: rajout (pour Mass Magic-Missile) m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 18; m_pEffectList[i]->m_dwFrameTime = 40; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = -(320 - (sX - m_sViewPointX))*1000; PlaySound('E', 4, sDist, lPan); SetCameraShakingEffect(sDist*2); break; case 36: // Snoopy: Rajout (pour Mass Magic-Missile) m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 15; m_pEffectList[i]->m_dwFrameTime = 40; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = -(320 - (sX - m_sViewPointX))*1000; PlaySound('E', 4, sDist, lPan); SetCameraShakingEffect(sDist); break; case 40: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 15; m_pEffectList[i]->m_dwFrameTime = 30; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = ((sX - m_sViewPointX)-320)*30; PlaySound('E', 45, sDist, lPan); break; case 41: // Large Type 1, 2, 3, 4 case 42: case 43: case 44: case 45: // Small Type 1, 2 case 46: m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY -220; m_pEffectList[i]->m_cMaxFrame = 14; m_pEffectList[i]->m_dwFrameTime = 20; m_pEffectList[i]->m_iV1 = 20; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = ((sX - m_sViewPointX)-320)*30; PlaySound('E', 46, sDist, lPan); break; case 47: // Blizzard case 48: // Blizzard case 49: // Blizzard m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY -220; m_pEffectList[i]->m_cMaxFrame = 12; m_pEffectList[i]->m_dwFrameTime = 20; m_pEffectList[i]->m_iV1 = 20; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = ((sX - m_sViewPointX)-320)*30; PlaySound('E', 46, sDist, lPan); break; case 50: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 12; m_pEffectList[i]->m_dwFrameTime = 50; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = ((sX - m_sViewPointX)-320)*30; if ((rand()%4) == 1) SetCameraShakingEffect(sDist); PlaySound('E', 47, sDist, lPan); break; case 51: m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 9; //15; m_pEffectList[i]->m_dwFrameTime = 80; break; case 52: // Protect ring m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 15; m_pEffectList[i]->m_dwFrameTime = 80; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = ((sX - m_sViewPointX)-320)*30; PlaySound('E', 5, sDist, lPan); break; case 53: // Hold twist m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 15; m_pEffectList[i]->m_dwFrameTime = 80; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = ((sX - m_sViewPointX)-320)*30; PlaySound('E', 5, sDist, lPan); break; case 54: // star twingkling (effect armes brillantes) case 55: // Unused m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 10; m_pEffectList[i]->m_dwFrameTime = 15; break; case 56: // Mass-Chill-Wind m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 14; m_pEffectList[i]->m_dwFrameTime = 30; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = ((sX - m_sViewPointX)-320)*30; PlaySound('E', 45, sDist, lPan); break; case 57: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 16; m_pEffectList[i]->m_dwFrameTime = 80; break; case 60: // m_pEffectList[i]->m_mX = sX +300; m_pEffectList[i]->m_mY = sY -460; m_pEffectList[i]->m_cMaxFrame = 10; m_pEffectList[i]->m_dwFrameTime = 50; break; case 61: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 16; m_pEffectList[i]->m_dwFrameTime = 10; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = -(((m_sViewPointX / 32) + 10) - sX)*1000; PlaySound('E', 4, sDist, lPan); SetCameraShakingEffect(sDist, 2); break; case 62: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 6; m_pEffectList[i]->m_dwFrameTime = 100; break; case 63: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 16; m_pEffectList[i]->m_dwFrameTime = 20; break; case 64: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 15; m_pEffectList[i]->m_dwFrameTime = 20; break; case 65: // Crusade's MS m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 30; m_pEffectList[i]->m_dwFrameTime = 80; break; case 66: // Crusade MS explosion m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 14; m_pEffectList[i]->m_dwFrameTime = 30; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = -(((m_sViewPointX / 32) + 10) - sX)*1000; PlaySound('E', 4, sDist, lPan); SetCameraShakingEffect(sDist, 2); break; case 67: // Crusade's MS fire + smoke ? m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 27; m_pEffectList[i]->m_dwFrameTime = 10; break; case 68: // worm-bite m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 17; m_pEffectList[i]->m_dwFrameTime = 30; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = -(((m_sViewPointX / 32) + 10) - sX)*1000; PlaySound('E', 4, sDist, lPan); m_pEffectList[i]->m_iV1 = sDist; //SetCameraShakingEffect(sDist, 2); break; case 69: // identique au cas 70 m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 11; m_pEffectList[i]->m_dwFrameTime = 30; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = -(((m_sViewPointX / 32) + 10) - (sX/32))*1000; PlaySound('E', 42, sDist, lPan); break; case 70: // identtique au cas 69 m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 11; m_pEffectList[i]->m_dwFrameTime = 30; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = -(((m_sViewPointX / 32) + 10) - (sX/32))*1000; PlaySound('E', 42, sDist, lPan); break; case 71: // m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = NULL; m_pEffectList[i]->m_dwFrameTime = 20; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; SetCameraShakingEffect(sDist); break; case 72: // Blizzard m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 15; m_pEffectList[i]->m_dwFrameTime = 20; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; lPan = ((sX - m_sViewPointX)-320)*30; if ((rand()%4) == 1) SetCameraShakingEffect(sDist); PlaySound('E', 47, sDist, lPan); break; case 73: m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 15; m_pEffectList[i]->m_dwFrameTime = 60; break; case 74: m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 19; m_pEffectList[i]->m_dwFrameTime = 40; break; case 75: //ice golem m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_dX = dX; m_pEffectList[i]->m_dY = dY; m_pEffectList[i]->m_cMaxFrame = 16; m_pEffectList[i]->m_dwFrameTime = 40; break; case 76: //ice golem m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_dX = dX; m_pEffectList[i]->m_dY = dY; m_pEffectList[i]->m_cMaxFrame = 16; m_pEffectList[i]->m_dwFrameTime = 40; break; case 77: //ice golem m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_dX = dX; m_pEffectList[i]->m_dY = dY; m_pEffectList[i]->m_cMaxFrame = 16; m_pEffectList[i]->m_dwFrameTime = 40; break; case 80: // Snoopy: rajoué, implémenté en dernier ds la v351 m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_iV1 = 20; m_pEffectList[i]->m_cMaxFrame = 30; m_pEffectList[i]->m_dwFrameTime = 25; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; SetCameraShakingEffect(sDist); break; case 81: // Snoopy: Rajout (StormBlade) m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = 27; m_pEffectList[i]->m_dwFrameTime = 40; break; case 82: // Snoopy: Rajout (Gate Apocalypse) m_pEffectList[i]->m_cMaxFrame = 30; m_pEffectList[i]->m_dwFrameTime = 40; break; case 100: // MagicMissile is Flying m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32 - 40; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = NULL; m_pEffectList[i]->m_dwFrameTime = 20; lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 1, sDist, lPan); break; case 101: // Heal case 111: // Staminar-Drain case 121: // Great Heal case 123: // Staminar-Recovery case 128: // Great-Staminar-Recovery m_pEffectList[i]->m_cMaxFrame = 14; m_pEffectList[i]->m_dwFrameTime = 80; lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 5, sDist, lPan); break; case 102: // CreateFood case 122: // Recall case 126: // Possession case 127: // Poison case 134: // DetectInvi case 136: // Cure case 142: // Confuse language case 152: // Polymorph case 153: // Mass-Poison case 162: // Confusion case 171: // Mass-Confusion m_pEffectList[i]->m_cMaxFrame = 13; m_pEffectList[i]->m_dwFrameTime = 120; lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 5, sDist, lPan); break; case 110: // Energy-Bolt m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32 - 40; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = NULL; m_pEffectList[i]->m_dwFrameTime = 20; lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 1, sDist, lPan); break; case 112: // Recall case 131: // Summon case 132: // Invi m_pEffectList[i]->m_cMaxFrame = 12; m_pEffectList[i]->m_dwFrameTime = 80; lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 5, sDist, lPan); break; case 113: // Defense-Shield case 144: // Great-Defense-Shield m_pEffectList[i]->m_cMaxFrame = 12; m_pEffectList[i]->m_dwFrameTime = 120; lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 5, sDist, lPan); break; case 114: // Celebrating Light bAddNewEffect(69 +(rand()%2), dX*32 +20 - (rand() % 40), dY*32 +20 - (rand() % 40), NULL, NULL, -12); bAddNewEffect(69 +(rand()%2), dX*32 +20 - (rand() % 40), dY*32 +20 - (rand() % 40), NULL, NULL, -9); bAddNewEffect(69 +(rand()%2), dX*32 +20 - (rand() % 40), dY*32 +20 - (rand() % 40), NULL, NULL, -6); bAddNewEffect(69 +(rand()%2), dX*32 +20 - (rand() % 40), dY*32 +20 - (rand() % 40), NULL, NULL, -3); bAddNewEffect(69 +(rand()%2), dX*32 +20 - (rand() % 40), dY*32 +20 - (rand() % 40), NULL, NULL, 0); delete m_pEffectList[i]; m_pEffectList[i] = NULL; break; case 120: // Fire Ball m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32 - 40; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = NULL; m_pEffectList[i]->m_dwFrameTime = 20; m_pEffectList[i]->m_cDir = m_Misc.cCalcDirection(sX, sY, dX, dY); lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 1, sDist, lPan); break; case 124: // Protect form N.M case 133: // Protection from Magic bAddNewEffect(52, dX*32, dY*32, NULL, NULL, 0, 0); delete m_pEffectList[i]; m_pEffectList[i] = NULL; break; case 125: // Hold Person case 135: // Paralyze bAddNewEffect(53, dX*32, dY*32, NULL, NULL, 0, 0); delete m_pEffectList[i]; m_pEffectList[i] = NULL; break; case 130: // Fire Strike case 137: // Lightning Arrow m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32 - 40; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = NULL; m_pEffectList[i]->m_dwFrameTime = 20; m_pEffectList[i]->m_cDir = m_Misc.cCalcDirection(sX, sY, dX, dY); lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 1, sDist, lPan); break; case 138: // Tremor. lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 4, sDist, lPan); SetCameraShakingEffect(sDist, 2); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); m_pEffectList[i]->m_cMaxFrame = 2; m_pEffectList[i]->m_dwFrameTime = 10; break; case 143: // Lightning m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32 - 50; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_rX = 5 - (rand() % 10); m_pEffectList[i]->m_rY = 5 - (rand() % 10); m_pEffectList[i]->m_cMaxFrame = 7; m_pEffectList[i]->m_dwFrameTime = 10; lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 40, sDist, lPan); break; case 145: // ChillWind m_pEffectList[i]->m_cMaxFrame = 2; m_pEffectList[i]->m_dwFrameTime = 10; break; case 147: // Triple-Energy-Bolt m_pEffectList[i]->m_cMaxFrame = NULL ; m_pEffectList[i]->m_dwFrameTime = 20; break; case 150: // Berserk : Cirlcle 6 magic case 177: // Illusion-Movement case 180: // Illusion case 183: // Inhibition-Casting case 190: // Mass-Illusion case 195: // Mass-Illusion-Movement m_pEffectList[i]->m_cMaxFrame = 11; m_pEffectList[i]->m_dwFrameTime = 100; lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 5, sDist, lPan); break; case 151: // LightningBolt m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32 - 50; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_rX = 5 - (rand() % 10); m_pEffectList[i]->m_rY = 5 - (rand() % 10); m_pEffectList[i]->m_cMaxFrame = 10; m_pEffectList[i]->m_dwFrameTime = 10; lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 40, sDist, lPan); break; case 156: // Mass-Ligtning-Arrow m_pEffectList[i]->m_cMaxFrame = 3; m_pEffectList[i]->m_dwFrameTime = 130; break; case 157: // Ice-Strike m_pEffectList[i]->m_cMaxFrame = 2; m_pEffectList[i]->m_dwFrameTime = 10; break; case 160: // Energy-Strike m_pEffectList[i]->m_cMaxFrame = 7; m_pEffectList[i]->m_dwFrameTime = 80; break; case 161: // Mass-Fire-Strike case 251: // m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32 - 40; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = NULL; m_pEffectList[i]->m_dwFrameTime = 20; m_pEffectList[i]->m_cDir = m_Misc.cCalcDirection(sX, sY, dX, dY); lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 1, sDist, lPan); break; case 163: // Mass-Chill-Wind m_pEffectList[i]->m_cMaxFrame = 2; m_pEffectList[i]->m_dwFrameTime = 10; break; case 164: // worm-bite lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 4, sDist, lPan); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); bAddNewEffect(14, dX*32 + (rand() % 120) - 60, dY*32 + (rand() % 80) - 40, NULL, NULL, 0, 0); m_pEffectList[i]->m_cMaxFrame = 1; m_pEffectList[i]->m_dwFrameTime = 10; break; case 165: // Absolute-Magic-Protection m_pEffectList[i]->m_cMaxFrame = 21; m_pEffectList[i]->m_dwFrameTime = 70; lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 5, sDist, lPan); break; case 166: // Armor Break m_pEffectList[i]->m_cMaxFrame = 13; m_pEffectList[i]->m_dwFrameTime = 80; lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 5, sDist, lPan); break; case 170: // Bloody-Shock-Wave m_pEffectList[i]->m_cMaxFrame = 7; m_pEffectList[i]->m_dwFrameTime = 80; break; case 172: // Mass-Ice-Strike m_pEffectList[i]->m_cMaxFrame = 2; m_pEffectList[i]->m_dwFrameTime = 10; break; case 174: // Lightning-Strike m_pEffectList[i]->m_cMaxFrame = 5; m_pEffectList[i]->m_dwFrameTime = 120; break; case 176: // Snoopy: Ajout Cancellation m_pEffectList[i]->m_cMaxFrame = 23; m_pEffectList[i]->m_dwFrameTime = 60; sDist = sDist / 32; lPan = -(((m_sViewPointX / 32) + 10) - sX)*1000; PlaySound('E', 5, sDist, lPan); break; case 181: // MS m_pEffectList[i]->m_mX = dX*32 +300; m_pEffectList[i]->m_mY = dY*32 -460; m_pEffectList[i]->m_cMaxFrame = 10; m_pEffectList[i]->m_dwFrameTime = 25; break; case 182: // Snoopy: Ajout Mass-Magic-Missile m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32 - 40; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = NULL; m_pEffectList[i]->m_dwFrameTime = 20; lPan = -(((m_sViewPointX / 32) + 10) - dX)*1000; PlaySound('E', 1, sDist, lPan); break; case 244: // Snoopy: déplacé pour nvx sorts: Aura du casteur de Mass MagicMissile //case 184: // effet sur le caster pour MassMM m_pEffectList[i]->m_cMaxFrame = 29; m_pEffectList[i]->m_dwFrameTime = 80; m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; break; case 191: // Blizzard m_pEffectList[i]->m_cMaxFrame = 7; m_pEffectList[i]->m_dwFrameTime = 80; break; //case 192: // Hero set Effect case 242: // Hero set Effect m_pEffectList[i]->m_cMaxFrame = 30; m_pEffectList[i]->m_dwFrameTime = 40; break; //case 193: // Hero set Effect case 243: // Hero set Effect m_pEffectList[i]->m_cMaxFrame = 19; m_pEffectList[i]->m_dwFrameTime = 18; break; case 194: // Resurrection m_pEffectList[i]->m_cMaxFrame = 30; m_pEffectList[i]->m_dwFrameTime = 40; break; case 196: // Snoopy: Ajout de Earth-Shock-Wave m_pEffectList[i]->m_mX = sX*32; m_pEffectList[i]->m_mY = sY*32; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = 30; m_pEffectList[i]->m_dwFrameTime = 25; sAbsX = abs(320 - (sX - m_sViewPointX)); sAbsY = abs(240 - (sY - m_sViewPointY)); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; sDist = sDist / 32; SetCameraShakingEffect(sDist); break; case 200: // case 201: // case 202: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 15; m_pEffectList[i]->m_dwFrameTime = 25; break; case 203: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 18; m_pEffectList[i]->m_dwFrameTime = 70; break; case 204: // case 205: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 12; m_pEffectList[i]->m_dwFrameTime = 70; break; case 206: // m_pEffectList[i]->m_mX = sX; m_pEffectList[i]->m_mY = sY; m_pEffectList[i]->m_cMaxFrame = 3; m_pEffectList[i]->m_dwFrameTime = 70; break; case 250: // m_pEffectList[i]->m_mX = sX * 32; m_pEffectList[i]->m_mY = sY * 32 -40; m_pEffectList[i]->m_iErr = 0; m_pEffectList[i]->m_cMaxFrame = 0; m_pEffectList[i]->m_dwFrameTime = 10; break; default: delete m_pEffectList[i]; m_pEffectList[i] = NULL; break; } if (m_pEffectList[i] != NULL) { m_pEffectList[i]->m_mX2 = m_pEffectList[i]->m_mX; m_pEffectList[i]->m_mY2 = m_pEffectList[i]->m_mY; } return; } } void CGame::DrawEffects() { int i, dX, dY, iDvalue, tX, tY, rX, rY, rX2, rY2, rX3, rY3, rX4, rY4, rX5, rY5, iErr; char cTempFrame; DWORD dwTime = m_dwCurTime; for (i = 0; i < MAXEFFECTS; i++) if ((m_pEffectList[i] != NULL) && (m_pEffectList[i]->m_cFrame >= 0)) { switch (m_pEffectList[i]->m_sType) { case 1: // Normal hit if (m_pEffectList[i]->m_cFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[8]->PutTransSprite_NoColorKey(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); break; case 2: // Arrow flying dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; cTempFrame = (m_pEffectList[i]->m_cDir-1)*2; if (cTempFrame < 0) break; m_pEffectSpr[7]->PutSpriteFast(dX, dY, cTempFrame, dwTime); break; case 4: // gold /* 1.5 if (m_pEffectList[i]->m_cFrame < 9) break; cTempFrame = m_pEffectList[i]->m_cFrame - 9; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[1]->PutSpriteFast(dX, dY-40, cTempFrame, dwTime); */ break; case 5: // FireBall Fire Explosion cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; iDvalue = (cTempFrame - 8)*(-5); if (cTempFrame < 7) m_pEffectSpr[3]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); else m_pEffectSpr[3]->PutTransSpriteRGB(dX, dY, cTempFrame, iDvalue, iDvalue, iDvalue, dwTime); break; case 6: // Energy Bolt case 10: // Lightning Arrow cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; iDvalue = (cTempFrame - 7)*(-6); if (cTempFrame < 6) m_pEffectSpr[6]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); else m_pEffectSpr[6]->PutTransSpriteRGB(dX, dY, cTempFrame, iDvalue, iDvalue, iDvalue, dwTime); // RGB2 break; case 7: // Magic Missile Explosion cTempFrame = m_pEffectList[i]->m_cFrame; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; iDvalue = (cTempFrame - 4)*(-3); if (cTempFrame < 4) m_pEffectSpr[6]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); else m_pEffectSpr[6]->PutTransSpriteRGB(dX, dY, cTempFrame, iDvalue, iDvalue, iDvalue, dwTime); // RGB2 break; case 8: // Burst cTempFrame = m_pEffectList[i]->m_cFrame; cTempFrame = 4 - cTempFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[11]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 9: // Burst cTempFrame = (rand() % 5); if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[11]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 11: // pt grenat cTempFrame = (rand() % 5) + 5; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[11]->PutTransSprite2(dX, dY, cTempFrame, dwTime); break; case 12: // Burst cTempFrame = (rand() % 6) + 10; if (cTempFrame < 0) break; iDvalue = (m_pEffectList[i]->m_cFrame - 4)*(-3); dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; if (cTempFrame < 4) m_pEffectSpr[11]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); else //m_pEffectSpr[11]->PutTransSpriteRGB(dX, dY, cTempFrame, iDvalue, iDvalue, iDvalue, dwTime); // RGB2 // m_pEffectSpr[11]->PutTransSprite(dX, dY, cTempFrame, dwTime); break; case 13: cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; if (cTempFrame < 13) { m_pEffectSpr[11]->PutTransSprite_NoColorKey(dX, dY, 25 + (cTempFrame / 5), dwTime); }else { m_pEffectSpr[11]->PutTransSprite_NoColorKey(dX, dY, (8 + cTempFrame), dwTime); } break; case 14: // Traces de pas (terrain sec) if (m_pEffectList[i]->m_cFrame < 0) break; dX = m_pEffectList[i]->m_mX - m_sViewPointX; dY = m_pEffectList[i]->m_mY - m_sViewPointY; m_pEffectSpr[11]->PutTransSprite50_NoColorKey(dX, dY, (28 + m_pEffectList[i]->m_cFrame), dwTime); break; case 15: // petits nuages rouges cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = m_pEffectList[i]->m_mX - m_sViewPointX; dY = m_pEffectList[i]->m_mY - m_sViewPointY; m_pEffectSpr[11]->PutTransSprite50_NoColorKey(dX, dY, (33 + cTempFrame), dwTime); break; case 16: // dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[0]->PutTransSprite_NoColorKey(dX, dY, 0, dwTime); break; case 17: //test dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; cTempFrame = 39 + (rand() % 3)*3 + (rand() % 3); if (cTempFrame < 0) break; m_pEffectSpr[11]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); dX = (m_pEffectList[i]->m_mX2) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY2) - m_sViewPointY; m_pEffectSpr[11]->PutTransSprite50_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 18: // dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; m_pEffectSpr[18]->PutTransSprite70_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 20: // critical hit case 21: case 22: case 23: case 24: case 25: case 26: case 27: // Critical strike with a weapon dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[8]->PutTransSprite_NoColorKey(dX, dY, 1, dwTime); break; case 30: // Mass-Fire-Strike dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; m_pEffectSpr[14]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 31: // Mass-Fire-Strike dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; m_pEffectSpr[15]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 32: // Trace de pas (raining weather) dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; cTempFrame = m_pEffectList[i]->m_cFrame + 20; if (cTempFrame < 0) break; m_pEffectSpr[11]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 33: // dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; iDvalue = 0; m_pEffectSpr[19]->PutTransSpriteRGB(dX, dY, cTempFrame, iDvalue, iDvalue, iDvalue, dwTime); // RGB2 break; case 34: // absent (220 et 351) break; case 35: // Snoopy: Ajout if (m_pEffectList[i]->m_cFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; cTempFrame = m_pEffectList[i]->m_cFrame; m_pEffectSpr[6]->PutTransSprite_NoColorKey(dX-30, dY-18, cTempFrame, dwTime); break; case 36: // Snoopy: Ajout if (m_pEffectList[i]->m_cFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; cTempFrame = m_pEffectList[i]->m_cFrame; m_pEffectSpr[97]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 40: cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[20]->PutTransSprite50_NoColorKey(dX, dY, cTempFrame, dwTime); // 20 break; case 41: // Large Type 1, 2, 3, 4 case 42: case 43: case 44: case 45: // Small Type 1, 2 case 46: dX = (m_pEffectList[i]->m_sX) - m_sViewPointX; dY = (m_pEffectList[i]->m_sY) - m_sViewPointY; m_pEffectSpr[21]->PutFadeSprite(dX, dY, 48, dwTime); cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; if ((8*(m_pEffectList[i]->m_sType-41) +cTempFrame) < (8*(m_pEffectList[i]->m_sType-41) +7)) { iDvalue = -8*(6 - cTempFrame); m_pEffectSpr[21]->PutTransSpriteRGB(dX, dY, 8*(m_pEffectList[i]->m_sType-41) +cTempFrame, iDvalue, iDvalue, iDvalue, dwTime); // RGB2 }else { if ((cTempFrame - 5) >= 8) cTempFrame = ((cTempFrame - 5) - 8) + 5; m_pEffectSpr[21]->PutSpriteFast(dX, dY, 8*(m_pEffectList[i]->m_sType-41) + (cTempFrame - 5), dwTime); } break; case 47: case 48: case 49: // Blizzard dX = (m_pEffectList[i]->m_sX) - m_sViewPointX; dY = (m_pEffectList[i]->m_sY) - m_sViewPointY; m_pEffectSpr[m_pEffectList[i]->m_sType-1]->PutRevTransSprite(dX, dY, 0, dwTime); cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; //PutString(dX, dY, "*", RGB(255,255,255)); if (cTempFrame < 7) { iDvalue = -8*(6 - cTempFrame); m_pEffectSpr[m_pEffectList[i]->m_sType-1]->PutTransSpriteRGB(dX, dY, cTempFrame+1, iDvalue, iDvalue, iDvalue, dwTime); } else { if (cTempFrame >= 8) cTempFrame = cTempFrame % 8; m_pEffectSpr[m_pEffectList[i]->m_sType-1]->PutSpriteFast(dX, dY, cTempFrame+1, dwTime); } break; case 50: cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; if (cTempFrame <= 6) { iDvalue = 0; m_pEffectSpr[22]->PutTransSpriteRGB(dX, dY, cTempFrame, iDvalue, iDvalue, iDvalue, dwTime); // RGB2 } else { iDvalue = -5*(cTempFrame - 6); m_pEffectSpr[22]->PutTransSpriteRGB(dX, dY, 6, iDvalue, iDvalue, iDvalue, dwTime); // RGB2 } break; case 51: // cTempFrame = m_pEffectList[i]->m_cFrame + 11; //15 if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[28]->PutTransSprite25(dX, dY, cTempFrame, dwTime); //20 break; case 52: // Protection Ring commente par siementec, a voir /* cTempFrame = m_pEffectList[i]->m_cFrame; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[24]->PutTransSprite(dX, dY, cTempFrame, dwTime); */ break; case 53: // Hold Twist cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; if (cTempFrame < 0) cTempFrame = 0; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[25]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); //25 break; case 54: // star twingkling (effect armes brillantes) cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) cTempFrame = 0; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[28]->PutTransSprite(dX, dY, cTempFrame, dwTime); break; case 55: // cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) cTempFrame = 0; dX = (m_pEffectList[i]->m_mX); dY = (m_pEffectList[i]->m_mY); m_pEffectSpr[28]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 56: // Mass-Chill-Wind cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) cTempFrame = 0; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[29]->PutTransSprite50_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 57: // absent (220 et 351) break; case 60: // case 181: // MS cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; if (cTempFrame > 4) { cTempFrame = cTempFrame / 4; } if (cTempFrame >= 0) { dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[31]->PutSpriteFast(dX, dY, 15 + cTempFrame, dwTime); m_pEffectSpr[31]->PutTransSprite(dX, dY, cTempFrame, dwTime); } break; case 61: // Fire aura on ground (crueffect1, 1) cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[32]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 62: // MS strike cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; if (cTempFrame > 0) { cTempFrame = cTempFrame - 1; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[31]->PutRevTransSprite(dX, dY, 20 + cTempFrame, dwTime, cTempFrame/3); } break; case 63: // Fire explosion (crueffect1, 2) cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[33]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 64: // effet halo blancchatre cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[34]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 65: // MS from crusade striking cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; cTempFrame = cTempFrame / 6; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[31]->PutRevTransSprite(dX, dY, 20 + cTempFrame, dwTime, cTempFrame >> 2); break; case 66: // MS explodes on the ground cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[39]->PutRevTransSprite(dX, dY, cTempFrame, dwTime); m_pEffectSpr[39]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 67: // MS fire with smoke cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; switch (rand() % 3) { case 0: m_pEffectSpr[0]->PutTransSprite25_NoColorKey(dX, dY +20, 1, dwTime); break; case 1: m_pEffectSpr[0]->PutTransSprite50_NoColorKey(dX, dY +20, 1, dwTime); break; case 2: m_pEffectSpr[0]->PutTransSprite70_NoColorKey(dX, dY +20, 1, dwTime); break; } m_pEffectSpr[35]->PutTransSprite70_NoColorKey(dX, dY, cTempFrame/3, dwTime); break; case 68: // worm-bite cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; if (cTempFrame <= 11) { m_pEffectSpr[40]->PutSpriteFast(dX, dY, cTempFrame, dwTime); m_pEffectSpr[41]->PutTransSprite50_NoColorKey(dX, dY, cTempFrame, dwTime); m_pEffectSpr[44]->PutRevTransSprite(dX-2, dY-3, cTempFrame, dwTime); m_pEffectSpr[44]->PutTransSprite_NoColorKey(dX-4, dY-3, cTempFrame, dwTime); }else { switch (cTempFrame) { case 12: case 13: case 14: m_pEffectSpr[40]->PutSpriteFast(dX, dY, 11, dwTime); break; case 15: m_pEffectSpr[40]->PutTransSprite70_NoColorKey(dX, dY, 11, dwTime); break; case 16: m_pEffectSpr[40]->PutTransSprite50_NoColorKey(dX, dY, 11, dwTime); break; case 17: m_pEffectSpr[40]->PutTransSprite25_NoColorKey(dX, dY, 11, dwTime); break; } } break; case 69: // identique au cas 70 cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[42]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 70: // identique au cas 69 cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[43]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 71: // absent v220 et v351 break; case 72: // Blizzard cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; if (cTempFrame <= 8) { iDvalue = 0; m_pEffectSpr[51]->PutTransSpriteRGB(dX, dY, cTempFrame, iDvalue, iDvalue, iDvalue, dwTime); }else { iDvalue = -1*(cTempFrame - 8); m_pEffectSpr[51]->PutTransSpriteRGB(dX, dY, 8, iDvalue, iDvalue, iDvalue, dwTime); // RGB2 } break; case 73: // absent v220 et v351 case 74: // absent v220 et v351 case 75: // absent v220 et v351 case 76: // absent v220 et v351 case 77: // absent v220 et v351 break; case 80: case 196: // Earth-Shock-Wave cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[91]->PutSpriteFast(dX, dY, cTempFrame, dwTime); //Nbe d'arguments modifiés ds la 351.... m_pEffectSpr[92]->PutTransSprite(dX, dY, cTempFrame, dwTime); break; case 81: // Snoopy: Ajout StormBlade dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; cTempFrame = m_pEffectList[i]->m_cFrame; m_pEffectSpr[100]->PutTransSprite_NoColorKey(dX+70, dY+70, cTempFrame, dwTime); break; case 82: // Gate (apocalypse) cTempFrame = m_pEffectList[i]->m_cFrame; m_pEffectSpr[101]->PutTransSprite_NoColorKey(320, 480, cTempFrame, dwTime); break; case 100: // Magic Missile dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[0]->PutTransSprite_NoColorKey(dX, dY, 0, dwTime); break; case 101: // Heal case 121: // Great-Heal cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; iDvalue = (cTempFrame - 5)*(-5); m_pEffectSpr[50]->PutTransSprite_NoColorKey(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); break; case 102: // Create Food case 124: // Protection from N.M case 125: // Hold-Person case 126: // Possession case 127: // Poison case 133: // Protect-From-Magic case 134: // Detect-Invisibility case 135: // Paralyze case 136: // Cure case 142: // Confuse Language case 152: // Polymorph case 153: // Mass-Poison case 162: // Confusion case 171: // Mass-Confusion cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; iDvalue = (cTempFrame - 5)*(-5); if (cTempFrame < 5) m_pEffectSpr[4]->PutTransSprite_NoColorKey(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); else m_pEffectSpr[4]->PutTransSpriteRGB(dX, dY, m_pEffectList[i]->m_cFrame, iDvalue, iDvalue, iDvalue, dwTime); // RGB2 break; case 110: // Energy-Bolt dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[0]->PutTransSprite_NoColorKey(dX, dY, 2 + (rand() % 4), dwTime); break; case 111: // Staminar Drain cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; iDvalue = (cTempFrame - 5)*(-5); m_pEffectSpr[49]->PutTransSprite_NoColorKey(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); break; case 112: // Recall case 131: // Summon-Creature case 132: // Invisibility cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; iDvalue = (cTempFrame - 5)*(-5); m_pEffectSpr[52]->PutTransSprite_NoColorKey(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); break; case 113: // Defense Shield cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; iDvalue = (cTempFrame - 5)*(-5); if (cTempFrame < 6) m_pEffectSpr[62]->PutTransSprite_NoColorKey(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); else m_pEffectSpr[62]->PutTransSpriteRGB(dX, dY, m_pEffectList[i]->m_cFrame, iDvalue, iDvalue, iDvalue, dwTime); // RGB2 break; case 120: // Fire Ball case 130: // Fire Strike case 161: // Mass-Fire-Strike case 251: // dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; cTempFrame = (m_pEffectList[i]->m_cDir-1)*4 + (rand() % 4); if (cTempFrame < 0) break; m_pEffectSpr[5]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); break; case 122: // Absent v220 et 351 break; case 123: // Staminar-Recovery case 128: // Great-Staminar-Recovery cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; iDvalue = (cTempFrame - 5)*(-5); m_pEffectSpr[56]->PutTransSprite_NoColorKey(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); break; case 137: // Lightning Arrow dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; tX = (m_pEffectList[i]->m_mX2) - m_sViewPointX; tY = (m_pEffectList[i]->m_mY2) - m_sViewPointY; iErr = 0; m_Misc.GetPoint(dX, dY, tX, tY, &rX, &rY, &iErr, 15); m_Misc.GetPoint(dX, dY, tX, tY, &rX2, &rY2, &iErr, 30); m_Misc.GetPoint(dX, dY, tX, tY, &rX3, &rY3, &iErr, 45); m_Misc.GetPoint(dX, dY, tX, tY, &rX4, &rY4, &iErr, 60); m_Misc.GetPoint(dX, dY, tX, tY, &rX5, &rY5, &iErr, 75); cTempFrame = (m_pEffectList[i]->m_cDir-1)*4 + (rand() % 4); if (cTempFrame < 0) break; m_pEffectSpr[10]->PutTransSprite25_NoColorKey(rX5, rY5, cTempFrame, dwTime); cTempFrame = (m_pEffectList[i]->m_cDir-1)*4 + (rand() % 4); if (cTempFrame < 0) break; m_pEffectSpr[10]->PutTransSprite25_NoColorKey(rX4, rY4, cTempFrame, dwTime); cTempFrame = (m_pEffectList[i]->m_cDir-1)*4 + (rand() % 4); if (cTempFrame < 0) break; m_pEffectSpr[10]->PutTransSprite50_NoColorKey(rX3, rY3, cTempFrame, dwTime); cTempFrame = (m_pEffectList[i]->m_cDir-1)*4 + (rand() % 4); if (cTempFrame < 0) break; m_pEffectSpr[10]->PutTransSprite50_NoColorKey(rX2, rY2, cTempFrame, dwTime); cTempFrame = (m_pEffectList[i]->m_cDir-1)*4 + (rand() % 4); if (cTempFrame < 0) break; m_pEffectSpr[10]->PutTransSprite70_NoColorKey(rX, rY, cTempFrame, dwTime); cTempFrame = (m_pEffectList[i]->m_cDir-1)*4 + (rand() % 4); if (cTempFrame < 0) break; m_pEffectSpr[10]->PutTransSprite(dX, dY, cTempFrame, dwTime); break; case 143: // Lightning _DrawThunderEffect(m_pEffectList[i]->m_dX*32 - m_sViewPointX, m_pEffectList[i]->m_dY*32 - m_sViewPointY - 800, m_pEffectList[i]->m_dX*32 - m_sViewPointX, m_pEffectList[i]->m_dY*32 - m_sViewPointY, m_pEffectList[i]->m_rX, m_pEffectList[i]->m_rY, 1); _DrawThunderEffect(m_pEffectList[i]->m_dX*32 - m_sViewPointX, m_pEffectList[i]->m_dY*32 - m_sViewPointY - 800, m_pEffectList[i]->m_dX*32 - m_sViewPointX, m_pEffectList[i]->m_dY*32 - m_sViewPointY, m_pEffectList[i]->m_rX+4, m_pEffectList[i]->m_rY+2, 2); _DrawThunderEffect(m_pEffectList[i]->m_dX*32 - m_sViewPointX, m_pEffectList[i]->m_dY*32 - m_sViewPointY - 800, m_pEffectList[i]->m_dX*32 - m_sViewPointX, m_pEffectList[i]->m_dY*32 - m_sViewPointY, m_pEffectList[i]->m_rX-2, m_pEffectList[i]->m_rY-2, 2); break; case 144: // Great-Defense-Shield cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; iDvalue = (cTempFrame - 5)*(-5); if (cTempFrame < 9) m_pEffectSpr[63]->PutTransSprite_NoColorKey(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); else m_pEffectSpr[63]->PutTransSpriteRGB(dX, dY, m_pEffectList[i]->m_cFrame, iDvalue, iDvalue, iDvalue, dwTime); // RGB2 break; case 151: // Lightning Bolt _DrawThunderEffect(m_pEffectList[i]->m_mX - m_sViewPointX, m_pEffectList[i]->m_mY - m_sViewPointY, m_pEffectList[i]->m_dX*32 - m_sViewPointX, m_pEffectList[i]->m_dY*32 - m_sViewPointY, m_pEffectList[i]->m_rX, m_pEffectList[i]->m_rY, 1); _DrawThunderEffect(m_pEffectList[i]->m_mX - m_sViewPointX, m_pEffectList[i]->m_mY - m_sViewPointY, m_pEffectList[i]->m_dX*32 - m_sViewPointX, m_pEffectList[i]->m_dY*32 - m_sViewPointY, m_pEffectList[i]->m_rX+2, m_pEffectList[i]->m_rY-2, 2); _DrawThunderEffect(m_pEffectList[i]->m_mX - m_sViewPointX, m_pEffectList[i]->m_mY - m_sViewPointY, m_pEffectList[i]->m_dX*32 - m_sViewPointX, m_pEffectList[i]->m_dY*32 - m_sViewPointY, m_pEffectList[i]->m_rX-2, m_pEffectList[i]->m_rY-2, 2); break; case 165: // Absolute-Magic-Protect cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; // 53 = APFM buble m_pEffectSpr[53]->PutTransSprite_NoColorKey(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); break; case 166: // Armor-Break cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; m_pEffectSpr[55]->PutRevTransSprite(dX, dY+35, m_pEffectList[i]->m_cFrame, dwTime); m_pEffectSpr[54]->PutTransSprite50(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); break; case 176: // Cancellation cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; m_pEffectSpr[90]->PutTransSprite_NoColorKey(dX+50, dY+85, cTempFrame, dwTime); break; case 177: // Illusion-Movement case 180: // Illusion cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; iDvalue = (cTempFrame - 5)*(-3); if (cTempFrame < 9) m_pEffectSpr[60]->PutTransSprite_NoColorKey(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); else m_pEffectSpr[60]->PutTransSpriteRGB(dX, dY, m_pEffectList[i]->m_cFrame, iDvalue, iDvalue, iDvalue, dwTime); // RGB2 break; case 182: //Mass-Magic-Missile cTempFrame = m_pEffectList[i]->m_cFrame; dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[98]->PutTransSprite(dX, dY, cTempFrame, dwTime, 0); break; case 183: // Inhibition-Casting cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; iDvalue = (cTempFrame - 5)*(-3); if (cTempFrame < 9) m_pEffectSpr[94]->PutTransSprite_NoColorKey(dX, dY + 40, m_pEffectList[i]->m_cFrame, dwTime); else m_pEffectSpr[94]->PutTransSpriteRGB(dX, dY + 40, m_pEffectList[i]->m_cFrame, iDvalue, iDvalue, iDvalue, dwTime); break; case 244: // Snoopy: déplacé pour nvx sorts: Aura du casteur de Mass MagicMissile //case 184: // Aura du casteur de Mass MagicMissile cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = m_pEffectList[i]->m_mX - m_sViewPointX; dY = m_pEffectList[i]->m_mY - m_sViewPointY; m_pEffectSpr[96]->PutTransSprite(dX, dY, m_pEffectList[i]->m_cFrame, dwTime, 0); break; case 190: // Mass-Illusion case 195: // Mass-Illusion-Movement cTempFrame = m_pEffectList[i]->m_cFrame; if (cTempFrame < 0) break; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; iDvalue = (cTempFrame - 5)*(-3); if (cTempFrame < 9) m_pEffectSpr[61]->PutTransSprite_NoColorKey(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); else m_pEffectSpr[61]->PutTransSpriteRGB(dX, dY, m_pEffectList[i]->m_cFrame, iDvalue, iDvalue, iDvalue, dwTime); // RGB2 break; //case 192: // Mage Hero set effect case 242: dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; m_pEffectSpr[87]->PutTransSprite_NoColorKey(dX+50, dY+57, m_pEffectList[i]->m_cFrame, dwTime); break; //case 193: // War Hero set effect case 243: dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; m_pEffectSpr[88]->PutTransSprite_NoColorKey(dX+65, dY+80, m_pEffectList[i]->m_cFrame, dwTime); break; case 194: // Resurrection dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; m_pEffectSpr[99]->PutTransSprite(dX, dY, m_pEffectList[i]->m_cFrame, dwTime, 0); break; case 200: // shotstar fall on ground dX = m_pEffectList[i]->m_mX; dY = m_pEffectList[i]->m_mY; m_pEffectSpr[133]->PutTransSprite_NoColorKey(dX, dY, (rand() %15), dwTime); break; case 201: // shotstar fall on ground dX = m_pEffectList[i]->m_mX; dY = m_pEffectList[i]->m_mY; m_pEffectSpr[134]->PutTransSprite_NoColorKey(dX, dY, (rand() %15), dwTime); break; case 202: // shotstar fall on ground dX = m_pEffectList[i]->m_mX; dY = m_pEffectList[i]->m_mY; m_pEffectSpr[135]->PutTransSprite_NoColorKey(dX, dY, (rand() %15), dwTime); break; case 203: // explosion feu apoc dX = m_pEffectList[i]->m_mX; dY = m_pEffectList[i]->m_mY; m_pEffectSpr[136]->PutTransSprite_NoColorKey(dX, dY, (rand() %18), dwTime); break; case 204: // Faille oblique dX = m_pEffectList[i]->m_mX; dY = m_pEffectList[i]->m_mY; m_pEffectSpr[137]->PutTransSprite_NoColorKey(dX, dY, (rand() %12), dwTime); break; case 205: // Faille horizontale dX = m_pEffectList[i]->m_mX; dY = m_pEffectList[i]->m_mY; m_pEffectSpr[138]->PutTransSprite_NoColorKey(dX, dY, (rand() %12), dwTime); break; case 206: // steams dX = m_pEffectList[i]->m_mX; dY = m_pEffectList[i]->m_mY; m_pEffectSpr[139]->PutTransSprite_NoColorKey(dX, dY, (rand() %20), dwTime); break; case 250: // Gate (round one) dX = m_pEffectList[i]->m_mX - m_sViewPointX; dY = m_pEffectList[i]->m_mY - m_sViewPointY; m_pEffectSpr[103]->PutTransSprite_NoColorKey(dX, dY, (rand() %3), dwTime); break; case 252: // burst (lisgt salmon color) dX = m_pEffectList[i]->m_mX - m_sViewPointX; dY = m_pEffectList[i]->m_mY - m_sViewPointY; m_pEffectSpr[104]->PutTransSprite_NoColorKey(dX, dY, (rand() %3), dwTime); break; } } } void CGame::bItemDrop_IconPannel(short msX, short msY) {short sX, sY, sItemIndex; sX = m_stDialogBoxInfo[30].sX; sY = m_stDialogBoxInfo[30].sY; sItemIndex = m_stMCursor.sSelectedObjectID; if (m_bIsItemDisabled[sItemIndex] == TRUE) return; if (m_cCommand < 0) return; if ((453 < msX) && (486 > msX) && (440 < msY) && (475 > msY)) { bItemDrop_Inventory(m_stDialogBoxInfo[2].sX + (rand() % 148), m_stDialogBoxInfo[2].sY + (rand() % 55)); return; } if ((425 < msX) && (448 > msX) && (440 < msY) && (475 > msY)) { bItemDrop_Character(); return; } } void CGame::DrawEffectLights() {int i, dX, dY, iDvalue; DWORD dwTime = m_dwCurTime; char cTempFrame; for (i = 0; i < MAXEFFECTS; i++) if (m_pEffectList[i] != NULL) { switch (m_pEffectList[i]->m_sType) { case 1: break; case 2: break; case 4: break; case 5: // Fire Explosion if (m_pEffectList[i]->m_cFrame >= 0) { dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; iDvalue = (m_pEffectList[i]->m_cFrame - 7)*(-1); if (m_pEffectList[i]->m_cFrame < 6) m_pEffectSpr[0]->PutTransSprite_NoColorKey(dX, dY+30, 1, dwTime); else m_pEffectSpr[0]->PutTransSpriteRGB(dX, dY+30, 1, iDvalue, iDvalue, iDvalue, dwTime); } break; case 6: // Energy Bolt case 10: // Lightning Arrow if (m_pEffectList[i]->m_cFrame >= 0) { dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; iDvalue = (m_pEffectList[i]->m_cFrame - 9)*(-1); if (m_pEffectList[i]->m_cFrame < 8) m_pEffectSpr[0]->PutTransSprite_NoColorKey(dX, dY+30, 1, dwTime); else m_pEffectSpr[0]->PutTransSpriteRGB(dX, dY+30, 1, iDvalue, iDvalue, iDvalue, dwTime); } break; case 7: // Magic Missile Explosion if (m_pEffectList[i]->m_cFrame >= 0) { dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; iDvalue = (m_pEffectList[i]->m_cFrame - 2)*(-1); if (m_pEffectList[i]->m_cFrame < 2) m_pEffectSpr[0]->PutTransSprite_NoColorKey(dX, dY+30, 1, dwTime); else m_pEffectSpr[0]->PutTransSpriteRGB(dX, dY+30, 1, iDvalue, iDvalue, iDvalue, dwTime); } break; case 16: case 61: case 66: case 100: case 110: case 120: case 130: case 137: // Lightning arrow //case 165: // APFM fixed green light // Light on ground below the flying effect dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; iDvalue = -5; m_pEffectSpr[0]->PutTransSpriteRGB(dX, dY+30, 1, iDvalue, iDvalue, iDvalue, dwTime); break; case 69: case 70: dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[0]->PutTransSprite25(dX, dY+30, 1, dwTime); break; case 33: // /* if (m_pEffectList[i]->m_cFrame >= 0) { dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; iDvalue = (m_pEffectList[i]->m_cFrame - 9)*(-1); if (m_pEffectList[i]->m_cFrame < 8) m_pEffectSpr[0]->PutTransSprite(dX, dY, 1, dwTime); else m_pEffectSpr[0]->PutTransSpriteRGB(dX, dY, 1, iDvalue, iDvalue, iDvalue, dwTime); } */ break; case 40: // case 56: if (m_pEffectList[i]->m_cFrame >= 0) { dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; iDvalue = (m_pEffectList[i]->m_cFrame - 7)*(-1); if (m_pEffectList[i]->m_cFrame < 6) m_pEffectSpr[0]->PutTransSprite(dX, dY, 1, dwTime); else m_pEffectSpr[0]->PutTransSpriteRGB(dX, dY, 1, iDvalue, iDvalue, iDvalue, dwTime); } break; case 52: // Protection Ring if (m_pEffectList[i]->m_cFrame >= 0) { dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[24]->PutTransSprite_NoColorKey(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); } break; case 57: if (m_pEffectList[i]->m_cFrame >= 0) { dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[30]->PutTransSprite_NoColorKey(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); } break; case 73: dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[74]->PutTransSprite(dX, dY-34, m_pEffectList[i]->m_cFrame, dwTime); break; case 74: dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[75]->PutTransSprite(dX, dY+35, m_pEffectList[i]->m_cFrame, dwTime); break; case 75: // Icegolem dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[76]->PutTransSprite25(dX+m_pEffectList[i]->m_dX*m_pEffectList[i]->m_cFrame, dY+m_pEffectList[i]->m_dY*m_pEffectList[i]->m_cFrame, m_pEffectList[i]->m_cFrame, dwTime); break; case 76:// Icegolem dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[77]->PutTransSprite25(dX+m_pEffectList[i]->m_dX*m_pEffectList[i]->m_cFrame, dY+m_pEffectList[i]->m_dY*m_pEffectList[i]->m_cFrame, m_pEffectList[i]->m_cFrame, dwTime); break; case 77:// Icegolem dX = (m_pEffectList[i]->m_mX) - m_sViewPointX; dY = (m_pEffectList[i]->m_mY) - m_sViewPointY; m_pEffectSpr[78]->PutTransSprite25(dX+m_pEffectList[i]->m_dX*m_pEffectList[i]->m_cFrame, dY+m_pEffectList[i]->m_dY*m_pEffectList[i]->m_cFrame, m_pEffectList[i]->m_cFrame, dwTime); break; case 150: // Berserk : Cirlcle 6 magic dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; m_pEffectSpr[58]->PutTransSprite_NoColorKey(dX, dY, m_pEffectList[i]->m_cFrame, dwTime); break; case 180: // Ilusion case 190: // Mass Illusion cTempFrame = m_pEffectList[i]->m_cFrame; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; m_pEffectSpr[59]->PutTransSprite_NoColorKey(dX, dY, cTempFrame, dwTime); //if( cTempFrame < 9 ) m_pEffectSpr[59]->PutTransSprite_NoColorKey( dX, dY, cTempFrame, dwTime ); //else m_pEffectSpr[59]->PutSpriteFast( dX, dY, cTempFrame, dwTime ); break; case 177: // Illusion mvt case 195: // Mass Illusion mvt cTempFrame = m_pEffectList[i]->m_cFrame; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; m_pEffectSpr[102]->PutTransSprite_NoColorKey(dX, dY+30, cTempFrame, dwTime); break; case 183: // Inhibition casting cTempFrame = m_pEffectList[i]->m_cFrame; dX = (m_pEffectList[i]->m_dX*32) - m_sViewPointX; dY = (m_pEffectList[i]->m_dY*32) - m_sViewPointY; m_pEffectSpr[95]->PutTransSprite_NoColorKey(dX, dY+40, cTempFrame, dwTime); break; } } } void CGame::_LoadShopMenuContents(char cType) { char cFileName[255], cTemp[255]; HANDLE hFile; FILE * pFile; DWORD dwFileSize; char * pBuffer; ZeroMemory(cTemp, sizeof(cTemp)); ZeroMemory(cFileName, sizeof(cFileName)); wsprintf(cTemp, "contents%d", cType); strcat(cFileName, "contents" ); strcat(cFileName, "\\"); strcat(cFileName, "\\"); strcat(cFileName, "Shop" ); strcat(cFileName, "\\"); strcat(cFileName, "\\"); strcat(cFileName, cTemp); strcat(cFileName, ".txt"); hFile = CreateFile(cFileName, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); dwFileSize = GetFileSize(hFile, NULL); if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); pFile = fopen(cFileName, "rt"); if (pFile == NULL) return; else { pBuffer = new char[dwFileSize+1]; ZeroMemory(pBuffer, dwFileSize+1); fread(pBuffer, dwFileSize, 1, pFile); __bDecodeContentsAndBuildItemForSaleList(pBuffer); delete[] pBuffer; } fclose(pFile); } BOOL CGame::__bDecodeContentsAndBuildItemForSaleList(char * pBuffer) { char * pContents, * token; char seps[] = "= ,\t\n"; char cReadModeA = 0; char cReadModeB = 0; int iItemForSaleListIndex = 0; class CStrTok * pStrTok; pContents = pBuffer; pStrTok = new class CStrTok(pContents, seps); token = pStrTok->pGet(); while( token != NULL ) { if (cReadModeA != 0) { // switch (cReadModeA) { case 1: switch (cReadModeB) { case 1: ZeroMemory(m_pItemForSaleList[iItemForSaleListIndex]->m_cName, sizeof(m_pItemForSaleList[iItemForSaleListIndex]->m_cName)); memcpy(m_pItemForSaleList[iItemForSaleListIndex]->m_cName, token, strlen(token)); cReadModeB = 2; break; case 2: // m_cItemType m_pItemForSaleList[iItemForSaleListIndex]->m_cItemType = atoi(token); cReadModeB = 3; break; case 3: // m_cEquipPos m_pItemForSaleList[iItemForSaleListIndex]->m_cEquipPos = atoi(token); cReadModeB = 4; break; case 4: // m_sItemEffectType //m_pItemForSaleList[iItemForSaleListIndex]->m_sItemEffectType = atoi(token); cReadModeB = 5; break; case 5: // m_sItemEffectValue1 m_pItemForSaleList[iItemForSaleListIndex]->m_sItemEffectValue1 = atoi(token); cReadModeB = 6; break; case 6: // m_sItemEffectValue2 m_pItemForSaleList[iItemForSaleListIndex]->m_sItemEffectValue2 = atoi(token); cReadModeB = 7; break; case 7: // m_sItemEffectValue3 m_pItemForSaleList[iItemForSaleListIndex]->m_sItemEffectValue3 = atoi(token); cReadModeB = 8; break; case 8: // m_sItemEffectValue4 m_pItemForSaleList[iItemForSaleListIndex]->m_sItemEffectValue4 = atoi(token); cReadModeB = 9; break; case 9: // m_sItemEffectValue5 m_pItemForSaleList[iItemForSaleListIndex]->m_sItemEffectValue5 = atoi(token); cReadModeB = 10; break; case 10: // m_sItemEffectValue6 m_pItemForSaleList[iItemForSaleListIndex]->m_sItemEffectValue6 = atoi(token); cReadModeB = 11; break; case 11: // m_wMaxLifeSpan m_pItemForSaleList[iItemForSaleListIndex]->m_wMaxLifeSpan = (WORD)atoi(token); cReadModeB = 12; break; case 12: // m_sMaxFixCount //m_pItemForSaleList[iItemForSaleListIndex]->m_sMaxFixCount = atoi(token); cReadModeB = 13; break; case 13: // m_sSprite m_pItemForSaleList[iItemForSaleListIndex]->m_sSprite = atoi(token); cReadModeB = 14; break; case 14: // m_sSpriteFrame m_pItemForSaleList[iItemForSaleListIndex]->m_sSpriteFrame = atoi(token); cReadModeB = 15; break; case 15: // m_wPrice m_pItemForSaleList[iItemForSaleListIndex]->m_wPrice = atoi(token); cReadModeB = 16; break; case 16: // m_wWeight m_pItemForSaleList[iItemForSaleListIndex]->m_wWeight = atoi(token); cReadModeB = 17; break; case 17: // Appr Value //m_pItemForSaleList[iItemForSaleListIndex]->m_cApprValue = atoi(token); cReadModeB = 18; break; case 18: // m_cSpeed m_pItemForSaleList[iItemForSaleListIndex]->m_cSpeed = atoi(token); cReadModeB = 19; break; case 19: // Level Limit m_pItemForSaleList[iItemForSaleListIndex]->m_sLevelLimit = atoi(token); m_pItemForSaleList[iItemForSaleListIndex]->m_dwCount = 1; cReadModeA = 0; cReadModeB = 0; iItemForSaleListIndex++; break; } break; default: break; } }else { if (memcmp(token, "ItemForSale", 4) == 0) { if (iItemForSaleListIndex >= MAXMENUITEMS) { delete pStrTok; return FALSE; } cReadModeA = 1; cReadModeB = 1; m_pItemForSaleList[iItemForSaleListIndex] = new class CItem; } } token = pStrTok->pGet(); } delete pStrTok; if ((cReadModeA != 0) || (cReadModeB != 0)) return FALSE; return TRUE; } static char __cSpace[] = {8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8, 8,6,8,7,8,8,9,10,9,7, 8,8,8,8,8, 8,8, 15,16,12,17,14,15,14,16,10,13, 19,10,17,17,15,14,15,16,13,17, 16,16,20,17,16,14, 8,8,8,8,8,8, 8,6,7,8,7,7,7,7,4,7,7, 4,11,7,8,8,7,8,6,5,8,9,14,8,9,8, 8,8,8,8, 8,8,8,8,8,8,8}; void CGame::PutString_SprFont(int iX, int iY, char * pStr, short sR, short sG, short sB) { int iXpos; DWORD iCnt; DWORD dwTime = G_dwGlobalTime; char cTmpStr[100]; ZeroMemory(cTmpStr, sizeof(cTmpStr)); strcpy(cTmpStr, pStr); iXpos = iX; for (iCnt = 0; iCnt < strlen(cTmpStr); iCnt++) { if ((cTmpStr[iCnt] >= 33) && (cTmpStr[iCnt] <= 122)) { m_pSprite[SPRID_INTERFACE_FONT1]->PutSpriteRGB(iXpos+1, iY, cTmpStr[iCnt] - 33, sR+11, sG+7, sB+6, dwTime); if ((sR == 0) && (sG == 0) && (sB == 0)) m_pSprite[SPRID_INTERFACE_FONT1]->PutSpriteFast(iXpos, iY, cTmpStr[iCnt] - 33, dwTime); else m_pSprite[SPRID_INTERFACE_FONT1]->PutSpriteRGB(iXpos, iY, cTmpStr[iCnt] - 33, sR, sG, sB, dwTime); iXpos += __cSpace[cTmpStr[iCnt] - 33]; } else iXpos += 5; } } void CGame::PutString_SprFont2(int iX, int iY, char * pStr, short sR, short sG, short sB) { int iXpos, iR, iG, iB; DWORD iCnt; DWORD dwTime = G_dwGlobalTime; char cTmpStr[200]; m_DDraw.ColorTransferRGB(RGB(sR, sG, sB), &iR, &iG, &iB); ZeroMemory(cTmpStr, sizeof(cTmpStr)); strcpy(cTmpStr, pStr); iXpos = iX; for (iCnt = 0; iCnt < strlen(cTmpStr); iCnt++) { if ((cTmpStr[iCnt] >= 33) && (cTmpStr[iCnt] <= 122)) { m_pSprite[SPRID_INTERFACE_FONT1]->PutSpriteFast(iXpos+1, iY, cTmpStr[iCnt] - 33, dwTime); m_pSprite[SPRID_INTERFACE_FONT1]->PutSpriteFast(iXpos+1, iY+1, cTmpStr[iCnt] - 33, dwTime); if ((sR == 0) && (sG == 0) && (sB == 0)) m_pSprite[SPRID_INTERFACE_FONT1]->PutSpriteFast(iXpos, iY, cTmpStr[iCnt] - 33, dwTime); else m_pSprite[SPRID_INTERFACE_FONT1]->PutSpriteRGB(iXpos, iY, cTmpStr[iCnt] - 33, iR, iG, iB, dwTime); iXpos += __cSpace[cTmpStr[iCnt] - 33]; } else iXpos += 5; } } void CGame::PutString_SprFont3(int iX, int iY, char * pStr, short sR, short sG, short sB, BOOL bTrans, int iType) { int iXpos, iAdd; DWORD iCnt; DWORD dwTime = G_dwGlobalTime; char cTmpStr[128]; ZeroMemory(cTmpStr, sizeof(cTmpStr)); strcpy(cTmpStr, pStr); if (iType != -1) { iAdd = 95*iType; iXpos = iX; for (iCnt = 0; iCnt < strlen(cTmpStr); iCnt++) { if ((cTmpStr[iCnt] >= 32) && (cTmpStr[iCnt] <= 126)) { if (bTrans == FALSE) { m_pSprite[SPRID_INTERFACE_SPRFONTS2]->PutSpriteFast(iXpos, iY+1, cTmpStr[iCnt] - 32 +iAdd, dwTime); m_pSprite[SPRID_INTERFACE_SPRFONTS2]->PutSpriteFast(iXpos+1, iY+1, cTmpStr[iCnt] - 32 +iAdd, dwTime); if ((sR == 0) && (sG == 0) && (sB == 0)) m_pSprite[SPRID_INTERFACE_SPRFONTS2]->PutSpriteFast(iXpos, iY, cTmpStr[iCnt] - 32 +iAdd, dwTime); else m_pSprite[SPRID_INTERFACE_SPRFONTS2]->PutSpriteRGB(iXpos, iY, cTmpStr[iCnt] - 32 +iAdd, sR, sG, sB, dwTime); } else m_pSprite[SPRID_INTERFACE_SPRFONTS2]->PutTransSpriteRGB(iXpos, iY, cTmpStr[iCnt] - 32 +iAdd, sR, sG, sB, dwTime); iXpos += (m_pSprite[SPRID_INTERFACE_SPRFONTS2]->m_stBrush[cTmpStr[iCnt] - 32 +iAdd].szx); } else iXpos += 5; } } else { iAdd = 0; iXpos = iX; for (iCnt = 0; iCnt < strlen(cTmpStr); iCnt++) { if ((cTmpStr[iCnt] >= 32) && (cTmpStr[iCnt] <= 126)) { if (bTrans == FALSE) { m_pSprite[SPRID_INTERFACE_FONT2]->PutSpriteFast(iXpos, iY+1, cTmpStr[iCnt] - 32 +iAdd, dwTime); m_pSprite[SPRID_INTERFACE_FONT2]->PutSpriteFast(iXpos+1, iY+1, cTmpStr[iCnt] - 32 +iAdd, dwTime); if ((sR == 0) && (sG == 0) && (sB == 0)) m_pSprite[SPRID_INTERFACE_FONT2]->PutSpriteFast(iXpos, iY, cTmpStr[iCnt] - 32 +iAdd, dwTime); else m_pSprite[SPRID_INTERFACE_FONT2]->PutSpriteRGB(iXpos, iY, cTmpStr[iCnt] - 32 +iAdd, sR, sG, sB, dwTime); } else m_pSprite[SPRID_INTERFACE_FONT2]->PutTransSpriteRGB(iXpos, iY, cTmpStr[iCnt] - 32 +iAdd, sR, sG, sB, dwTime); iXpos += (m_pSprite[SPRID_INTERFACE_FONT2]->m_stBrush[cTmpStr[iCnt] - 32 +iAdd].szx); } else iXpos += 5; } } } static char __cSpace2[] = {6,4,6,6,6,6,6,6,6,6,6}; //{8,6,9,8,8,9,8,8,8,8}; void CGame::PutString_SprNum(int iX, int iY, char * pStr, short sR, short sG, short sB) {int iXpos; unsigned char iCnt; DWORD dwTime = G_dwGlobalTime; char cTmpStr[200]; WORD wR, wG, wB; ZeroMemory(cTmpStr, sizeof(cTmpStr)); strcpy(cTmpStr, pStr); m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB(sR, sG, sB), &wR, &wG, &wB); iXpos = iX; for (iCnt = 0; iCnt < strlen(cTmpStr); iCnt++) { if ((cTmpStr[iCnt] >= 0x30) && (cTmpStr[iCnt] <= 0x39)) { m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutTransSprite(iXpos+2, iY, cTmpStr[iCnt] - 0x30 +6, dwTime); m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutTransSprite(iXpos+1, iY+1, cTmpStr[iCnt] - 0x30 +6, dwTime); if ((sR == 0) && (sG == 0) && (sB == 0)) m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutTransSprite(iXpos, iY, cTmpStr[iCnt] - 0x30 +6, dwTime); else m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutTransSpriteRGB(iXpos, iY, cTmpStr[iCnt] - 0x30 +6, wR, wG, wB, dwTime); iXpos += __cSpace2[cTmpStr[iCnt] - 0x30]; } } } void CGame::PutString(int iX, int iY, char * pString, COLORREF color, BOOL bHide, char cBGtype, BOOL bIsPreDC) {char * pTmp; int i; if (strlen(pString) == 0) return; if (bIsPreDC == FALSE) m_DDraw._GetBackBufferDC(); if (bHide == FALSE) { switch (cBGtype) { case 0: m_DDraw.TextOut(iX+1, iY, pString, color); break; case 1: m_DDraw.TextOut(iX, iY+1, pString, RGB(5,5,5)); m_DDraw.TextOut(iX+1, iY+1, pString, RGB(5,5,5)); m_DDraw.TextOut(iX+1, iY, pString, RGB(5,5,5)); break; } m_DDraw.TextOut(iX, iY, pString, color); }else { pTmp = new char[strlen(pString)+2]; ZeroMemory(pTmp, strlen(pString)+2); strcpy(pTmp, pString); for (i = 0; i < (int)strlen(pString); i++) if (pTmp[i] != NULL) pTmp[i] = '*'; switch (cBGtype) { case 0: m_DDraw.TextOut(iX+1, iY, pTmp, color); break; case 1: m_DDraw.TextOut(iX, iY+1, pTmp, RGB(5,5,5)); m_DDraw.TextOut(iX+1, iY+1, pTmp, RGB(5,5,5)); m_DDraw.TextOut(iX+1, iY, pTmp, RGB(5,5,5)); break; } m_DDraw.TextOut(iX, iY, pTmp, color); delete[] pTmp; } if (bIsPreDC == FALSE) m_DDraw._ReleaseBackBufferDC(); } void CGame::PutString(int iX, int iY, char * pString, COLORREF color) { m_DDraw._GetBackBufferDC(); m_DDraw.TextOut(iX, iY, pString, color); m_DDraw._ReleaseBackBufferDC(); } void CGame::PutString2(int iX, int iY, char * pString, short sR, short sG, short sB) { m_DDraw._GetBackBufferDC(); m_DDraw.TextOut(iX+1, iY, pString, RGB(0, 0, 0)); m_DDraw.TextOut(iX, iY+1, pString, RGB(0, 0, 0)); m_DDraw.TextOut(iX+1, iY+1, pString, RGB(0, 0, 0)); m_DDraw.TextOut(iX, iY, pString, RGB(sR, sG, sB)); m_DDraw._ReleaseBackBufferDC(); } void CGame::PutAlignedString(int iX1, int iX2, int iY, char * pString, short sR, short sG, short sB) { RECT rt; m_DDraw._GetBackBufferDC(); SetRect(&rt, iX1, iY, iX2, iY+15); m_DDraw.DrawText(&rt, pString, RGB(sR, sG, sB)); m_DDraw._ReleaseBackBufferDC(); } BOOL CGame::bInitMagicCfgList() { char cFn[255], cTemp[255]; char * pContents, * token; char seps[] = "= ,\t\n"; char cReadModeA = 0; char cReadModeB = 0; int iMagicCfgListIndex = 0; class CStrTok * pStrTok; HANDLE hFile; FILE * pFile; DWORD dwFileSize; ZeroMemory(cTemp, sizeof(cTemp)); ZeroMemory(cFn, sizeof(cFn)); // CLEROTH - MAGIC CFG strcpy(cTemp, "magiccfg.txt"); strcat(cFn, "contents"); strcat(cFn, "\\"); strcat(cFn, "\\"); strcat(cFn, cTemp); hFile = CreateFile(cFn, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); dwFileSize = GetFileSize(hFile, NULL); if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); pFile = fopen(cFn, "rt"); if (pFile == NULL) return FALSE; else { pContents = new char[dwFileSize+1]; ZeroMemory(pContents, dwFileSize+1); fread(pContents, dwFileSize, 1, pFile); fclose(pFile); } pStrTok = new class CStrTok(pContents, seps); token = pStrTok->pGet(); while( token != NULL ) { if (cReadModeA != 0) { switch (cReadModeA) { case 1: switch (cReadModeB) { case 1: if (_bGetIsStringIsNumber(token) == FALSE) { delete[] pContents; delete pStrTok; return FALSE; } if (m_pMagicCfgList[atoi(token)] != NULL) { delete[] pContents; delete pStrTok; return FALSE; } m_pMagicCfgList[atoi(token)] = new class CMagic; iMagicCfgListIndex = atoi(token); cReadModeB = 2; break; case 2: ZeroMemory(m_pMagicCfgList[iMagicCfgListIndex]->m_cName, sizeof(m_pMagicCfgList[iMagicCfgListIndex]->m_cName)); memcpy(m_pMagicCfgList[iMagicCfgListIndex]->m_cName, token, strlen(token)); cReadModeB = 3; break; case 3: // m_sValue1 if (_bGetIsStringIsNumber(token) == FALSE) { delete[] pContents; delete pStrTok; return FALSE; } m_pMagicCfgList[iMagicCfgListIndex]->m_sValue1 = atoi(token); cReadModeB = 4; break; case 4: // m_sValue2 // INT if (_bGetIsStringIsNumber(token) == FALSE) { delete[] pContents; delete pStrTok; return FALSE; } m_pMagicCfgList[iMagicCfgListIndex]->m_sValue2 = atoi(token); cReadModeB = 5; break; case 5: // m_sValue3 // COST if (_bGetIsStringIsNumber(token) == FALSE) { delete[] pContents; delete pStrTok; return FALSE; } m_pMagicCfgList[iMagicCfgListIndex]->m_sValue3 = atoi(token); cReadModeB = 6; break; // CLEROTH MAGIC CFG case 6: // m_sValue4 // STR if (_bGetIsStringIsNumber(token) == FALSE) { delete[] pContents; delete pStrTok; return FALSE; } m_pMagicCfgList[iMagicCfgListIndex]->m_sValue4 = atoi(token); cReadModeB = 7; break; case 7: // m_sValue5 cReadModeB = 8; break; case 8: // m_sValue6 cReadModeB = 9; break; case 9: // m_bIsVisible if (_bGetIsStringIsNumber(token) == FALSE) { delete[] pContents; delete pStrTok; return FALSE; } if( atoi(token) == 0 ) m_pMagicCfgList[iMagicCfgListIndex]->m_bIsVisible = FALSE; else m_pMagicCfgList[iMagicCfgListIndex]->m_bIsVisible = TRUE; cReadModeA = 0; cReadModeB = 0; break; } break; default: break; } } else { if (memcmp(token, "magic", 5) == 0) { cReadModeA = 1; cReadModeB = 1; } } token = pStrTok->pGet(); } delete pStrTok; delete[] pContents; if ((cReadModeA != 0) || (cReadModeB != 0)) { return FALSE; } return TRUE; } BOOL CGame::bCheckImportantFile() { HANDLE hFile; hFile = CreateFile("SPRITES\\TREES1.PAK", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if( hFile == INVALID_HANDLE_VALUE ) return FALSE; // // FileSize : 1846406.... Anti Tree1.pak hack....inutile ca peut se modifier sans changer la taille! // if( GetFileSize( hFile, NULL ) != 2945524 ) // { CloseHandle( hFile ); // return FALSE; // } CloseHandle( hFile ); return TRUE; } BOOL CGame::bInitSkillCfgList() { char cFn[255], cTemp[255]; char * pContents, * token; char seps[] = "= ,\t\n"; char cReadModeA = 0; char cReadModeB = 0; int iSkillCfgListIndex = 0; class CStrTok * pStrTok; HANDLE hFile; FILE * pFile; DWORD dwFileSize; ZeroMemory(cTemp, sizeof(cTemp)); ZeroMemory(cFn, sizeof(cFn)); strcpy(cTemp, "Skillcfg.txt"); strcat(cFn, "contents"); strcat(cFn, "\\"); strcat(cFn, "\\"); strcat(cFn, cTemp); hFile = CreateFile(cFn, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); dwFileSize = GetFileSize(hFile, NULL); if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); pFile = fopen(cFn, "rt"); if (pFile == NULL) return FALSE; else { pContents = new char[dwFileSize+1]; ZeroMemory(pContents, dwFileSize+1); fread(pContents, dwFileSize, 1, pFile); fclose(pFile); } pStrTok = new class CStrTok(pContents, seps); token = pStrTok->pGet(); while( token != NULL ) { if (cReadModeA != 0) { switch (cReadModeA) { case 1: switch (cReadModeB) { case 1: if (_bGetIsStringIsNumber(token) == FALSE) { delete[] pContents; delete pStrTok; return FALSE; } if (m_pSkillCfgList[atoi(token)] != NULL) { delete[] pContents; delete pStrTok; return FALSE; } m_pSkillCfgList[atoi(token)] = new class CSkill; iSkillCfgListIndex = atoi(token); cReadModeB = 2; break; case 2: ZeroMemory(m_pSkillCfgList[iSkillCfgListIndex]->m_cName, sizeof(m_pSkillCfgList[iSkillCfgListIndex]->m_cName)); memcpy(m_pSkillCfgList[iSkillCfgListIndex]->m_cName, token, strlen(token)); cReadModeB = 3; break; case 3: // m_bIsUseable if (_bGetIsStringIsNumber(token) == FALSE) { delete[] pContents; delete pStrTok; return FALSE; } m_pSkillCfgList[iSkillCfgListIndex]->m_bIsUseable = (BOOL)atoi(token); cReadModeB = 4; break; case 4: // m_cUseMethod if (_bGetIsStringIsNumber(token) == FALSE) { delete[] pContents; delete pStrTok; return FALSE; } m_pSkillCfgList[iSkillCfgListIndex]->m_cUseMethod = atoi(token); cReadModeA = 0; cReadModeB = 0; break; } break; default: break; } } else { if (memcmp(token, "skill", 5) == 0) { cReadModeA = 1; cReadModeB = 1; } } token = pStrTok->pGet(); } delete pStrTok; delete[] pContents; if ((cReadModeA != 0) || (cReadModeB != 0)) { return FALSE; } return TRUE; } BOOL CGame::_bGetIsStringIsNumber(char * pStr) { int i; for (i = 0; i < (int)strlen(pStr); i++) if ((pStr[i] != '-') && ((pStr[i] < (char)'0') || (pStr[i] > (char)'9'))) return FALSE; return TRUE; } void CGame::RequestFullObjectData(WORD wObjectID) { char cMsg[256]; int iRet; DWORD * dwp; WORD * wp; ZeroMemory(cMsg, sizeof(cMsg)); dwp = (DWORD *)(cMsg + INDEX4_MSGID); *dwp = MSGID_REQUEST_FULLOBJECTDATA; wp = (WORD *)(cMsg + INDEX2_MSGTYPE); *wp = wObjectID; iRet = m_pGSock->iSendMsg((char *)cMsg, 6); switch (iRet) { case XSOCKEVENT_SOCKETCLOSED: case XSOCKEVENT_SOCKETERROR: case XSOCKEVENT_QUENEFULL: ChangeGameMode(GAMEMODE_ONCONNECTIONLOST); delete m_pGSock; m_pGSock = NULL; break; case XSOCKEVENT_CRITICALERROR: delete m_pGSock; m_pGSock = NULL; if (G_pCalcSocket != NULL) { delete G_pCalcSocket; G_pCalcSocket = NULL; } SendMessage(m_hWnd, WM_DESTROY, NULL, NULL); break; } } BOOL CGame::DrawObject_OnAttack(int indexX, int indexY, int sX, int sY, BOOL bTrans, DWORD dwTime, int msX, int msY) {int iBodyIndex, iUndiesIndex, iHairIndex, iArmArmorIndex, iBodyArmorIndex, iPantsIndex, iBootsIndex, iHelmIndex, iR, iG, iB; int iWeaponIndex, iWeapon, iAdd, iShieldIndex, iMantleIndex; BOOL bInv = FALSE; int iWeaponGlare, iShieldGlare; int iWeaponColor, iShieldColor, iArmorColor, iMantleColor, iArmColor, iPantsColor, iBootsColor, iHelmColor; int iSkirtDraw = 0; if(_tmp_sOwnerType == 35 || _tmp_sOwnerType == 81 || _tmp_sOwnerType == 73 || _tmp_sOwnerType == 66) bInv = TRUE; //Energy-Ball,Wyvern if (m_cDetailLevel == 0) { iWeaponColor = 0; iShieldColor = 0; iArmorColor = 0; iMantleColor = 0; iArmColor = 0; iPantsColor = 0; iBootsColor = 0; iHelmColor = 0; }else { iWeaponColor = (_tmp_iApprColor & 0xF0000000) >> 28; iShieldColor = (_tmp_iApprColor & 0x0F000000) >> 24; iArmorColor = (_tmp_iApprColor & 0x00F00000) >> 20; iMantleColor = (_tmp_iApprColor & 0x000F0000) >> 16; iArmColor = (_tmp_iApprColor & 0x0000F000) >> 12; iPantsColor = (_tmp_iApprColor & 0x00000F00) >> 8; iBootsColor = (_tmp_iApprColor & 0x000000F0) >> 4; iHelmColor = (_tmp_iApprColor & 0x0000000F); } iWeaponGlare = (_tmp_sAppr4 & 0x000C) >> 2; iShieldGlare = (_tmp_sAppr4 & 0x0003); if ( (_tmp_iStatus & 0x10) != 0) { if (memcmp(m_cPlayerName, _tmp_cName, 10) == 0) bInv = TRUE; else if( _iGetFOE(_tmp_iStatus) == 1 ) bInv = TRUE; else return FALSE; } switch (_tmp_sOwnerType) { case 1: case 2: case 3: if ((_tmp_sAppr2 & 0xF000) != 0) { iWeapon = ((_tmp_sAppr2 & 0x0FF0) >> 4); if (iWeapon == 0) iAdd = 6; if ((iWeapon >= 1) && (iWeapon <= 39)) iAdd = 6; if ((iWeapon >= 40) && (iWeapon <= 59)) iAdd = 7; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (iAdd * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + iAdd; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + iAdd; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + iAdd; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + iAdd; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + iAdd; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_M + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*4 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_M + (_tmp_sAppr2 & 0x000F)*8 + 4; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + iAdd; }else { iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (5 * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + 5; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 5; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 5; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + 5; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 5; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 5; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 5; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 5; iWeaponIndex = -1; iShieldIndex = -1; } break; case 4: case 5: case 6: if (((_tmp_sAppr3 & 0x0F00) >> 8) == 1) iSkirtDraw = 1; if ((_tmp_sAppr2 & 0xF000) != 0) { iWeapon = ((_tmp_sAppr2 & 0x0FF0) >> 4); if (iWeapon == 0) iAdd = 6; if ((iWeapon >= 1) && (iWeapon <= 39)) iAdd = 6; if ((iWeapon >= 40) && (iWeapon <= 59)) iAdd = 7; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (iAdd * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + iAdd; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + iAdd; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + iAdd; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + iAdd; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + iAdd; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_W + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*4 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_W + (_tmp_sAppr2 & 0x000F)*8 + 4; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + iAdd; }else { iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (5 * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + 5; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 5; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 5; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + 5; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 5; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 5; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 5; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 5; iWeaponIndex = -1; iShieldIndex = -1; } break; default: if (_tmp_sAppr2 != 0) { iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (4 * 8); _tmp_cFrame = _tmp_sAppr2 -1; } else if (_tmp_sOwnerType == 66) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 73) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 86) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (1 * 8); else if (_tmp_sOwnerType == 87) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (1 * 8); else if (_tmp_sOwnerType == 89) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (1 * 8); else iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); iUndiesIndex = -1; iHairIndex = -1; iBodyArmorIndex = -1; iArmArmorIndex = -1; iBootsIndex = -1; iPantsIndex = -1; iWeaponIndex = -1; iShieldIndex = -1; iMantleIndex = -1; iHelmIndex = -1; break; } if(m_pSprite[iBodyIndex + (_tmp_cDir - 1)] == NULL) return false; if (m_bIsCrusadeMode || (m_bIsAstoriaMode && memcmp(m_cCurLocation, "astoria", 7) == 0)) { DrawObjectFOE(sX, sY, _tmp_cFrame); } if (_tmp_iEffectType != 0) { switch (_tmp_iEffectType) { case 1: m_pEffectSpr[26]->PutTransSprite(sX, sY, _tmp_iEffectFrame, dwTime); break; // Special Ability: Attack Effect case 2: m_pEffectSpr[27]->PutTransSprite(sX, sY, _tmp_iEffectFrame, dwTime); break; // Special Ability: Protect Effect } } if (bTrans == FALSE) { switch (_tmp_sOwnerType) { // Pas d'ombre pour ces mobs case 10: // Slime case 35: // Energy Sphere case 50: // TW case 51: // CP case 60: // Plant case 65: // IceGolem case 66: // Wyvern case 73: // FireWyvern case 81: // Abaddon case 91: // Gate break; default: if (m_cDetailLevel != 0) { if (sX < 50) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSpriteClip(sX, sY, _tmp_cFrame, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSprite(sX, sY, _tmp_cFrame, dwTime); } break; } CheckActiveAura(sX, sY, dwTime, _tmp_sOwnerType); if (_cDrawingOrder[_tmp_cDir] == 1) { if (iWeaponIndex != -1) { if (iWeaponColor == 0) { m_pSprite[iWeaponIndex]->PutSpriteFast(sX, sY, _tmp_cFrame, dwTime); }else { m_pSprite[iWeaponIndex]->PutSpriteRGB(sX, sY, _tmp_cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); } DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } if (_tmp_cFrame == 3) m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame -1, m_wR[10] -(m_wR[0]/3), m_wG[10] -(m_wG[0]/3), m_wB[10] -(m_wB[0]/3), dwTime); } if (_tmp_sOwnerType == 35) m_pEffectSpr[0]->PutTransSprite(sX, sY, 1, dwTime); if (_tmp_sOwnerType == 81) // Abaddon { m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, _tmp_cFrame, dwTime); }else if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, _tmp_cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX, sY, _tmp_cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX, sY, _tmp_cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iUndiesIndex != -1) m_pSprite[iUndiesIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (((_tmp_sAppr2 & 0x000F) == 8) && (iShieldGlare == 1)) { m_pEffectSpr[45]->PutTransSprite(sX -13, sY -34, 0, dwTime); }else if (iShieldIndex != -1) { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13, sY -34, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } }else { if (_tmp_sOwnerType == 35) m_pEffectSpr[0]->PutTransSprite(sX, sY, 1, dwTime); if (_tmp_sOwnerType == 81) // Abaddon { m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, _tmp_cFrame, dwTime); }else if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, _tmp_cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX, sY, _tmp_cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX, sY, _tmp_cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iUndiesIndex != -1) m_pSprite[iUndiesIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iShieldIndex != -1) { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13, sY -34, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iWeaponIndex != -1) { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX, sY, _tmp_cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX, sY, _tmp_cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } if (_tmp_cFrame == 3) m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame -1, m_wR[10] -(m_wR[0]/3), m_wG[10] -(m_wG[0]/3), m_wB[10] -(m_wB[0]/3), dwTime); } } if((_tmp_iStatus & 0x0F00) >> 8 == 9) // Highly trained m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 6, -2, 6, dwTime); if ((_tmp_iStatus & 0x20) != 0) // Berserk m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, -5, -5, dwTime); DrawAngel((_tmp_cDir - 1), sX+20, sY-20, _tmp_cFrame%8, dwTime); CheckActiveAura2(sX, sY, dwTime, _tmp_sOwnerType); }else if( strlen(_tmp_cName) > 0 ) { if( (_tmp_sOwnerType>=1) && (_tmp_sOwnerType<=6) ) DrawObjectName(sX, sY, _tmp_cName, _tmp_iStatus); else DrawNpcName(sX, sY, _tmp_sOwnerType, _tmp_iStatus); } if (_tmp_iChatIndex != NULL) { if ((m_pChatMsgList[_tmp_iChatIndex] != NULL) && (m_pChatMsgList[_tmp_iChatIndex]->m_iObjectID == _tmp_wObjectID)) { m_pChatMsgList[_tmp_iChatIndex]->m_sX = sX; m_pChatMsgList[_tmp_iChatIndex]->m_sY = sY; }else { m_pMapData->ClearChatMsg(indexX, indexY); } } // Snoopy: Abaddon effects if (_tmp_sOwnerType == 81) { int randFrame = _tmp_cFrame % 12; m_pEffectSpr[154]->PutTransSprite70(sX-50 , sY-50 , randFrame, dwTime); m_pEffectSpr[155]->PutTransSprite70(sX-20 , sY-80 , randFrame, dwTime); m_pEffectSpr[156]->PutTransSprite70(sX+70 , sY-50 , randFrame, dwTime); m_pEffectSpr[157]->PutTransSprite70(sX-30 , sY , randFrame, dwTime); m_pEffectSpr[158]->PutTransSprite70(sX-60 , sY+90 , randFrame, dwTime); m_pEffectSpr[159]->PutTransSprite70(sX+65 , sY+85 , randFrame, dwTime); switch (_tmp_cDir) { case 1: m_pEffectSpr[153]->PutTransSprite70(sX , sY+108 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-50 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 2: m_pEffectSpr[153]->PutTransSprite70(sX , sY+95 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-70 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 3: m_pEffectSpr[153]->PutTransSprite70(sX , sY+105 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-90 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 4: m_pEffectSpr[153]->PutTransSprite70(sX-35 , sY+100 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-80 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 5: m_pEffectSpr[153]->PutTransSprite70(sX , sY+95 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-65 , sY-5 , _tmp_iEffectFrame %15, dwTime); break; case 6: m_pEffectSpr[153]->PutTransSprite70(sX+45 , sY+95 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-31 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 7: m_pEffectSpr[153]->PutTransSprite70(sX+40 , sY+110 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-30 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 8: m_pEffectSpr[153]->PutTransSprite70(sX+20 , sY+110 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-20 , sY+16 , _tmp_iEffectFrame %15, dwTime); break; } } if ( (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top != -1) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top < msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.bottom > msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.left < msX) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.right > msX) ) return TRUE; return FALSE; } BOOL CGame::DrawObject_OnAttackMove(int indexX, int indexY, int sX, int sY, BOOL bTrans, DWORD dwTime, int msX, int msY) {int iBodyIndex, iUndiesIndex, iHairIndex, iArmArmorIndex, iBodyArmorIndex, iPantsIndex, iBootsIndex, iHelmIndex, iR, iG, iB; int iWeaponIndex, iWeapon, iAdd, iShieldIndex, iMantleIndex, dx, dy, dsx, dsy; int cFrameMoveDots; BOOL bInv = FALSE, bDashDraw = FALSE; int iWeaponGlare, iShieldGlare; int iWeaponColor, iShieldColor, iArmorColor, iMantleColor, iArmColor, iPantsColor, iBootsColor, iHelmColor; int iSkirtDraw = 0; if(_tmp_sOwnerType == 35 || _tmp_sOwnerType == 81 || _tmp_sOwnerType == 73 || _tmp_sOwnerType == 66) bInv = TRUE; //Energy-Ball,Wyvern if (m_cDetailLevel == 0) { iWeaponColor = 0; iShieldColor = 0; iArmorColor = 0; iMantleColor = 0; iArmColor = 0; iPantsColor = 0; iBootsColor = 0; iHelmColor = 0; }else { iWeaponColor = (_tmp_iApprColor & 0xF0000000) >> 28; iShieldColor = (_tmp_iApprColor & 0x0F000000) >> 24; iArmorColor = (_tmp_iApprColor & 0x00F00000) >> 20; iMantleColor = (_tmp_iApprColor & 0x000F0000) >> 16; iArmColor = (_tmp_iApprColor & 0x0000F000) >> 12; iPantsColor = (_tmp_iApprColor & 0x00000F00) >> 8; iBootsColor = (_tmp_iApprColor & 0x000000F0) >> 4; iHelmColor = (_tmp_iApprColor & 0x0000000F); } iWeaponGlare = (_tmp_sAppr4 & 0x000C) >> 2; iShieldGlare = (_tmp_sAppr4 & 0x0003); if ( (_tmp_iStatus & 0x10) != 0) { if (memcmp(m_cPlayerName, _tmp_cName, 10) == 0) bInv = TRUE; else if( _iGetFOE(_tmp_iStatus) == 1 ) bInv = TRUE; else return FALSE; } switch (_tmp_cFrame) { case 4: _tmp_cFrame = 4; break; case 5: _tmp_cFrame = 4; break; case 6: _tmp_cFrame = 4; break; case 7: _tmp_cFrame = 4; break; case 8: _tmp_cFrame = 4; break; case 9: _tmp_cFrame = 4; break; case 10: _tmp_cFrame = 5; break; case 11: _tmp_cFrame = 6; break; case 12: _tmp_cFrame = 7; break; } switch (_tmp_sOwnerType) { case 1: case 2: case 3: if ((_tmp_sAppr2 & 0xF000) != 0) { iWeapon = ((_tmp_sAppr2 & 0x0FF0) >> 4); if (iWeapon == 0) iAdd = 6; if ((iWeapon >= 1) && (iWeapon <= 39)) iAdd = 6; if ((iWeapon >= 40) && (iWeapon <= 59)) iAdd = 7; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (iAdd * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + iAdd; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + iAdd; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + iAdd; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + iAdd; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + iAdd; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_M + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*4 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_M + (_tmp_sAppr2 & 0x000F)*8 + 4; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + iAdd; }else { iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (5 * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + 5; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 5; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 5; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + 5; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 5; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 5; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 5; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 5; iWeaponIndex = -1; iShieldIndex = -1; } break; case 4: case 5: case 6: if (((_tmp_sAppr3 & 0x0F00) >> 8) == 1) iSkirtDraw = 1; if ((_tmp_sAppr2 & 0xF000) != 0) { iWeapon = ((_tmp_sAppr2 & 0x0FF0) >> 4); if (iWeapon == 0) iAdd = 6; if ((iWeapon >= 1) && (iWeapon <= 39)) iAdd = 6; if ((iWeapon >= 40) && (iWeapon <= 59)) iAdd = 7; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (iAdd * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + iAdd; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + iAdd; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + iAdd; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + iAdd; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + iAdd; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_W + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*4 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_W + (_tmp_sAppr2 & 0x000F)*8 + 4; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + iAdd; }else { iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (5 * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + 5; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 5; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 5; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + 5; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 5; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 5; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 5; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 5; iWeaponIndex = -1; iShieldIndex = -1; } break; default: iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); iUndiesIndex = -1; iHairIndex = -1; iBodyArmorIndex = -1; iArmArmorIndex = -1; iBootsIndex = -1; iPantsIndex = -1; iWeaponIndex = -1; iShieldIndex = -1; iMantleIndex = -1; iHelmIndex = -1; break; } dx = 0; dy = 0; if ((_tmp_cFrame >= 1) && (_tmp_cFrame <= 3)) { switch (_tmp_cFrame) { case 1: cFrameMoveDots = 26; break; case 2: cFrameMoveDots = 16; break; case 3: cFrameMoveDots = 0; break; } switch (_tmp_cDir) { case 1 : dy = cFrameMoveDots; break; case 2 : dy = cFrameMoveDots; dx = -cFrameMoveDots; break; case 3 : dx = -cFrameMoveDots; break; case 4 : dx = -cFrameMoveDots; dy = -cFrameMoveDots; break; case 5 : dy = -cFrameMoveDots; break; case 6 : dy = -cFrameMoveDots; dx = cFrameMoveDots; break; case 7 : dx = cFrameMoveDots; break; case 8 : dx = cFrameMoveDots; dy = cFrameMoveDots; break; } switch (_tmp_cFrame) { case 1: dy++; break; case 2: dy += 2; break; case 3: dy++; break; } switch (_tmp_cFrame) { case 2: bDashDraw = TRUE; cFrameMoveDots = 26; break; case 3: bDashDraw = TRUE; cFrameMoveDots = 16; break; } dsx = 0; dsy = 0; switch (_tmp_cDir) { case 1 : dsy = cFrameMoveDots; break; case 2 : dsy = cFrameMoveDots; dsx = -cFrameMoveDots; break; case 3 : dsx = -cFrameMoveDots; break; case 4 : dsx = -cFrameMoveDots; dsy = -cFrameMoveDots; break; case 5 : dsy = -cFrameMoveDots; break; case 6 : dsy = -cFrameMoveDots; dsx = cFrameMoveDots; break; case 7 : dsx = cFrameMoveDots; break; case 8 : dsx = cFrameMoveDots; dsy = cFrameMoveDots; break; } }else if (_tmp_cFrame > 3) { dx = 0; dy = 0; }else { switch (_tmp_cDir) { case 1: dy = 32; break; case 2: dy = 32; dx = -32; break; case 3: dx = -32; break; case 4: dx = -32; dy = -32; break; case 5: dy = -32; break; case 6: dy = -32; dx = 32; break; case 7: dx = 32; break; case 8: dx = 32; dy = 32; break; } } if(m_pSprite[iBodyIndex + (_tmp_cDir - 1)] == NULL) return false; if (m_bIsCrusadeMode || (m_bIsAstoriaMode && memcmp(m_cCurLocation, "astoria", 7) == 0)) { DrawObjectFOE(sX+dx, sY+dy, _tmp_cFrame); } if (_tmp_iEffectType != 0) { switch (_tmp_iEffectType) { case 1: m_pEffectSpr[26]->PutTransSprite(sX+dx, sY+dy, _tmp_iEffectFrame, dwTime); break; // Special Ability: Attack Effect case 2: m_pEffectSpr[27]->PutTransSprite(sX+dx, sY+dy, _tmp_iEffectFrame, dwTime); break; // Special Ability: Protect Effect } } if (bTrans == FALSE) { switch (_tmp_sOwnerType) { // Pas d'ombre pour ces mobs case 10: // Slime case 35: // Energy Sphere case 50: // TW case 51: // CP case 60: // Plant case 65: // IceGolem case 66: // Wyvern case 73: // Fire Wyvern case 81: // Abaddon case 91: // Gate break; default: if (m_cDetailLevel != 0) { if (sX < 50) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSpriteClip(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSprite(sX+dx, sY+dy, _tmp_cFrame, dwTime); } break; } CheckActiveAura(sX+dx, sY+dy, dwTime, _tmp_sOwnerType); if (_cDrawingOrder[_tmp_cDir] == 1) { if (iWeaponIndex != -1) { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } if (_tmp_cFrame == 3) m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame -1, m_wR[10] -(m_wR[0]/3), m_wG[10] -(m_wG[0]/3), m_wB[10] -(m_wB[0]/3), dwTime); } if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX+dx, sY+dy, _tmp_cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iUndiesIndex != -1) m_pSprite[iUndiesIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iShieldIndex != -1) { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13, sY -34, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } }else { if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX+dx, sY+dy, _tmp_cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iUndiesIndex != -1) m_pSprite[iUndiesIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iShieldIndex != -1) { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13+dx, sY -34+dy, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iWeaponIndex != -1) { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } if (_tmp_cFrame == 3) m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame -1, m_wR[10] -(m_wR[0]/3), m_wG[10] -(m_wG[0]/3), m_wB[10] -(m_wB[0]/3), dwTime); } } if((_tmp_iStatus & 0x0F00) >> 8 == 9) // Highly trained m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 6, -2, 6, dwTime); // Berserk if ((_tmp_iStatus & 0x20) != 0) m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, -5, -5, dwTime); DrawAngel(8+(_tmp_cDir - 1), sX+dx+20, sY+dy-20, _tmp_cFrame%8, dwTime); CheckActiveAura2(sX+dx, sY+dy, dwTime, _tmp_sOwnerType); if (bDashDraw == TRUE) { m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSpriteRGB(sX+dsx, sY+dsy, _tmp_cFrame, m_wR[10] -(m_wR[0]/3), m_wG[10] -(m_wG[0]/3), m_wB[10] -(m_wB[0]/3), dwTime); if (iWeaponIndex != -1) m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dsx, sY+dsy, _tmp_cFrame, m_wR[10] -(m_wR[0]/3), m_wG[10] -(m_wG[0]/3), m_wB[10] -(m_wB[0]/3), dwTime); if (iShieldIndex != -1) m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dsx, sY+dsy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[10] -(m_wR[0]/3), m_wG[10] -(m_wG[0]/3), m_wB[10] -(m_wB[0]/3), dwTime); } } else if( strlen(_tmp_cName) > 0 ) { if( (_tmp_sOwnerType>=1) && (_tmp_sOwnerType<=6) ) DrawObjectName(sX+dx, sY+dy, _tmp_cName, _tmp_iStatus); else DrawNpcName(sX+dx, sY+dy, _tmp_sOwnerType, _tmp_iStatus); } if (_tmp_iChatIndex != NULL) { if ((m_pChatMsgList[_tmp_iChatIndex] != NULL) && (m_pChatMsgList[_tmp_iChatIndex]->m_iObjectID == _tmp_wObjectID)) { m_pChatMsgList[_tmp_iChatIndex]->m_sX = sX+dx; m_pChatMsgList[_tmp_iChatIndex]->m_sY = sY+dy; }else { m_pMapData->ClearChatMsg(indexX, indexY); } } _tmp_dx = dx; _tmp_dy = dy; if ( (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top != -1) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top < msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.bottom > msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.left < msX) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.right > msX) ) return TRUE; return FALSE; } BOOL CGame::DrawObject_OnMagic(int indexX, int indexY, int sX, int sY, BOOL bTrans, DWORD dwTime, int msX, int msY) {int iBodyIndex, iUndiesIndex, iHairIndex, iArmArmorIndex, iBodyArmorIndex, iPantsIndex, iBootsIndex, iR, iG, iB, iHelmIndex, iMantleIndex; BOOL bInv = FALSE; int iWeaponColor, iShieldColor, iArmorColor, iMantleColor, iArmColor, iPantsColor, iBootsColor, iHelmColor; int iSkirtDraw = 0; if(_tmp_sOwnerType == 35 || _tmp_sOwnerType == 73 || _tmp_sOwnerType == 66) bInv = TRUE; //Energy-Ball,Wyvern if (m_cDetailLevel == 0) { iWeaponColor = 0; iShieldColor = 0; iArmorColor = 0; iMantleColor = 0; iArmColor = 0; iPantsColor = 0; iBootsColor = 0; iHelmColor = 0; }else { iWeaponColor = (_tmp_iApprColor & 0xF0000000) >> 28; iShieldColor = (_tmp_iApprColor & 0x0F000000) >> 24; iArmorColor = (_tmp_iApprColor & 0x00F00000) >> 20; iMantleColor = (_tmp_iApprColor & 0x000F0000) >> 16; iArmColor = (_tmp_iApprColor & 0x0000F000) >> 12; iPantsColor = (_tmp_iApprColor & 0x00000F00) >> 8; iBootsColor = (_tmp_iApprColor & 0x000000F0) >> 4; iHelmColor = (_tmp_iApprColor & 0x0000000F); } if ( (_tmp_iStatus & 0x10) != 0) { if (memcmp(m_cPlayerName, _tmp_cName, 10) == 0) bInv = TRUE; else { if (_tmp_iChatIndex != NULL) { if (m_pChatMsgList[_tmp_iChatIndex] != NULL) { m_pChatMsgList[_tmp_iChatIndex]->m_sX = sX; m_pChatMsgList[_tmp_iChatIndex]->m_sY = sY; }else { m_pMapData->ClearChatMsg(indexX, indexY); } } return FALSE; } } switch (_tmp_sOwnerType) { case 1: case 2: case 3: iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (8 * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + 8; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 8; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 8; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + 8; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 8; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 8; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 8; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 8; break; case 4: case 5: case 6: if (((_tmp_sAppr3 & 0x0F00) >> 8) == 1) iSkirtDraw = 1; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (8 * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + 8; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 8; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 8; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + 8; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 8; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 8; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 8; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 8; break; } /* switch (_tmp_cFrame) { case 15: _tmp_cFrame = 14; break; case 16: _tmp_cFrame = 14; break; case 17: _tmp_cFrame = 15; break; case 18: _tmp_cFrame = 15; break; case 19: _tmp_cFrame = 15; break; case 20: _tmp_cFrame = 15; break; case 21: _tmp_cFrame = 15; break; case 22: _tmp_cFrame = 15; break; case 23: _tmp_cFrame = 14; break; } */ if(m_pSprite[iBodyIndex + (_tmp_cDir - 1)] == NULL) return false; if (m_bIsCrusadeMode || (m_bIsAstoriaMode && memcmp(m_cCurLocation, "astoria", 7) == 0)) DrawObjectFOE(sX, sY, _tmp_cFrame); if (_tmp_iEffectType != 0) { switch (_tmp_iEffectType) { case 1: m_pEffectSpr[26]->PutTransSprite(sX, sY, _tmp_iEffectFrame, dwTime); break; // Special Ability: Attack Effect case 2: m_pEffectSpr[27]->PutTransSprite(sX, sY, _tmp_iEffectFrame, dwTime); break; // Special Ability: Protect Effect } } if (bTrans == FALSE) { switch (_tmp_sOwnerType) { // Pas d'ombre pour ces mobs case 10: // Slime case 35: // Energy Sphere case 50: // TW case 51: // CP case 60: // Plant case 65: // IceGolem case 66: // Wyvern case 73: // Fire Wyvern case 81: // Abaddon case 91: // Gate break; default: if (m_cDetailLevel != 0) { if (sX < 50) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSpriteClip(sX, sY, _tmp_cFrame, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSprite(sX, sY, _tmp_cFrame, dwTime); } break; } CheckActiveAura(sX, sY, dwTime, _tmp_sOwnerType); if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, _tmp_cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX, sY, _tmp_cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX, sY, _tmp_cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if (iUndiesIndex != -1) m_pSprite[iUndiesIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, dwTime); if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if (iMantleIndex != -1) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 16 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if((_tmp_iStatus & 0x0F00) >> 8 == 9) // Highly trained m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 6, -2, 6, dwTime); if ((_tmp_iStatus & 0x20) != 0) // Berserk m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, -5, -5, dwTime); DrawAngel(32+(_tmp_cDir - 1), sX+20, sY-20, _tmp_cFrame%16, dwTime); CheckActiveAura2(sX, sY, dwTime, _tmp_sOwnerType); }else if( strlen(_tmp_cName) > 0 ) { if( (_tmp_sOwnerType>=1) && (_tmp_sOwnerType<=6) ) DrawObjectName(sX, sY, _tmp_cName, _tmp_iStatus); else DrawNpcName(sX, sY, _tmp_sOwnerType, _tmp_iStatus); } if (_tmp_iChatIndex != NULL) { if ((m_pChatMsgList[_tmp_iChatIndex] != NULL) && (m_pChatMsgList[_tmp_iChatIndex]->m_iObjectID == _tmp_wObjectID)) { m_pChatMsgList[_tmp_iChatIndex]->m_sX = sX; m_pChatMsgList[_tmp_iChatIndex]->m_sY = sY; }else { m_pMapData->ClearChatMsg(indexX, indexY); } } if ( (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top != -1) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top < msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.bottom > msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.left < msX) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.right > msX) ) return TRUE; return FALSE; } BOOL CGame::DrawObject_OnGetItem(int indexX, int indexY, int sX, int sY, BOOL bTrans, DWORD dwTime, int msX, int msY) {int iBodyIndex, iUndiesIndex, iHairIndex, iArmArmorIndex, iBodyArmorIndex, iPantsIndex, iBootsIndex, iR, iG, iB, iHelmIndex, iMantleIndex; BOOL bInv = FALSE; int iWeaponColor, iShieldColor, iArmorColor, iMantleColor, iArmColor, iPantsColor, iBootsColor, iHelmColor; int iSkirtDraw = 0; if(_tmp_sOwnerType == 35 || _tmp_sOwnerType == 73 || _tmp_sOwnerType == 66) bInv = TRUE; //Energy-Ball,Wyvern if (m_cDetailLevel == 0) { iWeaponColor = 0; iShieldColor = 0; iArmorColor = 0; iMantleColor = 0; iArmColor = 0; iPantsColor = 0; iBootsColor = 0; iHelmColor = 0; }else { iWeaponColor = (_tmp_iApprColor & 0xF0000000) >> 28; iShieldColor = (_tmp_iApprColor & 0x0F000000) >> 24; iArmorColor = (_tmp_iApprColor & 0x00F00000) >> 20; iMantleColor = (_tmp_iApprColor & 0x000F0000) >> 16; iArmColor = (_tmp_iApprColor & 0x0000F000) >> 12; iPantsColor = (_tmp_iApprColor & 0x00000F00) >> 8; iBootsColor = (_tmp_iApprColor & 0x000000F0) >> 4; iHelmColor = (_tmp_iApprColor & 0x0000000F); } if ( (_tmp_iStatus & 0x10) != 0) { if (memcmp(m_cPlayerName, _tmp_cName, 10) == 0) bInv = TRUE; else if( _iGetFOE(_tmp_iStatus) == 1 ) bInv = TRUE; else return FALSE; } switch (_tmp_sOwnerType) { case 1: case 2: case 3: iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (9 * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + 9; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 9; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 9; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + 9; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 9; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 9; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 9; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 9; break; case 4: case 5: case 6: if (((_tmp_sAppr3 & 0x0F00) >> 8) == 1) iSkirtDraw = 1; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (9 * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + 9; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 9; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 9; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + 9; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 9; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 9; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 9; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 9; break; default: iUndiesIndex = -1; iHairIndex = -1; iArmArmorIndex = -1; iBodyArmorIndex = -1; iPantsIndex = -1; iBootsIndex = -1; iMantleIndex = -1; iHelmIndex = -1; break; } if(m_pSprite[iBodyIndex + (_tmp_cDir - 1)] == NULL) return false; if (m_bIsCrusadeMode || (m_bIsAstoriaMode && memcmp(m_cCurLocation, "astoria", 7) == 0)) DrawObjectFOE(sX, sY, _tmp_cFrame); if (_tmp_iEffectType != 0) { switch (_tmp_iEffectType) { case 1: m_pEffectSpr[26]->PutTransSprite(sX, sY, _tmp_iEffectFrame, dwTime); break; // Special Ability: Attack Effect case 2: m_pEffectSpr[27]->PutTransSprite(sX, sY, _tmp_iEffectFrame, dwTime); break; // Special Ability: Protect Effect } } if (bTrans == FALSE) { switch (_tmp_sOwnerType) { // Pas d'ombre pour ces mobs case 10: // Slime case 35: // Energy Sphere case 50: // TW case 51: // CP case 60: // Plant case 65: // IceGolem case 66: // Wyvern case 73: // Fire Wyvern case 81: // Abaddon case 91: // Gate break; default: if (m_cDetailLevel != 0) { if (sX < 50) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSpriteClip(sX, sY, _tmp_cFrame, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSprite(sX, sY, _tmp_cFrame, dwTime); } break; } CheckActiveAura(sX, sY, dwTime, _tmp_sOwnerType); if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite2(sX, sY, _tmp_cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX, sY, _tmp_cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX, sY, _tmp_cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if (iUndiesIndex != -1) { if(bInv) m_pSprite[iUndiesIndex]->PutTransSprite2(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else m_pSprite[iUndiesIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); } if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if(bInv) m_pSprite[iBootsIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } } if (iPantsIndex != -1) { if(bInv) m_pSprite[iPantsIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } } if (iArmArmorIndex != -1) { if(bInv) m_pSprite[iArmArmorIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if(bInv) m_pSprite[iBootsIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } } if (iBodyArmorIndex != -1) { if(bInv) m_pSprite[iBodyArmorIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } } if (iHelmIndex != -1) { if(bInv) m_pSprite[iHelmIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } } if (iMantleIndex != -1) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if((_tmp_iStatus & 0x0F00) >> 8 == 9) // Highly trained m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 6, -2, 6, dwTime); if ((_tmp_iStatus & 0x20) != 0) // Berserk m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, -5, -5, dwTime); DrawAngel(40+(_tmp_cDir - 1), sX+20, sY-20, _tmp_cFrame%4, dwTime); CheckActiveAura2(sX, sY, dwTime, _tmp_sOwnerType); }else if( strlen(_tmp_cName) > 0 ) { if( (_tmp_sOwnerType>=1) && (_tmp_sOwnerType<=6) ) DrawObjectName(sX, sY, _tmp_cName, _tmp_iStatus); else DrawNpcName(sX, sY, _tmp_sOwnerType, _tmp_iStatus); } if (_tmp_iChatIndex != NULL) { if ((m_pChatMsgList[_tmp_iChatIndex] != NULL) && (m_pChatMsgList[_tmp_iChatIndex]->m_iObjectID == _tmp_wObjectID)) { m_pChatMsgList[_tmp_iChatIndex]->m_sX = sX; m_pChatMsgList[_tmp_iChatIndex]->m_sY = sY; }else { m_pMapData->ClearChatMsg(indexX, indexY); } } if ( (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top != -1) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top < msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.bottom > msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.left < msX) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.right > msX) ) return TRUE; return FALSE; } BOOL CGame::DrawObject_OnDamage(int indexX, int indexY, int sX, int sY, BOOL bTrans, DWORD dwTime, int msX, int msY) {int iBodyIndex, iUndiesIndex, iHairIndex, iArmArmorIndex, iBodyArmorIndex, iPantsIndex, iBootsIndex, iWeaponIndex, iShieldIndex, iHelmIndex, iR, iG, iB; int iAdd, iDrawMode, iMantleIndex; char cFrame; BOOL bInv = FALSE; int iWeaponGlare, iShieldGlare; int iWeaponColor, iShieldColor, iArmorColor, iMantleColor, iArmColor, iPantsColor, iBootsColor, iHelmColor; int iSkirtDraw = 0; if(_tmp_sOwnerType == 35 || _tmp_sOwnerType == 81 || _tmp_sOwnerType == 73 || _tmp_sOwnerType == 66) bInv = TRUE; //Energy-Ball,Wyvern if (m_cDetailLevel == 0) { iWeaponColor = 0; iShieldColor = 0; iArmorColor = 0; iMantleColor = 0; iArmColor = 0; iPantsColor = 0; iBootsColor = 0; iHelmColor = 0; }else { iWeaponColor = (_tmp_iApprColor & 0xF0000000) >> 28; iShieldColor = (_tmp_iApprColor & 0x0F000000) >> 24; iArmorColor = (_tmp_iApprColor & 0x00F00000) >> 20; iMantleColor = (_tmp_iApprColor & 0x000F0000) >> 16; iArmColor = (_tmp_iApprColor & 0x0000F000) >> 12; iPantsColor = (_tmp_iApprColor & 0x00000F00) >> 8; iBootsColor = (_tmp_iApprColor & 0x000000F0) >> 4; iHelmColor = (_tmp_iApprColor & 0x0000000F); } iWeaponGlare = (_tmp_sAppr4 & 0x000C) >> 2; iShieldGlare = (_tmp_sAppr4 & 0x0003); if ( (_tmp_iStatus & 0x10) != 0) { if (memcmp(m_cPlayerName, _tmp_cName, 10) == 0) bInv = TRUE; else if( _iGetFOE(_tmp_iStatus) == 1 ) bInv = TRUE; else return FALSE; } cFrame = _tmp_cFrame; switch (_tmp_sOwnerType) { case 1: case 2: case 3: if (cFrame < 4) { if ((_tmp_sAppr2 & 0xF000) != 0) iAdd = 1; else iAdd = 0; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (iAdd * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + iAdd; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + iAdd; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + iAdd; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + iAdd; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + iAdd; if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_M + (_tmp_sAppr2 & 0x000F)*8 + iAdd; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_M + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*iAdd + (_tmp_cDir - 1); if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + iAdd; iDrawMode = 0; }else { cFrame -= 4; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (10 * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + 10; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 10; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 10; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + 10; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 10; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 10; if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_M + (_tmp_sAppr2 & 0x000F)*8 + 5; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_M + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*5 + (_tmp_cDir - 1); if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 10; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 10; iDrawMode = 1; } break; case 4: case 5: case 6: if (((_tmp_sAppr3 & 0x0F00) >> 8) == 1) iSkirtDraw = 1; if (cFrame < 4) { if ((_tmp_sAppr2 & 0xF000) != 0) iAdd = 1; else iAdd = 0; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (iAdd * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + iAdd; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + iAdd; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + iAdd; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + iAdd; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + iAdd; if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_W + (_tmp_sAppr2 & 0x000F)*8 + iAdd; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_W + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*iAdd + (_tmp_cDir - 1); if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + iAdd; iDrawMode = 0; }else { cFrame -= 4; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (10 * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + 10; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 10; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 10; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + 10; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 10; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 10; if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_W + (_tmp_sAppr2 & 0x000F)*8 + 5; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_W + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*5 + (_tmp_cDir - 1); if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 10; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 10; iDrawMode = 1; } break; default: if (cFrame < 4) { if (_tmp_sAppr2 != 0) { iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (4 * 8); cFrame = _tmp_sAppr2 -1; } else if (_tmp_sOwnerType == 66) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 67) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 68) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 69) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 73) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 81) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else if (_tmp_sOwnerType == 86) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else if (_tmp_sOwnerType == 87) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else if (_tmp_sOwnerType == 89) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else if (_tmp_sOwnerType == 91) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); }else { cFrame -= 4; if (_tmp_sAppr2 != 0) { iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (4 * 8); cFrame = _tmp_sAppr2 -1; } else if (_tmp_sOwnerType == 66) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 67) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 68) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 69) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 73) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 81) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else if (_tmp_sOwnerType == 86) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else if (_tmp_sOwnerType == 87) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else if (_tmp_sOwnerType == 89) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else if (_tmp_sOwnerType == 91) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (1 * 8); else iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (3 * 8); } iUndiesIndex = -1; iHairIndex = -1; iArmArmorIndex = -1; iBodyArmorIndex = -1; iPantsIndex = -1; iBootsIndex = -1; iWeaponIndex = -1; iShieldIndex = -1; iMantleIndex = -1; iHelmIndex = -1; iDrawMode = 0; break; } if(m_pSprite[iBodyIndex + (_tmp_cDir - 1)] == NULL) return false; if (m_bIsCrusadeMode || (m_bIsAstoriaMode && memcmp(m_cCurLocation, "astoria", 7) == 0)) DrawObjectFOE(sX, sY, cFrame); if (_tmp_iEffectType != 0) { switch (_tmp_iEffectType) { case 1: m_pEffectSpr[26]->PutTransSprite(sX, sY, _tmp_iEffectFrame, dwTime); break; // Special Ability: Attack Effect case 2: m_pEffectSpr[27]->PutTransSprite(sX, sY, _tmp_iEffectFrame, dwTime); break; // Special Ability: Protect Effect } } if (bTrans == FALSE) { switch (_tmp_sOwnerType) { // Pas d'ombre pour ces mobs case 10: // Slime case 35: // Energy Sphere case 50: // TW case 51: // CP case 60: // Plant case 65: // IceGolem case 66: // Wyvern case 73: // Fire Wyvern case 81: // Abaddon case 91: // Gate break; default: if (m_cDetailLevel != 0) { if (sX < 50) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSpriteClip(sX, sY, cFrame, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSprite(sX, sY, cFrame, dwTime); } break; } CheckActiveAura(sX, sY, dwTime, _tmp_sOwnerType); if (iDrawMode == 1) // Etrange, 1 semble impossible avec des mobs ! { if (_cDrawingOrder[_tmp_cDir] == 1) { if (iWeaponIndex != -1) { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX, sY, cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX, sY, cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if (_tmp_sOwnerType == 35) m_pEffectSpr[0]->PutTransSprite(sX, sY, 1, dwTime); if (_tmp_sOwnerType == 81) // Abaddon { m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, cFrame, dwTime); }else if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX, sY, cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX, sY, cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iUndiesIndex != -1) m_pSprite[iUndiesIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iShieldIndex != -1) { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13, sY -34, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } }else { if (_tmp_sOwnerType == 35) m_pEffectSpr[0]->PutTransSprite(sX, sY, 1, dwTime); if (_tmp_sOwnerType == 81) // Abaddon { m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, cFrame, dwTime); }else if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX, sY, cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX, sY, cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iUndiesIndex != -1) m_pSprite[iUndiesIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iShieldIndex != -1) { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13, sY -34, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 4 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iWeaponIndex != -1) { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX, sY, cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX, sY, cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } } if((_tmp_iStatus & 0x0F00) >> 8 == 9) // Highly trained m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, cFrame, 6, -2, 6, dwTime); if ((_tmp_iStatus & 0x20) != 0) // Berserk m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, cFrame, 0, -5, -5, dwTime); DrawAngel(16+(_tmp_cDir - 1), sX+20, sY-20, cFrame%4, dwTime); CheckActiveAura2(sX, sY, dwTime, _tmp_sOwnerType); }else // DrawMode != 1 { if (_cDrawingOrder[_tmp_cDir] == 1) { if (iWeaponIndex != -1) { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX, sY, cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX, sY, cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if (_tmp_sOwnerType == 35) m_pEffectSpr[0]->PutTransSprite(sX, sY, 1, dwTime); if (_tmp_sOwnerType == 81) // Abaddon { m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, cFrame, dwTime); }else if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX, sY, cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX, sY, cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iUndiesIndex != -1) m_pSprite[iUndiesIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iShieldIndex != -1) { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13, sY -34, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } }else { if (_tmp_sOwnerType == 35) m_pEffectSpr[0]->PutTransSprite(sX, sY, 1, dwTime); if (_tmp_sOwnerType == 81) // Abaddon { m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, cFrame, dwTime); }else if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX, sY, cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX, sY, cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iUndiesIndex != -1) m_pSprite[iUndiesIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iShieldIndex != -1) { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13, sY -34, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iWeaponIndex != -1) { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX, sY, cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX, sY, cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } } if((_tmp_iStatus & 0x0F00) >> 8 == 9) // Highly trained m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, cFrame, 6, -2, 6, dwTime); if ((_tmp_iStatus & 0x20) != 0) // Berserk m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSpriteRGB(sX, sY, cFrame, 0, -5, -5, dwTime); DrawAngel(16+(_tmp_cDir - 1), sX+20, sY-20, cFrame%4, dwTime); CheckActiveAura2(sX, sY, dwTime, _tmp_sOwnerType); } }else if( strlen(_tmp_cName) > 0 ) { if( (_tmp_sOwnerType>=1) && (_tmp_sOwnerType<=6) ) DrawObjectName(sX, sY, _tmp_cName, _tmp_iStatus); else DrawNpcName(sX, sY, _tmp_sOwnerType, _tmp_iStatus); } if (_tmp_iChatIndex != NULL) { if ((m_pChatMsgList[_tmp_iChatIndex] != NULL) && (m_pChatMsgList[_tmp_iChatIndex]->m_iObjectID == _tmp_wObjectID)) { m_pChatMsgList[_tmp_iChatIndex]->m_sX = sX; m_pChatMsgList[_tmp_iChatIndex]->m_sY = sY; } else { m_pMapData->ClearChatMsg(indexX, indexY); } } // Snoopy: Abaddon effects if (_tmp_sOwnerType == 81) { int randFrame = _tmp_cFrame % 12; m_pEffectSpr[154]->PutTransSprite70(sX-50 , sY-50 , randFrame, dwTime); m_pEffectSpr[155]->PutTransSprite70(sX-20 , sY-80 , randFrame, dwTime); m_pEffectSpr[156]->PutTransSprite70(sX+70 , sY-50 , randFrame, dwTime); m_pEffectSpr[157]->PutTransSprite70(sX-30 , sY , randFrame, dwTime); m_pEffectSpr[158]->PutTransSprite70(sX-60 , sY+90 , randFrame, dwTime); m_pEffectSpr[159]->PutTransSprite70(sX+65 , sY+85 , randFrame, dwTime); switch (_tmp_cDir) { case 1: m_pEffectSpr[153]->PutTransSprite70(sX , sY+108 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-50 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 2: m_pEffectSpr[153]->PutTransSprite70(sX , sY+95 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-70 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 3: m_pEffectSpr[153]->PutTransSprite70(sX , sY+105 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-90 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 4: m_pEffectSpr[153]->PutTransSprite70(sX-35 , sY+100 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-80 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 5: m_pEffectSpr[153]->PutTransSprite70(sX , sY+95 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-65 , sY-5 , _tmp_iEffectFrame %15, dwTime); break; case 6: m_pEffectSpr[153]->PutTransSprite70(sX+45 , sY+95 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-31 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 7: m_pEffectSpr[153]->PutTransSprite70(sX+40 , sY+110 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-30 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 8: m_pEffectSpr[153]->PutTransSprite70(sX+20 , sY+110 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-20 , sY+16 , _tmp_iEffectFrame %15, dwTime); break; } } if ( (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top != -1) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top < msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.bottom > msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.left < msX) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.right > msX) ) return TRUE; return FALSE; } BOOL CGame::DrawObject_OnDying(int indexX, int indexY, int sX, int sY, BOOL bTrans, DWORD dwTime, int msX, int msY) { int iBodyIndex, iUndiesIndex, iHairIndex, iArmArmorIndex, iBodyArmorIndex, iPantsIndex, iBootsIndex, iR, iG, iB, iHelmIndex, iMantleIndex; int iWeaponColor, iShieldColor, iArmorColor, iMantleColor, iArmColor, iPantsColor, iBootsColor, iHelmColor; int iSkirtDraw = 0; char cFrame; if (m_cDetailLevel == 0) { iWeaponColor = 0; iShieldColor = 0; iArmorColor = 0; iMantleColor = 0; iArmColor = 0; iPantsColor = 0; iBootsColor = 0; iHelmColor = 0; }else { iWeaponColor = (_tmp_iApprColor & 0xF0000000) >> 28; iShieldColor = (_tmp_iApprColor & 0x0F000000) >> 24; iArmorColor = (_tmp_iApprColor & 0x00F00000) >> 20; iMantleColor = (_tmp_iApprColor & 0x000F0000) >> 16; iArmColor = (_tmp_iApprColor & 0x0000F000) >> 12; iPantsColor = (_tmp_iApprColor & 0x00000F00) >> 8; iBootsColor = (_tmp_iApprColor & 0x000000F0) >> 4; iHelmColor = (_tmp_iApprColor & 0x0000000F); } cFrame = _tmp_cFrame; switch (_tmp_sOwnerType) { case 1: case 2: case 3: if (cFrame < 6) { iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (0 * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 0; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 0; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + 0; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 0; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 0; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 0; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 0; }else { cFrame -= 6; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (11 * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + 11; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 11; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 11; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + 11; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 11; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 11; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 11; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 11; } break; case 4: case 5: case 6: if (((_tmp_sAppr3 & 0x0F00) >> 8) == 1) iSkirtDraw = 1; if (cFrame < 6) { iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (0 * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 0; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 0; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + 0; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 0; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 0; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 0; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 0; }else { cFrame -= 6; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (11 * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + 11; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 11; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 11; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + 11; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 11; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 11; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 11; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 11; } break; default: if (cFrame < 4) { if (_tmp_sAppr2 != 0) { iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (4 * 8); cFrame = _tmp_sAppr2 -1; } else if (_tmp_sOwnerType == 66) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else if (_tmp_sOwnerType == 73) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else if (_tmp_sOwnerType == 81) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (3 * 8); else if (_tmp_sOwnerType == 86) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (3 * 8); else if (_tmp_sOwnerType == 87) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (3 * 8); else if (_tmp_sOwnerType == 89) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (3 * 8); else if (_tmp_sOwnerType == 91) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); iUndiesIndex = -1; iHairIndex = -1; iArmArmorIndex = -1; iBodyArmorIndex = -1; iPantsIndex = -1; iBootsIndex = -1; iMantleIndex = -1; iHelmIndex = -1; switch (_tmp_sOwnerType) { case 36: // AGT case 37: // CGT case 38: // MS case 39: // DT case 40: // ESG case 41: // GMG case 42: // ManaStone if (_tmp_sAppr2 == 0) cFrame = 0; break; case 51: cFrame = 0; break; } }else { switch (_tmp_sOwnerType) { case 51: cFrame = 0; break; default: cFrame -= 4; break; } if (_tmp_sAppr2 != 0) { iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (4 * 8); cFrame = _tmp_sAppr2 -1; } else if (_tmp_sOwnerType == 66) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else if (_tmp_sOwnerType == 73) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else if (_tmp_sOwnerType == 81) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (3 * 8); else if (_tmp_sOwnerType == 86) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (3 * 8); else if (_tmp_sOwnerType == 87) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (3 * 8); else if (_tmp_sOwnerType == 89) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (3 * 8); else if (_tmp_sOwnerType == 91) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (4 * 8); iUndiesIndex = -1; iHairIndex = -1; iArmArmorIndex = -1; iBodyArmorIndex = -1; iPantsIndex = -1; iBootsIndex = -1; iMantleIndex = -1; iHelmIndex = -1; } break; } if(m_pSprite[iBodyIndex + (_tmp_cDir - 1)] == NULL) return false; if (m_bIsCrusadeMode || (m_bIsAstoriaMode && memcmp(m_cCurLocation, "astoria", 7) == 0)) DrawObjectFOE(sX, sY, cFrame); if (_tmp_iEffectType != 0) { switch (_tmp_iEffectType) { case 1: m_pEffectSpr[26]->PutTransSprite(sX, sY, _tmp_iEffectFrame, dwTime); break; // Special Ability: Attack Effect case 2: m_pEffectSpr[27]->PutTransSprite(sX, sY, _tmp_iEffectFrame, dwTime); break; // Special Ability: Protect Effect } } if (bTrans == FALSE) { switch (_tmp_sOwnerType) { // Pas d'ombre pour ces mobs case 10: // Slime case 35: // Energy Sphere case 50: // TW case 51: // CP case 60: // Plant case 65: // IceGolem case 66: // Wyvern case 73: // Fire Wyvern case 81: // Abaddon case 91: // Gate break; default: if (m_cDetailLevel != 0) { if (sX < 50) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSpriteClip(sX, sY, cFrame, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSprite(sX, sY, cFrame, dwTime); } break; } if (_tmp_sOwnerType == 81) { m_pEffectSpr[152]->PutTransSprite70(sX-80 , sY-15 , _tmp_iEffectFrame %27, dwTime); // Explosion Abaddon m_pEffectSpr[152]->PutTransSprite70(sX , sY-15 , _tmp_iEffectFrame %27, dwTime); m_pEffectSpr[152]->PutTransSprite70(sX-40 , sY , _tmp_iEffectFrame %27, dwTime); m_pEffectSpr[163]->PutTransSprite70(sX-90 , sY-80 , _tmp_iEffectFrame %12, dwTime); // Ames qui s'envolent m_pEffectSpr[160]->PutTransSprite70(sX-60 , sY-50 , _tmp_iEffectFrame %12, dwTime); m_pEffectSpr[161]->PutTransSprite70(sX-30 , sY-20 , _tmp_iEffectFrame %12, dwTime); m_pEffectSpr[162]->PutTransSprite70(sX , sY-100, _tmp_iEffectFrame %12, dwTime); m_pEffectSpr[163]->PutTransSprite70(sX+30 , sY-30 , _tmp_iEffectFrame %12, dwTime); m_pEffectSpr[162]->PutTransSprite70(sX+60 , sY-90 , _tmp_iEffectFrame %12, dwTime); m_pEffectSpr[163]->PutTransSprite70(sX+90 , sY-50 , _tmp_iEffectFrame %12, dwTime); switch (_tmp_cDir) { case 1: m_pEffectSpr[140]->PutTransSprite70(sX, sY, cFrame, dwTime); break; // Abbadon dying case 2: m_pEffectSpr[141]->PutTransSprite70(sX, sY, cFrame, dwTime); break; // fixed sprit IDs case 3: m_pEffectSpr[142]->PutTransSprite70(sX, sY, cFrame, dwTime); break; case 4: m_pEffectSpr[143]->PutTransSprite70(sX, sY, cFrame, dwTime); break; case 5: m_pEffectSpr[144]->PutTransSprite70(sX, sY, cFrame, dwTime); break; case 6: m_pEffectSpr[145]->PutTransSprite70(sX, sY, cFrame, dwTime); break; case 7: m_pEffectSpr[146]->PutTransSprite70(sX, sY, cFrame, dwTime); break; case 8: m_pEffectSpr[147]->PutTransSprite70(sX, sY, cFrame, dwTime); break; } }else if( _tmp_sOwnerType == 66 ) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, cFrame, dwTime); else if( _tmp_sOwnerType == 73 ) { //m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, cFrame, dwTime); m_pSprite[33]->PutTransSprite(sX, sY, cFrame, dwTime); switch (_tmp_cDir) { case 1: m_pEffectSpr[141]->PutTransSprite70(sX, sY, cFrame+8, dwTime); break; // Abbadon qui meurt case 2: m_pEffectSpr[142]->PutTransSprite70(sX, sY, cFrame+8, dwTime); break; case 3: m_pEffectSpr[143]->PutTransSprite70(sX, sY, cFrame+8, dwTime); break; case 4: m_pEffectSpr[144]->PutTransSprite70(sX, sY, cFrame+8, dwTime); break; case 5: m_pEffectSpr[145]->PutTransSprite70(sX, sY, cFrame+8, dwTime); break; case 6: m_pEffectSpr[146]->PutTransSprite70(sX, sY, cFrame+8, dwTime); break; case 7: m_pEffectSpr[147]->PutTransSprite70(sX, sY, cFrame+8, dwTime); break; //case 8: m_pEffectSpr[148]->PutTransSprite70(sX, sY, cFrame, dwTime); break; case 8: m_pEffectSpr[141]->PutTransSprite70(sX, sY, cFrame+8, dwTime); break; //due to buggy Sprite nb } }else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX, sY, cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX, sY, cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if (iUndiesIndex != -1) m_pSprite[iUndiesIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if (iMantleIndex != -1) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if((_tmp_iStatus & 0x0F00) >> 8 == 9) // Highly trained m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, cFrame, 6, -2, 6, dwTime); if ((_tmp_iStatus & 0x20) != 0) // Berserk m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSpriteRGB(sX, sY, cFrame, 0, -5, -5, dwTime); DrawAngel(24+(_tmp_cDir - 1), sX+20, sY-20, _tmp_cFrame, dwTime); CheckActiveAura2(sX, sY, dwTime, _tmp_sOwnerType); }else if( strlen(_tmp_cName) > 0 ) { if( (_tmp_sOwnerType>=1) && (_tmp_sOwnerType<=6) ) DrawObjectName(sX, sY, _tmp_cName, _tmp_iStatus); else DrawNpcName(sX, sY, _tmp_sOwnerType, _tmp_iStatus); } if (_tmp_iChatIndex != NULL) { if ((m_pChatMsgList[_tmp_iChatIndex] != NULL) && (m_pChatMsgList[_tmp_iChatIndex]->m_iObjectID == _tmp_wObjectID)) { m_pChatMsgList[_tmp_iChatIndex]->m_sX = sX; m_pChatMsgList[_tmp_iChatIndex]->m_sY = sY; }else { m_pMapData->ClearChatMsg(indexX, indexY); } } if ( (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top != -1) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top < msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.bottom > msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.left < msX) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.right > msX) ) return TRUE; return FALSE; } BOOL CGame::DrawObject_OnDead(int indexX, int indexY, int sX, int sY, BOOL bTrans, DWORD dwTime, int msX, int msY) {int iBodyIndex, iUndiesIndex, iHairIndex, iArmArmorIndex, iBodyArmorIndex, iPantsIndex, iBootsIndex, iR, iG, iB, iFrame, iMantleIndex, iHelmIndex; int iWeaponColor, iShieldColor, iArmorColor, iMantleColor, iArmColor, iPantsColor, iBootsColor, iHelmColor; int iSkirtDraw = 0; if( _tmp_sOwnerType == 66) return FALSE; if (m_cDetailLevel == 0) { iWeaponColor = 0; iShieldColor = 0; iArmorColor = 0; iMantleColor = 0; iArmColor = 0; iPantsColor = 0; iBootsColor = 0; iHelmColor = 0; }else { iWeaponColor = (_tmp_iApprColor & 0xF0000000) >> 28; iShieldColor = (_tmp_iApprColor & 0x0F000000) >> 24; iArmorColor = (_tmp_iApprColor & 0x00F00000) >> 20; iMantleColor = (_tmp_iApprColor & 0x000F0000) >> 16; iArmColor = (_tmp_iApprColor & 0x0000F000) >> 12; iPantsColor = (_tmp_iApprColor & 0x00000F00) >> 8; iBootsColor = (_tmp_iApprColor & 0x000000F0) >> 4; iHelmColor = (_tmp_iApprColor & 0x0000000F); } switch (_tmp_sOwnerType) { case 1: case 2: case 3: iFrame = 7; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (11 * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + 11; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 11; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 11; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + 11; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 11; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 11; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 11; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 11; break; case 4: case 5: case 6: if (((_tmp_sAppr3 & 0x0F00) >> 8) == 1) iSkirtDraw = 1; iFrame = 7; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (11 * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + 11; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 11; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 11; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + 11; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 11; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 11; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 11; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 11; break; default: switch (_tmp_sOwnerType) { case 28: // Troll case 29: // Ogre case 30: // Liche case 31: // DD // les 2 dernieres sont pas bonnes pour un mort ! case 63: // Frost // les 2 dernieres sont pas bonnes pour un mort ! iFrame = 5; iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (4 * 8); break; case 32: // Uni case 33: // WW case 43: // LWB case 44: // GHK case 45: // GHKABS case 46: // TK case 47: // BG case 48: // SK case 49: // HC case 50: // TW case 53: // BB case 54: // DE case 55: // Rabbit case 56: // Cat case 57: // Frog case 58: // MG case 59: // Ettin case 60: // Plant case 61: // Rudolph case 62: // Direboar case 64: // Crops ----------- Crop ici! etonant, pourtant ! case 65: // IceGolem case 70: // Dragon..........Ajouts par Snoopy case 71: // Centaur case 72: // ClawTurtle case 74: // GiantCrayfish case 75: // Gi Lizard case 76: // Gi Tree case 77: // Master Orc case 78: // Minaus case 79: // Nizie case 80: // Tentocle case 82: // Sorceress case 83: // ATK case 84: // MasterElf case 85: // DSK case 88: // Barbarian iFrame = 7; iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (4 * 8); break; case 86: // HBT case 87: // CT case 89: // AGC iFrame = 7; iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (3 * 8); break; case 66: // Wyvern iFrame = 15; iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); break; case 73: // FireWyvern iFrame = 7; iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); bTrans = TRUE; // Prevents showing hugly corpse break; case 81: // Abaddon iFrame = 0; iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (3 * 8); bTrans = TRUE; // Prevents showing hugly corpse break; case 51: // CP iFrame = 0; iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (4 * 8); break; case 52: // GG iFrame = 11; iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (4 * 8); break; case 91: // Gate iFrame = 5; iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); break; default: // 40*4 (10...27) iFrame = 3; iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (4 * 8); break; } iUndiesIndex = -1; iHairIndex = -1; iArmArmorIndex = -1; iBodyArmorIndex = -1; iPantsIndex = -1; iBootsIndex = -1; iMantleIndex = -1; iHelmIndex = -1; break; } if(m_pSprite[iBodyIndex + (_tmp_cDir - 1)] == NULL) return false; if (bTrans == FALSE) { if (_tmp_cFrame == -1) { _tmp_cFrame = 7; if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX, sY, iFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX, sY, iFrame, dwTime); SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if (iUndiesIndex != -1) m_pSprite[iUndiesIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if (iMantleIndex != -1) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if((_tmp_iStatus & 0x0F00) >> 8 == 9) m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, iFrame, 6, -2, 6, dwTime); }else if ((_tmp_iStatus & 0x20) != 0) m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, iFrame, -2*_tmp_cFrame +5, -2*_tmp_cFrame -5, -2*_tmp_cFrame -5, dwTime); else { if((_tmp_iStatus & 0x0F00) >> 8 == 9) m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, iFrame, -2*_tmp_cFrame +6,-2*_tmp_cFrame -2,-2*_tmp_cFrame +6, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, iFrame, -2*_tmp_cFrame,-2*_tmp_cFrame,-2*_tmp_cFrame, dwTime); } }else if( strlen(_tmp_cName) > 0 ) { if( (_tmp_sOwnerType>=1) && (_tmp_sOwnerType<=6) ) DrawObjectName(sX, sY, _tmp_cName, _tmp_iStatus); else DrawNpcName(sX, sY, _tmp_sOwnerType, _tmp_iStatus); } if (_tmp_iChatIndex != NULL) { if ((m_pChatMsgList[_tmp_iChatIndex] != NULL) && (m_pChatMsgList[_tmp_iChatIndex]->m_iObjectID == _tmp_wObjectID)) { m_pChatMsgList[_tmp_iChatIndex]->m_sX = sX; m_pChatMsgList[_tmp_iChatIndex]->m_sY = sY; }else { m_pMapData->ClearDeadChatMsg(indexX, indexY); } } // Snoopy: Abaddon effects if (_tmp_sOwnerType == 81) { Abaddon_corpse(sX, sY); // By Snoopy.... }else if (_tmp_sOwnerType == 73) { //m_pEffectSpr[35]->PutTransSprite70(sX+120, sY+120, rand(), dwTime); m_pEffectSpr[35]->PutTransSprite70(sX+20, sY-15, rand()%10, dwTime); } if ( (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top != -1) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top < msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.bottom > msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.left < msX) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.right > msX) ) return TRUE; return FALSE; } BOOL CGame::DrawObject_OnMove(int indexX, int indexY, int sX, int sY, BOOL bTrans, DWORD dwTime, int msX, int msY) {int dx, dy; int iBodyIndex, iHairIndex, iUndiesIndex, iArmArmorIndex, iBodyArmorIndex, iPantsIndex, iBootsIndex, iHelmIndex, iR, iG, iB; int iWeaponIndex, iShieldIndex, iAdd, iMantleIndex; BOOL bInv = FALSE; int iWeaponGlare, iShieldGlare; int iWeaponColor, iShieldColor, iArmorColor, iMantleColor, iArmColor, iPantsColor, iBootsColor, iHelmColor; int iSkirtDraw = 0; if(_tmp_sOwnerType == 35 || _tmp_sOwnerType == 66 || _tmp_sOwnerType == 73) bInv = TRUE; //Energy-Ball, Wyvern if (m_cDetailLevel == 0) { iWeaponColor = 0; iShieldColor = 0; iArmorColor = 0; iMantleColor = 0; iArmColor = 0; iPantsColor = 0; iBootsColor = 0; iHelmColor = 0; }else { iWeaponColor = (_tmp_iApprColor & 0xF0000000) >> 28; iShieldColor = (_tmp_iApprColor & 0x0F000000) >> 24; iArmorColor = (_tmp_iApprColor & 0x00F00000) >> 20; iMantleColor = (_tmp_iApprColor & 0x000F0000) >> 16; iArmColor = (_tmp_iApprColor & 0x0000F000) >> 12; iPantsColor = (_tmp_iApprColor & 0x00000F00) >> 8; iBootsColor = (_tmp_iApprColor & 0x000000F0) >> 4; iHelmColor = (_tmp_iApprColor & 0x0000000F); } iWeaponGlare = (_tmp_sAppr4 & 0x000C) >> 2; iShieldGlare = (_tmp_sAppr4 & 0x0003); if ( (_tmp_iStatus & 0x10) != 0) { if (memcmp(m_cPlayerName, _tmp_cName, 10) == 0) bInv = TRUE; else if( _iGetFOE(_tmp_iStatus) == 1 ) bInv = TRUE; else return FALSE; } switch (_tmp_sOwnerType) { case 1: case 2: case 3: if ((_tmp_sAppr2 & 0xF000) != 0) { iAdd = 3; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (iAdd * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + iAdd; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + iAdd; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + iAdd; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + iAdd; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + iAdd; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_M + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*3 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_M + (_tmp_sAppr2 & 0x000F)*8 + 3; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + iAdd; }else { iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (2 * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + 2; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 2; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 2; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + 2; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 2; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 2; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_M + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*2 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_M + (_tmp_sAppr2 & 0x000F)*8 + 2; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 2; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 2; } break; case 4: case 5: case 6: if (((_tmp_sAppr3 & 0x0F00) >> 8) == 1) iSkirtDraw = 1; if ((_tmp_sAppr2 & 0xF000) != 0) { iAdd = 3; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (iAdd * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + iAdd; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + iAdd; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + iAdd; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + iAdd; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + iAdd; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_W + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*3 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_W + (_tmp_sAppr2 & 0x000F)*8 + 3; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + iAdd; }else { iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (2 * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + 2; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 2; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 2; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + 2; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 2; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 2; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_W + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*2 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_W + (_tmp_sAppr2 & 0x000F)*8 + 2; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 2; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 2; } break; default: if (_tmp_sOwnerType == 86) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (1 * 8); iUndiesIndex = -1; iHairIndex = -1; iBodyArmorIndex = -1; iArmArmorIndex = -1; iBootsIndex = -1; iPantsIndex = -1; iWeaponIndex = -1; iShieldIndex = -1; iMantleIndex = -1; iHelmIndex = -1; break; } dx = 0; dy = 0; switch (_tmp_cDir) { case 1 : dy = 28 - (_tmp_cFrame<<2); break; case 2 : dy = 28 - (_tmp_cFrame<<2); dx = (_tmp_cFrame<<2) - 28; break; case 3 : dx = (_tmp_cFrame<<2) - 28; break; case 4 : dx = (_tmp_cFrame<<2) - 28; dy = (_tmp_cFrame<<2) - 28; break; case 5 : dy = (_tmp_cFrame<<2) - 28; break; case 6 : dy = (_tmp_cFrame<<2) - 28; dx = 28 - (_tmp_cFrame<<2); break; case 7 : dx = 28 - (_tmp_cFrame<<2); break; case 8 : dx = 28 - (_tmp_cFrame<<2); dy = 28 - (_tmp_cFrame<<2); break; } switch (_tmp_sOwnerType) { case 1: case 2: case 3: case 4: case 5: case 6: case 28: // Troll. case 29: // Orge. case 30: // Liche case 31: // DD case 32: // Uni case 33: // ww case 43: // LWB case 44: // GHK case 45: // GHKABS case 46: // TK case 47: // BG case 48: // SK case 49: // HC case 50: // TW case 52: // GG case 53: // BB case 54: // DE case 55: // Rabbit case 56: // Cat case 57: // Frog case 58: // MG case 59: // Ettin case 60: // Plant case 61: // Rudolph case 62: // DireBoar case 63: // Frost case 65: // Ice-Golem case 66: // Wyvern case 70: // Dragon..........Ajouts par Snoopy case 71: // Centaur case 72: // ClawTurtle case 73: // FireWyvern case 74: // GiantCrayfish case 75: // Gi Lizard case 76: // Gi Tree case 77: // Master Orc case 78: // Minaus case 79: // Nizie case 80: // Tentocle case 81: // Abaddon case 82: // Sorceress case 83: // ATK case 84: // MasterElf case 85: // DSK case 86: // HBT case 87: // CT case 88: // Barbarian case 89: // AGC case 90: // Gail break; default: _tmp_cFrame = _tmp_cFrame / 2; break; } if(m_pSprite[iBodyIndex + (_tmp_cDir - 1)] == NULL) return false; if (m_bIsCrusadeMode || (m_bIsAstoriaMode && memcmp(m_cCurLocation, "astoria", 7) == 0)) DrawObjectFOE(sX+dx, sY+dy, _tmp_cFrame); if (_tmp_iEffectType != 0) { switch (_tmp_iEffectType) { case 1: m_pEffectSpr[26]->PutTransSprite(sX+dx, sY+dy, _tmp_iEffectFrame, dwTime); break; // Special Ability: Attack Effect case 2: m_pEffectSpr[27]->PutTransSprite(sX+dx, sY+dy, _tmp_iEffectFrame, dwTime); break; // Special Ability: Protect Effect } } if( _tmp_sOwnerType == 65 ) // IceGolem { /*m_pEffectSpr[77]->PutTransSprite70(sX+dx, sY+dy, _tmp_cFrame, dwTime);*/ switch( rand()%3 ) { case 0: m_pEffectSpr[76]->PutTransSprite70(sX+dx, sY+dy, _tmp_cFrame, dwTime); break; case 1: m_pEffectSpr[77]->PutTransSprite70(sX+dx, sY+dy, _tmp_cFrame, dwTime); break; case 2: m_pEffectSpr[78]->PutTransSprite70(sX+dx, sY+dy, _tmp_cFrame, dwTime); break; } } if (bTrans == FALSE) { switch (_tmp_sOwnerType) { // Pas d'ombre pour ces mobs case 10: // Slime case 35: // Energy Sphere case 50: // TW case 51: // CP case 60: // Plant case 65: // IceGolem case 66: // Wyvern case 73: // Fire Wyvern case 81: // Abaddon case 91: // Gate break; default: if (m_cDetailLevel != 0) { if (sX < 50) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSpriteClip(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSprite(sX+dx, sY+dy, _tmp_cFrame, dwTime); } break; } CheckActiveAura(sX+dx, sY+dy, dwTime, _tmp_sOwnerType); if (_cDrawingOrder[_tmp_cDir] == 1) { if (iWeaponIndex != -1) { if(bInv) m_pSprite[iWeaponIndex]->PutTransSprite25(sX+dx, sY+dy, _tmp_cFrame, dwTime); else { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); } DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if (_tmp_sOwnerType == 35) m_pEffectSpr[0]->PutTransSprite(sX+dx, sY+dy, 1, dwTime); if (_tmp_sOwnerType == 81) // Abaddon { m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX+dx, sY+dy, _tmp_cFrame, dwTime); }else if (bInv == TRUE) //m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite2(sX+dx, sY+dy, _tmp_cFrame, dwTime); m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX+dx, sY+dy, _tmp_cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iUndiesIndex != -1) { if(bInv) m_pSprite[iUndiesIndex]->PutTransSprite2(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iUndiesIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); } if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if(bInv) m_pSprite[iBootsIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } } if (iPantsIndex != -1) { if(bInv) m_pSprite[iPantsIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } } if (iArmArmorIndex != -1) { if(bInv) m_pSprite[iArmArmorIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if(bInv) m_pSprite[iBootsIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } } if (iBodyArmorIndex != -1) { if(bInv) m_pSprite[iBodyArmorIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } } if (iHelmIndex != -1) { if(bInv) m_pSprite[iHelmIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iShieldIndex != -1) { if(bInv) m_pSprite[iShieldIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); } switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13+dx, sY -34+dy, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } }else { if (_tmp_sOwnerType == 35) m_pEffectSpr[0]->PutTransSprite(sX+dx, sY+dy, 1, dwTime); if (_tmp_sOwnerType == 81) // Abaddon { m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite70(sX+dx, sY+dy, _tmp_cFrame, dwTime); }else if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX+dx, sY+dy, _tmp_cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iUndiesIndex != -1) { if(bInv) m_pSprite[iUndiesIndex]->PutTransSprite2(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iUndiesIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); } if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if(bInv) m_pSprite[iBootsIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } } if (iPantsIndex != -1) { if(bInv) m_pSprite[iPantsIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } } if (iArmArmorIndex != -1) { if(bInv) m_pSprite[iArmArmorIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if(bInv) m_pSprite[iBootsIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } } if (iBodyArmorIndex != -1) { if(bInv) m_pSprite[iBodyArmorIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } } if (iHelmIndex != -1) { if(bInv) m_pSprite[iHelmIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iShieldIndex != -1) { if(bInv) m_pSprite[iShieldIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); } switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13+dx, sY -34+dy, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iWeaponIndex != -1) { if(bInv) m_pSprite[iWeaponIndex]->PutTransSprite25(sX+dx, sY+dy, _tmp_cFrame, dwTime); else { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); } DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } } if((_tmp_iStatus & 0x0F00) >> 8 == 9) // Highly trained m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 6, -2, 6, dwTime); // Berserk if ((_tmp_iStatus & 0x20) != 0) m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, -5, -5, dwTime); DrawAngel(40+(_tmp_cDir - 1), sX+dx+20, sY+dy-20, _tmp_cFrame%4, dwTime); CheckActiveAura2(sX+dx, sY+dy, dwTime, _tmp_sOwnerType); }else if( strlen(_tmp_cName) > 0 ) { if( (_tmp_sOwnerType>=1) && (_tmp_sOwnerType<=6) ) DrawObjectName(sX+dx, sY+dy, _tmp_cName, _tmp_iStatus); else DrawNpcName(sX+dx, sY+dy, _tmp_sOwnerType, _tmp_iStatus); } if (_tmp_iChatIndex != NULL) { if ((m_pChatMsgList[_tmp_iChatIndex] != NULL) && (m_pChatMsgList[_tmp_iChatIndex]->m_iObjectID == _tmp_wObjectID)) { m_pChatMsgList[_tmp_iChatIndex]->m_sX = sX+dx; m_pChatMsgList[_tmp_iChatIndex]->m_sY = sY+dy; }else { m_pMapData->ClearChatMsg(indexX, indexY); } } _tmp_dx = dx; _tmp_dy = dy; // Snoopy: Abaddon effects if (_tmp_sOwnerType == 81) { int randFrame = _tmp_iEffectFrame %12; m_pEffectSpr[154]->PutTransSprite70(sX-50 , sY-50 , randFrame, dwTime); m_pEffectSpr[155]->PutTransSprite70(sX-20 , sY-80 , randFrame, dwTime); m_pEffectSpr[156]->PutTransSprite70(sX+70 , sY-50 , randFrame, dwTime); m_pEffectSpr[157]->PutTransSprite70(sX-30 , sY , randFrame, dwTime); m_pEffectSpr[158]->PutTransSprite70(sX-60 , sY+90 , randFrame, dwTime); m_pEffectSpr[159]->PutTransSprite70(sX+65 , sY+85 , randFrame, dwTime); switch (_tmp_cDir) { case 1: m_pEffectSpr[153]->PutTransSprite70(sX+dx , sY+dy+108 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX+dx-50 , sY+dy+10 , _tmp_iEffectFrame %15, dwTime); break; case 2: m_pEffectSpr[153]->PutTransSprite70(sX+dx , sY+dy+95 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX+dx-70 , sY+dy+10 , _tmp_iEffectFrame %15, dwTime); break; case 3: m_pEffectSpr[153]->PutTransSprite70(sX+dx , sY+dy+105 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX+dx-90 , sY+dy+10 , _tmp_iEffectFrame %15, dwTime); break; case 4: m_pEffectSpr[153]->PutTransSprite70(sX+dx-35 , sY+dy+100 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX+dx-80 , sY+dy+10 , _tmp_iEffectFrame %15, dwTime); break; case 5: m_pEffectSpr[153]->PutTransSprite70(sX+dx , sY+dy+95 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX+dx-65 , sY+dy-5 , _tmp_iEffectFrame %15, dwTime); break; case 6: m_pEffectSpr[153]->PutTransSprite70(sX+dx+45 , sY+dy+95 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX+dx-31 , sY+dy+10 , _tmp_iEffectFrame %15, dwTime); break; case 7: m_pEffectSpr[153]->PutTransSprite70(sX+dx+40 , sY+dy+110 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX+dx-30 , sY+dy+10 , _tmp_iEffectFrame %15, dwTime); break; case 8: m_pEffectSpr[153]->PutTransSprite70(sX+dx+20 , sY+dy+110 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX+dx-20 , sY+dy+16 , _tmp_iEffectFrame %15, dwTime); break; } } if ( (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top != -1) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top < msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.bottom > msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.left < msX) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.right > msX) ) return TRUE; return FALSE; } BOOL CGame::DrawObject_OnDamageMove(int indexX, int indexY, int sX, int sY, BOOL bTrans, DWORD dwTime, int msX, int msY) { int cFrame, cDir; int dx, dy; int iBodyIndex, iHairIndex, iUndiesIndex, iArmArmorIndex, iBodyArmorIndex, iPantsIndex, iBootsIndex, iHelmIndex, iR, iG, iB; int iWeaponIndex, iShieldIndex, iMantleIndex; BOOL bInv = FALSE; int iWeaponGlare, iShieldGlare; int iWeaponColor, iShieldColor, iArmorColor, iMantleColor, iArmColor, iPantsColor, iBootsColor, iHelmColor; int iSkirtDraw = 0; if(_tmp_sOwnerType == 67 || _tmp_sOwnerType == 68 || _tmp_sOwnerType == 69 || _tmp_sOwnerType == 81) return FALSE; if(_tmp_sOwnerType == 35 || _tmp_sOwnerType == 73 || _tmp_sOwnerType == 66) bInv = TRUE; //Energy-Ball,Wyvern if (m_cDetailLevel == 0) { iWeaponColor = 0; iShieldColor = 0; iArmorColor = 0; iMantleColor = 0; iArmColor = 0; iPantsColor = 0; iBootsColor = 0; iHelmColor = 0; }else { iWeaponColor = (_tmp_iApprColor & 0xF0000000) >> 28; iShieldColor = (_tmp_iApprColor & 0x0F000000) >> 24; iArmorColor = (_tmp_iApprColor & 0x00F00000) >> 20; iMantleColor = (_tmp_iApprColor & 0x000F0000) >> 16; iArmColor = (_tmp_iApprColor & 0x0000F000) >> 12; iPantsColor = (_tmp_iApprColor & 0x00000F00) >> 8; iBootsColor = (_tmp_iApprColor & 0x000000F0) >> 4; iHelmColor = (_tmp_iApprColor & 0x0000000F); } iWeaponGlare = (_tmp_sAppr4 & 0x000C) >> 2; iShieldGlare = (_tmp_sAppr4 & 0x0003); if ( (_tmp_iStatus & 0x10) != 0) { if (memcmp(m_cPlayerName, _tmp_cName, 10) == 0) bInv = TRUE; else if( _iGetFOE(_tmp_iStatus) == 1 ) bInv = TRUE; else return FALSE; } cDir = _tmp_cDir; switch (_tmp_cDir) { case 1: _tmp_cDir = 5; break; case 2: _tmp_cDir = 6; break; case 3: _tmp_cDir = 7; break; case 4: _tmp_cDir = 8; break; case 5: _tmp_cDir = 1; break; case 6: _tmp_cDir = 2; break; case 7: _tmp_cDir = 3; break; case 8: _tmp_cDir = 4; break; } switch (_tmp_sOwnerType) { case 1: case 2: case 3: iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (10 * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + 10; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 10; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 10; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + 10; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 10; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 10; if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_M + (_tmp_sAppr2 & 0x000F)*8 + 5; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_M + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*5 + (_tmp_cDir - 1); if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 10; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 10; break; case 4: case 5: case 6: if (((_tmp_sAppr3 & 0x0F00) >> 8) == 1) iSkirtDraw = 1; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (10 * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + 10; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 10; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 10; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + 10; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 10; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 10; if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_W + (_tmp_sAppr2 & 0x000F)*8 + 5; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_W + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*5 + (_tmp_cDir - 1); if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 10; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 10; break; default: if (_tmp_sOwnerType == 66) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 73) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 86) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8); else if (_tmp_sOwnerType == 87) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8);// Ne devrait pas arriver! else if (_tmp_sOwnerType == 89) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (2 * 8);// Ne devrait pas arriver! else iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (3 * 8); iUndiesIndex = -1; iHairIndex = -1; iArmArmorIndex = -1; iBodyArmorIndex = -1; iPantsIndex = -1; iBootsIndex = -1; iWeaponIndex = -1; iShieldIndex = -1; iMantleIndex = -1; iHelmIndex = -1; break; } dx = 0; dy = 0; switch (_tmp_cDir) { case 1 : dy = 28 - (_tmp_cFrame<<2); break; case 2 : dy = 28 - (_tmp_cFrame<<2); dx = (_tmp_cFrame<<2) - 28; break; case 3 : dx = (_tmp_cFrame<<2) - 28; break; case 4 : dx = (_tmp_cFrame<<2) - 28; dy = (_tmp_cFrame<<2) - 28; break; case 5 : dy = (_tmp_cFrame<<2) - 28; break; case 6 : dy = (_tmp_cFrame<<2) - 28; dx = 28 - (_tmp_cFrame<<2); break; case 7 : dx = 28 - (_tmp_cFrame<<2); break; case 8 : dx = 28 - (_tmp_cFrame<<2); dy = 28 - (_tmp_cFrame<<2); break; } cFrame = _tmp_cFrame; if(m_pSprite[iBodyIndex + (_tmp_cDir - 1)] == NULL) return false; if (m_bIsCrusadeMode || (m_bIsAstoriaMode && memcmp(m_cCurLocation, "astoria", 7) == 0)) DrawObjectFOE(sX+dx, sY+dy, cFrame); if (_tmp_iEffectType != 0) { switch (_tmp_iEffectType) { case 1: m_pEffectSpr[26]->PutTransSprite(sX+dx, sY+dy, _tmp_iEffectFrame, dwTime); break; // Special Ability: Attack Effect case 2: m_pEffectSpr[27]->PutTransSprite(sX+dy, sY+dy, _tmp_iEffectFrame, dwTime); break; // Special Ability: Protect Effect } } if (bTrans == FALSE) { switch (_tmp_sOwnerType) { // Pas d'ombre pour ces mobs case 10: // Slime case 35: // Energy Sphere case 50: // TW case 51: // CP case 60: // Plant case 65: // IceGolem case 66: // Wyvern case 73: // Fire Wyvern case 81: // Abaddon case 91: // Gate break; default: if (m_cDetailLevel != 0) { if (sX < 50) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSpriteClip(sX+dx, sY+dy, cFrame, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSprite(sX+dx, sY+dy, cFrame, dwTime); } break; } CheckActiveAura(sX+dx, sY+dy, dwTime, _tmp_sOwnerType); if (_cDrawingOrder[_tmp_cDir] == 1) { if (iWeaponIndex != -1) { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX+dx, sY+dy, cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX+dx, sY+dy, cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if (_tmp_sOwnerType == 35) m_pEffectSpr[0]->PutTransSprite(sX, sY, 1, dwTime); if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX+dx, sY+dy, cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX+dx, sY+dy, cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX+dx, sY+dy, cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iUndiesIndex != -1) { if(bInv) m_pSprite[iUndiesIndex]->PutTransSprite2(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iUndiesIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); } if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iShieldIndex != -1) { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13+dx, sY -34+dy, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } }else { if (_tmp_sOwnerType == 35) m_pEffectSpr[0]->PutTransSprite(sX, sY, 1, dwTime); if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX+dx, sY+dy, cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX+dx, sY+dy, cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX+dx, sY+dy, cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iUndiesIndex != -1) { if(bInv) m_pSprite[iUndiesIndex]->PutTransSprite2(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iUndiesIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); } if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iShieldIndex != -1) { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13+dx, sY -34+dy, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 4 + cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iWeaponIndex != -1) { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX+dx, sY+dy, cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX+dx, sY+dy, cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } } if((_tmp_iStatus & 0x0F00) >> 8 == 9) // Highly trained m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX+dx, sY+dx, cFrame, 6, -2, 6, dwTime); if ((_tmp_iStatus & 0x20) != 0) // Berserk m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX+dx, sY+dy, cFrame, 0, -5, -5, dwTime); DrawAngel(16+(_tmp_cDir - 1), sX+dx+20, sY+dy-20, cFrame%4, dwTime); CheckActiveAura2(sX+dx, sY+dy, dwTime, _tmp_sOwnerType); }else if( strlen(_tmp_cName) > 0 ) { if( (_tmp_sOwnerType>=1) && (_tmp_sOwnerType<=6) ) DrawObjectName(sX+dx, sY+dy, _tmp_cName, _tmp_iStatus); else DrawNpcName(sX+dx, sY+dy, _tmp_sOwnerType, _tmp_iStatus); } if (_tmp_iChatIndex != NULL) { if ((m_pChatMsgList[_tmp_iChatIndex] != NULL) && (m_pChatMsgList[_tmp_iChatIndex]->m_iObjectID == _tmp_wObjectID)) { m_pChatMsgList[_tmp_iChatIndex]->m_sX = sX+dx; m_pChatMsgList[_tmp_iChatIndex]->m_sY = sY+dy; }else { m_pMapData->ClearChatMsg(indexX, indexY); } } _tmp_dx = dx; _tmp_dy = dy; if ( (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top != -1) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top < msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.bottom > msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.left < msX) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.right > msX) ) return TRUE; return FALSE; } BOOL CGame::DrawObject_OnMove_ForMenu(int indexX, int indexY, int sX, int sY, BOOL bTrans, DWORD dwTime, int msX, int msY) {short dx, dy; int iBodyIndex, iHairIndex, iUndiesIndex, iArmArmorIndex, iBodyArmorIndex, iPantsIndex, iBootsIndex, iHelmIndex, iR, iG, iB; int iWeaponIndex, iShieldIndex, iAdd, iMantleIndex; BOOL bInv = FALSE; int iWeaponColor, iShieldColor, iArmorColor, iMantleColor, iArmColor, iPantsColor, iBootsColor, iHelmColor; int iSkirtDraw = 0; iWeaponColor = (_tmp_iApprColor & 0xF0000000) >> 28; iShieldColor = (_tmp_iApprColor & 0x0F000000) >> 24; iArmorColor = (_tmp_iApprColor & 0x00F00000) >> 20; iMantleColor = (_tmp_iApprColor & 0x000F0000) >> 16; iArmColor = (_tmp_iApprColor & 0x0000F000) >> 12; iPantsColor = (_tmp_iApprColor & 0x00000F00) >> 8; iBootsColor = (_tmp_iApprColor & 0x000000F0) >> 4; iHelmColor = (_tmp_iApprColor & 0x0000000F); switch (_tmp_sOwnerType) { case 1: case 2: case 3: if ((_tmp_sAppr2 & 0xF000) != 0) { iAdd = 3; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (iAdd * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + iAdd; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else { iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + iAdd; } }else iBodyArmorIndex = -1; if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + iAdd; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + iAdd; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + iAdd; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_M + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*3 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_M + (_tmp_sAppr2 & 0x000F)*8 + 3; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + iAdd; }else { iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (2 * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + 2; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 2; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 2; }else iBodyArmorIndex = -1; if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + 2; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 2; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 2; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_M + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*2 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_M + (_tmp_sAppr2 & 0x000F)*8 + 2; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 2; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 2; } break; case 4: case 5: case 6: if (((_tmp_sAppr3 & 0x0F00) >> 8) == 1) iSkirtDraw = 1; if ((_tmp_sAppr2 & 0xF000) != 0) { iAdd = 3; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (iAdd * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + iAdd; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + iAdd; }else iBodyArmorIndex = -1; if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + iAdd; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + iAdd; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + iAdd; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_W + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*3 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_W + (_tmp_sAppr2 & 0x000F)*8 + 3; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + iAdd; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + iAdd; }else { iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (2 * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + 2; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 2; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 2; }else iBodyArmorIndex = -1; if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + 2; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 2; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 2; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_W + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*2 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_W + (_tmp_sAppr2 & 0x000F)*8 + 2; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 2; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 2; } break; default: iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (1 * 8); iUndiesIndex = -1; iHairIndex = -1; iBodyArmorIndex = -1; iArmArmorIndex = -1; iBootsIndex = -1; iPantsIndex = -1; iWeaponIndex = -1; iShieldIndex = -1; iHelmIndex = -1; break; } dx = 0; dy = 0; if (_cDrawingOrder[_tmp_cDir] == 1) { if (iWeaponIndex != -1) { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); } switch (_tmp_sOwnerType) { // Pas d'ombre pour ces mobs case 10: // Slime case 35: // Energy Sphere case 50: // TW case 51: // CP case 60: // Plant case 65: // IceGolem case 66: // Wyvern case 73: // Fire Wyvern case 81: // Abaddon case 91: // Gate break; default: if (m_cDetailLevel != 0) { if (sX < 50) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSpriteClip(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSprite(sX+dx, sY+dy, _tmp_cFrame, dwTime); } break; } if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iUndiesIndex != -1) { if(bInv) m_pSprite[iUndiesIndex]->PutTransSprite2(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iUndiesIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); } if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iShieldIndex != -1) { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } }else { switch (_tmp_sOwnerType) { // Pas d'ombre pour ces mobs case 10: // Slime case 35: // Energy Sphere case 50: // TW case 51: // CP case 60: // Plant case 65: // IceGolem case 66: // Wyvern case 73: // Fire Wyvern case 81: // Abaddon case 91: // Gate break; default: if (m_cDetailLevel != 0) { if (sX < 50) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSpriteClip(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSprite(sX+dx, sY+dy, _tmp_cFrame, dwTime); } break; } if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iUndiesIndex != -1) m_pSprite[iUndiesIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iPantsIndex != -1) { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } if (iArmArmorIndex != -1) { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } if (iBodyArmorIndex != -1) { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } if (iHelmIndex != -1) { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iShieldIndex != -1) { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } if (iWeaponIndex != -1) { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); } } if (_tmp_iChatIndex != NULL) { if (m_pChatMsgList[_tmp_iChatIndex] != NULL) { DrawChatMsgBox(sX+dx, sY+dy, _tmp_iChatIndex, FALSE); }else { m_pMapData->ClearChatMsg(indexX, indexY); } } _tmp_dx = dx; _tmp_dy = dy; if ( (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top != -1) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top < msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.bottom > msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.left < msX) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.right > msX) ) return TRUE; return FALSE; } BOOL CGame::DrawObject_OnStop(int indexX, int indexY, int sX, int sY, BOOL bTrans, DWORD dwTime, int msX, int msY) {int iBodyIndex, iUndiesIndex, iHairIndex, iBodyArmorIndex, iArmArmorIndex, iPantsIndex, iBootsIndex, iHelmIndex, iR, iG, iB; int iWeaponIndex, iShieldIndex, iMantleIndex; BOOL bInv = FALSE; int iWeaponGlare, iShieldGlare; int iWeaponColor, iShieldColor, iArmorColor, iMantleColor, iArmColor, iPantsColor, iBootsColor, iHelmColor; int iSkirtDraw = 0; if(_tmp_sOwnerType == 35 || _tmp_sOwnerType == 73 || _tmp_sOwnerType == 66 || _tmp_sOwnerType == 81) bInv = TRUE; //Energy-Ball, Wyvern if (m_cDetailLevel == 0) { iWeaponColor = 0; iShieldColor = 0; iArmorColor = 0; iMantleColor = 0; iArmColor = 0; iPantsColor = 0; iBootsColor = 0; iHelmColor = 0; }else { iWeaponColor = (_tmp_iApprColor & 0xF0000000) >> 28; iShieldColor = (_tmp_iApprColor & 0x0F000000) >> 24; iArmorColor = (_tmp_iApprColor & 0x00F00000) >> 20; iMantleColor = (_tmp_iApprColor & 0x000F0000) >> 16; iArmColor = (_tmp_iApprColor & 0x0000F000) >> 12; iPantsColor = (_tmp_iApprColor & 0x00000F00) >> 8; iBootsColor = (_tmp_iApprColor & 0x000000F0) >> 4; iHelmColor = (_tmp_iApprColor & 0x0000000F); } iWeaponGlare = (_tmp_sAppr4 & 0x000C) >> 2; iShieldGlare = (_tmp_sAppr4 & 0x0003); if ( (_tmp_iStatus & 0x10) != 0) { if (memcmp(m_cPlayerName, _tmp_cName, 10) == 0) bInv = TRUE; else if( _iGetFOE(_tmp_iStatus) == 1 ) bInv = TRUE; else return FALSE; } // CLEROTH - Single-direction monsters switch(_tmp_sOwnerType){ case 110: // Air Elemental _tmp_cDir = 1; // North break; case 91: // Snoopy: Gate if (_tmp_cDir <= 3) _tmp_cDir = 3; else _tmp_cDir = 5; break; } switch (_tmp_sOwnerType) { case 1: case 2: case 3: _tmp_cFrame = _tmp_cFrame / 2; if ((_tmp_sAppr2 & 0xF000) != 0) { iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (1 * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + 1; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 1; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 1; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + 1; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 1; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 1; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_M + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*1 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_M + (_tmp_sAppr2 & 0x000F)*8 + 1; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 1; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 1; }else { iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (0 * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_M + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*0 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_M + (_tmp_sAppr2 & 0x000F)*8 + 0; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 0; } break; case 4: case 5: case 6: _tmp_cFrame = _tmp_cFrame / 2; if (((_tmp_sAppr3 & 0x0F00) >> 8) == 1) iSkirtDraw = 1; if ((_tmp_sAppr2 & 0xF000) != 0) { iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (1 * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + 1; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 1; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 1; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + 1; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 1; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 1; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_W + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*1 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_W + (_tmp_sAppr2 & 0x000F)*8 + 1; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 1; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 1; }else { iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (0 * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else iWeaponIndex = SPRID_WEAPON_W + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*0 + (_tmp_cDir - 1); if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_W + (_tmp_sAppr2 & 0x000F)*8 + 0; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 0; } break; case 20: // Howard case 24: // Tom _tmp_sAppr2 = 0; default: if (_tmp_sAppr2 != 0) { iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (4 * 8); _tmp_cFrame = (_tmp_sAppr2 & 0x00FF ) -1; } /* else if (_tmp_sOwnerType == 66) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 73) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); else if (_tmp_sOwnerType == 81) iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8);*/ else iBodyIndex = SPRID_MOB + (_tmp_sOwnerType - 10 )*8*7 + (0 * 8); iUndiesIndex = -1; iHairIndex = -1; iBodyArmorIndex = -1; iArmArmorIndex = -1; iBootsIndex = -1; iPantsIndex = -1; iWeaponIndex = -1; iShieldIndex = -1; iMantleIndex = -1; iHelmIndex = -1; break; } if(m_pSprite[iBodyIndex + (_tmp_cDir - 1)] == NULL) return false; if (m_bIsCrusadeMode || (m_bIsAstoriaMode && memcmp(m_cCurLocation, "astoria", 7) == 0)) DrawObjectFOE(sX, sY, _tmp_cFrame); switch (_tmp_sOwnerType) { // hum? la lumiere en dessous ? case 15: // ShopKeeper case 19: // Gandalf case 20: // Howard case 24: // Tom case 25: // William case 26: // Kenedy case 51: // CP case 86: // HBT case 90: // Gail case NPC_PRINCESS: m_pEffectSpr[0]->PutTransSprite(sX, sY, 1, dwTime); break; } if (_tmp_iEffectType != 0) { switch (_tmp_iEffectType) { case 1: m_pEffectSpr[26]->PutTransSprite(sX, sY, _tmp_iEffectFrame, dwTime); break; // Special Ability: Attack Effect case 2: m_pEffectSpr[27]->PutTransSprite(sX, sY, _tmp_iEffectFrame, dwTime); break; // Special Ability: Protect Effect } } if (bTrans == FALSE) { switch (_tmp_sOwnerType) { // Pas d'ombre pour ces mobs case 10: // Slime case 35: // Energy Sphere case 50: // TW case 51: // CP case 60: // Plant case 65: // IceGolem case 66: // Wyvern case 73: // Fire Wyvern case 81: // Abaddon case 91: // Gate break; default: if (m_cDetailLevel != 0) { if (sX < 50) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSpriteClip(sX, sY, _tmp_cFrame, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSprite(sX, sY, _tmp_cFrame, dwTime); } break; } CheckActiveAura(sX, sY, dwTime, _tmp_sOwnerType); if (_cDrawingOrder[_tmp_cDir] == 1) { if (iWeaponIndex != -1) { if(bInv) m_pSprite[iWeaponIndex]->PutTransSprite25(sX, sY, _tmp_cFrame, dwTime); else { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX, sY, _tmp_cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX, sY, _tmp_cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); } DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if (_tmp_sOwnerType == 35) m_pEffectSpr[0]->PutTransSprite(sX, sY, 1, dwTime); if (_tmp_sOwnerType == 81) // Abaddon { m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, _tmp_cFrame, dwTime); }else if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, _tmp_cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX, sY, _tmp_cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX, sY, _tmp_cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iUndiesIndex != -1) { if(bInv) m_pSprite[iUndiesIndex]->PutTransSprite2(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iUndiesIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); } if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if(bInv) m_pSprite[iBootsIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } } if (iPantsIndex != -1) { if(bInv) m_pSprite[iPantsIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } } if (iArmArmorIndex != -1) { if(bInv) m_pSprite[iArmArmorIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if(bInv) m_pSprite[iBootsIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } } if (iBodyArmorIndex != -1) { if(bInv) m_pSprite[iBodyArmorIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } } if (iHelmIndex != -1) { if(bInv) m_pSprite[iHelmIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iShieldIndex != -1) { if(bInv) m_pSprite[iShieldIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); } switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13, sY -34, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } }else { if (_tmp_sOwnerType == 35) m_pEffectSpr[0]->PutTransSprite(sX, sY, 1, dwTime); if (_tmp_sOwnerType == 81) // Abaddon { m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, _tmp_cFrame, dwTime); }else if (bInv == TRUE) { m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX, sY, _tmp_cFrame, dwTime); }else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX, sY, _tmp_cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX, sY, _tmp_cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 0)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iUndiesIndex != -1) { if(bInv) m_pSprite[iUndiesIndex]->PutTransSprite2(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iUndiesIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); } if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if(bInv) m_pSprite[iBootsIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } } if (iPantsIndex != -1) { if(bInv) m_pSprite[iPantsIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } } if (iArmArmorIndex != -1) { if(bInv) m_pSprite[iArmArmorIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if(bInv) m_pSprite[iBootsIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } } if (iBodyArmorIndex != -1) { if(bInv) m_pSprite[iBodyArmorIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } } if (iHelmIndex != -1) { if(bInv) m_pSprite[iHelmIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 2)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iShieldIndex != -1) { if(bInv) m_pSprite[iShieldIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); } switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13, sY -34, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrder[_tmp_cDir] == 1)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iWeaponIndex != -1) { if(bInv) m_pSprite[iWeaponIndex]->PutTransSprite25(sX, sY, _tmp_cFrame, dwTime); else { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX, sY, _tmp_cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX, sY, _tmp_cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); } DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } } if (_tmp_sOwnerType == 64) // crop { switch( _tmp_cFrame ) { case 0: // color effect for crop m_pEffectSpr[84]->PutTransSprite(sX+52, sY+54, (dwTime%3000)/120, dwTime ); break; case 1: // color effect for crop m_pEffectSpr[83]->PutTransSprite(sX+53, sY+59, (dwTime%3000)/120, dwTime ); break; case 2: // color effect for crop m_pEffectSpr[82]->PutTransSprite(sX+53, sY+65, (dwTime%3000)/120, dwTime ); break; } } if((_tmp_iStatus & 0x0F00) >> 8 == 9) // Highly trained m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 6, -2, 6, dwTime); // Berserk if ((_tmp_iStatus & 0x20) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSpriteRGB(sX, sY, _tmp_cFrame, 0, -5, -5, dwTime); DrawAngel(40+(_tmp_cDir - 1), sX+20, sY-20, _tmp_cFrame%4, dwTime); CheckActiveAura2(sX, sY, dwTime, _tmp_sOwnerType); }else if( strlen(_tmp_cName) > 0 ) { if( (_tmp_sOwnerType>=1) && (_tmp_sOwnerType<=6) ) DrawObjectName(sX, sY, _tmp_cName, _tmp_iStatus); else{ DrawNpcName(sX, sY, _tmp_sOwnerType, _tmp_iStatus); } #if _DEBUG wsprintf(G_cTxt,"Appr1: 0x%.4X ",(WORD)_tmp_sAppr1); PutString2(sX+70, sY+(14*1), G_cTxt, 30,255,30); wsprintf(G_cTxt,"Appr2: 0x%.4X ",(WORD)_tmp_sAppr2); PutString2(sX+70, sY+(14*2), G_cTxt, 30,255,30); wsprintf(G_cTxt,"Appr3: 0x%.4X ",(WORD)_tmp_sAppr3); PutString2(sX+70, sY+(14*3), G_cTxt, 30,255,30); wsprintf(G_cTxt,"Appr4: 0x%.4X ",(WORD)_tmp_sAppr4); PutString2(sX+70, sY+(14*4), G_cTxt, 30,255,30); #endif } if (_tmp_iChatIndex != NULL) { if ((m_pChatMsgList[_tmp_iChatIndex] != NULL) && (m_pChatMsgList[_tmp_iChatIndex]->m_iObjectID == _tmp_wObjectID)) { m_pChatMsgList[_tmp_iChatIndex]->m_sX = sX; m_pChatMsgList[_tmp_iChatIndex]->m_sY = sY; }else { m_pMapData->ClearChatMsg(indexX, indexY); } } // Snoopy: Abaddon effects if (_tmp_sOwnerType == 81) { int randFrame = _tmp_cFrame % 12; m_pEffectSpr[154]->PutTransSprite70(sX-50 , sY-50 , randFrame, dwTime); m_pEffectSpr[155]->PutTransSprite70(sX-20 , sY-80 , randFrame, dwTime); m_pEffectSpr[156]->PutTransSprite70(sX+70 , sY-50 , randFrame, dwTime); m_pEffectSpr[157]->PutTransSprite70(sX-30 , sY , randFrame, dwTime); m_pEffectSpr[158]->PutTransSprite70(sX-60 , sY+90 , randFrame, dwTime); m_pEffectSpr[159]->PutTransSprite70(sX+65 , sY+85 , randFrame, dwTime); switch (_tmp_cDir) { case 1: m_pEffectSpr[153]->PutTransSprite70(sX , sY+108 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-50 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 2: m_pEffectSpr[153]->PutTransSprite70(sX , sY+95 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-70 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 3: m_pEffectSpr[153]->PutTransSprite70(sX , sY+105 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-90 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 4: m_pEffectSpr[153]->PutTransSprite70(sX-35 , sY+100 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-80 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 5: m_pEffectSpr[153]->PutTransSprite70(sX , sY+95 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-65 , sY-5 , _tmp_iEffectFrame %15, dwTime); break; case 6: m_pEffectSpr[153]->PutTransSprite70(sX+45 , sY+95 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-31 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 7: m_pEffectSpr[153]->PutTransSprite70(sX+40 , sY+110 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-30 , sY+10 , _tmp_iEffectFrame %15, dwTime); break; case 8: m_pEffectSpr[153]->PutTransSprite70(sX+20 , sY+110 , _tmp_iEffectFrame %28, dwTime); m_pEffectSpr[164]->PutTransSprite70(sX-20 , sY+16 , _tmp_iEffectFrame %15, dwTime); break; } } if ( (m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top != -1) && (m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top < msY) && (m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom > msY) && (m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left < msX) && (m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right > msX) ) return TRUE; return FALSE; } void CGame::_ReadMapData(short sPivotX, short sPivotY, char * pData) {int i; char * cp, ucHeader, cDir, cName[12], cItemColor; short * sp, sTotal, sX, sY, sType, sAppr1, sAppr2, sAppr3, sAppr4, sItemSpr, sItemSprFrame, sDynamicObjectType; int iStatus; int * ip, iApprColor; WORD wObjectID; WORD * wp, wDynamicObjectID; cp = pData; m_sVDL_X = sPivotX; m_sVDL_Y = sPivotY; sp = (short *)cp; sTotal = *sp; cp += 2; for (i = 1; i <= sTotal; i++) { sp = (short *)cp; sX = *sp; cp += 2; sp = (short *)cp; sY = *sp; cp += 2; ucHeader = *cp; cp++; if (ucHeader & 0x01) // object ID { wp = (WORD *)cp; wObjectID = *wp; cp += 2; sp = (short *)cp; sType = *sp;// object type cp += 2; // dir cDir = *cp; cp++; if (wObjectID < 10000) { sp = (short *)cp; sAppr1 = *sp;// Appearance1 cp += 2; sp = (short *)cp; sAppr2 = *sp;// Appearance2 cp += 2; sp = (short *)cp; sAppr3 = *sp;// Appearance3 cp += 2; sp = (short *)cp; sAppr4 = *sp;// Appearance4 cp += 2; ip = (int *)cp; iApprColor = *ip; cp += 4; // CLEROTH - CRASH BUG ( STATUS ) // Status ip = (int *)cp; iStatus = *ip; cp += 4; // Name ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 10); cp += 10; }else // NPC { sAppr1 = sAppr3 = sAppr4 = 0; sp = (short *)cp; sAppr2 = *sp;// Appearance2 cp += 2; // CLEROTH - CRASH BUG ( STATUS ) // Status ip = (int *)cp; iStatus = *ip; cp += 4; // Name ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 5); cp += 5; } m_pMapData->bSetOwner(wObjectID, sPivotX + sX, sPivotY + sY, sType, cDir, sAppr1, sAppr2, sAppr3, sAppr4, iApprColor, iStatus, cName, OBJECTSTOP, NULL, NULL, NULL); } if (ucHeader & 0x02) // object ID { wp = (WORD *)cp; wObjectID = *wp; cp += 2; sp = (short *)cp; sType = *sp; // object type cp += 2; cDir = *cp; // dir cp++; if (wObjectID < 10000) { sp = (short *)cp; sAppr1 = *sp;// Appearance1 cp += 2; sp = (short *)cp; sAppr2 = *sp;// Appearance2 cp += 2; sp = (short *)cp; sAppr3 = *sp;// Appearance3 cp += 2; sp = (short *)cp; sAppr4 = *sp;// Appearance4 cp += 2; ip = (int *)cp; iApprColor = *ip; cp += 4; // CLEROTH - CRASH BUG ( STATUS ) // Status ip = (int *)cp; iStatus = *ip; cp += 4; // Name ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 10); cp += 10; }else // NPC { sAppr1 = sAppr3 = sAppr4 = 0; sp = (short *)cp; sAppr2 = *sp;// Appearance2 cp += 2; ip = (int *)cp; iStatus = *ip;// Status cp += 4; ZeroMemory(cName, sizeof(cName)); // Name memcpy(cName, cp, 5); cp += 5; } m_pMapData->bSetDeadOwner(wObjectID, sPivotX + sX, sPivotY + sY, sType, cDir, sAppr1, sAppr2, sAppr3, sAppr4, iApprColor, iStatus, cName); } if (ucHeader & 0x04) { sp = (short *)cp; sItemSpr = *sp; cp += 2; sp = (short *)cp; sItemSprFrame = *sp; cp += 2; cItemColor = *cp; cp++; m_pMapData->bSetItem(sPivotX + sX, sPivotY + sY, sItemSpr, sItemSprFrame, cItemColor, FALSE); } if (ucHeader & 0x08) // Dynamic object { wp = (WORD *)cp; wDynamicObjectID = *wp; cp += 2; sp = (short *)cp; sDynamicObjectType = *sp; cp += 2; m_pMapData->bSetDynamicObject(sPivotX + sX, sPivotY + sY, wDynamicObjectID, sDynamicObjectType, FALSE); } } } void CGame::LogEventHandler(char * pData) {WORD * wp, wEventType, wObjectID; short * sp, sX, sY, sType, sAppr1, sAppr2, sAppr3, sAppr4; int iStatus; char * cp, cDir, cName[12]; int * ip, iApprColor; wp = (WORD *)(pData + INDEX2_MSGTYPE); wEventType = *wp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; wObjectID = *wp; cp += 2; sp = (short *)cp; sX = *sp; cp += 2; sp = (short *)cp; sY = *sp; cp += 2; sp = (short *)cp; sType = *sp; cp += 2; cDir = *cp; cp++; ZeroMemory(cName, sizeof(cName)); if (wObjectID < 10000) { memcpy(cName, cp, 10); cp += 10; sp = (short *)cp; sAppr1 = *sp; cp += 2; sp = (short *)cp; sAppr2 = *sp; cp += 2; sp = (short *)cp; sAppr3 = *sp; cp += 2; sp = (short *)cp; sAppr4 = *sp; cp += 2; ip = (int *)cp; iApprColor = *ip; cp += 4; // CLEROTH - CRASH BUG ( STATUS ) ip = (int *)cp; iStatus = *ip; cp += 4; }else // NPC { memcpy(cName, cp, 5); cp += 5; sAppr1 = sAppr3 = sAppr4 = 0; sp = (short *)cp; sAppr2 = *sp; cp += 2; ip = (int *)cp; iStatus = *ip; cp += 4; } switch (wEventType) { case MSGTYPE_CONFIRM: m_pMapData->bSetOwner(wObjectID, sX, sY, sType, cDir, sAppr1, sAppr2, sAppr3, sAppr4, iApprColor, iStatus, cName, OBJECTSTOP, NULL, NULL, NULL); switch (sType) { case 43: // LWB case 44: // GHK case 45: // GHKABS case 46: // TK case 47: // BG bAddNewEffect(64, (sX)*32 ,(sY)*32, NULL, NULL, 0); break; } break; case MSGTYPE_REJECT: m_pMapData->bSetOwner(wObjectID, -1, -1, sType, cDir, sAppr1, sAppr2, sAppr3, sAppr4, iApprColor, iStatus, cName, OBJECTSTOP, NULL, NULL, NULL); break; } _RemoveChatMsgListByObjectID(wObjectID); } void CGame::OnLogSocketEvent(WPARAM wParam, LPARAM lParam) {int iRet; char * pData; DWORD dwMsgSize; if (m_pLSock == NULL) return; iRet = m_pLSock->iOnSocketEvent(wParam, lParam); switch (iRet) { case XSOCKEVENT_CONNECTIONESTABLISH: ConnectionEstablishHandler(SERVERTYPE_LOG); break; case XSOCKEVENT_READCOMPLETE: pData = m_pLSock->pGetRcvDataPointer(&dwMsgSize); LogRecvMsgHandler(pData); m_dwTime = G_dwGlobalTime; break; case XSOCKEVENT_SOCKETCLOSED: ChangeGameMode(GAMEMODE_ONCONNECTIONLOST); delete m_pLSock; m_pLSock = NULL; break; case XSOCKEVENT_SOCKETERROR: ChangeGameMode(GAMEMODE_ONCONNECTIONLOST); delete m_pLSock; m_pLSock = NULL; break; case XSOCKEVENT_CRITICALERROR: delete m_pLSock; m_pLSock = NULL; break; } } void CGame::LogResponseHandler(char * pData) { WORD * wp, wResponse; WORD wServerUpperVersion, wServerLowerVersion; DWORD * dwp; char * cp, cCharName[12]; int * ip, i; dwp = (DWORD *)(pData); wp = (WORD *)(pData + INDEX2_MSGTYPE); wResponse = *wp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); switch (wResponse) { case LOGRESMSGTYPE_CHARACTERDELETED: cp = (pData + INDEX2_MSGTYPE + 2); //m_iAccountStatus = (int)*cp; cp++; m_iTotalChar = (int)*cp; cp++; for (i = 0; i < 4; i++) if (m_pCharList[i] != NULL) { delete m_pCharList[i]; m_pCharList[i] = NULL; } for (i = 0; i < m_iTotalChar; i++) { m_pCharList[i] = new class CCharInfo; memcpy(m_pCharList[i]->m_cName, cp, 10); cp += 10; if (*cp == 0) { m_pCharList[i]->m_sSex = NULL; // Sex cp += 40; }else { cp++; wp = (WORD *)cp; m_pCharList[i]->m_sAppr1 = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sAppr2 = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sAppr3 = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sAppr4 = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sSex = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sSkinCol = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sLevel = *wp; cp += 2; dwp = (DWORD *)cp; m_pCharList[i]->m_iExp = *dwp; cp += 4; wp = (WORD *)cp; m_pCharList[i]->m_sStr = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sVit = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sDex = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sInt = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sMag = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sChr = *wp; cp += 2; ip = (int *)cp; m_pCharList[i]->m_iApprColor = *ip; cp += 4; wp = (WORD *)cp; m_pCharList[i]->m_iYear = (int)*wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_iMonth = (int)*wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_iDay = (int)*wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_iHour = (int)*wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_iMinute = (int)*wp; cp += 2; ZeroMemory(m_pCharList[i]->m_cMapName, sizeof(m_pCharList[i]->m_cMapName)); memcpy(m_pCharList[i]->m_cMapName, cp, 10); cp += 10; } } ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "3A"); break; case LOGRESMSGTYPE_CONFIRM: cp = (pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; wServerUpperVersion = *wp; cp += 2; wp = (WORD *)cp; wServerLowerVersion = *wp; cp += 2; // m_iAccountStatus = (int)*cp; cp++; wp = (WORD *)cp; m_iAccntYear = *wp; cp += 2; wp = (WORD *)cp; m_iAccntMonth = *wp; cp += 2; wp = (WORD *)cp; m_iAccntDay = *wp; cp += 2; wp = (WORD *)cp; m_iIpYear = *wp; cp += 2; wp = (WORD *)cp; m_iIpMonth = *wp; cp += 2; wp = (WORD *)cp; m_iIpDay = *wp; cp += 2; m_iTotalChar = (int)*cp; cp++; for (i = 0; i < 4; i++) if (m_pCharList[i] != NULL) { delete m_pCharList[i]; m_pCharList[i] = NULL; } for (i = 0; i < m_iTotalChar; i++) { m_pCharList[i] = new class CCharInfo; memcpy(m_pCharList[i]->m_cName, cp, 10); cp += 10; if (*cp == 0) { m_pCharList[i]->m_sSex = NULL; cp += 40; }else { cp++; wp = (WORD *)cp; m_pCharList[i]->m_sAppr1 = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sAppr2 = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sAppr3 = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sAppr4 = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sSex = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sSkinCol = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sLevel = *wp; cp += 2; dwp = (DWORD *)cp; m_pCharList[i]->m_iExp = *dwp; cp += 4; wp = (WORD *)cp; m_pCharList[i]->m_sStr = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sVit = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sDex = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sInt = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sMag = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sChr = *wp; cp += 2; ip = (int *)cp; m_pCharList[i]->m_iApprColor = *ip; cp += 4; wp = (WORD *)cp; m_pCharList[i]->m_iYear = (int)*wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_iMonth = (int)*wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_iDay = (int)*wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_iHour = (int)*wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_iMinute = (int)*wp; cp += 2; ZeroMemory(m_pCharList[i]->m_cMapName, sizeof(m_pCharList[i]->m_cMapName)); memcpy(m_pCharList[i]->m_cMapName, cp, 10); cp += 10; } } ip = (int *)cp; m_iTimeLeftSecAccount = *ip; cp += 4; ip = (int *)cp; m_iTimeLeftSecIP = *ip; cp += 4; ChangeGameMode(GAMEMODE_ONSELECTCHARACTER); ClearContents_OnSelectCharacter(); #ifndef _DEBUG if ( (wServerUpperVersion!=UPPER_VERSION) || (wServerLowerVersion!=LOWER_VERSION) ) ChangeGameMode(GAMEMODE_ONVERSIONNOTMATCH); #endif break; case LOGRESMSGTYPE_REJECT: cp = (pData + INDEX2_MSGTYPE + 2); ip = (int *)cp; m_iBlockYear = *ip; cp += 4; ip = (int *)cp; m_iBlockMonth = *ip; cp += 4; ip = (int *)cp; m_iBlockDay = *ip; cp += 4; ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "7H"); break; case LOGRESMSGTYPE_NOTENOUGHPOINT: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "7I"); break; case LOGRESMSGTYPE_ACCOUNTLOCKED: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "7K"); break; case LOGRESMSGTYPE_SERVICENOTAVAILABLE: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "7L"); break; case LOGRESMSGTYPE_PASSWORDCHANGESUCCESS: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "6B"); break; case LOGRESMSGTYPE_PASSWORDCHANGEFAIL: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "6C"); break; case LOGRESMSGTYPE_PASSWORDMISMATCH: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "11"); break; case LOGRESMSGTYPE_NOTEXISTINGACCOUNT: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "12"); break; case LOGRESMSGTYPE_NEWACCOUNTCREATED: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "54"); break; case LOGRESMSGTYPE_NEWACCOUNTFAILED: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "05"); break; case LOGRESMSGTYPE_ALREADYEXISTINGACCOUNT: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "06"); break; case LOGRESMSGTYPE_NOTEXISTINGCHARACTER: ChangeGameMode(GAMEMODE_ONMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "Not existing character!"); break; case LOGRESMSGTYPE_NEWCHARACTERCREATED: ZeroMemory(cCharName, sizeof(cCharName)); memcpy(cCharName, cp, 10); cp += 10; m_iTotalChar = (int)*cp; cp++; for (i = 0; i < 4; i++) if (m_pCharList[i] != NULL) delete m_pCharList[i]; // for (i = 0; i < m_iTotalChar; i++) { m_pCharList[i] = new class CCharInfo; memcpy(m_pCharList[i]->m_cName, cp, 10); cp += 10; if (*cp == 0) { m_pCharList[i]->m_sSex = NULL; // Sex cp += 40; } else { cp++; wp = (WORD *)cp; m_pCharList[i]->m_sAppr1 = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sAppr2 = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sAppr3 = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sAppr4 = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sSex = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sSkinCol = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sLevel = *wp; cp += 2; dwp = (DWORD *)cp; m_pCharList[i]->m_iExp = *dwp; cp += 4; wp = (WORD *)cp; m_pCharList[i]->m_sStr = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sVit = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sDex = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sInt = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sMag = *wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_sChr = *wp; cp += 2; ip = (int *)cp; m_pCharList[i]->m_iApprColor = *ip; cp += 4; wp = (WORD *)cp; m_pCharList[i]->m_iYear = (int)*wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_iMonth = (int)*wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_iDay = (int)*wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_iHour = (int)*wp; cp += 2; wp = (WORD *)cp; m_pCharList[i]->m_iMinute = (int)*wp; cp += 2; ZeroMemory(m_pCharList[i]->m_cMapName, sizeof(m_pCharList[i]->m_cMapName)); memcpy(m_pCharList[i]->m_cMapName, cp, 10); cp += 10; } } ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "47"); break; case LOGRESMSGTYPE_NEWCHARACTERFAILED: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "28"); break; case LOGRESMSGTYPE_ALREADYEXISTINGCHARACTER: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "29"); break; case ENTERGAMERESTYPE_PLAYING: ChangeGameMode(GAMEMODE_ONQUERYFORCELOGIN); break; case ENTERGAMERESTYPE_CONFIRM: { Sleep(50); // await processing of permitted IP from Login Server to Map Server int iGameServerPort; char cGameServerAddr[16]; ZeroMemory(cGameServerAddr, sizeof(cGameServerAddr)); cp = (pData + INDEX2_MSGTYPE + 2); memcpy(cGameServerAddr, cp, 16); cp += 16; wp = (WORD *)cp; iGameServerPort = *wp; cp += 2; ZeroMemory(m_cGameServerName, sizeof(m_cGameServerName)); memcpy(m_cGameServerName, cp, 20); cp += 20; m_pGSock = new class XSocket(m_hWnd, SOCKETBLOCKLIMIT); if (m_iGameServerMode == 1) { m_pGSock->bConnect(m_cLogServerAddr, iGameServerPort, WM_USER_GAMESOCKETEVENT); }else { m_pGSock->bConnect(cGameServerAddr, iGameServerPort, WM_USER_GAMESOCKETEVENT); } m_pGSock->bInitBufferSize(30000); } break; case ENTERGAMERESTYPE_REJECT: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); switch (*cp) { case 1: strcpy(m_cMsg, "3E"); break; case 2: strcpy(m_cMsg, "3F"); break; case 3: strcpy(m_cMsg, "33"); break; case 4: strcpy(m_cMsg, "3D"); break; case 5: strcpy(m_cMsg, "3G"); break; case 6: strcpy(m_cMsg, "3Z"); break; case 7: strcpy(m_cMsg, "3J"); break; } break; case ENTERGAMERESTYPE_FORCEDISCONN: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "3X"); break; case LOGRESMSGTYPE_NOTEXISTINGWORLDSERVER: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "1Y"); break; case LOGRESMSGTYPE_INPUTKEYCODE: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); switch (*cp) { case 1: strcpy(m_cMsg, "8U"); break; //MainMenu, Keycode registration success case 2: strcpy(m_cMsg, "82"); break; //MainMenu, Not existing Account case 3: strcpy(m_cMsg, "81"); break; //MainMenu, Password wrong case 4: strcpy(m_cMsg, "8V"); break; //MainMenu, Invalid Keycode case 5: strcpy(m_cMsg, "8W"); break; //MainMenu, Already Used Keycode } break; case LOGRESMSGTYPE_FORCECHANGEPASSWORD: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "6M"); break; case LOGRESMSGTYPE_INVALIDKOREANSSN: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "1a"); break; case LOGRESMSGTYPE_LESSTHENFIFTEEN: ChangeGameMode(GAMEMODE_ONLOGRESMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "1b"); break; } delete m_pLSock; m_pLSock = NULL; } void CGame::LogRecvMsgHandler(char * pData) { LogResponseHandler(pData); } void CGame::UpdateScreen_OnMsg() {short msX, msY, msZ; char cLB, cRB, cMB; DWORD dwTime = G_dwGlobalTime; m_DDraw.ClearBackB4(); PutString(10, 10, m_cMsg, RGB(255,155,155), FALSE, 1); DrawVersion(); m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); if ((G_dwGlobalTime - m_dwTime) > 1500) { ChangeGameMode(GAMEMODE_ONMAINMENU); } } void CGame::_InitOnCreateNewCharacter() { m_cGender = rand() % 2 + 1; m_cSkinCol = rand() % 3 + 1; m_cHairStyle = rand() % 8; m_cHairCol = rand() % 16; m_cUnderCol = rand() % 8; m_createStat[STAT_STR] = 10; m_createStat[STAT_VIT] = 10; m_createStat[STAT_DEX] = 10; m_createStat[STAT_INT] = 10; m_createStat[STAT_MAG] = 10; m_createStat[STAT_CHR] = 10; } void CGame::ClearContents_OnCreateNewAccount() { ZeroMemory(m_cAccountPassword, sizeof(m_cAccountPassword)); ZeroMemory(m_cEmailAddr, sizeof(m_cEmailAddr)); //v1.4334 ZeroMemory(m_cAccountQuiz, sizeof(m_cAccountQuiz)); ZeroMemory(m_cAccountAnswer, sizeof(m_cAccountAnswer)); } void CGame::ChangeGameMode(char cMode) { m_cGameMode = cMode; m_cGameModeCount = 0; m_dwTime = G_dwGlobalTime; #ifndef SELECTSERVER if( cMode == GAMEMODE_ONSELECTSERVER ) { ZeroMemory(m_cWorldServerName, sizeof(m_cWorldServerName)); strcpy(m_cWorldServerName, NAME_WORLDNAME1); m_cGameMode = GAMEMODE_ONLOGIN; } #endif } BOOL CGame::bReadIp() { ZeroMemory(m_cLogServerAddr, sizeof(m_cLogServerAddr)); strcpy(m_cLogServerAddr, SERVER_IP); m_iLogServerPort = SERVER_PORT; return TRUE; } BOOL CGame::bReadLoginConfigFile(char * cFn) {FILE * pFile; HANDLE hFile; DWORD dwFileSize; char * cp, * token, cReadMode; char seps[] = "= ,\t\n"; cReadMode = 0; // Get file size only hFile = CreateFile(cFn, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); dwFileSize = GetFileSize(hFile, NULL); if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); pFile = fopen(cFn, "rt"); if (pFile == NULL) goto DEFAULT_IP; cp = new char[dwFileSize+2]; ZeroMemory(cp, dwFileSize+2); fread(cp, dwFileSize, 1, pFile); token = strtok( cp, seps ); while( token != NULL ) { if (cReadMode != 0) { switch (cReadMode) { case 1: // log-server-address if (strlen(token) > 15) { delete[] cp; if (pFile != NULL) fclose(pFile); goto DEFAULT_IP; } ZeroMemory(m_cLogServerAddr, sizeof(m_cLogServerAddr)); strcpy(m_cLogServerAddr, token); cReadMode = 0; break; case 2: // log-server-port m_iLogServerPort = atoi(token); if (m_iLogServerPort == 0) { delete[] cp; if (pFile != NULL) fclose(pFile); goto DEFAULT_IP; } cReadMode = 0; break; case 3: // game-server-mode if ((memcmp(token, "lan", 3) == 0) || (memcmp(token, "LAN", 3) == 0)) { m_iGameServerMode = 1; // Will no connect multi-hoster HB // but will connect from LAN even with bad router } if ((memcmp(token, "internet", 8) == 0) || (memcmp(token, "INTERNET", 8) == 0)) { m_iGameServerMode = 2; // Default HB mode } cReadMode = 0; break; } }else { if (memcmp(token, "log-server-address",18) == 0) cReadMode = 1; if (memcmp(token, "log-server-port",15) == 0) cReadMode = 2; if (memcmp(token, "game-server-mode",16) == 0) cReadMode = 3; } token = strtok( NULL, seps ); } delete[] cp; if (pFile != NULL) fclose(pFile); return TRUE; DEFAULT_IP: ZeroMemory(m_cLogServerAddr, sizeof(m_cLogServerAddr)); strcpy(m_cLogServerAddr, SERVER_IP); m_iLogServerPort = SERVER_PORT; return TRUE; } void CGame::ReleaseUnusedSprites() { int i; for (i = 0; i < MAXSPRITES; i++) if (m_pSprite[i] != NULL) { if( (m_pSprite[i]->m_bIsSurfaceEmpty == FALSE) && (m_pSprite[i]->m_bOnCriticalSection == FALSE) ) { if ((G_dwGlobalTime - m_pSprite[i]->m_dwRefTime) > 60000 ) m_pSprite[i]->_iCloseSprite(); } } for (i = 0; i < MAXTILES; i++) if (m_pTileSpr[i] != NULL) { if( (m_pTileSpr[i]->m_bIsSurfaceEmpty == FALSE) && (m_pTileSpr[i]->m_bOnCriticalSection == FALSE) ) { if ((G_dwGlobalTime - m_pTileSpr[i]->m_dwRefTime) > 60000 ) m_pTileSpr[i]->_iCloseSprite(); } } for (i = 0; i < MAXEFFECTSPR; i++) if (m_pEffectSpr[i] != NULL) { if( (m_pEffectSpr[i]->m_bIsSurfaceEmpty == FALSE) && (m_pEffectSpr[i]->m_bOnCriticalSection == FALSE) ) { if ((G_dwGlobalTime - m_pEffectSpr[i]->m_dwRefTime) > 60000 ) m_pEffectSpr[i]->_iCloseSprite(); } } for (i = 0; i < MAXSOUNDEFFECTS; i++) { if (m_pCSound[i] != NULL) { if (((G_dwGlobalTime - m_pCSound[i]->m_dwTime) > 30000) && (m_pCSound[i]->m_bIsLooping == FALSE)) m_pCSound[i]->_ReleaseSoundBuffer(); } if (m_pMSound[i] != NULL) { if (((G_dwGlobalTime - m_pMSound[i]->m_dwTime) > 30000) && (m_pMSound[i]->m_bIsLooping == FALSE)) m_pMSound[i]->_ReleaseSoundBuffer(); } if (m_pESound[i] != NULL) { if (((G_dwGlobalTime - m_pESound[i]->m_dwTime) > 30000) && (m_pESound[i]->m_bIsLooping == FALSE)) m_pESound[i]->_ReleaseSoundBuffer(); } } } void CGame::PutChatScrollList(char * pMsg, char cType) { int i; if (m_pChatScrollList[MAXCHATSCROLLMSGS - 1] != NULL) { delete m_pChatScrollList[MAXCHATSCROLLMSGS - 1]; m_pChatScrollList[MAXCHATSCROLLMSGS - 1] = NULL; } for (i = MAXCHATSCROLLMSGS - 2; i >= 0; i--) { m_pChatScrollList[i+1] = m_pChatScrollList[i]; m_pChatScrollList[i] = NULL; } m_pChatScrollList[0] = new class CMsg(1, pMsg, cType); if (m_tabbedNotification && !m_bIsProgramActive) { if (strstr (pMsg,m_cPlayerName)) FlashWindow(m_hWnd,true); } } void CGame::ChatMsgHandler(char * pData) { int i, iObjectID, iLoc; short * sp, sX, sY; char * cp, cMsgType, cName[21], cTemp[100], cMsg[100], cTxt1[100], cTxt2[100]; DWORD dwTime; WORD * wp; BOOL bFlag; dwTime = m_dwCurTime; ZeroMemory(cTxt1, sizeof(cTxt1)); ZeroMemory(cTxt2, sizeof(cTxt2)); ZeroMemory(cMsg, sizeof(cMsg)); wp = (WORD *)(pData + INDEX2_MSGTYPE); iObjectID = (int)*wp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sX = *sp; cp += 2; sp = (short *)cp; sY = *sp; cp += 2; ZeroMemory(cName, sizeof(cName)); memcpy(cName, (char *)cp, 10); cp += 10; cMsgType = *cp; cp++; ZeroMemory(cTemp, sizeof(cTemp)); strcpy(cTemp, cp); if((m_MuteList.find(string(cName)) != m_MuteList.end()) || (!m_bWhisper && cMsgType == CHAT_WHISPER) || (!m_bShout && (cMsgType == CHAT_SHOUT || cMsgType == CHAT_NATIONSHOUT) ) || ((cMsgType==0 || cMsgType==2 || cMsgType==3) && !m_Misc.bCheckIMEString(cTemp)) ) { return; } char timeStamp[50]; TimeStamp(timeStamp); ZeroMemory(cMsg, sizeof(cMsg)); if(cMsgType == CHAT_WHISPER && (memcmp(m_cPlayerName, cName, 10) == 0))\ { if (m_showTimeStamp) wsprintf(cMsg, "[%s](%s) %s: %s", timeStamp, m_cWhisperName, cName, cTemp); else wsprintf(cMsg, "(%s) %s: %s", m_cWhisperName, cName, cTemp); }else{ if (m_showTimeStamp) wsprintf(cMsg, "[%s] %s: %s", timeStamp, cName, cTemp); else wsprintf(cMsg, "%s: %s", cName, cTemp); } m_DDraw._GetBackBufferDC(); bFlag = FALSE; short sCheckByte = 0; while (bFlag == FALSE) { iLoc = m_Misc.iGetTextLengthLoc(m_DDraw.m_hDC, cMsg, 305); for( int i=0 ; i<iLoc ; i++ ) if( cMsg[i] < 0 ) sCheckByte ++; if (iLoc == 0) { PutChatScrollList(cMsg, cMsgType); bFlag = TRUE; }else { if ((sCheckByte%2)==0) { ZeroMemory(cTemp, sizeof(cTemp)); memcpy(cTemp, cMsg, iLoc); PutChatScrollList(cTemp, cMsgType); ZeroMemory(cTemp, sizeof(cTemp)); strcpy(cTemp, cMsg +iLoc ); ZeroMemory(cMsg, sizeof(cMsg)); strcpy(cMsg, " "); strcat(cMsg, cTemp); }else { ZeroMemory(cTemp, sizeof(cTemp)); memcpy(cTemp, cMsg, iLoc+1); PutChatScrollList(cTemp, cMsgType); ZeroMemory(cTemp, sizeof(cTemp)); strcpy(cTemp, cMsg +iLoc+1); ZeroMemory(cMsg, sizeof(cMsg)); strcpy(cMsg, " "); strcat(cMsg, cTemp); } } } m_DDraw._ReleaseBackBufferDC(); _RemoveChatMsgListByObjectID(iObjectID); for (i = 1; i < MAXCHATMSGS; i++) if (m_pChatMsgList[i] == NULL) { m_pChatMsgList[i] = new class CMsg(1, (char *)(cp), dwTime); m_pChatMsgList[i]->m_iObjectID = iObjectID; if (m_pMapData->bSetChatMsgOwner(iObjectID, sX, sY, i) == FALSE) { delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } char cHeadMsg[200]; if ( (cMsgType != 0) && (m_bIsDialogEnabled[10] != TRUE) ) { ZeroMemory(cHeadMsg, sizeof(cHeadMsg)); if(cMsgType == CHAT_WHISPER && (memcmp(m_cPlayerName, cName, 10) == 0)) { if (m_showTimeStamp) wsprintf(cHeadMsg, "[%s](%s) %s: %s", timeStamp, m_cWhisperName, cName, cp); else wsprintf(cHeadMsg, "(%s) %s: %s", m_cWhisperName, cName, cp); }else{ if (m_showTimeStamp) wsprintf(cHeadMsg, "[%s] %s: %s", timeStamp, cName, cp); else wsprintf(cHeadMsg, "%s: %s", cName, cp); } AddEventList(cHeadMsg, cMsgType); } return; } } void CGame::ReleaseTimeoverChatMsg() { int i; DWORD dwTime; dwTime = G_dwGlobalTime; for ( i = 1; i < MAXCHATMSGS; i++) if (m_pChatMsgList[i] != NULL) { if ((m_pChatMsgList[i]->m_cType >= 1) && (m_pChatMsgList[i]->m_cType <= 20)) { if ((dwTime - m_pChatMsgList[i]->m_dwTime) > CHATTIMEOUT_A) { delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } } else if ((m_pChatMsgList[i]->m_cType >= 21) && (m_pChatMsgList[i]->m_cType <= 40)) { if ((dwTime - m_pChatMsgList[i]->m_dwTime) > CHATTIMEOUT_B) { delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } } else if ((m_pChatMsgList[i]->m_cType >= 41) && (m_pChatMsgList[i]->m_cType <= 60)) { if ((dwTime - m_pChatMsgList[i]->m_dwTime) > CHATTIMEOUT_C) { delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } } else if ((dwTime - m_pChatMsgList[i]->m_dwTime) > CHATTIMEOUT_A) { delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } } } void CGame::DrawBackground(short sDivX, short sModX, short sDivY, short sModY) { int indexX, indexY, ix, iy; short sSpr, sSprFrame; if (sDivX < 0 || sDivY < 0) return ; if ((m_bIsRedrawPDBGS == TRUE) || (m_iPDBGSdivX != sDivX) || (m_iPDBGSdivY != sDivY)) { // Pre-Draw Background Surface m_bIsRedrawPDBGS = FALSE; m_iPDBGSdivX = sDivX; m_iPDBGSdivY = sDivY; SetRect(&m_DDraw.m_rcClipArea, 0,0, 640+32, 480+32); indexY = sDivY+m_pMapData->m_sPivotY; for (iy = -sModY; iy < 427+48 ; iy += 32) { indexX = sDivX+m_pMapData->m_sPivotX; for (ix = -sModX; ix < 640+48 ; ix += 32) { sSpr = m_pMapData->m_tile[indexX][indexY].m_sTileSprite; sSprFrame = m_pMapData->m_tile[indexX][indexY].m_sTileSpriteFrame; m_pTileSpr[sSpr]->PutSpriteFastNoColorKeyDst(m_DDraw.m_lpPDBGS, ix - 16 +sModX, iy - 16 +sModY, sSprFrame, m_dwCurTime); indexX++; } indexY++; } SetRect(&m_DDraw.m_rcClipArea, 0,0, 640, 480); } RECT rcRect; SetRect(&rcRect, sModX, sModY, 640+sModX, 480+sModY); // our fictitious sprite bitmap is m_DDraw.m_lpBackB4->BltFast( 0, 0, m_DDraw.m_lpPDBGS, &rcRect, DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT); if (m_showGrid) { indexY = sDivY+m_pMapData->m_sPivotY; for (iy = -sModY; iy < 427+48 ; iy += 32) { indexX = sDivX+m_pMapData->m_sPivotX; for (ix = -sModX; ix < 640+48 ; ix += 32) { DrawLine(ix - 16 , iy - 16 , ix + 16 , iy - 16 , 6,13,13); DrawLine(ix - 16 , iy - 16 , ix - 16 , iy + 16 , 6,13,13); indexX++; } indexY++; } } if( m_bIsCrusadeMode ) { if(m_iConstructLocX != -1) DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, m_iConstructLocX*32 - m_sViewPointX, m_iConstructLocY*32 - m_sViewPointY, 41); if( m_iTeleportLocX != -1) DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, m_iTeleportLocX*32 - m_sViewPointX, m_iTeleportLocY*32 - m_sViewPointY, 42); } } BOOL CGame::bEffectFrameCounter() {int i, x; DWORD dwTime; BOOL bRet = FALSE; short sAbsX, sAbsY, sDist; char cDir; long lPan; dwTime = m_dwCurTime; dwTime += m_pMapData->m_dwFrameAdjustTime; for (i = 0; i < MAXEFFECTS; i++) if (m_pEffectList[i] != NULL) { if ((dwTime - m_pEffectList[i]->m_dwTime) > m_pEffectList[i]->m_dwFrameTime) { m_pEffectList[i]->m_dwTime = dwTime; m_pEffectList[i]->m_cFrame++; bRet = TRUE; m_pEffectList[i]->m_mX2 = m_pEffectList[i]->m_mX; m_pEffectList[i]->m_mY2 = m_pEffectList[i]->m_mY; switch (m_pEffectList[i]->m_sType) { case 1: // coup normal if (m_pEffectList[i]->m_cFrame == 1) { for (int j = 1; j <= m_pEffectList[i]->m_iV1; j++) bAddNewEffect(11, m_pEffectList[i]->m_mX + 15 - (rand() % 30), m_pEffectList[i]->m_mY + 15 - (rand() % 30), NULL, NULL, -1*(rand() % 2)); } if (m_pEffectList[i]->m_cFrame >= m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 2: // (Arrow missing target ?) m_Misc.GetPoint(m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32 - 40, &m_pEffectList[i]->m_mX, &m_pEffectList[i]->m_mY, &m_pEffectList[i]->m_iErr, 70); if ( (abs(m_pEffectList[i]->m_mX - m_pEffectList[i]->m_dX*32) <= 2) && (abs(m_pEffectList[i]->m_mY - (m_pEffectList[i]->m_dY*32 - 40)) <= 2) ) { //bAddNewEffect(14, m_pEffectList[i]->m_mX +(rand() % 5) - 2, m_pEffectList[i]->m_mY +(rand() % 5) - 2, NULL, NULL, 0, 0); delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 4: // Gold Drop ,33,69,70 case 33: // case 69: case 70: if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 5: case 30: case 31: // Fire Explosion case 252: if (m_pEffectList[i]->m_cFrame == 1) { bAddNewEffect(12, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(12, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(12, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(12, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(12, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); } if (m_pEffectList[i]->m_cFrame == 7) { bAddNewEffect(15, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), 0, NULL, NULL); bAddNewEffect(15, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), 0, NULL, NULL); bAddNewEffect(15, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), 0, NULL, NULL); } if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 6: // Lightning Bolt Burst if (m_pEffectList[i]->m_cFrame == 1) { bAddNewEffect(9, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); } if (m_pEffectList[i]->m_cFrame >= m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 7: // Magic Missile Burst if (m_pEffectList[i]->m_cFrame == 1) { bAddNewEffect(9, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); } if (m_pEffectList[i]->m_cFrame >= m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 9: // Burst Type 2 case 11: // Burst Type 3 m_pEffectList[i]->m_mX += m_pEffectList[i]->m_rX; m_pEffectList[i]->m_mY += m_pEffectList[i]->m_rY; m_pEffectList[i]->m_rY++; if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 10: // Lightning Arrow Burst if (m_pEffectList[i]->m_cFrame == 1) { bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); } if (m_pEffectList[i]->m_cFrame >= m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 12: // Burst Type 4 m_pEffectList[i]->m_mX += m_pEffectList[i]->m_rX; m_pEffectList[i]->m_mY += m_pEffectList[i]->m_rY; if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 13: // Bulles druncncity if (m_pEffectList[i]->m_cFrame < 15) { if ((rand() % 2) == 0) m_pEffectList[i]->m_mX++; else m_pEffectList[i]->m_mX--; m_pEffectList[i]->m_mY--; } if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 16: // m_Misc.GetPoint(m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, m_pEffectList[i]->m_dX, m_pEffectList[i]->m_dY, &m_pEffectList[i]->m_mX, &m_pEffectList[i]->m_mY, &m_pEffectList[i]->m_iErr, 40); bAddNewEffect(8, m_pEffectList[i]->m_mX + (rand() % 20) - 10, m_pEffectList[i]->m_mY + (rand() % 20) - 10, NULL, NULL, -1*(rand() % 4)); if ( (abs(m_pEffectList[i]->m_mX - m_pEffectList[i]->m_dX) <= 2) && (abs(m_pEffectList[i]->m_mY - (m_pEffectList[i]->m_dY)) <= 2)) { bAddNewEffect(18, m_pEffectList[i]->m_dX, m_pEffectList[i]->m_dY, NULL, NULL, 0); // testcode 0111 18 bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(9, m_pEffectList[i]->m_mX + 20 - (rand() % 40), m_pEffectList[i]->m_mY + 20 - (rand() % 40), NULL, NULL, -1*(rand() % 2)); delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 17: // Ice-Storm cDir = m_Misc.cGetNextMoveDir(m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, m_pEffectList[i]->m_mX3, m_pEffectList[i]->m_mY3); switch (cDir) { case 1: m_pEffectList[i]->m_rY -= 2; break; case 2: m_pEffectList[i]->m_rY -= 2; m_pEffectList[i]->m_rX += 2; break; case 3: m_pEffectList[i]->m_rX += 2; break; case 4: m_pEffectList[i]->m_rX += 2; m_pEffectList[i]->m_rY += 2; break; case 5: m_pEffectList[i]->m_rY += 2; break; case 6: m_pEffectList[i]->m_rX -= 2; m_pEffectList[i]->m_rY += 2; break; case 7: m_pEffectList[i]->m_rX -= 2; break; case 8: m_pEffectList[i]->m_rX -= 2; m_pEffectList[i]->m_rY -= 2; break; } if (m_pEffectList[i]->m_rX < -10) m_pEffectList[i]->m_rX = -10; if (m_pEffectList[i]->m_rX > 10) m_pEffectList[i]->m_rX = 10; if (m_pEffectList[i]->m_rY < -10) m_pEffectList[i]->m_rY = -10; if (m_pEffectList[i]->m_rY > 10) m_pEffectList[i]->m_rY = 10; m_pEffectList[i]->m_mX += m_pEffectList[i]->m_rX; m_pEffectList[i]->m_mY += m_pEffectList[i]->m_rY; m_pEffectList[i]->m_mY3--; if (m_pEffectList[i]->m_cFrame > 10) { m_pEffectList[i]->m_cFrame = 0; if (abs(m_pEffectList[i]->m_sY - m_pEffectList[i]->m_mY3) > 100) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } } break; case 20: // Critical strike with a weapon case 21: case 22: case 23: case 24: case 25: case 26: case 27: // Critical strike with a weapon m_Misc.GetPoint(m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32 - 40, &m_pEffectList[i]->m_mX, &m_pEffectList[i]->m_mY, &m_pEffectList[i]->m_iErr, 50); bAddNewEffect(8, m_pEffectList[i]->m_mX + 10 - (rand() % 20), m_pEffectList[i]->m_mY + 10 - (rand() % 20), NULL, NULL, 0);//-1*(rand() % 4)); bAddNewEffect(8, m_pEffectList[i]->m_mX + 10 - (rand() % 20), m_pEffectList[i]->m_mY + 10 - (rand() % 20), NULL, NULL, 0);//-1*(rand() % 4)); bAddNewEffect(8, m_pEffectList[i]->m_mX + 10 - (rand() % 20), m_pEffectList[i]->m_mY + 10 - (rand() % 20), NULL, NULL, 0);//-1*(rand() % 4)); bAddNewEffect(8, m_pEffectList[i]->m_mX + 10 - (rand() % 20), m_pEffectList[i]->m_mY + 10 - (rand() % 20), NULL, NULL, 0);//-1*(rand() % 4)); bAddNewEffect(8, m_pEffectList[i]->m_mX + 10 - (rand() % 20), m_pEffectList[i]->m_mY + 10 - (rand() % 20), NULL, NULL, 0);//-1*(rand() % 4)); if ( (abs(m_pEffectList[i]->m_mX - m_pEffectList[i]->m_dX*32) <= 2) && (abs(m_pEffectList[i]->m_mY - (m_pEffectList[i]->m_dY*32 - 40)) <= 2) ) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 34: // m_Misc.GetPoint(m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, m_pEffectList[i]->m_dX, m_pEffectList[i]->m_dY, &m_pEffectList[i]->m_mX, &m_pEffectList[i]->m_mY, &m_pEffectList[i]->m_iErr, 50); bAddNewEffect(33, m_pEffectList[i]->m_mX + (rand() % 30) - 15, m_pEffectList[i]->m_mY + (rand() % 30) - 15, NULL, NULL, -1*(rand() % 4)); if ( (abs(m_pEffectList[i]->m_mX - m_pEffectList[i]->m_dX) <= 2) && (abs(m_pEffectList[i]->m_mY - (m_pEffectList[i]->m_dY)) <= 2) ) { bAddNewEffect(33, m_pEffectList[i]->m_dX, m_pEffectList[i]->m_dY, NULL, NULL, 0); //7 delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 40: case 56: if (m_pEffectList[i]->m_cFrame == 9) { bAddNewEffect(51, m_pEffectList[i]->m_mX +((rand() % 100)-50), m_pEffectList[i]->m_mY +((rand() % 70)-35), NULL, NULL, 0, 0); bAddNewEffect(51, m_pEffectList[i]->m_mX +((rand() % 100)-50), m_pEffectList[i]->m_mY +((rand() % 70)-35), NULL, NULL, 0, 0); bAddNewEffect(51, m_pEffectList[i]->m_mX +((rand() % 100)-50), m_pEffectList[i]->m_mY +((rand() % 70)-35), NULL, NULL, 0, 0); bAddNewEffect(51, m_pEffectList[i]->m_mX +((rand() % 100)-50), m_pEffectList[i]->m_mY +((rand() % 70)-35), NULL, NULL, 0, 0); bAddNewEffect(51, m_pEffectList[i]->m_mX +((rand() % 100)-50), m_pEffectList[i]->m_mY +((rand() % 70)-35), NULL, NULL, 0, 0); } if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 41: //Large Type 1, 2, 3, 4 case 42: case 43: case 44: case 45: // Small Type 1, 2 case 46: if (m_pEffectList[i]->m_cFrame >= 7) { m_pEffectList[i]->m_mX--; m_pEffectList[i]->m_mY += m_pEffectList[i]->m_iV1; m_pEffectList[i]->m_iV1++; } if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { if ((m_pEffectList[i]->m_sType != 45) && (m_pEffectList[i]->m_sType != 46)) { bAddNewEffect(50, m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, NULL, NULL, 0); bAddNewEffect(14, m_pEffectList[i]->m_mX +((rand() % 20)-10), m_pEffectList[i]->m_mY +((rand() % 20)-10), NULL, NULL, 0, 0); bAddNewEffect(14, m_pEffectList[i]->m_mX +((rand() % 20)-10), m_pEffectList[i]->m_mY +((rand() % 20)-10), NULL, NULL, 0, 0); bAddNewEffect(14, m_pEffectList[i]->m_mX +((rand() % 20)-10), m_pEffectList[i]->m_mY +((rand() % 20)-10), NULL, NULL, 0, 0); bAddNewEffect(51, m_pEffectList[i]->m_mX +((rand() % 20)-10), m_pEffectList[i]->m_mY +((rand() % 20)-10), NULL, NULL, 0, 0); bAddNewEffect(51, m_pEffectList[i]->m_mX +((rand() % 20)-10), m_pEffectList[i]->m_mY +((rand() % 20)-10), NULL, NULL, 0, 0); } delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 47: // Blizzard case 48: case 49: if (m_pEffectList[i]->m_cFrame >= 7) { m_pEffectList[i]->m_mX--; m_pEffectList[i]->m_mY += m_pEffectList[i]->m_iV1; m_pEffectList[i]->m_iV1 += 4; } if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { if (m_pEffectList[i]->m_sType == 49) bAddNewEffect(72, m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, NULL, NULL, 0); else bAddNewEffect(50, m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, NULL, NULL, 0); bAddNewEffect(14, m_pEffectList[i]->m_mX +((rand() % 20)-10), m_pEffectList[i]->m_mY +((rand() % 20)-10), NULL, NULL, 0, 0); bAddNewEffect(14, m_pEffectList[i]->m_mX +((rand() % 20)-10), m_pEffectList[i]->m_mY +((rand() % 20)-10), NULL, NULL, 0, 0); bAddNewEffect(14, m_pEffectList[i]->m_mX +((rand() % 20)-10), m_pEffectList[i]->m_mY +((rand() % 20)-10), NULL, NULL, 0, 0); bAddNewEffect(51, m_pEffectList[i]->m_mX +((rand() % 20)-10), m_pEffectList[i]->m_mY +((rand() % 20)-10), NULL, NULL, 0, 0); bAddNewEffect(51, m_pEffectList[i]->m_mX +((rand() % 20)-10), m_pEffectList[i]->m_mY +((rand() % 20)-10), NULL, NULL, 0, 0); delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 60: // case 181: // Meteor-Strike if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { bAddNewEffect(61, m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, NULL, NULL, 0, 0); bAddNewEffect(63, m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, NULL, NULL, 0, 0); bAddNewEffect(12, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(12, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(12, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(12, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); bAddNewEffect(12, m_pEffectList[i]->m_mX + 5 - (rand() % 10), m_pEffectList[i]->m_mY + 5 - (rand() % 10), NULL, NULL, -1*(rand() % 2)); delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else if (m_pEffectList[i]->m_cFrame >= 0) { m_pEffectList[i]->m_mX -= 30; m_pEffectList[i]->m_mY += 46; bAddNewEffect(62, m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, NULL, NULL, 0, 0); } break; case 62: if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else if (m_pEffectList[i]->m_cFrame >= 0) { m_pEffectList[i]->m_mX += (rand() % 3) -1; m_pEffectList[i]->m_mY += (rand() % 3) -1; } break; case 65: // Building fire after MS (crusade) 65 & 67 if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else if (m_pEffectList[i]->m_cFrame >= 0) { m_pEffectList[i]->m_mX += (rand() % 3) -1; m_pEffectList[i]->m_mY -= 4 +(rand() % 2); } break; case 66: case 203: case 204: case 205: case 206: if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 68: if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else if (m_pEffectList[i]->m_cFrame == 11) { SetCameraShakingEffect(m_pEffectList[i]->m_iV1, 2); } break; case 71: m_Misc.GetPoint(m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, m_pEffectList[i]->m_dX, m_pEffectList[i]->m_dY, &m_pEffectList[i]->m_mX, &m_pEffectList[i]->m_mY, &m_pEffectList[i]->m_iErr, 50); bAddNewEffect(48, m_pEffectList[i]->m_mX + (rand() % 30) - 15, m_pEffectList[i]->m_mY + (rand() % 30) - 15, NULL, NULL, 0); bAddNewEffect(51, m_pEffectList[i]->m_mX +((rand() % 20)-10), m_pEffectList[i]->m_mY +((rand() % 20)-10), NULL, NULL, 0, 0); if ( (abs(m_pEffectList[i]->m_mX - m_pEffectList[i]->m_dX) <= 2) && (abs(m_pEffectList[i]->m_mY - (m_pEffectList[i]->m_dY)) <= 2) ) { bAddNewEffect(49, m_pEffectList[i]->m_mX/* + (rand() % 30) - 15*/, m_pEffectList[i]->m_mY/* + (rand() % 30) - 15*/, NULL, NULL, 0); delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 81: // Snoopy: Ajout StromBlade m_Misc.GetPoint(m_pEffectList[i]->m_mX , m_pEffectList[i]->m_mY , m_pEffectList[i]->m_dX*32 , m_pEffectList[i]->m_dY*32 , &m_pEffectList[i]->m_mX , &m_pEffectList[i]->m_mY , &m_pEffectList[i]->m_iErr , 10); if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 100: // Magic Missile m_Misc.GetPoint(m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32/* - 40*/, &m_pEffectList[i]->m_mX, &m_pEffectList[i]->m_mY, &m_pEffectList[i]->m_iErr, 50); bAddNewEffect(8, m_pEffectList[i]->m_mX + (rand() % 20) - 10, m_pEffectList[i]->m_mY + (rand() % 20) - 10, NULL, NULL, -1*(rand() % 4)); if ( (abs(m_pEffectList[i]->m_mX - m_pEffectList[i]->m_dX*32) <= 2) && (abs(m_pEffectList[i]->m_mY - (m_pEffectList[i]->m_dY*32/* - 40*/)) <= 2) ) { bAddNewEffect(7, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32, NULL, NULL, 0); delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 110: // Enegy-Bolt m_Misc.GetPoint(m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32/* - 40*/, &m_pEffectList[i]->m_mX, &m_pEffectList[i]->m_mY, &m_pEffectList[i]->m_iErr, 50); bAddNewEffect(8, m_pEffectList[i]->m_mX + (rand() % 20) - 10, m_pEffectList[i]->m_mY + (rand() % 20) - 10, NULL, NULL, -1*(rand() % 4)); bAddNewEffect(8, m_pEffectList[i]->m_mX + (rand() % 20) - 10, m_pEffectList[i]->m_mY + (rand() % 20) - 10, NULL, NULL, -1*(rand() % 4)); if ( (abs(m_pEffectList[i]->m_mX - m_pEffectList[i]->m_dX*32) <= 2) && (abs(m_pEffectList[i]->m_mY - m_pEffectList[i]->m_dY*32) <= 2) ) { bAddNewEffect(6, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32, NULL, NULL, 0); // 6 testcode 0111 delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 120: // Fire Ball m_Misc.GetPoint(m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32/* - 40*/, &m_pEffectList[i]->m_mX, &m_pEffectList[i]->m_mY, &m_pEffectList[i]->m_iErr, 50); if ( (abs(m_pEffectList[i]->m_mX - m_pEffectList[i]->m_dX*32) <= 2) && (abs(m_pEffectList[i]->m_mY - m_pEffectList[i]->m_dY*32) <= 2) ) { bAddNewEffect(5, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32, NULL, NULL, 0); delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 130: // Fire Strike m_Misc.GetPoint(m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32/* - 40*/, &m_pEffectList[i]->m_mX, &m_pEffectList[i]->m_mY, &m_pEffectList[i]->m_iErr, 50); if ( (abs(m_pEffectList[i]->m_mX - m_pEffectList[i]->m_dX*32) <= 2) && (abs(m_pEffectList[i]->m_mY - m_pEffectList[i]->m_dY*32) <= 2) ) { bAddNewEffect(5, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32, NULL, NULL, 0); bAddNewEffect(5, m_pEffectList[i]->m_dX*32 -30, m_pEffectList[i]->m_dY*32 -15, NULL, NULL, -7); bAddNewEffect(5, m_pEffectList[i]->m_dX*32 +35, m_pEffectList[i]->m_dY*32 -30, NULL, NULL, -5); bAddNewEffect(5, m_pEffectList[i]->m_dX*32 +20, m_pEffectList[i]->m_dY*32 +30, NULL, NULL, -3); delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 137: // Lightning Arrow m_Misc.GetPoint(m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32/* - 40*/, &m_pEffectList[i]->m_mX, &m_pEffectList[i]->m_mY, &m_pEffectList[i]->m_iErr, 50); bAddNewEffect(8, m_pEffectList[i]->m_mX + (rand() % 20) - 10, m_pEffectList[i]->m_mY + (rand() % 20) - 10, NULL, NULL, -1*(rand() % 4)); bAddNewEffect(8, m_pEffectList[i]->m_mX + (rand() % 20) - 10, m_pEffectList[i]->m_mY + (rand() % 20) - 10, NULL, NULL, -1*(rand() % 4)); bAddNewEffect(8, m_pEffectList[i]->m_mX + (rand() % 20) - 10, m_pEffectList[i]->m_mY + (rand() % 20) - 10, NULL, NULL, -1*(rand() % 4)); if ( (abs(m_pEffectList[i]->m_mX - m_pEffectList[i]->m_dX*32) <= 2) && (abs(m_pEffectList[i]->m_mY - m_pEffectList[i]->m_dY*32) <= 2) ) { bAddNewEffect(10, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32, NULL, NULL, 0); delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 143: // Lightning case 151: // Lightning-Bolt if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { bAddNewEffect(10, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32, NULL, NULL, 0); delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else { m_pEffectList[i]->m_rX = 5 - (rand() % 10); m_pEffectList[i]->m_rY = 5 - (rand() % 10); } break; case 145: // Chill-Wind bAddNewEffect(40, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32, NULL, NULL, 0); bAddNewEffect(40, m_pEffectList[i]->m_dX*32 -30, m_pEffectList[i]->m_dY*32 -15, NULL, NULL, -10); bAddNewEffect(40, m_pEffectList[i]->m_dX*32 +35, m_pEffectList[i]->m_dY*32 -30, NULL, NULL, -6); bAddNewEffect(40, m_pEffectList[i]->m_dX*32 +20, m_pEffectList[i]->m_dY*32 +30, NULL, NULL, -3); delete m_pEffectList[i]; m_pEffectList[i] = NULL; break; case 147: // Triple-Energy-Bolt bAddNewEffect(110, m_pEffectList[i]->m_sX , m_pEffectList[i]->m_sY , m_pEffectList[i]->m_dX -1, m_pEffectList[i]->m_dY-1, 0); bAddNewEffect(110, m_pEffectList[i]->m_sX, m_pEffectList[i]->m_sY, m_pEffectList[i]->m_dX +1, m_pEffectList[i]->m_dY -1, 0); bAddNewEffect(110, m_pEffectList[i]->m_sX, m_pEffectList[i]->m_sY, m_pEffectList[i]->m_dX +1, m_pEffectList[i]->m_dY +1, 0); bAddNewEffect(8, m_pEffectList[i]->m_mX + (rand() % 20) - 10, m_pEffectList[i]->m_mY + (rand() % 20) - 10, NULL, NULL, -1*(rand() % 4)); sAbsX = abs(((m_sViewPointX / 32) + 10) - m_pEffectList[i]->m_dX); sAbsY = abs(((m_sViewPointY / 32) + 7) - m_pEffectList[i]->m_dY); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; lPan = -(((m_sViewPointX / 32) + 10) - m_pEffectList[i]->m_dX)*1000; PlaySound('E', 1, sDist, lPan); bAddNewEffect(7, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32, NULL, NULL, 0); delete m_pEffectList[i]; m_pEffectList[i] = NULL; break ; case 156: // Mass-Lightning-Arrow if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else { bAddNewEffect(137, m_pEffectList[i]->m_sX, m_pEffectList[i]->m_sY, m_pEffectList[i]->m_dX, m_pEffectList[i]->m_dY, 0); sAbsX = abs(((m_sViewPointX / 32) + 10) - m_pEffectList[i]->m_dX); sAbsY = abs(((m_sViewPointY / 32) + 7) - m_pEffectList[i]->m_dY); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; lPan = -(((m_sViewPointX / 32) + 10) - m_pEffectList[i]->m_dX)*1000; PlaySound('E', 1, sDist, lPan); } break; case 157: // Ice-Strike bAddNewEffect(41, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32, NULL, NULL, 0); for (x = 0; x < 14; x++) { bAddNewEffect(41 + (rand() % 3), m_pEffectList[i]->m_dX*32 +(rand() % 100) - 50 +10, m_pEffectList[i]->m_dY*32 + (rand() % 90) - 45, NULL, NULL, -1*x-1); } for (x = 0; x < 6; x++) { bAddNewEffect(45 + (rand() % 2), m_pEffectList[i]->m_dX*32 +(rand() % 100) - 50 +10, m_pEffectList[i]->m_dY*32 + (rand() % 90) - 45, NULL, NULL, -1*x-1 -10); } delete m_pEffectList[i]; m_pEffectList[i] = NULL; break; case 160: // Energy-Strike if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else { bAddNewEffect(16, m_pEffectList[i]->m_sX, m_pEffectList[i]->m_sY, m_pEffectList[i]->m_dX*32 + 50 - (rand() % 100), m_pEffectList[i]->m_dY*32 + 50 - (rand() % 100), 0); sAbsX = abs(((m_sViewPointX / 32) + 10) - m_pEffectList[i]->m_dX); sAbsY = abs(((m_sViewPointY / 32) + 7) - m_pEffectList[i]->m_dY); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; lPan = -(((m_sViewPointX / 32) + 10) - m_pEffectList[i]->m_dX); PlaySound('E', 1, sDist, lPan); } break; case 161: // Mass-Fire-Strike m_Misc.GetPoint(m_pEffectList[i]->m_mX, m_pEffectList[i]->m_mY, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32/* - 40*/, &m_pEffectList[i]->m_mX, &m_pEffectList[i]->m_mY, &m_pEffectList[i]->m_iErr, 50); if ( (abs(m_pEffectList[i]->m_mX - m_pEffectList[i]->m_dX*32) <= 2) && (abs(m_pEffectList[i]->m_mY - m_pEffectList[i]->m_dY*32) <= 2) ) { bAddNewEffect(30, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32, NULL, NULL, 0); bAddNewEffect(31, m_pEffectList[i]->m_dX*32 -30, m_pEffectList[i]->m_dY*32 -15, NULL, NULL, -7); bAddNewEffect(31, m_pEffectList[i]->m_dX*32 +35, m_pEffectList[i]->m_dY*32 -30, NULL, NULL, -5); bAddNewEffect(31, m_pEffectList[i]->m_dX*32 +20, m_pEffectList[i]->m_dY*32 +30, NULL, NULL, -3); delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 163: // Mass-Chill-Wind Chill-Wind bAddNewEffect(56, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32, NULL, NULL, 0); bAddNewEffect(56, m_pEffectList[i]->m_dX*32 -30, m_pEffectList[i]->m_dY*32 -15, NULL, NULL, -10); bAddNewEffect(56, m_pEffectList[i]->m_dX*32 +35, m_pEffectList[i]->m_dY*32 -30, NULL, NULL, -6); bAddNewEffect(56, m_pEffectList[i]->m_dX*32 +20, m_pEffectList[i]->m_dY*32 +30, NULL, NULL, -3); bAddNewEffect(56, m_pEffectList[i]->m_dX*32 +(rand()%100)-50, m_pEffectList[i]->m_dY*32 +(rand()%70)-35, NULL, NULL, -1*(rand()%10)); bAddNewEffect(56, m_pEffectList[i]->m_dX*32 +(rand()%100)-50, m_pEffectList[i]->m_dY*32 +(rand()%70)-35, NULL, NULL, -1*(rand()%10)); bAddNewEffect(56, m_pEffectList[i]->m_dX*32 +(rand()%100)-50, m_pEffectList[i]->m_dY*32 +(rand()%70)-35, NULL, NULL, -1*(rand()%10)); bAddNewEffect(56, m_pEffectList[i]->m_dX*32 +(rand()%100)-50, m_pEffectList[i]->m_dY*32 +(rand()%70)-35, NULL, NULL, -1*(rand()%10)); delete m_pEffectList[i]; m_pEffectList[i] = NULL; break; case 164: // worm-bite if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { bAddNewEffect(68, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32, NULL, NULL, 0); // testcode 0111 18 delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 170: // Bloody-Shock-Wave if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else if ((m_pEffectList[i]->m_cFrame % 2) == 0) { bAddNewEffect(34, m_pEffectList[i]->m_sX, m_pEffectList[i]->m_sY, m_pEffectList[i]->m_dX*32 + 30 - (rand() % 60), m_pEffectList[i]->m_dY*32 + 30 - (rand() % 60), 0); sAbsX = abs(((m_sViewPointX / 32) + 10) - m_pEffectList[i]->m_dX); sAbsY = abs(((m_sViewPointY / 32) + 7) - m_pEffectList[i]->m_dY); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; lPan = -(((m_sViewPointX / 32) + 10) - m_pEffectList[i]->m_dX); PlaySound('E', 1, sDist, lPan); } break; case 172: // Mass-Ice-Strike bAddNewEffect(44, m_pEffectList[i]->m_dX*32, m_pEffectList[i]->m_dY*32, NULL, NULL, 0); bAddNewEffect(44, m_pEffectList[i]->m_dX*32 +(rand() % 110) - 55 +10, m_pEffectList[i]->m_dY*32 + (rand() % 100) - 50, NULL, NULL, -1*(rand() % 3)); bAddNewEffect(44, m_pEffectList[i]->m_dX*32 +(rand() % 110) - 55 +10, m_pEffectList[i]->m_dY*32 + (rand() % 100) - 50, NULL, NULL, -1*(rand() % 3)); bAddNewEffect(44, m_pEffectList[i]->m_dX*32 +(rand() % 110) - 55 +10, m_pEffectList[i]->m_dY*32 + (rand() % 100) - 50, NULL, NULL, -1*(rand() % 3)); bAddNewEffect(44, m_pEffectList[i]->m_dX*32 +(rand() % 110) - 55 +10, m_pEffectList[i]->m_dY*32 + (rand() % 100) - 50, NULL, NULL, -1*(rand() % 3)); bAddNewEffect(44, m_pEffectList[i]->m_dX*32 +(rand() % 110) - 55 +10, m_pEffectList[i]->m_dY*32 + (rand() % 100) - 50, NULL, NULL, -1*(rand() % 3)); bAddNewEffect(44, m_pEffectList[i]->m_dX*32 +(rand() % 110) - 55 +10, m_pEffectList[i]->m_dY*32 + (rand() % 100) - 50, NULL, NULL, -1*(rand() % 3)); bAddNewEffect(44, m_pEffectList[i]->m_dX*32 +(rand() % 110) - 55 +10, m_pEffectList[i]->m_dY*32 + (rand() % 100) - 50, NULL, NULL, -1*(rand() % 3)); bAddNewEffect(44, m_pEffectList[i]->m_dX*32 +(rand() % 110) - 55 +10, m_pEffectList[i]->m_dY*32 + (rand() % 100) - 50, NULL, NULL, -1*(rand() % 3)); for (x = 0; x < 16; x++) { bAddNewEffect(44, m_pEffectList[i]->m_dX*32 +(rand() % 110) - 55 +10, m_pEffectList[i]->m_dY*32 + (rand() % 100) - 50, NULL, NULL, -1*x-1); } for (x = 0; x < 8; x++) { bAddNewEffect(45 + (rand() % 2), m_pEffectList[i]->m_dX*32 +(rand() % 100) - 50 +10, m_pEffectList[i]->m_dY*32 + (rand() % 90) - 45, NULL, NULL, -1*x-1 -10); } delete m_pEffectList[i]; m_pEffectList[i] = NULL; break; case 174: // Lightning-Strike if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else { bAddNewEffect(151, m_pEffectList[i]->m_sX, m_pEffectList[i]->m_sY, m_pEffectList[i]->m_dX +(rand()%3) -1, m_pEffectList[i]->m_dY +(rand()%3) -1, 0); sAbsX = abs(((m_sViewPointX / 32) + 10) - m_pEffectList[i]->m_dX); sAbsY = abs(((m_sViewPointY / 32) + 7) - m_pEffectList[i]->m_dY); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; lPan = -(((m_sViewPointX / 32) + 10) - m_pEffectList[i]->m_dX); PlaySound('E', 1, sDist, lPan); } break; case 182: // Mass-Magic-Missile m_Misc.GetPoint(m_pEffectList[i]->m_mX , m_pEffectList[i]->m_mY , m_pEffectList[i]->m_dX*32 , m_pEffectList[i]->m_dY*32 , &m_pEffectList[i]->m_mX , &m_pEffectList[i]->m_mY , &m_pEffectList[i]->m_iErr , 50); bAddNewEffect(8, m_pEffectList[i]->m_mX + (rand() % 20) - 10, m_pEffectList[i]->m_mY + (rand() % 20) - 10, NULL, NULL, -1*(rand() % 4)); if ( (abs(m_pEffectList[i]->m_mX - m_pEffectList[i]->m_dX*32) <= 2) && (abs(m_pEffectList[i]->m_mY - m_pEffectList[i]->m_dY*32) <= 2) ) { // JLE 0043132A delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else { bAddNewEffect(35, m_pEffectList[i]->m_dX*32 +22, m_pEffectList[i]->m_dY*32 -15, NULL, NULL, -7, 1); bAddNewEffect(36, m_pEffectList[i]->m_dX*32 -22, m_pEffectList[i]->m_dY*32 -7, NULL, NULL, -7, 1); bAddNewEffect(36, m_pEffectList[i]->m_dX*32 +30, m_pEffectList[i]->m_dY*32 -22, NULL, NULL, -5, 1); bAddNewEffect(36, m_pEffectList[i]->m_dX*32 +12, m_pEffectList[i]->m_dY*32 +22, NULL, NULL, -3, 1); } break; case 191: // Blizzard if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else /*if (m_pEffectList[i]->m_cFrame == 1)*/ { bAddNewEffect(71, m_pEffectList[i]->m_sX, m_pEffectList[i]->m_sY, m_pEffectList[i]->m_dX*32 +(rand()%120)-60, m_pEffectList[i]->m_dY*32 +(rand()%120)-60, 0); sAbsX = abs(((m_sViewPointX / 32) + 10) - m_pEffectList[i]->m_dX); sAbsY = abs(((m_sViewPointY / 32) + 7) - m_pEffectList[i]->m_dY); if (sAbsX > sAbsY) sDist = sAbsX; else sDist = sAbsY; lPan = -(((m_sViewPointX / 32) + 10) - m_pEffectList[i]->m_dX); PlaySound('E', 1, sDist, lPan); } break; case 196: // Earth-Shock-Wave m_Misc.GetPoint(m_pEffectList[i]->m_mX , m_pEffectList[i]->m_mY , m_pEffectList[i]->m_dX*32 , m_pEffectList[i]->m_dY*32 , &m_pEffectList[i]->m_mX , &m_pEffectList[i]->m_mY , &m_pEffectList[i]->m_iErr , 40); bAddNewEffect(80, m_pEffectList[i]->m_mX + (rand() % 30) - 15, m_pEffectList[i]->m_mY + (rand() % 30) - 15, NULL, NULL, 0, 1); bAddNewEffect(80, m_pEffectList[i]->m_mX + (rand() % 20) - 10, m_pEffectList[i]->m_mY + (rand() % 20) - 10, NULL, NULL, 0, 0); if (m_pEffectList[i]->m_cFrame >= m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else { sAbsX = abs(((m_sViewPointX / 32) + 10) - m_pEffectList[i]->m_dX); sAbsY = abs(((m_sViewPointY / 32) + 7) - m_pEffectList[i]->m_dY); if (sAbsX > sAbsY) sDist = sAbsX -10; else sDist = sAbsY -10; lPan = -(((m_sViewPointX / 32) + 10) - m_pEffectList[i]->m_dX); PlaySound('E', 1, sDist, lPan); } break; case 200: if (m_pEffectList[i]->m_cFrame >= m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else { bAddNewEffect(203, m_pEffectList[i]->m_sX + 40, m_pEffectList[i]->m_sY + 120, NULL, NULL, 0, 0); bAddNewEffect(204, m_pEffectList[i]->m_sX -10, m_pEffectList[i]->m_sY +70, NULL, NULL, 0, 0); bAddNewEffect(205, m_pEffectList[i]->m_sX -10, m_pEffectList[i]->m_sY +75, NULL, NULL, 0, 0); bAddNewEffect(206, m_pEffectList[i]->m_sX -7, m_pEffectList[i]->m_sY +27, NULL, NULL, 0, 0); bAddNewEffect(201, (rand() % 160) + 320, (rand() % 120) + 240, NULL, NULL, 0, 1); bAddNewEffect(202, (rand() % 160) + 320, (rand() % 120) + 240, NULL, NULL, 0, 1); delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 201: if (m_pEffectList[i]->m_cFrame >= m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else { bAddNewEffect(203, m_pEffectList[i]->m_sX + 110, m_pEffectList[i]->m_sY + 120, NULL, NULL, 0, 0); bAddNewEffect(204, m_pEffectList[i]->m_sX -10, m_pEffectList[i]->m_sY +70, NULL, NULL, 0, 0); bAddNewEffect(205, m_pEffectList[i]->m_sX -10, m_pEffectList[i]->m_sY +75, NULL, NULL, 0, 0); bAddNewEffect(202, (rand() % 160) + 320, (rand() % 120) + 240, NULL, NULL, 0, 1); delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 202: if (m_pEffectList[i]->m_cFrame >= m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else { bAddNewEffect(203, m_pEffectList[i]->m_sX + 65, m_pEffectList[i]->m_sY + 120, NULL, NULL, 0, 0); bAddNewEffect(204, m_pEffectList[i]->m_sX -10, m_pEffectList[i]->m_sY +70, NULL, NULL, 0, 0); bAddNewEffect(205, m_pEffectList[i]->m_sX -10, m_pEffectList[i]->m_sY +75, NULL, NULL, 0, 0); bAddNewEffect(206, m_pEffectList[i]->m_sX -7, m_pEffectList[i]->m_sY +27, NULL, NULL, 0, 0); delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 250: // Gate round m_Misc.GetPoint(m_pEffectList[i]->m_mX , m_pEffectList[i]->m_mY , m_pEffectList[i]->m_dX*32 , m_pEffectList[i]->m_dY*32 -40 , &m_pEffectList[i]->m_mX , &m_pEffectList[i]->m_mY , &m_pEffectList[i]->m_iErr , 10); if ( (abs(m_pEffectList[i]->m_mX - m_pEffectList[i]->m_dX*32) <= 2) && (abs(m_pEffectList[i]->m_mY - (m_pEffectList[i]->m_dY*32 - 40)) <= 2) ) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 251: // Salmon burst (effect11s) m_Misc.GetPoint(m_pEffectList[i]->m_mX , m_pEffectList[i]->m_mY , m_pEffectList[i]->m_dX*32 , m_pEffectList[i]->m_dY*32 , &m_pEffectList[i]->m_mX , &m_pEffectList[i]->m_mY , &m_pEffectList[i]->m_iErr , 50); if ( (abs(m_pEffectList[i]->m_mX - m_pEffectList[i]->m_dX*32) <= 2) && (abs(m_pEffectList[i]->m_mY - (m_pEffectList[i]->m_dY*32 - 40)) <= 2) ) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; }else { bAddNewEffect(252, m_pEffectList[i]->m_dX*32 , m_pEffectList[i]->m_dY*32 , 0, 0, 0, 1); bAddNewEffect(252, m_pEffectList[i]->m_dX*32 - 30, m_pEffectList[i]->m_dY*32 - 15, 0, 0, -7, 1); bAddNewEffect(252, m_pEffectList[i]->m_dX*32 - 35, m_pEffectList[i]->m_dY*32 - 30, 0, 0, -5, 1); bAddNewEffect(252, m_pEffectList[i]->m_dX*32 + 20, m_pEffectList[i]->m_dY*32 + 30, 0, 0, -3, 1); delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; case 8: case 14: case 15: case 18: case 32: case 35: // case 36: // case 50: case 51: case 52: case 53: case 54: case 55: case 57: case 61: case 63: case 64: case 67: case 72: case 73: case 74: case 75: case 76: case 77: case 80: // case 82: // case 101: case 102: case 111: case 112: case 113: case 121: case 122: case 123: // Stamina Rec case 124: case 125: case 126: case 127: case 128: // Gr Stamina Rec case 131: case 132: case 133: case 134: case 135: case 136: case 142: case 144: case 150: // Berserk : Cirlcle 6 magic case 152: // Polymorph case 153: case 162: case 165: case 166: case 171: case 176: // case 177: // case 180: case 183: // case 184: // EP's Magic Drain case 190: case 192: case 193: case 194: case 195: case 242: // Mage hero effect case 243: // War hero effect case 244: // Snoopy: déplacé pour nvx sorts: Aura du casteur de Mass MagicMissile if (m_pEffectList[i]->m_cFrame > m_pEffectList[i]->m_cMaxFrame) { delete m_pEffectList[i]; m_pEffectList[i] = NULL; } break; } } } return bRet; } BOOL CGame::DrawObject_OnRun(int indexX, int indexY, int sX, int sY, BOOL bTrans, DWORD dwTime, int msX, int msY) {int dx, dy; int iBodyIndex, iHairIndex, iUndiesIndex, iArmArmorIndex, iBodyArmorIndex, iPantsIndex, iBootsIndex, iWeaponIndex, iShieldIndex, iHelmIndex, iR, iG, iB, iMantleIndex; BOOL bInv = FALSE; int iWeaponGlare, iShieldGlare; int iWeaponColor, iShieldColor, iArmorColor, iMantleColor, iArmColor, iPantsColor, iBootsColor, iHelmColor; int iSkirtDraw = 0; if(_tmp_sOwnerType == 35 || _tmp_sOwnerType == 73 || _tmp_sOwnerType == 66) bInv = TRUE; //Energy-Ball,Wyvern if (m_cDetailLevel == 0) { iWeaponColor = 0; iShieldColor = 0; iArmorColor = 0; iMantleColor = 0; iArmColor = 0; iPantsColor = 0; iBootsColor = 0; iHelmColor = 0; }else { iWeaponColor = (_tmp_iApprColor & 0xF0000000) >> 28; iShieldColor = (_tmp_iApprColor & 0x0F000000) >> 24; iArmorColor = (_tmp_iApprColor & 0x00F00000) >> 20; iMantleColor = (_tmp_iApprColor & 0x000F0000) >> 16; iArmColor = (_tmp_iApprColor & 0x0000F000) >> 12; iPantsColor = (_tmp_iApprColor & 0x00000F00) >> 8; iBootsColor = (_tmp_iApprColor & 0x000000F0) >> 4; iHelmColor = (_tmp_iApprColor & 0x0000000F); } iWeaponGlare = (_tmp_sAppr4 & 0x000C) >> 2; iShieldGlare = (_tmp_sAppr4 & 0x0003); if ( (_tmp_iStatus & 0x10) != 0) { if (memcmp(m_cPlayerName, _tmp_cName, 10) == 0) bInv = TRUE; else if( _iGetFOE(_tmp_iStatus) == 1 ) bInv = TRUE; else return FALSE; } switch (_tmp_sOwnerType) { case 1: case 2: case 3: iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (4 * 8); iUndiesIndex = SPRID_UNDIES_M + (_tmp_sAppr1 & 0x000F)*15 + 4; iHairIndex = SPRID_HAIR_M + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 4; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_M + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 4; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_M + (_tmp_sAppr3 & 0x000F)*15 + 4; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_M + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 4; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_M + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 4; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else { iWeaponIndex = SPRID_WEAPON_M + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*6 + (_tmp_cDir - 1); } if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_M + (_tmp_sAppr2 & 0x000F)*8 + 6; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_M + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 4; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_M + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 4; break; case 4: case 5: case 6: if (((_tmp_sAppr3 & 0x0F00) >> 8) == 1) iSkirtDraw = 1; iBodyIndex = 500 + (_tmp_sOwnerType - 1 )*8*15 + (4 * 8); iUndiesIndex = SPRID_UNDIES_W + (_tmp_sAppr1 & 0x000F)*15 + 4; iHairIndex = SPRID_HAIR_W + ((_tmp_sAppr1 & 0x0F00) >> 8)*15 + 4; if ((_tmp_sAppr4 & 0x80) == 0) { if (((_tmp_sAppr3 & 0xF000) >> 12) == 0) iBodyArmorIndex = -1; else iBodyArmorIndex = SPRID_BODYARMOR_W + ((_tmp_sAppr3 & 0xF000) >> 12)*15 + 4; } if ((_tmp_sAppr3 & 0x000F) == 0) iArmArmorIndex = -1; else iArmArmorIndex = SPRID_BERK_W + (_tmp_sAppr3 & 0x000F)*15 + 4; if ((_tmp_sAppr3 & 0x0F00) == 0) iPantsIndex = -1; else iPantsIndex = SPRID_LEGG_W + ((_tmp_sAppr3 & 0x0F00) >> 8)*15 + 4; if (((_tmp_sAppr4 & 0xF000) >> 12) == 0) iBootsIndex = -1; else iBootsIndex = SPRID_BOOT_W + ((_tmp_sAppr4 & 0xF000) >> 12)*15 + 4; if (((_tmp_sAppr2 & 0x0FF0) >> 4) == 0) iWeaponIndex = -1; else { iWeaponIndex = SPRID_WEAPON_W + ((_tmp_sAppr2 & 0x0FF0) >> 4)*64 + 8*6 + (_tmp_cDir - 1); } if ((_tmp_sAppr2 & 0x000F) == 0) iShieldIndex = -1; else iShieldIndex = SPRID_SHIELD_W + (_tmp_sAppr2 & 0x000F)*8 + 6; if ((_tmp_sAppr4 & 0x0F00) == 0) iMantleIndex = -1; else iMantleIndex = SPRID_MANTLE_W + ((_tmp_sAppr4 & 0x0F00) >> 8)*15 + 4; if ((_tmp_sAppr3 & 0x00F0) == 0) iHelmIndex = -1; else iHelmIndex = SPRID_HEAD_W + ((_tmp_sAppr3 & 0x00F0) >> 4)*15 + 4; break; default: iUndiesIndex = -1; iHairIndex = -1; iArmArmorIndex = -1; iBodyArmorIndex = -1; iPantsIndex = -1; iBootsIndex = -1; iMantleIndex = -1; iHelmIndex = -1; break; } dx = 0; dy = 0; switch (_tmp_cDir) { case 1 : dy = 28 - (_tmp_cFrame<<2); break; case 2 : dy = 28 - (_tmp_cFrame<<2); dx = (_tmp_cFrame<<2) - 28; break; case 3 : dx = (_tmp_cFrame<<2) - 28; break; case 4 : dx = (_tmp_cFrame<<2) - 28; dy = (_tmp_cFrame<<2) - 28; break; case 5 : dy = (_tmp_cFrame<<2) - 28; break; case 6 : dy = (_tmp_cFrame<<2) - 28; dx = 28 - (_tmp_cFrame<<2); break; case 7 : dx = 28 - (_tmp_cFrame<<2); break; case 8 : dx = 28 - (_tmp_cFrame<<2); dy = 28 - (_tmp_cFrame<<2); break; } if(m_pSprite[iBodyIndex + (_tmp_cDir - 1)] == NULL) return false; if (m_bIsCrusadeMode || (m_bIsAstoriaMode && memcmp(m_cCurLocation, "astoria", 7) == 0)) DrawObjectFOE(sX+dx, sY+dy, _tmp_cFrame); if (_tmp_iEffectType != 0) { switch (_tmp_iEffectType) { case 1: m_pEffectSpr[26]->PutTransSprite(sX+dx, sY+dy, _tmp_iEffectFrame, dwTime); break; // Special Ability: Attack Effect case 2: m_pEffectSpr[27]->PutTransSprite(sX+dx, sY+dy, _tmp_iEffectFrame, dwTime); break; // Special Ability: Protect Effect } } if (bTrans == FALSE) { switch (_tmp_sOwnerType) { // Pas d'ombre pour ces mobs case 10: // Slime case 35: // Energy Sphere case 50: // TW case 51: // CP case 60: // Plant case 65: // IceGolem case 66: // Wyvern case 73: // Fire Wyvern case 81: // Abaddon case 91: // Gate break; default: if (m_cDetailLevel != 0) { if (sX < 50) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSpriteClip(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutShadowSprite(sX+dx, sY+dy, _tmp_cFrame, dwTime); } break; } CheckActiveAura(sX+dx, sY+dy, dwTime, _tmp_sOwnerType); if (_cDrawingOrder[_tmp_cDir] == 1) { if (iWeaponIndex != -1) { if(bInv) m_pSprite[iWeaponIndex]->PutTransSprite25(sX+dx, sY+dy, _tmp_cFrame, dwTime); else { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); } DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if (bInv == TRUE) //m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite2(sX+dx, sY+dy, _tmp_cFrame, dwTime); m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite(sX+dx, sY+dy, _tmp_cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrderOnRun[_tmp_cDir] == 0)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iUndiesIndex != -1) { if(bInv) m_pSprite[iUndiesIndex]->PutTransSprite2(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iUndiesIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); } if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if(bInv) m_pSprite[iBootsIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } } if (iPantsIndex != -1) { if(bInv) m_pSprite[iPantsIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } } if (iArmArmorIndex != -1) { if(bInv) m_pSprite[iArmArmorIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if(bInv) m_pSprite[iBootsIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } } if (iBodyArmorIndex != -1) { if(bInv) m_pSprite[iBodyArmorIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } } if (iHelmIndex != -1) { if(bInv) m_pSprite[iHelmIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } } if ((iMantleIndex != -1) && (_cMantleDrawingOrderOnRun[_tmp_cDir] == 2)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iShieldIndex != -1) { if(bInv) m_pSprite[iShieldIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); } switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13+dx, sY -34+dy, 0, dwTime); // GM effect case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrderOnRun[_tmp_cDir] == 1)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } }else { if (bInv == TRUE) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutTransSprite2(sX+dx, sY+dy, _tmp_cFrame, dwTime); else { if ((_tmp_iStatus & STATUS_FROZEN) != 0) m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_wR[10] -m_wR[0]/2, m_wG[10] -m_wG[0]/2, m_wB[10] -m_wB[0]/2, dwTime); else m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); } SetRect(&m_rcBodyRect, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.left, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.top, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.right, m_pSprite[iBodyIndex + (_tmp_cDir - 1)]->m_rcBound.bottom); if ((iMantleIndex != -1) && (_cMantleDrawingOrderOnRun[_tmp_cDir] == 0)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iUndiesIndex != -1) { if(bInv) m_pSprite[iUndiesIndex]->PutTransSprite2(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); m_pSprite[iUndiesIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); } if ((iHairIndex != -1) && (iHelmIndex == -1)) { _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[iHairIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, iR, iG, iB, dwTime); } if ((iBootsIndex != -1) && (iSkirtDraw == 1)) { if(bInv) m_pSprite[iBootsIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } } if (iPantsIndex != -1) { if(bInv) m_pSprite[iPantsIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iPantsColor == 0) m_pSprite[iPantsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iPantsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iPantsColor] -m_wR[0], m_wG[iPantsColor] -m_wG[0], m_wB[iPantsColor] -m_wB[0], dwTime); } } if (iArmArmorIndex != -1) { if(bInv) m_pSprite[iArmArmorIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iArmColor == 0) m_pSprite[iArmArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iArmArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmColor] -m_wR[0], m_wG[iArmColor] -m_wG[0], m_wB[iArmColor] -m_wB[0], dwTime); } } if ((iBootsIndex != -1) && (iSkirtDraw == 0)) { if(bInv) m_pSprite[iBootsIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iBootsColor == 0) m_pSprite[iBootsIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBootsIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iBootsColor] -m_wR[0], m_wG[iBootsColor] -m_wG[0], m_wB[iBootsColor] -m_wB[0], dwTime); } } if (iBodyArmorIndex != -1) { if(bInv) m_pSprite[iBodyArmorIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iArmorColor == 0) m_pSprite[iBodyArmorIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iBodyArmorIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iArmorColor] -m_wR[0], m_wG[iArmorColor] -m_wG[0], m_wB[iArmorColor] -m_wB[0], dwTime); } } if (iHelmIndex != -1) { if(bInv) m_pSprite[iHelmIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iHelmColor == 0) m_pSprite[iHelmIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iHelmIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iHelmColor] -m_wR[0], m_wG[iHelmColor] -m_wG[0], m_wB[iHelmColor] -m_wB[0], dwTime); } } if ((iMantleIndex != -1) && (_cMantleDrawingOrderOnRun[_tmp_cDir] == 2)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iShieldIndex != -1) { if(bInv) m_pSprite[iShieldIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iShieldColor == 0) m_pSprite[iShieldIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iShieldIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iShieldColor] -m_wR[0], m_wG[iShieldColor] -m_wG[0], m_wB[iShieldColor] -m_wB[0], dwTime); } switch (iShieldGlare) { case 0: break; //case 1: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX, sY, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 1: m_pEffectSpr[45]->PutTransSprite(sX -13+dx, sY -34+dy, 0, dwTime); case 2: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iShieldIndex]->PutTransSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } if ((iMantleIndex != -1) && (_cMantleDrawingOrderOnRun[_tmp_cDir] == 1)) { if(bInv) m_pSprite[iMantleIndex]->PutTransSprite25(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else { if (iMantleColor == 0) m_pSprite[iMantleIndex]->PutSpriteFast(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, dwTime); else m_pSprite[iMantleIndex]->PutSpriteRGB(sX+dx, sY+dy, (_tmp_cDir-1) * 8 + _tmp_cFrame, m_wR[iMantleColor] -m_wR[0], m_wG[iMantleColor] -m_wG[0], m_wB[iMantleColor] -m_wB[0], dwTime); } } if (iWeaponIndex != -1) { if(bInv) m_pSprite[iWeaponIndex]->PutTransSprite25(sX+dx, sY+dy, _tmp_cFrame, dwTime); else { if (iWeaponColor == 0) m_pSprite[iWeaponIndex]->PutSpriteFast(sX+dx, sY+dy, _tmp_cFrame, dwTime); else m_pSprite[iWeaponIndex]->PutSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_wWR[iWeaponColor] -m_wR[0], m_wWG[iWeaponColor] -m_wG[0], m_wWB[iWeaponColor] -m_wB[0], dwTime); } DKGlare(iWeaponColor, iWeaponIndex, &iWeaponGlare); switch (iWeaponGlare) { case 0: break; case 1: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, m_iDrawFlag, 0, 0, dwTime); break; // Red Glare case 2: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, m_iDrawFlag, 0, dwTime); break; // Green Glare case 3: m_pSprite[iWeaponIndex]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, 0, m_iDrawFlag, dwTime); break; // Blue Glare } } } if((_tmp_iStatus & 0x0F00) >> 8 == 9) // Highly trained m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX+dx, sY+dx, _tmp_cFrame, 6, -2, 6, dwTime); if ((_tmp_iStatus & 0x20) != 0) // Berserk m_pSprite[iBodyIndex + (_tmp_cDir -1)]->PutTransSpriteRGB(sX+dx, sY+dy, _tmp_cFrame, 0, -5, -5, dwTime); DrawAngel(40+(_tmp_cDir - 1), sX+dx+20, sY+dy-20, _tmp_cFrame%4, dwTime); CheckActiveAura2(sX+dx, sY+dy, dwTime, _tmp_sOwnerType); }else if( strlen(_tmp_cName) > 0 ) { if( (_tmp_sOwnerType>=1) && (_tmp_sOwnerType<=6) ) DrawObjectName(sX+dx, sY+dy, _tmp_cName, _tmp_iStatus); else DrawNpcName(sX+dx, sY+dy, _tmp_sOwnerType, _tmp_iStatus); } if (_tmp_iChatIndex != NULL) { if ((m_pChatMsgList[_tmp_iChatIndex] != NULL) && (m_pChatMsgList[_tmp_iChatIndex]->m_iObjectID == _tmp_wObjectID)) { m_pChatMsgList[_tmp_iChatIndex]->m_sX = sX+dx; m_pChatMsgList[_tmp_iChatIndex]->m_sY = sY+dy; }else { m_pMapData->ClearChatMsg(indexX, indexY); } } _tmp_dx = dx; _tmp_dy = dy; if ( (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top != -1) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.top < msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.bottom > msY) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.left < msX) && (m_pSprite[iBodyIndex + (_tmp_cDir -1)]->m_rcBound.right > msX)) return TRUE; return FALSE; } void CGame::GetPlayerTurn() { char cDir; short sX, sY, sCnt1, sCnt2; int iError; sX = m_sPlayerX; sY = m_sPlayerY; sCnt1 = 0; m_cPlayerTurn = 0; iError = 0; while (1) { cDir = cGetNextMoveDir(sX, sY, m_sCommX, m_sCommY); if (cDir == 0) break; switch (cDir) { case 1: sY--; break; case 2: sX++; sY--; break; case 3: sX++; break; case 4: sX++; sY++; break; case 5: sY++; break; case 6: sX--; sY++; break; case 7: sX--; break; case 8: sX--; sY--; break; } sCnt1++; if (sCnt1 > 30) break; } sX = m_sPlayerX; sY = m_sPlayerY; sCnt2 = 0; m_cPlayerTurn = 1; iError = 0; while (1) { cDir = cGetNextMoveDir(sX, sY, m_sCommX, m_sCommY); if (cDir == 0) break; switch (cDir) { case 1: sY--; break; case 2: sX++; sY--; break; case 3: sX++; break; case 4: sX++; sY++; break; case 5: sY++; break; case 6: sX--; sY++; break; case 7: sX--; break; case 8: sX--; sY--; break; } sCnt2++; if (sCnt2 > 30) break; } if (sCnt1 > sCnt2) m_cPlayerTurn = 0; else m_cPlayerTurn = 1; } int CGame::_iCheckDlgBoxFocus(short msX, short msY, char cButtonSide) {int i; char cDlgID; short sX, sY; DWORD dwTime = m_dwCurTime; if (cButtonSide == 1) { // Snoopy: 41->61 for (i = 0; i < 61; i++) // Snoopy: 40->60 if (m_cDialogBoxOrder[60 - i] != NULL) // Snoopy: 40->60 { cDlgID = m_cDialogBoxOrder[60 - i]; if ((m_stDialogBoxInfo[cDlgID].sX <= msX) && ((m_stDialogBoxInfo[cDlgID].sX + m_stDialogBoxInfo[cDlgID].sSizeX) >= msX) && (m_stDialogBoxInfo[cDlgID].sY <= msY) && ((m_stDialogBoxInfo[cDlgID].sY + m_stDialogBoxInfo[cDlgID].sSizeY) >= msY) ) { EnableDialogBox(cDlgID, NULL, NULL, NULL); m_stMCursor.sPrevX = msX; m_stMCursor.sPrevY = msY; m_stMCursor.sDistX = msX - m_stDialogBoxInfo[cDlgID].sX; m_stMCursor.sDistY = msY - m_stDialogBoxInfo[cDlgID].sY; switch (cDlgID) { case 1: if (bDlgBoxPress_Character(msX, msY) == FALSE) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_DLGBOX; m_stMCursor.sSelectedObjectID = cDlgID; } break; case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 12: case 16: case 17: case 20: case 22: case 23: case 24: case 25: case 28: case 29: case 30: case 31: case 33: case 34: case 35: case 36: case 37: case 38: case 40: case 50: // resur // NPC case 67: case 68: case 69: m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_DLGBOX; m_stMCursor.sSelectedObjectID = cDlgID; break; case 13: sX = m_stDialogBoxInfo[cDlgID].sX; sY = m_stDialogBoxInfo[cDlgID].sY; if ((m_stDialogBoxInfo[cDlgID].cMode == 9) && (msX >= sX + 240) && (msX <= sX + 260) && (msY >= sY + 20) && (msY <= sY + 330)) { m_stDialogBoxInfo[cDlgID].bIsScrollSelected = TRUE; return -1; } if(!m_stDialogBoxInfo[cDlgID].bIsScrollSelected) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_DLGBOX; m_stMCursor.sSelectedObjectID = cDlgID; } else return -1; break; case 14: case 15: case 18: case 19: case 21: case 32: sX = m_stDialogBoxInfo[cDlgID].sX; sY = m_stDialogBoxInfo[cDlgID].sY; if ((msX >= sX + 240) && (msX <= sX + 260) && (msY >= sY + 40) && (msY <= sY + 320)) { m_stDialogBoxInfo[cDlgID].bIsScrollSelected = TRUE; return -1; } if (m_stDialogBoxInfo[cDlgID].bIsScrollSelected == FALSE) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_DLGBOX; m_stMCursor.sSelectedObjectID = cDlgID; } else return -1; break; case 52: // split shop m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_DLGBOX; m_stMCursor.sSelectedObjectID = cDlgID; break; case 53: m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_DLGBOX; m_stMCursor.sSelectedObjectID = cDlgID; break; case 2: // (Sell Item) if (bDlgBoxPress_Inventory(msX, msY) == FALSE) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_DLGBOX; m_stMCursor.sSelectedObjectID = cDlgID; } break; case 10: sX = m_stDialogBoxInfo[10].sX; sY = m_stDialogBoxInfo[10].sY; if ((msX >= sX + 340) && (msX <= sX + 360) && (msY >= sY + 22) && (msY <= sY + 138)) { m_stDialogBoxInfo[10].bIsScrollSelected = TRUE; return -1; } if (m_stDialogBoxInfo[10].bIsScrollSelected == FALSE) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_DLGBOX; m_stMCursor.sSelectedObjectID = cDlgID; } else return -1; break; case 11: sX = m_stDialogBoxInfo[11].sX; sY = m_stDialogBoxInfo[11].sY; if ((m_stDialogBoxInfo[11].cMode == 0) && (msX >= sX + 240) && (msX <= sX + 260) && (msY >= sY + 20) && (msY <= sY + 330)) { m_stDialogBoxInfo[11].bIsScrollSelected = TRUE; return -1; } if (m_stDialogBoxInfo[11].bIsScrollSelected == FALSE) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_DLGBOX; m_stMCursor.sSelectedObjectID = cDlgID; } else return -1; break; case 26: if (bDlgBoxPress_SkillDlg(msX, msY) == FALSE) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_DLGBOX; m_stMCursor.sSelectedObjectID = cDlgID; } break; case 27: case 41: //Snoopy: Drag exchange confirmation dialog case 42: // Snoopy: Drag majestic stats case 43: case 51: // Snoopy: Drag Gail menu m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_DLGBOX; m_stMCursor.sSelectedObjectID = cDlgID; break; } return 1; } } return 0; }else if (cButtonSide == 2) { if ((dwTime - m_dwDialogCloseTime) < 300) return 0; // Snoopy: 40->60 for (i = 0; i < 61; i++) // Snoopy: 40->60 if (m_cDialogBoxOrder[60 - i] != NULL) { // Snoopy: 40->60 cDlgID = m_cDialogBoxOrder[60 - i]; if ((m_stDialogBoxInfo[cDlgID].sX < msX) && ((m_stDialogBoxInfo[cDlgID].sX + m_stDialogBoxInfo[cDlgID].sSizeX) > msX) && (m_stDialogBoxInfo[cDlgID].sY < msY) && ((m_stDialogBoxInfo[cDlgID].sY + m_stDialogBoxInfo[cDlgID].sSizeY) > msY) ) { if ((cDlgID != 5) && (cDlgID != 6) && (cDlgID != 8) && (cDlgID != 12) && ((cDlgID != 23) || (m_stDialogBoxInfo[23].cMode < 3)) && (cDlgID != 24) && (cDlgID != 27) && (cDlgID != 34) && (cDlgID != 33) && !((cDlgID == 32) && ((m_stDialogBoxInfo[cDlgID].cMode == 1) || (m_stDialogBoxInfo[cDlgID].cMode == 3)))) DisableDialogBox(cDlgID); m_dwDialogCloseTime = dwTime; return 1; } } } return 0; } void CGame::InitItemList(char * pData) {char cTotalItems; int i, iAngelValue; short * sp; DWORD * dwp; WORD * wp; char * cp; for (i = 0; i < MAXITEMS; i++) m_cItemOrder[i] = -1; for (i = 0; i < MAXITEMEQUIPPOS; i++) m_sItemEquipmentStatus[i] = -1; for (i = 0; i < MAXITEMS; i++) m_bIsItemDisabled[i] = FALSE; cp = (char *)(pData + INDEX2_MSGTYPE + 2); cTotalItems = *cp; cp++; for (i = 0; i < MAXITEMS; i++) if (m_pItemList[i] != NULL) { delete m_pItemList[i]; m_pItemList[i] = NULL; } for (i = 0; i < MAXBANKITEMS; i++) if (m_pBankList[i] != NULL) { delete m_pBankList[i]; m_pBankList[i] = NULL; } for (i = 0; i < cTotalItems; i++) { m_pItemList[i] = new class CItem; memcpy(m_pItemList[i]->m_cName, cp, 20); cp += 20; dwp = (DWORD *)cp; m_pItemList[i]->m_dwCount = *dwp; m_pItemList[i]->m_sX = 40; m_pItemList[i]->m_sY = 30; cp += 4; m_pItemList[i]->m_cItemType = *cp; cp++; m_pItemList[i]->m_cEquipPos = *cp; cp++; if( *cp == 0 ) m_bIsItemEquipped[i] = FALSE; else m_bIsItemEquipped[i] = TRUE; cp++; if (m_bIsItemEquipped[i] == TRUE) { m_sItemEquipmentStatus[m_pItemList[i]->m_cEquipPos] = i; } sp = (short *)cp; m_pItemList[i]->m_sLevelLimit = *sp; cp += 2; m_pItemList[i]->m_cGenderLimit = *cp; cp++; wp =(WORD *)cp; m_pItemList[i]->m_wCurLifeSpan = *wp; cp += 2; wp =(WORD *)cp; m_pItemList[i]->m_wWeight = *wp; cp += 2; sp = (short *)cp; m_pItemList[i]->m_sSprite = *sp; cp += 2; sp = (short *)cp; m_pItemList[i]->m_sSpriteFrame = *sp; cp += 2; m_pItemList[i]->m_cItemColor = *cp; cp++; m_pItemList[i]->m_sItemSpecEffectValue2 = (short)*cp; cp++; dwp = (DWORD *)cp; m_pItemList[i]->m_dwAttribute = *dwp; cp += 4; /* m_pItemList[i]->m_bIsCustomMade = (BOOL)*cp; cp++; */ m_cItemOrder[i] = i; // Snoopy: Add Angelic Stats if ( (m_pItemList[i]->m_cItemType == 1) && (m_bIsItemEquipped[i] == TRUE) && (m_pItemList[i]->m_cEquipPos >= 11)) { if(memcmp(m_pItemList[i]->m_cName, "AngelicPendant(STR)", 19) == 0) { iAngelValue = (m_pItemList[i]->m_dwAttribute & 0xF0000000) >> 28; m_angelStat[STAT_STR] = 1 + iAngelValue; }else if(memcmp(m_pItemList[i]->m_cName, "AngelicPendant(DEX)", 19) == 0) { iAngelValue = (m_pItemList[i]->m_dwAttribute & 0xF0000000) >> 28; m_angelStat[STAT_DEX] = 1 + iAngelValue; }else if(memcmp(m_pItemList[i]->m_cName, "AngelicPendant(INT)", 19) == 0) { iAngelValue = (m_pItemList[i]->m_dwAttribute & 0xF0000000) >> 28; m_angelStat[STAT_INT] = 1 + iAngelValue; }else if(memcmp(m_pItemList[i]->m_cName, "AngelicPendant(MAG)", 19) == 0) { iAngelValue = (m_pItemList[i]->m_dwAttribute & 0xF0000000) >> 28; m_angelStat[STAT_MAG] = 1 + iAngelValue; } } } cTotalItems = *cp; cp++; for (i = 0; i < MAXBANKITEMS; i++) if (m_pBankList[i] != NULL) { delete m_pBankList[i]; m_pBankList[i] = NULL; } for (i = 0; i < cTotalItems; i++) { m_pBankList[i] = new class CItem; memcpy(m_pBankList[i]->m_cName, cp, 20); cp += 20; dwp = (DWORD *)cp; m_pBankList[i]->m_dwCount = *dwp; cp += 4; m_pBankList[i]->m_sX = 40; m_pBankList[i]->m_sY = 30; m_pBankList[i]->m_cItemType = *cp; cp++; m_pBankList[i]->m_cEquipPos = *cp; cp++; sp = (short *)cp; m_pBankList[i]->m_sLevelLimit = *sp; cp += 2; m_pBankList[i]->m_cGenderLimit = *cp; cp++; wp =(WORD *)cp; m_pBankList[i]->m_wCurLifeSpan = *wp; cp += 2; wp =(WORD *)cp; m_pBankList[i]->m_wWeight = *wp; cp += 2; sp = (short *)cp; m_pBankList[i]->m_sSprite = *sp; cp += 2; sp = (short *)cp; m_pBankList[i]->m_sSpriteFrame = *sp; cp += 2; m_pBankList[i]->m_cItemColor = *cp; cp++; m_pBankList[i]->m_sItemSpecEffectValue2 = (short)*cp; cp++; dwp = (DWORD *)cp; m_pBankList[i]->m_dwAttribute = *dwp; cp += 4; /* m_pBankList[i]->m_bIsCustomMade = (BOOL)*cp; cp++; */ } // Magic, Skill Mastery for (i = 0; i < MAXMAGICTYPE; i++) { m_cMagicMastery[i] = *cp; cp++; } for (i = 0; i < MAXSKILLTYPE; i++) { m_cSkillMastery[i] = (unsigned char)*cp; if (m_pSkillCfgList[i] != NULL) m_pSkillCfgList[i]->m_iLevel = (int)*cp; cp++; } } void CGame::DrawDialogBox_GuideMap(short msX, short msY, char cLB) { int m_iMaxMapIndex = SPRID_INTERFACE_GUIDEMAP + m_cMapIndex +1; int m_iMinMapIndex = SPRID_INTERFACE_GUIDEMAP; int m_iMinMapSquare = m_cMapIndex ; int pointX, pointY; //telescope.pak: frames 1..31 <=> SPRID_INTERFACE_GUIDEMAP +1...+31 <=> m_cMapIndex 0..30 //telescope1.pak: frames 1..3 <=> SPRID_INTERFACE_GUIDEMAP +36..+38 <=> m_cMapIndex 35..37 et + if( m_cMapIndex < 0 ) return; if (m_cMapIndex >= 35) { m_iMaxMapIndex = SPRID_INTERFACE_GUIDEMAP + m_cMapIndex +1; m_iMinMapIndex = SPRID_INTERFACE_GUIDEMAP + 35; m_iMinMapSquare = m_cMapIndex - 35; } short sX, sY, shX, shY, szX, szY; sX = m_stDialogBoxInfo[9].sX; sY = m_stDialogBoxInfo[9].sY; szX = m_stDialogBoxInfo[9].sSizeX; szY = m_stDialogBoxInfo[9].sSizeY; if( sX < 20 ) sX = 0; if( sY < 20 ) sY = 0; if( sX > 640-128-20 ) sX = 640-128; if( sY > 427-128-20 ) sY = 427-128; for( shX=-2 ; shX<130 ; shX++ ) { m_DDraw.PutPixel( sX+shX, sY-2 , 50,50,50); m_DDraw.PutPixel( sX+shX, sY-1 , 50,50,50); m_DDraw.PutPixel( sX+shX, sY+128, 50,50,50); m_DDraw.PutPixel( sX+shX, sY+129, 50,50,50); } for( shY=-2 ; shY<130 ; shY++ ) { m_DDraw.PutPixel( sX-2 , sY+shY, 50,50,50); m_DDraw.PutPixel( sX-1 , sY+shY, 50,50,50); m_DDraw.PutPixel( sX+128, sY+shY, 50,50,50); m_DDraw.PutPixel( sX+129, sY+shY, 50,50,50); } if( m_bZoomMap ) { shX = m_sPlayerX-64; shY = m_sPlayerY-64; if( shX < 0 ) shX = 0; if( shY < 0 ) shY = 0; if( shX > m_pMapData->m_sMapSizeX-128 ) shX = m_pMapData->m_sMapSizeX-128; if( shY > m_pMapData->m_sMapSizeY-128 ) shY = m_pMapData->m_sMapSizeY-128; if (m_bDialogTrans) m_pSprite[m_iMaxMapIndex]->PutShiftTransSprite2(sX, sY, shX, shY, 0, m_dwCurTime ); else m_pSprite[m_iMaxMapIndex]->PutShiftSpriteFast(sX, sY, shX, shY, 0, m_dwCurTime ); if (m_iPartyStatus != 0 && m_iIlusionOwnerH == NULL){ for (int i = 0; i < m_stPartyMember.size(); i++) if (m_stPartyMember[i]->sX != 0 && m_stPartyMember[i]->sY != 0) { if( m_stPartyMember[i]->sX >= shX && m_stPartyMember[i]->sX <= shX+128 && m_stPartyMember[i]->sY >= shY && m_stPartyMember[i]->sY <= shY+128 ){ pointX = (sX - shX + m_stPartyMember[i]->sX) -1; pointY = (sY - shY + m_stPartyMember[i]->sY) -1; for(int pX = 0; pX < 3; pX++){ m_DDraw.PutPixel(pointX + pX, pointY, 60,220,60); if(pX==1)m_DDraw.PutPixel(pointX + pX, pointY + 1, 50,170,250); else m_DDraw.PutPixel(pointX + pX, pointY + 1, 60,220,60); m_DDraw.PutPixel(pointX + pX, pointY + 2, 60,220,60); } } } } m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX - shX + m_sPlayerX, sY - shY + m_sPlayerY, 37, m_dwCurTime); if (m_relicX != 0 && m_relicY != 0) { if( m_relicX >= shX && m_relicX <= shX+128 && m_relicY >= shY && m_relicY <= shY+128 ){ pointX = (sX - shX + m_relicX) -1; pointY = (sY - shY + m_relicY) -1; for(int pX = 0; pX < 3; pX++){ m_DDraw.PutPixel(pointX + pX, pointY, 230,60,60); if(pX==1)m_DDraw.PutPixel(pointX + pX, pointY + 1, 50,170,250); else m_DDraw.PutPixel(pointX + pX, pointY + 1, 230,60,60); m_DDraw.PutPixel(pointX + pX, pointY + 2, 230,60,60); } } } if( (m_dwCurTime - m_dwMonsterEventTime) < 30000 ) { if( (m_dwCurTime%500)< 370 ) { if( m_sEventX >= shX && m_sEventX <= shX+128 && m_sEventY >= shY && m_sEventY <= shY+128 ) m_pSprite[SPRID_INTERFACE_MONSTER]->PutSpriteFast(sX + m_sEventX - shX, sY + m_sEventY -shY, m_sMonsterID, m_dwCurTime); } }else { m_dwMonsterEventTime = 0; m_sMonsterID = 0; } }else // Sans zoom { if (m_bDialogTrans) m_pSprite[m_iMinMapIndex]->PutTransSprite2(sX, sY, m_iMinMapSquare, m_dwCurTime); else m_pSprite[m_iMinMapIndex]->PutSpriteFastNoColorKey(sX, sY, m_iMinMapSquare, m_dwCurTime); if (m_iPartyStatus != 0 && m_iIlusionOwnerH == NULL){ for (int i = 0; i < m_stPartyMember.size(); i++) if (m_stPartyMember[i]->sX != 0 && m_stPartyMember[i]->sY != 0) { pointX = sX + ((m_stPartyMember[i]->sX*128)/(m_pMapData->m_sMapSizeX)) -1; pointY = sY + ((m_stPartyMember[i]->sY*128)/(m_pMapData->m_sMapSizeY)) -1; for(int pX = 0; pX < 3; pX++){ m_DDraw.PutPixel(pointX + pX, pointY, 60,215,60); if(pX==1)m_DDraw.PutPixel(pointX + pX, pointY + 1, 50,170,250); else m_DDraw.PutPixel(pointX + pX, pointY + 1, 60,215,60); m_DDraw.PutPixel(pointX + pX, pointY + 2, 60,215,60); } } } shX = (m_sPlayerX*128)/(m_pMapData->m_sMapSizeX); shY = (m_sPlayerY*128)/(m_pMapData->m_sMapSizeY); m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX + shX, sY + shY, 37, m_dwCurTime); if (m_relicX != 0 && m_relicY != 0) { pointX = sX + ((m_relicX*128)/(m_pMapData->m_sMapSizeX)) -1; pointY = sY + ((m_relicY*128)/(m_pMapData->m_sMapSizeY)) -1; for(int pX = 0; pX < 3; pX++){ m_DDraw.PutPixel(pointX + pX, pointY, 230,60,60); if(pX==1)m_DDraw.PutPixel(pointX + pX, pointY + 1, 50,170,250); else m_DDraw.PutPixel(pointX + pX, pointY + 1, 230,60,60); m_DDraw.PutPixel(pointX + pX, pointY + 2, 230,60,60); } } if( (G_dwGlobalTime - m_dwMonsterEventTime) < 30000 ) { if( (m_dwCurTime%500)< 370 ) { shX = (m_sEventX*128)/(m_pMapData->m_sMapSizeX); shY = (m_sEventY*128)/(m_pMapData->m_sMapSizeY); m_pSprite[SPRID_INTERFACE_MONSTER]->PutSpriteFast(sX + shX, sY + shY, m_sMonsterID, m_dwCurTime); } }else { m_dwMonsterEventTime = 0; m_sMonsterID = 0; } } if( cLB != 0 ) return; if( msX >= sX && msX < sX+szY && msY >= sY && msY < sY+szY ) { if( sY > 213 ) shY = sY - 17; else shY = sY + szY + 4; if( m_bZoomMap ) PutString( sX, shY, MSG_GUIDEMAP_MIN, RGB(200, 200, 120) );//"(-) else PutString( sX, shY, MSG_GUIDEMAP_MAX, RGB(200, 200, 120) );//"(+) if( m_bZoomMap ) { shX = m_sPlayerX-64; shY = m_sPlayerY-64; if( shX < 0 ) shX = 0; if( shY < 0 ) shY = 0; if( shX > m_pMapData->m_sMapSizeX-128 ) shX = m_pMapData->m_sMapSizeX-128; if( shY > m_pMapData->m_sMapSizeY-128 ) shY = m_pMapData->m_sMapSizeY-128; shX += msX - sX; shY += msY - sY; }else { shX = (msX-sX)*m_pMapData->m_sMapSizeX/128; shY = (msY-sY)*m_pMapData->m_sMapSizeY/128; } wsprintf( G_cTxt, "%d, %d", shX, shY ); if( m_cMapIndex == 11 ) // Aresden: Fixed by Snoopy for v3.51 maps { if( shX > 46 && shX < 66 && shY > 107 && shY < 127 ) strcpy( G_cTxt, MSG_MAPNAME_MAGICTOWER ); else if( shX > 103 && shX < 123 && shY > 86 && shY < 116 ) strcpy( G_cTxt, MSG_MAPNAME_GUILDHALL ); else if( shX > 176 && shX < 196 && shY > 62 && shY < 82 ) strcpy( G_cTxt, MSG_MAPNAME_CATH ); else if( shX > 135 && shX < 155 && shY > 113 && shY < 133 ) strcpy( G_cTxt, MSG_MAPNAME_CITYHALL ); else if( shX > 97 && shX < 117 && shY > 175 && shY < 195 ) strcpy( G_cTxt, MSG_MAPNAME_WAREHOUSE ); else if( shX > 223 && shX < 243 && shY > 124 && shY < 144 ) strcpy( G_cTxt, MSG_MAPNAME_WAREHOUSE ); else if( shX > 118 && shX < 138 && shY > 157 && shY < 177 ) strcpy( G_cTxt, MSG_MAPNAME_SHOP ); else if( shX > 148 && shX < 178 && shY > 188 && shY < 208 ) strcpy( G_cTxt, MSG_MAPNAME_BLACKSMITH ); else if( shX > 69 && shX < 89 && shY > 199 && shY < 219 ) strcpy( G_cTxt, MSG_MAPNAME_DUNGEON ); else if( shX > 21 && shX < 41 && shY > 266 && shY < 286 ) strcpy( G_cTxt, MSG_MAPNAME_HUNT); else if( shX > 20 && shX < 40 && shY > 13 && shY < 33 ) strcpy( G_cTxt, MSG_MAPNAME_ML ); else if( shX > 246 && shX < 266 && shY > 16 && shY < 36 ) strcpy( G_cTxt, MSG_MAPNAME_ML ); else if( shX > 265 && shX < 285 && shY > 195 && shY < 215 ) strcpy( G_cTxt, MSG_MAPNAME_FARM); else if( shX > 88 && shX < 108 && shY > 150 && shY < 170 ) strcpy( G_cTxt, MSG_MAPNAME_CMDHALL ); }else if( m_cMapIndex == 3 ) // Elvine: Fixed by Snoopy for v3.51 maps { if( shX > 170 && shX < 190 && shY > 65 && shY < 85 ) strcpy( G_cTxt, MSG_MAPNAME_MAGICTOWER ); else if( shX > 67 && shX < 87 && shY > 130 && shY < 150 ) strcpy( G_cTxt, MSG_MAPNAME_GUILDHALL ); else if( shX > 121 && shX < 141 && shY > 66 && shY < 86 ) strcpy( G_cTxt, MSG_MAPNAME_CATH ); else if( shX > 135 && shX < 155 && shY > 117 && shY < 137 ) strcpy( G_cTxt, MSG_MAPNAME_CITYHALL ); else if( shX > 190 && shX < 213 && shY > 118 && shY < 138 ) strcpy( G_cTxt, MSG_MAPNAME_WAREHOUSE ); else if( shX > 73 && shX < 103 && shY > 165 && shY < 185 ) strcpy( G_cTxt, MSG_MAPNAME_WAREHOUSE ); else if( shX > 217 && shX < 237 && shY > 142 && shY < 162 ) strcpy( G_cTxt, MSG_MAPNAME_SHOP ); else if( shX > 216 && shX < 256 && shY > 99 && shY < 119 ) strcpy( G_cTxt, MSG_MAPNAME_BLACKSMITH ); else if( shX > 251 && shX < 271 && shY > 73 && shY < 93 ) strcpy( G_cTxt, MSG_MAPNAME_DUNGEON ); else if( shX > 212 && shX < 232 && shY > 13 && shY < 33 ) strcpy( G_cTxt, MSG_MAPNAME_HUNT); else if( shX > 16 && shX < 36 && shY > 262 && shY < 282 ) strcpy( G_cTxt, MSG_MAPNAME_ML ); else if( shX > 244 && shX < 264 && shY > 248 && shY < 268 ) strcpy( G_cTxt, MSG_MAPNAME_ML ); else if( shX > 264 && shX < 284 && shY > 177 && shY < 207 ) strcpy( G_cTxt, MSG_MAPNAME_FARM); else if( shX > 207 && shX < 227 && shY > 79 && shY < 99 ) strcpy( G_cTxt, MSG_MAPNAME_CMDHALL ); } else if( m_cMapIndex == 5 ) // Elvine Farm: Fixed by Snoopy for v3.51 maps { if( shX > 62 && shX < 82 && shY > 187 && shY < 207 ) strcpy( G_cTxt, MSG_MAPNAME_WAREHOUSE ); else if( shX > 81 && shX < 101 && shY > 169 && shY < 189 ) strcpy( G_cTxt, MSG_MAPNAME_SHOP ); else if( shX > 101 && shX < 131 && shY > 180 && shY < 200 ) strcpy( G_cTxt, MSG_MAPNAME_BLACKSMITH ); else if( shX > 130 && shX < 150 && shY > 195 && shY < 215 ) strcpy( G_cTxt, MSG_MAPNAME_DUNGEON ); else if( shX > 86 && shX < 106 && shY > 139 && shY < 159 ) strcpy( G_cTxt, MSG_MAPNAME_BARRACK ); } else if( m_cMapIndex == 6 ) // Areden's Farm: Fixed by Snoopy for v3.51 maps { if( shX > 30 && shX < 50 && shY > 80 && shY < 100 ) strcpy( G_cTxt, MSG_MAPNAME_WAREHOUSE ); else if( shX > 55 && shX < 85 && shY > 80 && shY < 100 ) strcpy( G_cTxt, MSG_MAPNAME_BLACKSMITH ); else if( shX > 52 && shX < 72 && shY > 80 && shY < 100 ) strcpy( G_cTxt, MSG_MAPNAME_SHOP ); else if( shX > 70 && shX < 90 && shY > 60 && shY < 80 ) strcpy( G_cTxt, MSG_MAPNAME_DUNGEON ); else if( shX > 45 && shX < 65 && shY > 123 && shY < 143 ) strcpy( G_cTxt, MSG_MAPNAME_BARRACK ); } else if ( m_cMapIndex == 41 ) { if ( shX > 192 && shX < 212 && shY > 165 && shY < 185 ) strcpy( G_cTxt, "Warehouse"); else if( shX > 145 && shX < 165 && shY > 190 && shY < 210 ) strcpy( G_cTxt, "BlackSmith"); else if( shX > 136 && shX < 156 && shY > 162 && shY < 182 ) strcpy( G_cTxt, "Shop"); else if( shX > 203 && shX < 223 && shY > 140 && shY < 160 ) strcpy( G_cTxt, "Magicshop"); else if( shX > 80 && shX < 100 && shY > 164 && shY < 184 ) strcpy( G_cTxt, "Church" ); else if( shX > 92 && shX < 112 && shY > 107 && shY < 127 ) strcpy( G_cTxt, "Cityhall" ); else if( shX > 55 && shX < 75 && shY > 141 && shY < 161 ) strcpy( G_cTxt, "Warehouse"); else if( shX > 204 && shX < 224 && shY > 18 && shY < 38 ) strcpy( G_cTxt, "Middleland"); else if( shX > 37 && shX < 57 && shY > 30 && shY < 50 ) strcpy( G_cTxt, "Middleland"); else if( shX > 223 && shX < 243 && shY > 28 && shY < 48 ) strcpy( G_cTxt, "Dungeon"); else if( shX > 43 && shX < 63 && shY > 250 && shY < 270 ) strcpy( G_cTxt, "Huntzone"); else if( shX > 245 && shX < 265 && shY > 150 && shY < 170 ) strcpy( G_cTxt, "Farm"); else if( shX > 144 && shX < 153 && shY > 93 && shY < 111 ) strcpy( G_cTxt, "GuildHall"); else if( shX > 185 && shX < 205 && shY > 75 && shY < 95) strcpy( G_cTxt, "Command Hall"); else if( shX > 223 && shX < 243 && shY > 28 && shY < 48 ) strcpy( G_cTxt, "Dungeon"); } else if( m_cMapIndex == 42 ) { if( shX > 30 && shX < 50 && shY > 80 && shY < 100 ) strcpy( G_cTxt, "Warehouse"); else if( shX > 55 && shX < 85 && shY > 80 && shY < 100 ) strcpy( G_cTxt, "BlackSmith"); else if( shX > 52 && shX < 72 && shY > 80 && shY < 100 ) strcpy( G_cTxt, "Shop"); else if( shX > 70 && shX < 90 && shY > 60 && shY < 80 ) strcpy( G_cTxt, "Dungeon"); else if( shX > 45 && shX < 65 && shY > 123 && shY < 143 ) strcpy( G_cTxt, "Barrack"); } PutString( msX-10, msY-13, G_cTxt, RGB(200, 200, 120) ); } } void CGame::DrawDialogBoxs(short msX, short msY, short msZ, char cLB) { int i; if (m_bIsObserverMode == TRUE) return; m_DInput.m_sZ = 0; //Snoopy: 41->61 for (i = 0; i < 61; i++) if (m_cDialogBoxOrder[i] != NULL) { switch (m_cDialogBoxOrder[i]) { case 1: //DrawDialogBox_Character(msX, msY); //@@@ DrawDialogBox_Character(msX, msY); break; case 2: DrawDialogBox_Inventory(msX, msY); //@@@ break; case 3: DrawDialogBox_Magic(msX, msY, msZ); //@@@ break; case 4: DrawDialogBox_ItemDrop(msX, msY); //@@@ break; case 5: DrawDialogBox_15AgeMsg(msX, msY); //@@@ break; case 6: DrawDialogBox_WarningMsg(msX, msY); //@@@ break; case 7: DrawDialogBox_GuildMenu(msX, msY); break; case 8: DrawDialogBox_GuildOperation(msX, msY); break; case 9: DrawDialogBox_GuideMap(msX, msY, cLB); break; case 10: DrawDialogBox_Chat(msX, msY, msZ, cLB); //@@@ break; case 11: DrawDialogBox_Shop(msX, msY, msZ, cLB); //@@@ break; case 12: DrawDialogBox_LevelUpSetting(msX, msY); //@@@ break; case 13: DrawDialogBox_CityHallMenu(msX, msY, msZ, cLB); break; case 14: DrawDialogBox_Bank(msX, msY, msZ, cLB); //@@@ break; case 15: DrawDialogBox_Skill(msX, msY, msZ, cLB); //@@@ break; case 16: DrawDialogBox_MagicShop(msX, msY, msZ); //@@@ break; case 17: DrawDialogBox_QueryDropItemAmount(); break; case 18: DrawDialogBox_Text(msX, msY, msZ, cLB); //@@@ break; case 19: DrawDialogBox_SysMenu(msX, msY, cLB); //@@@ break; case 20: DrawDialogBox_NpcActionQuery(msX, msY); //@@@ break; case 21: DrawDialogBox_NpcTalk(msX, msY, cLB); //@@@ break; case 22: DrawDialogBox_Map(); break; case 23: DrawDialogBox_SellorRepairItem(msX, msY); //@@@ break; case 24: DrawDialogBox_Fishing(msX, msY); break; case 25: DrawDialogBox_ShutDownMsg(msX, msY); //@@@ break; case 26: // Manuf DrawDialogBox_SkillDlg(msX, msY, msZ, cLB); break; case 27: DrawDialogBox_Exchange(msX, msY); //@@@ break; case 28: DrawDialogBox_Quest(msX, msY); //@@@ break; case 29: DrawDialogBox_GaugePannel(); //@@@ break; case 30: DrawDialogBox_IconPannel(msX, msY); //@@@ break; case 31: DrawDialogBox_SellList(msX, msY); //@@@ break; case 32: DrawDialogBox_Party(msX, msY, msZ, cLB); //@@@ break; case 33: DrawDialogBox_CrusadeJob(msX, msY); //@@@ break; case 34: DrawDialogBox_ItemUpgrade(msX, msY); break; case 35: DrawDialogBox_Help(msX, msY); //@@@ break; case 36: DrawDialogBox_Commander(msX, msY); //@@@ break; case 37: DrawDialogBox_Constructor(msX, msY); //@@@ break; case 38: DrawDialogBox_Soldier(msX, msY); //@@@ break; case 40: DrawDialogBox_Slates(msX, msY, msZ, cLB); break; case 41: //Snoopy: Confirmation Exchange DrawDialogBox_ConfirmExchange(msX, msY); break; case 42: DrawDialogBox_ChangeStatsMajestic(msX, msY); break; case 43: DrawDialogBox_FriendList(msX,msY); break; case 50: // Snoopy: Resurection? DrawDialogBox_Resurect(msX, msY); break; case 51: // Gail DrawDialogBox_CMDHallMenu(msX, msY); break; case 53: DrawDialogBox_DKMenuWeapons(msX, msY); break; } } if (m_cSkillMastery[_iGetWeaponSkillType()] == 100) { if (m_iSuperAttackLeft > 0) { if (GetAsyncKeyState(VK_MENU)>>15) m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutTransSprite(368, 439, 3, m_dwCurTime); wsprintf(G_cTxt, "%d", m_iSuperAttackLeft); PutString_SprFont2(380, 454, G_cTxt, 220, 200, 200); } }else { if (m_iSuperAttackLeft > 0) { wsprintf(G_cTxt, "%d", m_iSuperAttackLeft); PutString_SprFont2(380, 454, G_cTxt, 10, 10, 10); } } } void CGame::_Draw_CharacterBody(short sX, short sY, short sType) { DWORD dwTime = m_dwCurTime; int iR, iG, iB; if (sType <= 3) { m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 0]->PutSpriteFast(sX, sY, sType-1, dwTime); _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 18]->PutSpriteRGB(sX, sY, (_tmp_sAppr1 & 0x0F00) >> 8, iR, iG, iB, dwTime); m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 19]->PutSpriteFast(sX, sY, (_tmp_sAppr1 & 0x000F), dwTime); }else { m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 40]->PutSpriteFast(sX, sY, sType-4, dwTime); _GetHairColorRGB(((_tmp_sAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 18 +40]->PutSpriteRGB(sX, sY, (_tmp_sAppr1 & 0x0F00) >> 8, iR, iG, iB, dwTime); m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 19 +40]->PutSpriteFast(sX, sY, (_tmp_sAppr1 & 0x000F), dwTime); } } void CGame::EnableDialogBox(int iBoxID, int cType, int sV1, int sV2, char * pString) { int i; short sX, sY; switch (iBoxID) { case 11: if (m_bIsDialogEnabled[11] == FALSE) { switch (cType) { case NULL: break; default: _LoadShopMenuContents(cType); m_stDialogBoxInfo[11].sV1 = cType; m_stDialogBoxInfo[11].cMode = 0; m_stDialogBoxInfo[11].sView = 0; m_stDialogBoxInfo[11].bFlag = TRUE; m_stDialogBoxInfo[11].sV3 = 1; break; } } break; case 12: // levelup diag if (m_bIsDialogEnabled[12] == FALSE) { m_stDialogBoxInfo[12].sX = m_stDialogBoxInfo[1].sX + 20; m_stDialogBoxInfo[12].sY = m_stDialogBoxInfo[1].sY + 20; m_iLU_Point = m_iLevel*3 - ( (m_stat[STAT_STR] + m_stat[STAT_VIT] + m_stat[STAT_DEX] + m_stat[STAT_INT] + m_stat[STAT_MAG] + m_stat[STAT_CHR]) - 70) - 3 + m_angelStat[STAT_STR] + m_angelStat[STAT_DEX] + m_angelStat[STAT_INT] + m_angelStat[STAT_MAG]; m_stDialogBoxInfo[12].sV1 = m_iLU_Point; } break; case 3: // Magic Dialog break; case 4: if (m_bIsDialogEnabled[4] == FALSE) { m_stDialogBoxInfo[4].sView = cType; } break; case 5: if (m_bIsDialogEnabled[5] == FALSE) { m_stDialogBoxInfo[5].sView = cType; } break; case 6: if (m_bIsDialogEnabled[6] == FALSE) { m_stDialogBoxInfo[6].sView = cType; } break; case 7: if (m_stDialogBoxInfo[7].cMode == 1) { sX = m_stDialogBoxInfo[7].sX; sY = m_stDialogBoxInfo[7].sY; EndInputString(); StartInputString(sX + 75, sY + 140, 21, m_cGuildName); } break; case 17: // demande quantité if (m_bIsDialogEnabled[17] == FALSE) { m_stDialogBoxInfo[iBoxID].cMode = 1; m_stDialogBoxInfo[17].sView = cType; EndInputString(); ZeroMemory(m_cAmountString, sizeof(m_cAmountString)); wsprintf( m_cAmountString, "%d", sV1 ); sX = m_stDialogBoxInfo[17].sX; sY = m_stDialogBoxInfo[17].sY; StartInputString(sX + 40, sY + 57, 11, m_cAmountString, FALSE); }else { if (m_stDialogBoxInfo[17].cMode == 1) { sX = m_stDialogBoxInfo[17].sX; sY = m_stDialogBoxInfo[17].sY; EndInputString(); StartInputString(sX + 40, sY + 57, 11, m_cAmountString, FALSE); } } break; case 18: if (m_bIsDialogEnabled[18] == FALSE) { switch (cType) { case NULL: m_stDialogBoxInfo[18].cMode = 0; m_stDialogBoxInfo[18].sView = 0; break; default: _LoadTextDlgContents(cType); m_stDialogBoxInfo[18].cMode = 0; m_stDialogBoxInfo[18].sView = 0; break; } } break; case 19: break; case 20: // Talk to npc or unicorn m_bIsItemDisabled[m_stDialogBoxInfo[20].sV1] = FALSE; if (m_bIsDialogEnabled[20] == FALSE) { m_stDialogBoxInfo[11].sV1 = m_stDialogBoxInfo[11].sV2 = m_stDialogBoxInfo[11].sV3 = m_stDialogBoxInfo[11].sV4 = m_stDialogBoxInfo[11].sV5 = m_stDialogBoxInfo[11].sV6 = NULL; m_stDialogBoxInfo[20].cMode = cType; m_stDialogBoxInfo[20].sView = 0; m_stDialogBoxInfo[20].sV1 = sV1; m_stDialogBoxInfo[20].sV2 = sV2; } break; case 21: if (m_bIsDialogEnabled[21] == FALSE) { m_stDialogBoxInfo[21].cMode = cType; m_stDialogBoxInfo[21].sView = 0; m_stDialogBoxInfo[21].sV1 = _iLoadTextDlgContents2(sV1+20); m_stDialogBoxInfo[21].sV2 = sV1+20; } break; case 22: if (m_bIsDialogEnabled[22] == FALSE) { m_stDialogBoxInfo[22].sV1 = sV1; m_stDialogBoxInfo[22].sV2 = sV2; m_stDialogBoxInfo[22].sSizeX = 290; m_stDialogBoxInfo[22].sSizeY = 290; } break; case 23: if (m_bIsDialogEnabled[23] == FALSE) { m_stDialogBoxInfo[23].cMode = cType; m_stDialogBoxInfo[23].sV1 = sV1; // ItemID m_stDialogBoxInfo[23].sV2 = sV2; if( cType == 2 ) { m_stDialogBoxInfo[23].sX = m_stDialogBoxInfo[11].sX; m_stDialogBoxInfo[23].sY = m_stDialogBoxInfo[11].sY; } } break; case 15: break; case 24: if (m_bIsDialogEnabled[24] == FALSE) { m_stDialogBoxInfo[24].cMode = cType; m_stDialogBoxInfo[24].sV1 = sV1; m_stDialogBoxInfo[24].sV2 = sV2; m_bSkillUsingStatus = TRUE; } break; case 25: if (m_bIsDialogEnabled[25] == FALSE) { m_stDialogBoxInfo[25].cMode = cType; m_stDialogBoxInfo[25].sV1 = sV1; m_stDialogBoxInfo[25].sV2 = sV2; } break; case 26: switch (cType) { case 1: case 2: // if (m_bIsDialogEnabled[26] == FALSE) { m_stDialogBoxInfo[26].cMode = cType; m_stDialogBoxInfo[26].sV1 = -1; m_stDialogBoxInfo[26].sV2 = -1; m_stDialogBoxInfo[26].sV3 = -1; m_stDialogBoxInfo[26].sV4 = -1; m_stDialogBoxInfo[26].sV5 = -1; m_stDialogBoxInfo[26].sV6 = -1; m_stDialogBoxInfo[26].cStr[0] = 0; m_bSkillUsingStatus = TRUE; m_stDialogBoxInfo[26].sSizeX = 195; m_stDialogBoxInfo[26].sSizeY = 215; DisableDialogBox(17); DisableDialogBox(20); DisableDialogBox(23); } break; case 3: // if (m_bIsDialogEnabled[26] == FALSE) { m_stDialogBoxInfo[26].sView = 0; m_stDialogBoxInfo[26].cMode = cType; m_stDialogBoxInfo[26].sV1 = -1; m_stDialogBoxInfo[26].sV2 = -1; m_stDialogBoxInfo[26].sV3 = -1; m_stDialogBoxInfo[26].sV4 = -1; m_stDialogBoxInfo[26].sV5 = -1; m_stDialogBoxInfo[26].sV6 = -1; m_stDialogBoxInfo[26].cStr[0] = 0; m_stDialogBoxInfo[26].cStr[1] = 0; m_stDialogBoxInfo[26].cStr[4] = 0; m_bSkillUsingStatus = TRUE; _bCheckBuildItemStatus(); //m_stDialogBoxInfo[26].sX = 0; //m_stDialogBoxInfo[26].sY = 0; m_stDialogBoxInfo[26].sSizeX = 270; m_stDialogBoxInfo[26].sSizeY = 381; DisableDialogBox(17); DisableDialogBox(20); DisableDialogBox(23); } break; case 6: if (m_bIsDialogEnabled[26] == FALSE) { m_stDialogBoxInfo[26].cMode = cType; m_stDialogBoxInfo[26].cStr[2] = sV1; m_stDialogBoxInfo[26].cStr[3] = sV2; m_stDialogBoxInfo[26].sSizeX = 270; m_stDialogBoxInfo[26].sSizeY = 381; m_bSkillUsingStatus = TRUE; _bCheckBuildItemStatus(); DisableDialogBox(17); DisableDialogBox(20); DisableDialogBox(23); } break; // Crafting case 7: case 8: if (m_bIsDialogEnabled[26] == FALSE) { m_stDialogBoxInfo[26].cMode = cType; m_stDialogBoxInfo[26].sV1 = -1; m_stDialogBoxInfo[26].sV2 = -1; m_stDialogBoxInfo[26].sV3 = -1; m_stDialogBoxInfo[26].sV4 = -1; m_stDialogBoxInfo[26].sV5 = -1; m_stDialogBoxInfo[26].sV6 = -1; m_stDialogBoxInfo[26].cStr[0] = 0; m_stDialogBoxInfo[26].cStr[1] = 0; m_bSkillUsingStatus = TRUE; //_bCheckCraftItemStatus(); m_stDialogBoxInfo[26].sSizeX = 195; m_stDialogBoxInfo[26].sSizeY = 215; DisableDialogBox(17); DisableDialogBox(20); DisableDialogBox(23); } break; } break; case 27: // Snoopy: 7 mar 06 (multitrade) case rewriten if (m_bIsDialogEnabled[27] == FALSE) { m_stDialogBoxInfo[27].cMode = cType; for (i=0; i<8;i++) { ZeroMemory(m_stDialogBoxExchangeInfo[i].cStr1, sizeof(m_stDialogBoxExchangeInfo[i].cStr1)); ZeroMemory(m_stDialogBoxExchangeInfo[i].cStr2, sizeof(m_stDialogBoxExchangeInfo[i].cStr2)); m_stDialogBoxExchangeInfo[i].sV1 = -1; m_stDialogBoxExchangeInfo[i].sV2 = -1; m_stDialogBoxExchangeInfo[i].sV3 = -1; m_stDialogBoxExchangeInfo[i].sV4 = -1; m_stDialogBoxExchangeInfo[i].sV5 = -1; m_stDialogBoxExchangeInfo[i].sV6 = -1; m_stDialogBoxExchangeInfo[i].sV7 = -1; m_stDialogBoxExchangeInfo[i].dwV1 = 0; } DisableDialogBox(17); DisableDialogBox(20); DisableDialogBox(23); DisableDialogBox(26); } break; case 41: // Snoopy: 7 mar 06 (MultiTrade) Confirmation dialog break; case 28: if (m_bIsDialogEnabled[28] == FALSE) { m_stDialogBoxInfo[28].cMode = cType; m_stDialogBoxInfo[28].sX = m_stDialogBoxInfo[1].sX + 20; m_stDialogBoxInfo[28].sY = m_stDialogBoxInfo[1].sY + 20; } break; case 32: if (m_bIsDialogEnabled[32] == FALSE) { m_stDialogBoxInfo[32].cMode = cType; m_stDialogBoxInfo[32].sX = m_stDialogBoxInfo[1].sX + 20; m_stDialogBoxInfo[32].sY = m_stDialogBoxInfo[1].sY + 20; } break; case 33: if ((m_iHP <= 0) || m_side == NEUTRAL) return; if (m_bIsDialogEnabled[33] == FALSE) { m_stDialogBoxInfo[33].cMode = cType; m_stDialogBoxInfo[33].sX = 360; m_stDialogBoxInfo[33].sY = 65; m_stDialogBoxInfo[33].sV1 = sV1; } break; case 34: if (m_bIsDialogEnabled[34] == FALSE) { int iSoX, iSoM; iSoX = iSoM = 0; for (i = 0; i < MAXITEMS; i++) if (m_pItemList[i] != NULL) { if ((m_pItemList[i]->m_sSprite == 6) && (m_pItemList[i]->m_sSpriteFrame == 128)) iSoX++; if ((m_pItemList[i]->m_sSprite == 6) && (m_pItemList[i]->m_sSpriteFrame == 129)) iSoM++; } if ((iSoX > 0) || (iSoM > 0)) { m_stDialogBoxInfo[34].cMode = 6; // Stone upgrade m_stDialogBoxInfo[34].sV2 = iSoX; m_stDialogBoxInfo[34].sV3 = iSoM; m_stDialogBoxInfo[34].sV1 = -1; m_stDialogBoxInfo[34].dwV1 = NULL; }else if (m_iGizonItemUpgradeLeft >0) { m_stDialogBoxInfo[34].cMode = 1; m_stDialogBoxInfo[34].sV2 = -1; m_stDialogBoxInfo[34].sV3 = -1; m_stDialogBoxInfo[34].sV1 = -1; m_stDialogBoxInfo[34].dwV1 = NULL; }else { AddEventList(DRAW_DIALOGBOX_ITEMUPGRADE30, 10); // "Stone of Xelima or Merien is not present." return; } } break; case 16: if (m_bIsDialogEnabled[iBoxID] == FALSE) { if (m_cSkillMastery[SKILL_MAGIC] == 0) { DisableDialogBox(16); EnableDialogBox(21, 0, 480, 0); return; } else { m_stDialogBoxInfo[iBoxID].cMode = 0; m_stDialogBoxInfo[iBoxID].sView = 0; } } break; case 14: EndInputString(); if (m_bIsDialogEnabled[iBoxID] == FALSE) { m_stDialogBoxInfo[iBoxID].cMode = 0; m_stDialogBoxInfo[iBoxID].sView = 0; EnableDialogBox(2, NULL, NULL, NULL); } break; case 40: // Slates if (m_bIsDialogEnabled[40] == FALSE) { m_stDialogBoxInfo[40].sView = 0; m_stDialogBoxInfo[40].cMode = cType; m_stDialogBoxInfo[40].sV1 = -1; m_stDialogBoxInfo[40].sV2 = -1; m_stDialogBoxInfo[40].sV3 = -1; m_stDialogBoxInfo[40].sV4 = -1; m_stDialogBoxInfo[40].sV5 = -1; m_stDialogBoxInfo[40].sV6 = -1; m_stDialogBoxInfo[40].cStr[0] = 0; m_stDialogBoxInfo[40].cStr[1] = 0; m_stDialogBoxInfo[40].cStr[4] = 0; m_stDialogBoxInfo[40].sSizeX = 180; m_stDialogBoxInfo[40].sSizeY = 183; DisableDialogBox(17); DisableDialogBox(20); DisableDialogBox(23); DisableDialogBox(26); } break; case 42: // Diuuude: Change stats window if (m_bIsDialogEnabled[42] == FALSE) { m_stDialogBoxInfo[42].sX = m_stDialogBoxInfo[12].sX+10; m_stDialogBoxInfo[42].sY = m_stDialogBoxInfo[12].sY+10; m_stDialogBoxInfo[42].cMode = 0; m_stDialogBoxInfo[42].sView = 0; m_bSkillUsingStatus = FALSE; } break; case 43: if (m_bIsDialogEnabled[43] == FALSE) { m_iFriendIndex = -1; m_stDialogBoxInfo[43].sV1= 0; } break; case 50: // Snoopy: Resurection if (m_bIsDialogEnabled[50] == FALSE) { m_stDialogBoxInfo[50].sX = 185; m_stDialogBoxInfo[50].sY = 100; m_stDialogBoxInfo[50].cMode = 0; m_stDialogBoxInfo[50].sView = 0; m_bSkillUsingStatus = FALSE; } break; case 52: //New Shop break; case 53: //new bsmith break; default: EndInputString(); if (m_bIsDialogEnabled[iBoxID] == FALSE) { m_stDialogBoxInfo[iBoxID].cMode = 0; m_stDialogBoxInfo[iBoxID].sView = 0; } break; } if( iBoxID != 30 ) { if (m_bIsDialogEnabled[iBoxID] == FALSE) { if( m_stDialogBoxInfo[iBoxID].sY > 400 ) m_stDialogBoxInfo[iBoxID].sY = 410; if( m_stDialogBoxInfo[iBoxID].sX > 620 ) m_stDialogBoxInfo[iBoxID].sX = 620; if( (m_stDialogBoxInfo[iBoxID].sX+m_stDialogBoxInfo[iBoxID].sSizeX) < 10 ) m_stDialogBoxInfo[iBoxID].sX += 20; if( (m_stDialogBoxInfo[iBoxID].sY+m_stDialogBoxInfo[iBoxID].sSizeY) < 10 ) m_stDialogBoxInfo[iBoxID].sY += 20; } } m_bIsDialogEnabled[iBoxID] = TRUE; if (pString != NULL) strcpy(m_stDialogBoxInfo[iBoxID].cStr, pString); //Snoopy: 39->59 for (i = 0; i < 59; i++) if (m_cDialogBoxOrder[i] == iBoxID) m_cDialogBoxOrder[i] = NULL; //Snoopy: 39->59 for (i = 1; i < 59; i++) if ((m_cDialogBoxOrder[i-1] == NULL) && (m_cDialogBoxOrder[i] != NULL)) { m_cDialogBoxOrder[i-1] = m_cDialogBoxOrder[i]; m_cDialogBoxOrder[i] = NULL; } //Snoopy: 39->59 for (i = 0; i < 59; i++) if (m_cDialogBoxOrder[i] == NULL) { m_cDialogBoxOrder[i] = iBoxID; return; } } void CGame::DisableDialogBox(int iBoxID) { int i; switch (iBoxID) { case 4: m_bIsItemDisabled[m_stDialogBoxInfo[4].sView] = FALSE; break; case 5: m_bIsItemDisabled[m_stDialogBoxInfo[5].sView] = FALSE; break; case 6: m_bIsItemDisabled[m_stDialogBoxInfo[6].sView] = FALSE; break; case 7: if (m_stDialogBoxInfo[7].cMode == 1) EndInputString(); m_stDialogBoxInfo[7].cMode = 0; break; case 11: for (i = 0; i < MAXMENUITEMS; i++) if (m_pItemForSaleList[i] != NULL) { delete m_pItemForSaleList[i]; m_pItemForSaleList[i] = NULL; } m_stDialogBoxInfo[39].sV3 = 0; m_stDialogBoxInfo[39].sV4 = 0; m_stDialogBoxInfo[39].sV5 = 0; m_stDialogBoxInfo[39].sV6 = 0; break; case 14: if (m_stDialogBoxInfo[14].cMode < 0) return; break; case 17: if (m_stDialogBoxInfo[17].cMode == 1) { EndInputString(); m_bIsItemDisabled[m_stDialogBoxInfo[17].sView] = FALSE; } break; case 20: m_bIsItemDisabled[m_stDialogBoxInfo[20].sV1] = FALSE; break; case 21: if (m_stDialogBoxInfo[21].sV2 == 500) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_GETMAGICABILITY, NULL, NULL, NULL, NULL, NULL); } break; case 24: m_bSkillUsingStatus = FALSE; break; case 26: if (m_stDialogBoxInfo[26].sV1 != -1) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV1] = FALSE; if (m_stDialogBoxInfo[26].sV2 != -1) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV2] = FALSE; if (m_stDialogBoxInfo[26].sV3 != -1) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV3] = FALSE; if (m_stDialogBoxInfo[26].sV4 != -1) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV4] = FALSE; if (m_stDialogBoxInfo[26].sV5 != -1) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV5] = FALSE; if (m_stDialogBoxInfo[26].sV6 != -1) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV6] = FALSE; m_bSkillUsingStatus = FALSE; break; case 27: //Snoopy: 7 mar 06 (multiTrade) case rewriten for (i=0; i<8;i++) { ZeroMemory(m_stDialogBoxExchangeInfo[i].cStr1, sizeof(m_stDialogBoxExchangeInfo[i].cStr1)); ZeroMemory(m_stDialogBoxExchangeInfo[i].cStr2, sizeof(m_stDialogBoxExchangeInfo[i].cStr2)); m_stDialogBoxExchangeInfo[i].sV1 = -1; m_stDialogBoxExchangeInfo[i].sV2 = -1; m_stDialogBoxExchangeInfo[i].sV3 = -1; m_stDialogBoxExchangeInfo[i].sV4 = -1; m_stDialogBoxExchangeInfo[i].sV5 = -1; m_stDialogBoxExchangeInfo[i].sV6 = -1; m_stDialogBoxExchangeInfo[i].sV7 = -1; m_stDialogBoxExchangeInfo[i].dwV1 = 0; if (m_bIsItemDisabled[m_stDialogBoxExchangeInfo[i].sItemID] == TRUE) m_bIsItemDisabled[m_stDialogBoxExchangeInfo[i].sItemID] = FALSE; } break; case 31: for (i = 0; i < MAXSELLLIST; i++) { if (m_stSellItemList[i].iIndex != -1) m_bIsItemDisabled[m_stSellItemList[i].iIndex] = FALSE; m_stSellItemList[i].iIndex = -1; m_stSellItemList[i].iAmount = 0; } break; case 34: if(m_stDialogBoxInfo[34].sV1 != -1) m_bIsItemDisabled[m_stDialogBoxInfo[34].sV1] = FALSE; break; case 40: m_bIsItemDisabled[m_stDialogBoxInfo[40].sV1] = FALSE; m_bIsItemDisabled[m_stDialogBoxInfo[40].sV2] = FALSE; m_bIsItemDisabled[m_stDialogBoxInfo[40].sV3] = FALSE; m_bIsItemDisabled[m_stDialogBoxInfo[40].sV4] = FALSE; ZeroMemory(m_stDialogBoxInfo[40].cStr, sizeof(m_stDialogBoxInfo[40].cStr)); ZeroMemory(m_stDialogBoxInfo[40].cStr2, sizeof(m_stDialogBoxInfo[40].cStr2)); ZeroMemory(m_stDialogBoxInfo[40].cStr3, sizeof(m_stDialogBoxInfo[40].cStr3)); ZeroMemory(m_stDialogBoxInfo[40].cStr4, sizeof(m_stDialogBoxInfo[40].cStr4)); m_stDialogBoxInfo[40].sV1 = -1; m_stDialogBoxInfo[40].sV2 = -1; m_stDialogBoxInfo[40].sV3 = -1; m_stDialogBoxInfo[40].sV4 = -1; m_stDialogBoxInfo[40].sV5 = -1; m_stDialogBoxInfo[40].sV6 = -1; m_stDialogBoxInfo[40].sV9 = -1; m_stDialogBoxInfo[40].sV10 = -1; m_stDialogBoxInfo[40].sV11 = -1; m_stDialogBoxInfo[40].sV12 = -1; m_stDialogBoxInfo[40].sV13 = -1; m_stDialogBoxInfo[40].sV14 = -1; m_stDialogBoxInfo[40].dwV1 = 0; m_stDialogBoxInfo[40].dwV2 = 0; break; case 42: cStateChange1 = 0; cStateChange2 = 0; cStateChange3 = 0; /* m_luStat[STAT_STR] = 0; m_luStat[STAT_VIT] = 0; m_luStat[STAT_DEX] = 0; m_luStat[STAT_INT] = 0; m_luStat[STAT_MAG] = 0; m_luStat[STAT_CHR] = 0;*/ break; } m_bIsDialogEnabled[iBoxID] = FALSE; // Snoopy: 39->59 for (i = 0; i < 59; i++) if (m_cDialogBoxOrder[i] == iBoxID) m_cDialogBoxOrder[i] = NULL; // Snoopy: 39->59 for (i = 1; i < 59; i++) if ((m_cDialogBoxOrder[i-1] == NULL) && (m_cDialogBoxOrder[i] != NULL)) { m_cDialogBoxOrder[i-1] = m_cDialogBoxOrder[i]; m_cDialogBoxOrder[i] = NULL; } } int CGame::iGetTopDialogBoxIndex() { int i; //Snoopy: 38->58 for (i = 58; i >= 0; i--) if (m_cDialogBoxOrder[i] != NULL) return m_cDialogBoxOrder[i]; return NULL; } void CGame::DlgBoxClick_IconPannel(short msX, short msY) { short sX, sY; sX = m_stDialogBoxInfo[30].sX; sY = m_stDialogBoxInfo[30].sY; // CLEROTH - LU /* if ((msX > 322) && (msX < 355) && (434 < msY) && (475 > msY)) { if (m_iLU_Point <= 0) return; if (m_bIsDialogEnabled[12] == TRUE) DisableDialogBox(12); else EnableDialogBox(12, NULL, NULL, NULL); PlaySound('E', 14, 5); }*/ if ((msX > 322) && (msX < 355) && (434 < msY) && (475 > msY)) { // Crusade if (m_bIsCrusadeMode == FALSE) return; switch (m_iCrusadeDuty) { case 1: // Fighter EnableDialogBox(38, NULL, NULL, NULL); break; case 2: // Constructor EnableDialogBox(37, NULL, NULL, NULL); break; case 3: // Commander EnableDialogBox(36, NULL, NULL, NULL); break; default: break; } PlaySound('E', 14, 5); } if ((362 < msX) && (404 > msX) && (434 < msY) && (475 > msY)) { // Combat Mode Toggle bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TOGGLECOMBATMODE, NULL, NULL, NULL, NULL, NULL); PlaySound('E', 14, 5); } // Character if ((412 <= msX) && (447 >= msX) && (434 < msY) && (475 > msY)) { if (m_bIsDialogEnabled[1] == TRUE) DisableDialogBox(1); else EnableDialogBox(1, NULL, NULL, NULL); PlaySound('E', 14, 5); } // Inventory if ((450 <= msX) && (484 >= msX) && (434 < msY) && (475 > msY)) { if (m_bIsDialogEnabled[2] == TRUE) DisableDialogBox(2); else EnableDialogBox(2, NULL, NULL, NULL); PlaySound('E', 14, 5); } // Magic if ((485 <= msX) && (521 >= msX) && (434 < msY) && (475 > msY)) { if (m_bIsDialogEnabled[3] == TRUE) DisableDialogBox(3); else EnableDialogBox(3, NULL, NULL, NULL); PlaySound('E', 14, 5); } // Skill if ((522 <= msX) && (558 >= msX) && (434 < msY) && (475 > msY)) { if (m_bIsDialogEnabled[15] == TRUE) DisableDialogBox(15); else EnableDialogBox(15, NULL, NULL, NULL); PlaySound('E', 14, 5); } // Chat if ((559 <= msX) && (595 >= msX) && (434 < msY) && (475 > msY)) { if (m_bIsDialogEnabled[10] == TRUE) DisableDialogBox(10); else EnableDialogBox(10, NULL, NULL, NULL); PlaySound('E', 14, 5); } // System Menu if ((596 <= msX) && (630 >= msX) && (434 < msY) && (475 > msY)) { if (m_bIsDialogEnabled[19] == TRUE) DisableDialogBox(19); else EnableDialogBox(19, NULL, NULL, NULL); PlaySound('E', 14, 5); } } void CGame::DrawChatMsgs(short sX, short sY, short dX, short dY) { int i; for (i = 0; i < MAXCHATMSGS; i++) if (m_pChatMsgList[i] != NULL) if ( (m_pChatMsgList[i]->m_sX >= sX) && (m_pChatMsgList[i]->m_sX <= dX) && (m_pChatMsgList[i]->m_sY >= sY) && (m_pChatMsgList[i]->m_sY <= dY) ) { switch (m_pChatMsgList[i]->m_cType) { case 41: case 42: case 21: case 22: case 23: DrawChatMsgBox(m_pChatMsgList[i]->m_sX, m_pChatMsgList[i]->m_sY, i, FALSE); break; } } m_DDraw._GetBackBufferDC(); for (i = 0; i < MAXCHATMSGS; i++) if (m_pChatMsgList[i] != NULL) if ( (m_pChatMsgList[i]->m_sX >= sX) && (m_pChatMsgList[i]->m_sX <= dX) && (m_pChatMsgList[i]->m_sY >= sY) && (m_pChatMsgList[i]->m_sY <= dY) ) { switch (m_pChatMsgList[i]->m_cType) { case 41: case 42: case 21: case 22: case 23: break; case 20: default: DrawChatMsgBox(m_pChatMsgList[i]->m_sX, m_pChatMsgList[i]->m_sY, i, TRUE); break; } } m_DDraw._ReleaseBackBufferDC(); } void CGame::_LoadTextDlgContents(int cType) {char * pContents, * token, cTemp[120], cFileName[120]; char seps[] = "\n"; int iIndex = 0, i; class CStrTok * pStrTok; DWORD dwFileSize; HANDLE hFile; FILE * pFile; for (i = 0; i < TEXTDLGMAXLINES; i++) { if (m_pMsgTextList[i] != NULL) delete m_pMsgTextList[i]; m_pMsgTextList[i] = NULL; } // cType ZeroMemory(cTemp, sizeof(cTemp)); ZeroMemory(cFileName, sizeof(cFileName)); wsprintf(cTemp, "contents%d", cType); strcat(cFileName, "contents"); strcat(cFileName, "\\"); strcat(cFileName, "\\"); strcat(cFileName, cTemp); strcat(cFileName, ".txt"); hFile = CreateFile(cFileName, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); dwFileSize = GetFileSize(hFile, NULL); if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); pFile = fopen(cFileName, "rt"); if (pFile == NULL) return; else { pContents = new char[dwFileSize+1]; ZeroMemory(pContents, dwFileSize+1); fread(pContents, dwFileSize, 1, pFile); } fclose(pFile); pStrTok = new class CStrTok(pContents, seps); token = pStrTok->pGet(); while( token != NULL ) { m_pMsgTextList[iIndex] = new class CMsg(NULL, token, NULL); token = pStrTok->pGet(); iIndex++; } delete pStrTok; delete[] pContents; } int CGame::_iLoadTextDlgContents2(int iType) {char * pContents, * token, cTemp[120], cFileName[120]; char seps[] = "\n"; int iIndex = 0, i; class CStrTok * pStrTok; DWORD dwFileSize; HANDLE hFile; FILE * pFile; for (i = 0; i < TEXTDLGMAXLINES; i++) { if (m_pMsgTextList2[i] != NULL) delete m_pMsgTextList2[i]; m_pMsgTextList2[i] = NULL; } // cType ZeroMemory(cTemp, sizeof(cTemp)); ZeroMemory(cFileName, sizeof(cFileName)); wsprintf(cTemp, "contents%d", iType); strcat(cFileName, "contents"); strcat(cFileName, "\\"); strcat(cFileName, "\\"); strcat(cFileName, cTemp); strcat(cFileName, ".txt"); hFile = CreateFile(cFileName, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); dwFileSize = GetFileSize(hFile, NULL); if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); pFile = fopen(cFileName, "rt"); if (pFile == NULL) return -1; else { pContents = new char[dwFileSize+1]; if (pContents == NULL) return -1; ZeroMemory(pContents, dwFileSize+1); fread(pContents, dwFileSize, 1, pFile); } fclose(pFile); pStrTok = new class CStrTok(pContents, seps); token = pStrTok->pGet(); while( token != NULL ) { m_pMsgTextList2[iIndex] = new class CMsg(NULL, token, NULL); token = pStrTok->pGet(); iIndex++; } delete pStrTok; delete[] pContents; return iIndex; } void CGame::DlgBoxClick_Party(short msX, short msY) { short sX, sY; sX = m_stDialogBoxInfo[32].sX; sY = m_stDialogBoxInfo[32].sY; switch (m_stDialogBoxInfo[32].cMode) { case 0: if (m_iPartyStatus == 0) { if ((msX > sX + 80) && (msX < sX + 195) && (msY > sY + 80) && (msY < sY + 100)) { m_stDialogBoxInfo[32].cMode = 2; m_bIsGetPointingMode = TRUE; m_iPointCommandType = 200; PlaySound('E', 14, 5); } } if (m_iPartyStatus != 0) { if ((msX > sX + 80) && (msX < sX + 195) && (msY > sY + 100) && (msY < sY + 120)) { m_stDialogBoxInfo[32].cMode = 11; PlaySound('E', 14, 5); } } if (m_iPartyStatus != 0) { if ((msX > sX + 80) && (msX < sX + 195) && (msY > sY + 120) && (msY < sY + 140)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_JOINPARTY, NULL, 2, NULL, NULL, m_cMCName); m_stDialogBoxInfo[32].cMode = 4; PlaySound('E', 14, 5); } } if ((msX > sX + 80) && (msX < sX + 195) && (msY > sY + 140) && (msY < sY + 160)) { m_partyAutoAccept = !m_partyAutoAccept; PlaySound('E', 14, 5); } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DisableDialogBox(32); break; case 1: if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_ACCEPTJOINPARTY, NULL, 1, NULL, NULL, m_stDialogBoxInfo[32].cStr); DisableDialogBox(32); PlaySound('E', 14, 5); } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_ACCEPTJOINPARTY, NULL, 0, NULL, NULL, m_stDialogBoxInfo[32].cStr); DisableDialogBox(32); PlaySound('E', 14, 5); } break; case 2: if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { m_stDialogBoxInfo[32].cMode = 0; PlaySound('E', 14, 5); } break; case 3: if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { m_stDialogBoxInfo[32].cMode = 0; bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_ACCEPTJOINPARTY, NULL, 2, NULL, NULL, m_stDialogBoxInfo[32].cStr); DisableDialogBox(32); PlaySound('E', 14, 5); } break; case 4: case 6: case 7: case 8: case 9: case 10: if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { m_stDialogBoxInfo[32].cMode = 0; PlaySound('E', 14, 5); } break; case 11: if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_JOINPARTY, NULL, NULL, NULL, NULL, m_cMCName); m_stDialogBoxInfo[32].cMode = 5; PlaySound('E', 14, 5); } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { m_stDialogBoxInfo[32].cMode = 0; PlaySound('E', 14, 5); } break; } } void CGame::DlgBoxClick_CrusadeJob(short msX, short msY) { short sX, sY; sX = m_stDialogBoxInfo[33].sX; sY = m_stDialogBoxInfo[33].sY; switch (m_stDialogBoxInfo[33].cMode) { case 1: if( m_side == NEUTRAL ) { DisableDialogBox(33); PlaySound('E', 14, 5); }else if (m_side == ARESDEN) { if (m_iGuildRank == 0) { if ((msX > sX + 24) && (msX < sX + 246) && (msY > sY + 150) && (msY < sY + 165)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_SELECTCRUSADEDUTY, NULL, 3, NULL, NULL, NULL); DisableDialogBox(33); PlaySound('E', 14, 5); } }else { if ((msX > sX + 24) && (msX < sX + 246) && (msY > sY + 150) && (msY < sY + 165)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_SELECTCRUSADEDUTY, NULL, 1, NULL, NULL, NULL); DisableDialogBox(33); } if (m_iGuildRank != -1) { if ((msX > sX + 24) && (msX < sX + 246) && (msY > sY + 175) && (msY < sY + 190)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_SELECTCRUSADEDUTY, NULL, 2, NULL, NULL, NULL); DisableDialogBox(33); PlaySound('E', 14, 5); } } } }else if (m_side == ELVINE) { if (m_iGuildRank == 0) { if ((msX > sX + 24) && (msX < sX + 246) && (msY > sY + 150) && (msY < sY + 165)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_SELECTCRUSADEDUTY, NULL, 3, NULL, NULL, NULL); DisableDialogBox(33); PlaySound('E', 14, 5); } }else { if ((msX > sX + 24) && (msX < sX + 246) && (msY > sY + 150) && (msY < sY + 165)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_SELECTCRUSADEDUTY, NULL, 1, NULL, NULL, NULL); DisableDialogBox(33); PlaySound('E', 14, 5); } if (m_iGuildRank != -1) { if ((msX > sX + 24) && (msX < sX + 246) && (msY > sY + 175) && (msY < sY + 190)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_SELECTCRUSADEDUTY, NULL, 2, NULL, NULL, NULL); DisableDialogBox(33); PlaySound('E', 14, 5); } } } } if ((msX > sX + 210) && (msX < sX + 260) && (msY >= sY + 296) && (msY <= sY + 316)) { DisableDialogBox(18); EnableDialogBox(18, 813, NULL, NULL); PlaySound('E', 14, 5); } break; case 2: if ((msX > sX + 24) && (msX < sX + 246) && (msY > sY + 160) && (msY < sY + 175)) { switch (m_iCrusadeDuty) { case 1: EnableDialogBox(18, 803, NULL, NULL); break; case 2: EnableDialogBox(18, 805, NULL, NULL); break; case 3: EnableDialogBox(18, 808, NULL, NULL); break; } } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { DisableDialogBox(33); PlaySound('E', 14, 5); } break; } } void CGame::_RequestMapStatus(char * pMapName, int iMode) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_MAPSTATUS, NULL, iMode, NULL, NULL, pMapName); } void CGame::AddMapStatusInfo(char * pData, BOOL bIsLastData) { char * cp, cTotal; short * sp, sIndex; int i; ZeroMemory(m_cStatusMapName, sizeof(m_cStatusMapName)); cp = (char *)(pData + 6); memcpy(m_cStatusMapName, cp, 10); cp += 10; sp = (short *)cp; sIndex = *sp; cp += 2; cTotal = *cp; cp++; for (i = 1; i <= cTotal; i++) { m_stCrusadeStructureInfo[sIndex].cType = *cp; cp++; sp = (short *)cp; m_stCrusadeStructureInfo[sIndex].sX = *sp; cp += 2; sp = (short *)cp; m_stCrusadeStructureInfo[sIndex].sY = *sp; cp += 2; m_stCrusadeStructureInfo[sIndex].cSide = *cp; cp++; sIndex++; } if (bIsLastData == TRUE) { while (sIndex < MAXCRUSADESTRUCTURES) { m_stCrusadeStructureInfo[sIndex].cType = NULL; m_stCrusadeStructureInfo[sIndex].sX = NULL; m_stCrusadeStructureInfo[sIndex].sY = NULL; m_stCrusadeStructureInfo[sIndex].cSide = NULL; sIndex++; } } } bool CGame::GetText(HWND hWnd,UINT msg,WPARAM wparam, LPARAM lparam) { int len; HIMC hIMC=NULL; if (m_pInputBuffer == NULL) return FALSE; switch (msg) { /*case WM_IME_COMPOSITION: ZeroMemory(m_cEdit, sizeof(m_cEdit)); if (lparam & GCS_RESULTSTR) { hIMC = ImmGetContext(hWnd); len = ImmGetCompositionString(hIMC, GCS_RESULTSTR, NULL, 0); if( len > 4 ) len = 4; ImmGetCompositionString(hIMC, GCS_RESULTSTR, m_cEdit, len); ImmReleaseContext(hWnd, hIMC); len = strlen(m_pInputBuffer) + strlen(m_cEdit); if (len < m_cInputMaxLen) strcpy(m_pInputBuffer+strlen(m_pInputBuffer),m_cEdit); ZeroMemory(m_cEdit, sizeof(m_cEdit)); } else if (lparam & GCS_COMPSTR) { hIMC = ImmGetContext(hWnd); len = ImmGetCompositionString(hIMC, GCS_COMPSTR, NULL, 0); if( len > 4 ) len = 4; ImmGetCompositionString(hIMC, GCS_COMPSTR, m_cEdit, len); ImmReleaseContext(hWnd, hIMC); len = strlen(m_pInputBuffer) + strlen(m_cEdit); if (len >= m_cInputMaxLen) ZeroMemory(m_cEdit, sizeof(m_cEdit)); } return TRUE;*/ case WM_CHAR: if(wparam == 8) { if(strlen(m_pInputBuffer) > 0) { len = strlen(m_pInputBuffer); switch (GetCharKind(m_pInputBuffer, len-1)) { case 1: m_pInputBuffer[len-1] = NULL; break; case 2: case 3: m_pInputBuffer[len-2] = NULL; m_pInputBuffer[len-1] = NULL; break; } ZeroMemory(m_cEdit, sizeof(m_cEdit)); } } else if ((wparam != 9) && (wparam != 13) && (wparam != 27)) { len = strlen(m_pInputBuffer); if (len >= m_cInputMaxLen-1) return FALSE; m_pInputBuffer[len] = wparam & 0xff; m_pInputBuffer[len+1] = 0; } return TRUE; } return FALSE; } int CGame::GetCharKind(char *str, int index) { int kind=1; do { if(kind==2) kind=3; else { if((unsigned char) *str < 128) kind=1; else kind=2; } str++; index--; } while(index>=0); return kind; } void CGame::ShowReceivedString(BOOL bIsHide) { ZeroMemory(G_cTxt, sizeof(G_cTxt)); #ifdef USING_WIN_IME if( G_hEditWnd != NULL ) GetWindowText(G_hEditWnd, m_pInputBuffer, (int)m_cInputMaxLen); strcpy(G_cTxt, m_pInputBuffer); #else strcpy(G_cTxt, m_pInputBuffer); if( (m_cEdit[0] != 0) && ( strlen(m_pInputBuffer)+strlen(m_cEdit)+1 <= m_cInputMaxLen ) ) { strcpy(G_cTxt + strlen(m_pInputBuffer), m_cEdit); } #endif if (bIsHide == TRUE) { for (unsigned char i = 0; i < strlen(G_cTxt); i++) if (G_cTxt[i] != NULL) G_cTxt[i] = '*'; } if( (G_dwGlobalTime%400) < 210 ) G_cTxt[strlen(G_cTxt)] = '_'; PutString(m_iInputX+1, m_iInputY+1, G_cTxt, RGB(0,0,0)); PutString(m_iInputX, m_iInputY+1, G_cTxt, RGB(0,0,0)); PutString(m_iInputX+1, m_iInputY, G_cTxt, RGB(0,0,0)); PutString(m_iInputX, m_iInputY, G_cTxt, RGB(255,255,255)); } void CGame::ClearInputString() { if (m_pInputBuffer != NULL) ZeroMemory(m_pInputBuffer, sizeof(m_pInputBuffer)); ZeroMemory(m_cEdit, sizeof(m_cEdit)); #ifdef USING_WIN_IME if (G_hEditWnd != NULL) SetWindowText(G_hEditWnd, ""); #endif } void CGame::StartInputString(int sX, int sY, unsigned char iLen, char * pBuffer, BOOL bIsHide) { m_bInputStatus = TRUE; m_iInputX = sX; m_iInputY = sY; m_pInputBuffer = pBuffer; ZeroMemory(m_cEdit, sizeof(m_cEdit)); m_cInputMaxLen = iLen; #ifdef USING_WIN_IME if (bIsHide == FALSE) G_hEditWnd = CreateWindow( RICHEDIT_CLASS, NULL, WS_POPUP | ES_SELFIME, sX-5 , sY -1, iLen*12, 16, G_hWnd, (HMENU)0, G_hInstance, NULL); else G_hEditWnd = CreateWindow( RICHEDIT_CLASS, NULL, WS_POPUP | ES_PASSWORD | ES_SELFIME, sX-5 , sY -1, iLen*12, 16, G_hWnd, (HMENU)0, G_hInstance, NULL); SetWindowText(G_hEditWnd, m_pInputBuffer); SendMessage(G_hEditWnd, EM_EXLIMITTEXT, 0, iLen-1 ); SendMessage(G_hEditWnd, EM_SETLANGOPTIONS, 0, ~IMF_AUTOFONT); COMPOSITIONFORM composform; composform.dwStyle = CFS_POINT; composform.ptCurrentPos.x = sX; composform.ptCurrentPos.y = sY; HIMC hImc = ImmGetContext(G_hWnd); ImmSetCompositionWindow( hImc, &composform ); int StrLen = strlen( m_pInputBuffer ); SendMessage(G_hEditWnd, EM_SETSEL, StrLen, StrLen); #endif } void CGame::EndInputString() { m_bInputStatus = FALSE; #ifdef USING_WIN_IME if (G_hEditWnd != NULL) { GetWindowText(G_hEditWnd, m_pInputBuffer, (int)m_cInputMaxLen); CANDIDATEFORM candiform; SendMessage(G_hEditWnd, WM_IME_CONTROL, IMC_GETCANDIDATEPOS, (LPARAM)&candiform); DestroyWindow(G_hEditWnd); G_hEditWnd = NULL; } #else int len = strlen(m_cEdit); if (len > 0) { m_cEdit[len] = 0; strcpy(m_pInputBuffer+strlen(m_pInputBuffer),m_cEdit); ZeroMemory( m_cEdit, sizeof(m_cEdit) ); } #endif } void CGame::ReceiveString(char *pString) { strcpy(pString, m_pInputBuffer); #ifdef USING_WIN_IME if (G_hEditWnd != NULL) GetWindowText(G_hEditWnd, pString, (int)m_cInputMaxLen); #endif } void CGame::DrawNewDialogBox(char cType, int sX, int sY, int iFrame, BOOL bIsNoColorKey, BOOL bIsTrans) { DWORD dwTime = G_dwGlobalTime; if (m_pSprite[cType] == NULL) return; if (bIsNoColorKey == FALSE) { if (bIsTrans == TRUE) m_pSprite[cType]->PutTransSprite2(sX, sY, iFrame, dwTime); else m_pSprite[cType]->PutSpriteFast(sX, sY, iFrame, dwTime); } else m_pSprite[cType]->PutSpriteFastNoColorKey(sX, sY, iFrame, dwTime); } void CGame::DlgBoxClick_Commander(int msX, int msY) // Snoopy: Fixed for 351 {short sX, sY, tX, tY; double d1, d2, d3; if (m_bIsCrusadeMode == FALSE) return; sX = m_stDialogBoxInfo[36].sX; sY = m_stDialogBoxInfo[36].sY; switch (m_stDialogBoxInfo[36].cMode) { case 0: // Main if ((msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_stDialogBoxInfo[36].cMode = 1; PlaySound('E', 14, 5); } if ((msX >= sX +20 +50) && (msX <= sX +20 +46 +50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { if (m_iTeleportLocX == -1) { SetTopMsg(CRUSADE_MESSAGE15, 5); }else if (strcmp(m_cMapName, m_cTeleportMapName) == 0) { SetTopMsg(CRUSADE_MESSAGE16, 5); }else { m_stDialogBoxInfo[36].cMode = 2; PlaySound('E', 14, 5); } } if ((msX >= sX +20 +100) && (msX <= sX +20 +46 +100) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_stDialogBoxInfo[36].cMode = 3; m_stDialogBoxInfo[36].sV1 = 0; PlaySound('E', 14, 5); } if ((msX >= sX +20 +150) && (msX <= sX +20 +46 +150) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_stDialogBoxInfo[36].cMode = 4; PlaySound('E', 14, 5); } if ((msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { DisableDialogBox(18); EnableDialogBox(18, 808, NULL, NULL); PlaySound('E', 14, 5); } break; case 1: // Set TP if ((msX >= sX + 15) && (msX <= sX + 15 + 278) && (msY >= sY + 60) && (msY <= sY + 60 + 272)) { d1 = (double)(msX - (sX + 15)); d2 = (double)(524.0f); //(752.0f); d3 = (d2*d1)/279.0f; tX = (int)d3; d1 = (double)(msY - (sY + 60)); d2 = (double)(524.0f); //(680.0f); d3 = (d2*d1)/(280.0f); //253.0f; tY = (int)d3; if (tX < 30) tX = 30; if (tY < 30) tY = 30; if (tX > 494) tX = 494;//722; if (tY > 494) tY = 494;//650; bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SETGUILDTELEPORTLOC, NULL, tX, tY, NULL, "middleland"); m_stDialogBoxInfo[36].cMode = 0; PlaySound('E', 14, 5); _RequestMapStatus("middleland", 1); } if ((msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_stDialogBoxInfo[36].cMode = 0; PlaySound('E', 14, 5); } if ((msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { DisableDialogBox(18); EnableDialogBox(18, 809, NULL, NULL); PlaySound('E', 14, 5); } break; case 2: // Use TP if ((msX >= sX +20 +50) && (msX <= sX +20 +46 +50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_GUILDTELEPORT, NULL, NULL, NULL, NULL, NULL); DisableDialogBox(36); PlaySound('E', 14, 5); } if ((msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_stDialogBoxInfo[36].cMode = 0; PlaySound('E', 14, 5); } if ((msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { DisableDialogBox(18); EnableDialogBox(18, 810, NULL, NULL); PlaySound('E', 14, 5); } break; case 3: // Summon Unit if( m_side == ARESDEN ) { if ((msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 3000) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SUMMONWARUNIT, NULL, 47, 1, m_stDialogBoxInfo[36].sV1, NULL); PlaySound('E', 14, 5); DisableDialogBox(36); } } if ((msX >= sX +20 +50) && (msX <= sX +20 +50 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 2000) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SUMMONWARUNIT, NULL, 46, 1, m_stDialogBoxInfo[36].sV1, NULL); PlaySound('E', 14, 5); DisableDialogBox(36); } } if ((msX >= sX +20 +100) && (msX <= sX +20 +100 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 1000) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SUMMONWARUNIT, NULL, 43, 1, m_stDialogBoxInfo[36].sV1, NULL); PlaySound('E', 14, 5); DisableDialogBox(36); } } if ((msX >= sX +20 +150) && (msX <= sX +20 +150 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 1500) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SUMMONWARUNIT, NULL, 51, 1, m_stDialogBoxInfo[36].sV1, NULL); PlaySound('E', 14, 5); DisableDialogBox(36); } } }else if (m_side == ELVINE) { if ((msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 3000) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SUMMONWARUNIT, NULL, 45, 1, m_stDialogBoxInfo[36].sV1, NULL); PlaySound('E', 14, 5); DisableDialogBox(36); } } if ((msX >= sX +20 +50) && (msX <= sX +20 +50 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 2000) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SUMMONWARUNIT, NULL, 44, 1, m_stDialogBoxInfo[36].sV1, NULL); PlaySound('E', 14, 5); DisableDialogBox(36); } } if ((msX >= sX +20 +100) && (msX <= sX +20 +100 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 1000) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SUMMONWARUNIT, NULL, 43, 1, m_stDialogBoxInfo[36].sV1, NULL); PlaySound('E', 14, 5); DisableDialogBox(36); } } if ((msX >= sX +20 +150) && (msX <= sX +20 +150 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 1500) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SUMMONWARUNIT, NULL, 51, 1, m_stDialogBoxInfo[36].sV1, NULL); PlaySound('E', 14, 5); DisableDialogBox(36); } } } if ((msX >= sX +20) && (msX <= sX +380) && (msY > sY +140) && (msY < sY +160)) { m_stDialogBoxInfo[36].sV1 = 0; PlaySound('E', 14, 5); } if ((msX >= sX +20) && (msX <= sX +380) && (msY > sY +160) && (msY < sY +175)) { m_stDialogBoxInfo[36].sV1 = 1; PlaySound('E', 14, 5); } if ((msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_stDialogBoxInfo[36].cMode = 0; PlaySound('E', 14, 5); } if ((msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { DisableDialogBox(18); EnableDialogBox(18, 811, NULL, NULL); PlaySound('E', 14, 5); } break; case 4: // Set constr if ( (msX >= sX + 15) && (msX <= sX + 15 + 278) && (msY >= sY + 60) && (msY <= sY + 60 + 272)) { d1 = (double)(msX - (sX + 15)); d2 = (double)(524.0);//(752.0f); d3 = (d2*d1)/279.0f; tX = (int)d3; d1 = (double)(msY - (sY + 60)); d2 = (double)(524.0);//(680.0f); d3 = (d2*d1)/(280.0);//253.0f; tY = (int)d3; if (tX < 30) tX = 30; if (tY < 30) tY = 30; if (tX > 494) tX = 494;//722; if (tY > 494) tY = 494;//650; bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SETGUILDCONSTRUCTLOC, NULL, tX, tY, NULL, "middleland"); m_stDialogBoxInfo[36].cMode = 0; PlaySound('E', 14, 5); _RequestMapStatus("middleland", 1); } if ((msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_stDialogBoxInfo[36].cMode = 0; PlaySound('E', 14, 5); } if ((msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { DisableDialogBox(18); EnableDialogBox(18, 812, NULL, NULL); PlaySound('E', 14, 5); } break; } } void CGame::DlgBoxClick_Constructor(int msX, int msY) // Snoopy: Fixed for 351 { short sX, sY; if (m_bIsCrusadeMode == FALSE) return; sX = m_stDialogBoxInfo[37].sX; sY = m_stDialogBoxInfo[37].sY; switch (m_stDialogBoxInfo[37].cMode) { case 0: // Main if ((msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { if (m_iConstructLocX == -1) { SetTopMsg(CRUSADE_MESSAGE14, 5); }else { m_stDialogBoxInfo[37].cMode = 1; PlaySound('E', 14, 5); } } if ((msX >= sX +20 +50) && (msX <= sX +20 +46 +50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { if (m_iTeleportLocX == -1) { SetTopMsg(CRUSADE_MESSAGE15, 5); }else if (strcmp(m_cMapName, m_cTeleportMapName) == 0) { SetTopMsg(CRUSADE_MESSAGE16, 5); }else { m_stDialogBoxInfo[37].cMode = 2; PlaySound('E', 14, 5); } } if ((msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { DisableDialogBox(18); EnableDialogBox(18, 805, NULL, NULL); PlaySound('E', 14, 5); } break; case 1: // Choose building if ((msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY +220) && (msY <= sY +220 +50)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SUMMONWARUNIT, NULL, 38, 1, m_stDialogBoxInfo[36].sV1, NULL); PlaySound('E', 14, 5); DisableDialogBox(37); } if ((msX >= sX +20 +50) && (msX <= sX +20 +50 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SUMMONWARUNIT, NULL, 39, 1, m_stDialogBoxInfo[36].sV1, NULL); PlaySound('E', 14, 5); DisableDialogBox(37); } if ((msX >= sX +20 +100) && (msX <= sX +20 +100 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SUMMONWARUNIT, NULL, 36, 1, m_stDialogBoxInfo[36].sV1, NULL); PlaySound('E', 14, 5); DisableDialogBox(37); } if ((msX >= sX +20 +150) && (msX <= sX +20 +150 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SUMMONWARUNIT, NULL, 37, 1, m_stDialogBoxInfo[36].sV1, NULL); PlaySound('E', 14, 5); DisableDialogBox(37); } if ((msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 322) && (msY <= sY + 322 + 52)) { m_stDialogBoxInfo[37].cMode = 0; PlaySound('E', 14, 5); } if ((msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 322) && (msY <= sY + 322 + 52)) { DisableDialogBox(18); EnableDialogBox(18, 806, NULL, NULL); PlaySound('E', 14, 5); } break; case 2: // Use TP if ((msX >= sX +20 +50) && (msX <= sX +20 +46 +50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) {bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_GUILDTELEPORT, NULL, NULL, NULL, NULL, NULL); DisableDialogBox(37); PlaySound('E', 14, 5); } if ((msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_stDialogBoxInfo[37].cMode = 0; PlaySound('E', 14, 5); } if ((msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { DisableDialogBox(18); EnableDialogBox(18, 807, NULL, NULL); PlaySound('E', 14, 5); } break; } } void CGame::DlgBoxClick_Soldier(int msX, int msY) // Snoopy: Fixed for 351 { short sX, sY; if (m_bIsCrusadeMode == FALSE) return; sX = m_stDialogBoxInfo[38].sX; sY = m_stDialogBoxInfo[38].sY; switch (m_stDialogBoxInfo[38].cMode) { case 0: // Main dlg if ((msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { if (m_iTeleportLocX == -1) { SetTopMsg(CRUSADE_MESSAGE15, 5); }else if (strcmp(m_cMapName, m_cTeleportMapName) == 0) { SetTopMsg(CRUSADE_MESSAGE16, 5); }else { m_stDialogBoxInfo[38].cMode = 1; PlaySound('E', 14, 5); } } if ((msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { DisableDialogBox(18); EnableDialogBox(18, 803, NULL, NULL); PlaySound('E', 14, 5); } break; case 1: // Use TP if ((msX >= sX +20) && (msX <= sX +20 +46+50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_GUILDTELEPORT, NULL, NULL, NULL, NULL, NULL); DisableDialogBox(38); PlaySound('E', 14, 5); } if ((msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_stDialogBoxInfo[38].cMode = 0; PlaySound('E', 14, 5); } if ((msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { DisableDialogBox(18); EnableDialogBox(18, 804, NULL, NULL); PlaySound('E', 14, 5); } break; } } void CGame::SetCameraShakingEffect(short sDist, int iMul) { int iDegree; iDegree = 5 - sDist; if (iDegree <= 0) iDegree = 0; iDegree *= 2; if (iMul != 0) iDegree *= iMul; if (iDegree <= 2) return; m_iCameraShakingDegree = iDegree; } void CGame::MeteorStrikeComing(int iCode) { switch (iCode) { case 1: // SetTopMsg(CRUSADE_MESSAGE0, 5); break; case 2: // SetTopMsg(CRUSADE_MESSAGE10, 10); break; case 3: // SetTopMsg(CRUSADE_MESSAGE90, 5); break; case 4: // SetTopMsg(CRUSADE_MESSAGE11, 10); break; } } void CGame::DrawObjectFOE(int ix, int iy, int iFrame) { if( _iGetFOE(_tmp_iStatus) < 0 ) // red crusade circle { if (iFrame <= 4 ) m_pEffectSpr[38]->PutTransSprite(ix, iy, iFrame, G_dwGlobalTime); } } void CGame::SetTopMsg(const char *pString, unsigned char iLastSec) { ZeroMemory(m_cTopMsg, sizeof(m_cTopMsg)); strcpy(m_cTopMsg, pString); m_iTopMsgLastSec = iLastSec; m_dwTopMsgTime = G_dwGlobalTime; } void CGame::DrawTopMsg() { if (strlen(m_cTopMsg) == 0) return; m_DDraw.DrawShadowBox(0, 0, 639, 30); if ((((G_dwGlobalTime - m_dwTopMsgTime)/250) % 2) == 0) PutAlignedString(0, 639, 10, m_cTopMsg, 255,255,255); if ( G_dwGlobalTime > (m_iTopMsgLastSec*CLOCKS_PER_SEC+m_dwTopMsgTime) ) { ZeroMemory(m_cTopMsg, sizeof(m_cTopMsg)); } } void CGame::DrawAstoriaStats() { wsprintf( G_cTxt, "Deaths/Kills:"); PutString_SprFont3(10, 135, G_cTxt, m_wR[14]*4, m_wG[14]*4, m_wB[14]*4, TRUE, 2); wsprintf( G_cTxt, "%s: %d/%d", sideName[ARESDEN], m_astoriaStats[ARESDEN].deaths, m_astoriaStats[ARESDEN].kills); PutString_SprFont3(10, 155, G_cTxt, m_wR[14]*4, m_wG[14]*4, m_wB[14]*4, TRUE, 2); wsprintf( G_cTxt, "%s: %d/%d", sideName[ELVINE], m_astoriaStats[ELVINE].deaths, m_astoriaStats[ELVINE].kills); PutString_SprFont3(10, 170, G_cTxt, m_wR[14]*4, m_wG[14]*4, m_wB[14]*4, TRUE, 2); if(m_relicOwnedTime != 0) { DWORD currTime = timeGetTime(); wsprintf( G_cTxt, "Time left for %s to win: %u:%.2u", sideName[m_relicOwnedSide], ((m_relicOwnedTime + RELICVICTORYTIME - currTime) / CLOCKS_PER_SEC) / 60, ((m_relicOwnedTime + RELICVICTORYTIME - currTime) / CLOCKS_PER_SEC) % 60 ); PutString_SprFont3(10, 30, G_cTxt, m_wR[3]*4, m_wG[3]*4, m_wB[3]*4, TRUE, 2); } } void CGame::DrawDialogBox_IconPannel(short msX, short msY) { short sX, sY; DWORD dwTime = m_dwCurTime; sX = m_stDialogBoxInfo[30].sX; sY = m_stDialogBoxInfo[30].sY; m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(sX, sY, 14, dwTime); if (m_bIsCombatMode) { if (m_bIsSafeAttackMode) m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(368, 440, 4, dwTime); else m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(368, 440, 5, dwTime); } if ((m_bIsCrusadeMode) && (m_iCrusadeDuty != 0)) { if (m_side == ARESDEN) { if ((322 <= msX) && (355 >= msX) && (434 < msY) && (475 > msY)) m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(322, 434, 1, dwTime); else m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(322, 434, 2, dwTime); } else if (m_side == ELVINE) { if ((322 <= msX) && (355 >= msX) && (434 < msY) && (475 > msY)) m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(322, 434, 0, dwTime); else m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(322, 434, 15, dwTime); } } // CLEROTH - LU if ( m_iLU_Point > 0 ) { if ((322 <= msX) && (355 >= msX) && (434 < msY) && (475 > msY)) m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(322, 434, 17, dwTime); else m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(322, 434, 18, dwTime); } if ((msY > 436) && (msY < 478)) // Menu Icons { if ((msX > 410) && (msX < 447)) { // Character m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(412, 434, 6, dwTime); wsprintf(G_cTxt, "Character Menu"); PutString(msX-10, msY-20, G_cTxt, RGB(250,250,220)); } if ((msX > 447) && (msX < 484)) { // Inventory m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(449, 434, 7, dwTime); wsprintf(G_cTxt, "Inventory"); PutString(msX-10, msY-20, G_cTxt, RGB(250,250,220)); } if ((msX > 484) && (msX < 521)) { // Magic m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(486, 434, 8, dwTime); wsprintf(G_cTxt, "Spell Book"); PutString(msX-10, msY-20, G_cTxt, RGB(250,250,220)); } if ((msX > 521) && (msX < 558)) { // Skill m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(523, 434, 9, dwTime); wsprintf(G_cTxt, "Skill List"); PutString(msX-10, msY-20, G_cTxt, RGB(250,250,220)); } if ((msX > 558) && (msX < 595)) { // History m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(560, 434, 10, dwTime); wsprintf(G_cTxt, "Chat History"); PutString(msX-10, msY-20, G_cTxt, RGB(250,250,220)); } if ((msX > 595) && (msX < 631)) { // System Menu m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFast(597, 434, 11, dwTime); wsprintf(G_cTxt, "Options"); PutString(msX-20, msY-20, G_cTxt, RGB(250,250,220)); } } if ( ((msX > 144) && (msX < 317) && (msY > 434) && (msY < 477)) || (m_bCtrlPressed) ) { int iLev = 0; int iCurExp = m_levelExpTable[m_iLevel]; int iNextExp = m_levelExpTable[m_iLevel+1]; if(m_iExp < iNextExp) { iNextExp = iNextExp - iCurExp; if( m_iExp > iCurExp ) iCurExp = m_iExp - iCurExp; // curxp: partie faite else iCurExp = 0; // below current lvl ! short sPerc = 0; if( iCurExp > 200000 ) sPerc = short( ((iCurExp>>4)*10000)/(iNextExp>>4) ); else sPerc = (short)( (iCurExp*10000)/iNextExp ); wsprintf(G_cTxt, "Required Exp: %d", iNextExp-iCurExp, sPerc/100, sPerc%100); }else { wsprintf(G_cTxt, "Exp: %d(100.00%)", m_iExp); // "Exp: 151000/150000" } }else wsprintf(G_cTxt, "%s(%d,%d)", m_cMapMessage, m_sPlayerX, m_sPlayerY); PutAlignedString(140, 323, 456, G_cTxt, 250,250,220); } void CGame::DrawDialogBox_GaugePannel() { uint32 iMaxPoint, iBarWidth, iTemp; // HP bar iMaxPoint = m_stat[STAT_VIT]*3 + m_iLevel*2 + m_stat[STAT_STR]/2; if (m_iHP > iMaxPoint) m_iHP = iMaxPoint; iBarWidth = 101 - (m_iHP*101)/iMaxPoint; if( iBarWidth < 0 ) iBarWidth = 0; if( iBarWidth > 101 ) iBarWidth = 101; m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFastWidth(23, 437, 12, iBarWidth, m_dwCurTime); wsprintf(G_cTxt, "(%d)", (short) m_iHP); if (m_bIsPoisoned) { PutString_SprNum(85, 441, G_cTxt, m_wR[5]*11, m_wG[5]*11, m_wB[5]*11); PutString_SprFont3(35, 439, "Poisoned", m_wR[5]*8, m_wG[5]*8, m_wB[5]*8, TRUE, 2); } else PutString_SprNum(80, 441, G_cTxt, 200, 100, 100); //MP bar iMaxPoint = m_stat[STAT_MAG]*2 + m_iLevel*2 + m_stat[STAT_INT]/2; if (m_iMP > iMaxPoint) m_iMP = iMaxPoint; iBarWidth = 101 - (m_iMP*101)/iMaxPoint; if( iBarWidth < 0 ) iBarWidth = 0; if( iBarWidth > 101 ) iBarWidth = 101; m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFastWidth(23, 459, 12, iBarWidth, m_dwCurTime); wsprintf(G_cTxt, "%d", m_iMP); PutString_SprNum(80, 463, G_cTxt, 100, 100, 200); // SP bar iMaxPoint = m_iLevel*2 + m_stat[STAT_STR]*2; if (m_iSP > iMaxPoint) m_iSP = iMaxPoint; iBarWidth = 167 - (m_iSP*167)/iMaxPoint; if( iBarWidth < 0 ) iBarWidth = 0; if( iBarWidth > 167 ) iBarWidth = 167; m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFastWidth(147, 434, 13, iBarWidth, m_dwCurTime); iTemp = m_iSP; wsprintf(G_cTxt, "%d", iTemp,iMaxPoint); PutString_SprNum(228, 436, G_cTxt, 100, 100, 200); // Experience Gauge iMaxPoint = m_levelExpTable[m_iLevel+1] - m_levelExpTable[m_iLevel]; iTemp = m_iExp - m_levelExpTable[m_iLevel]; iBarWidth = 167 - (iTemp*167)/iMaxPoint; if( iBarWidth < 0 ) iBarWidth = 0; if( iBarWidth > 167 ) iBarWidth = 167; m_pSprite[SPRID_INTERFACE_ND_ICONPANNEL]->PutSpriteFastWidth(147 + iBarWidth, 434+13, 13, (167-iBarWidth), m_dwCurTime); iTemp = iTemp - iMaxPoint; wsprintf(G_cTxt, "%d", iTemp); PutString_SprNum(228, 435+13, G_cTxt, 100, 100, 200); } void CGame::DrawDialogBox_Text(short msX, short msY, short msZ, char cLB) { short sX, sY; int i, iTotalLines, iPointerLoc; double d1,d2,d3; sX = m_stDialogBoxInfo[18].sX; sY = m_stDialogBoxInfo[18].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 0); iTotalLines = 0; for (i = 0; i < TEXTDLGMAXLINES; i++) if (m_pMsgTextList[i] != NULL) iTotalLines++; if( iTotalLines > 17 ) DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 1); if( iGetTopDialogBoxIndex() == 18 && msZ != 0 ) { m_stDialogBoxInfo[18].sView = m_stDialogBoxInfo[18].sView - msZ/60; m_DInput.m_sZ = 0; } if( m_stDialogBoxInfo[18].sView < 0 ) m_stDialogBoxInfo[18].sView = 0; if( iTotalLines>17 && m_stDialogBoxInfo[18].sView > iTotalLines-17 ) m_stDialogBoxInfo[18].sView = iTotalLines-17; if (iTotalLines > 17) { d1 = (double)m_stDialogBoxInfo[18].sView; d2 = (double)(iTotalLines-17); d3 = (274.0f * d1)/d2; iPointerLoc = (int)(d3+0.5); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 1); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX+242, sY+35+iPointerLoc, 7); } else iPointerLoc = 0; for (i = 0; i < 17; i++) if (m_pMsgTextList[i + m_stDialogBoxInfo[18].sView] != NULL) { if (m_bDialogTrans == FALSE) { switch (m_pMsgTextList[i + m_stDialogBoxInfo[18].sView]->m_pMsg[0]) { case '_': PutAlignedString(sX +24, sX +236, sY + 50 +i*13, (m_pMsgTextList[i + m_stDialogBoxInfo[18].sView]->m_pMsg+1), 255,255,255); break; case ';': PutAlignedString(sX +24, sX +236, sY + 50 +i*13, (m_pMsgTextList[i + m_stDialogBoxInfo[18].sView]->m_pMsg+1), 4, 0, 50); break; default: PutAlignedString(sX +24, sX +236, sY + 50 +i*13, m_pMsgTextList[i + m_stDialogBoxInfo[18].sView]->m_pMsg, 45,25,25); break; } } else PutAlignedString(sX +24, sX +236, sY + 50 +i*13, m_pMsgTextList[i + m_stDialogBoxInfo[18].sView]->m_pMsg, 0,0,0); } if (cLB != 0 && iTotalLines > 17) { if ((iGetTopDialogBoxIndex() == 18)) { if ((msX >= sX + 240) && (msX <= sX + 260) && (msY >= sY + 40) && (msY <= sY + 320)) { d1 = (double)(msY -(sY+35)); d2 = (double)(iTotalLines-17); d3 = (d1 * d2)/274.0f; iPointerLoc = (int)d3; if (iPointerLoc > iTotalLines-17) iPointerLoc = iTotalLines-17; m_stDialogBoxInfo[18].sView = iPointerLoc; } } } else m_stDialogBoxInfo[18].bIsScrollSelected = FALSE; if ((msX > sX + RBTNPOSX) && (msX < sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); } void CGame::DrawDialogBox_15AgeMsg(short msX, short msY) { return; // Snoopy: removed FeedbackCard & minus 15 age } void CGame::DrawDialogBox_WarningMsg(short msX, short msY)//6 { short sX, sY; sX = m_stDialogBoxInfo[6].sX; sY = m_stDialogBoxInfo[6].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, sX, sY, 2); PutString2(sX + 72, sY + 32, MSG_WARNING1, 200,200,25);//" ** This is a battle area **" PutString(sX + 30, sY + 55, MSG_WARNING2, RGB(220,130,45) );//"This is a dangerous area where you" PutString(sX + 30, sY + 72, MSG_WARNING3, RGB(220,130,45) );//"cannot protected from others' attack." PutString(sX + 30, sY + 90, MSG_WARNING4, RGB(220,130,45) );//"To play the game in safe, go to the" PutString(sX + 30, sY +108, MSG_WARNING5, RGB(220,130,45) );//" cityhall and change to civilian mode." if ((msX >= sX + 122 ) && (msX <= sX + 125 + BTNSZX ) && (msY >= sY + 127 ) && (msY <= sY + 127 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 122, sY + 127 , 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 122, sY + 127 , 0); } void CGame::DrawDialogBox_ItemDrop(short msX, short msY) { short sX, sY; char cTxt[120], cStr1[64], cStr2[64], cStr3[64]; sX = m_stDialogBoxInfo[4].sX; sY = m_stDialogBoxInfo[4].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME1, sX, sY, 2); GetItemName(m_pItemList[m_stDialogBoxInfo[4].sView]->m_cName, m_pItemList[m_stDialogBoxInfo[4].sView]->m_dwAttribute, cStr1, cStr2, cStr3 ); if (strlen(m_stDialogBoxInfo[4].cStr) == 0) wsprintf(cTxt, "%s", cStr1); if(m_bIsSpecial) { PutString(sX + 35, sY + 20, cTxt, RGB(0, 255, 0)); PutString(sX + 36, sY + 20, cTxt, RGB(0, 255, 0)); }else { PutString(sX + 35, sY + 20, cTxt, RGB(4,0,50)); PutString(sX + 36, sY + 20, cTxt, RGB(4,0,50)); } PutString(sX + 35, sY + 36, DRAW_DIALOGBOX_ITEM_DROP1 , RGB(4,0,50)); PutString(sX + 36, sY + 36, DRAW_DIALOGBOX_ITEM_DROP1, RGB(4,0,50)); if(m_bItemDrop) { if ((msX >= sX + 35) && (msX <= sX + 240 ) && (msY >= sY + 80) && (msY <= sY + 90)) { PutString(sX + 35, sY + 80, DRAW_DIALOGBOX_ITEM_DROP2, RGB(255,255,255)); PutString(sX + 36, sY + 80, DRAW_DIALOGBOX_ITEM_DROP2, RGB(255,255,255)); }else { PutString(sX + 35, sY + 80, DRAW_DIALOGBOX_ITEM_DROP2, RGB(4,0,50)); PutString(sX + 36, sY + 80, DRAW_DIALOGBOX_ITEM_DROP2, RGB(4,0,50)); } }else { if ((msX >= sX + 35) && (msX <= sX + 240 ) && (msY >= sY + 80) && (msY <= sY + 90)) { PutString(sX + 35, sY + 80, DRAW_DIALOGBOX_ITEM_DROP3, RGB(255,255,255)); PutString(sX + 36, sY + 80, DRAW_DIALOGBOX_ITEM_DROP3, RGB(255,255,255)); }else { PutString(sX + 35, sY + 80, DRAW_DIALOGBOX_ITEM_DROP3, RGB(4,0,50)); PutString(sX + 36, sY + 80, DRAW_DIALOGBOX_ITEM_DROP3, RGB(4,0,50)); } } if ((msX >= sX + 30) && (msX <= sX + 30 + BTNSZX) && (msY >= sY + 55) && (msY <= sY + 55 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 30, sY + 55 ,19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 30, sY + 55 , 18); if ((msX >= sX + 170 ) && (msX <= sX + 170 + BTNSZX ) && (msY >= sY + 55 ) && (msY <= sY + 55 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 170 , sY + 55 , 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 170, sY + 55 , 2); } void CGame::DrawDialogBox_NpcTalk(short msX, short msY, char cLB) { short sX, sY; int i, iTotalLines, iPointerLoc; double d1, d2, d3; sX = m_stDialogBoxInfo[21].sX; sY = m_stDialogBoxInfo[21].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); switch (m_stDialogBoxInfo[21].cMode) { case 0: // OK if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 1: // Accept / Decline if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 33); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 32); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 41); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 40); break; case 2: // Next if ((msX >= sX + 190) && (msX <= sX + 278) && (msY >= sY + 296) && (msY <= sY + 316)) PutString_SprFont(sX + 190, sY + 270, "Next", 6,6,20); else PutString_SprFont(sX + 190, sY + 270, "Next", 0,0,7); break; } for (i = 0; i < 17; i++) if ((i < TEXTDLGMAXLINES) && (m_pMsgTextList2[i + m_stDialogBoxInfo[21].sView] != NULL)) { PutAlignedString(sX, sX+m_stDialogBoxInfo[21].sSizeX, sY + 57 +i*15, m_pMsgTextList2[i + m_stDialogBoxInfo[21].sView]->m_pMsg, 45,25,25); } iTotalLines = 0; for (i = 0; i < TEXTDLGMAXLINES; i++) if (m_pMsgTextList2[i] != NULL) iTotalLines++; if (iTotalLines > 17) { d1 = (double)m_stDialogBoxInfo[21].sView; d2 = (double)(iTotalLines-17); d3 = (274.0f * d1)/d2; iPointerLoc = (int)d3; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 3); } else iPointerLoc = 0; if (cLB != 0 && iTotalLines > 17) { if ((iGetTopDialogBoxIndex() == 21)) { if ((msX >= sX + 240) && (msX <= sX + 260) && (msY >= sY + 40) && (msY <= sY + 320)) { d1 = (double)(msY -(sY+40)); d2 = (double)(iTotalLines-17); d3 = (d1 * d2)/274.0f; iPointerLoc = (int)d3; if (iPointerLoc > iTotalLines) iPointerLoc = iTotalLines; m_stDialogBoxInfo[21].sView = iPointerLoc; } } } else m_stDialogBoxInfo[21].bIsScrollSelected = FALSE; } void CGame::DrawDialogBox_Slates(short msX, short msY, short msZ, char cLB) { int iAdjX, iAdjY; short sX, sY; DWORD dwTime = m_dwCurTime; iAdjX = 5 ; iAdjY = 8 ; switch (m_stDialogBoxInfo[40].cMode) { // Slates Dialog - Diuuude case 1: sX = m_stDialogBoxInfo[40].sX; sY = m_stDialogBoxInfo[40].sY; iAdjX = -1; iAdjY = -7; DrawNewDialogBox(SPRID_INTERFACE_ND_INVENTORY, sX, sY, 4); if (m_stDialogBoxInfo[40].sV1 != -1){ DrawNewDialogBox(SPRID_INTERFACE_ND_INVENTORY, sX+20, sY+12, 5); } if (m_stDialogBoxInfo[40].sV2 != -1){ DrawNewDialogBox(SPRID_INTERFACE_ND_INVENTORY, sX+20, sY+87, 6); } if (m_stDialogBoxInfo[40].sV3 != -1){ DrawNewDialogBox(SPRID_INTERFACE_ND_INVENTORY, sX+85, sY+32, 7); } if (m_stDialogBoxInfo[40].sV4 != -1){ DrawNewDialogBox(SPRID_INTERFACE_ND_INVENTORY, sX+70, sY+97, 8); } if ((m_stDialogBoxInfo[40].sV1 != -1) && (m_stDialogBoxInfo[40].sV2 != -1) && (m_stDialogBoxInfo[40].sV3 != -1) && (m_stDialogBoxInfo[40].sV4 != -1)){ if ((msX >= sX + 120) && (msX <= sX + 180) && (msY >= sY + 150) && (msY <= sY + 165)) PutString_SprFont(sX + 120, sY + 150, "Casting", 6,6,20); else PutString_SprFont(sX + 120, sY + 150, "Casting", 0, 0, 7); } break; // Slates Dialog - Diuuude case 2: PlaySound('E', 16, 0); if (m_stDialogBoxInfo[40].cStr[0] != 0) { sX = m_stDialogBoxInfo[40].sX + iAdjX + (m_stDialogBoxInfo[40].cStr[0] - (rand() % (m_stDialogBoxInfo[40].cStr[0]*2))); sY = m_stDialogBoxInfo[40].sY + iAdjY + (m_stDialogBoxInfo[40].cStr[0] - (rand() % (m_stDialogBoxInfo[40].cStr[0]*2))); }else { sX = m_stDialogBoxInfo[40].sX; sY = m_stDialogBoxInfo[40].sY; } m_pSprite[SPRID_INTERFACE_ND_INVENTORY]->PutSpriteFast(sX, sY, 4, dwTime); m_pSprite[SPRID_INTERFACE_ND_INVENTORY]->PutSpriteFast(sX+22, sY+14, 3, dwTime); //PutString_SprFont(sX + iAdjX + 170, sY + iAdjY + 170, "KURURURURURURURURU!!!", 20,6,6); PutAlignedString(199, 438, 201, "KURURURURURURURURU!!!", 220,140,160); PutAlignedString(200, 439, 200, "KURURURURURURURURU!!!", 90,220,200); if ((dwTime - m_stDialogBoxInfo[40].dwT1) > 1000) { m_stDialogBoxInfo[40].dwT1 = dwTime; m_stDialogBoxInfo[40].cStr[0]++; } if (m_stDialogBoxInfo[40].cStr[0] >= 5) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_CREATESLATE, NULL, m_stDialogBoxInfo[40].sV1, m_stDialogBoxInfo[40].sV2, m_stDialogBoxInfo[40].sV3, NULL, m_stDialogBoxInfo[40].sV4); DisableDialogBox(40); } break; } } void CGame::DlgBoxClick_Slates(short msX, short msY) { int iAdjX, iAdjY; short sX, sY; sX = m_stDialogBoxInfo[40].sX; sY = m_stDialogBoxInfo[40].sY; iAdjX = 5 ; iAdjY = 8 ; switch (m_stDialogBoxInfo[40].cMode) { // Slates DialogBox - Diuuude case 1: if ((m_stDialogBoxInfo[40].sV1 != -1) && (m_stDialogBoxInfo[40].sV2 != -1) && (m_stDialogBoxInfo[40].sV3 != -1) && (m_stDialogBoxInfo[40].sV4 != -1)){ if ((msX >= sX + 120) && (msX <= sX + 180) && (msY >= sY + 150) && (msY <= sY + 165)){ m_stDialogBoxInfo[40].cMode = 2; PlaySound('E', 14, 5); } } break; } } void CGame::DlgBoxClick_NpcTalk(int msX, int msY) { short sX, sY; sX = m_stDialogBoxInfo[21].sX; sY = m_stDialogBoxInfo[21].sY; switch (m_stDialogBoxInfo[21].cMode) { case 0: // OK if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { DisableDialogBox(21); PlaySound('E', 14, 5); } break; case 1: // Accept / Decline if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Accept bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_QUESTACCEPTED, NULL, NULL, NULL, NULL, NULL); DisableDialogBox(21); PlaySound('E', 14, 5); } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Cancel DisableDialogBox(21); PlaySound('E', 14, 5); } break; case 2: // Next if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { DisableDialogBox(21); PlaySound('E', 14, 5); } break; } } void CGame::TimeStamp(char * pString) { SYSTEMTIME SysTime; GetLocalTime(&SysTime); wsprintf(pString, "%02d:%02d:%02d", SysTime.wHour, SysTime.wMinute, SysTime.wSecond); } void CGame::DrawDialogBox_Chat(short msX, short msY, short msZ, char cLB) { short sX, sY; int i, iPointerLoc; double d1, d2, d3; sX = m_stDialogBoxInfo[10].sX; sY = m_stDialogBoxInfo[10].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 4, FALSE, m_bDialogTrans); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 22, FALSE, m_bDialogTrans); if ( msZ != 0 && (iGetTopDialogBoxIndex() == 10)) { m_stDialogBoxInfo[10].sView = m_stDialogBoxInfo[10].sView + msZ/30; m_DInput.m_sZ = 0; } if( m_stDialogBoxInfo[10].sView < 0 ) m_stDialogBoxInfo[10].sView = 0; if( m_stDialogBoxInfo[10].sView > MAXCHATSCROLLMSGS-8 ) m_stDialogBoxInfo[10].sView = MAXCHATSCROLLMSGS-8; d1 = (double)m_stDialogBoxInfo[10].sView; d2 = (double)(105); d3 = (d1*d2)/(MAXCHATSCROLLMSGS-8); iPointerLoc = (int)d3; iPointerLoc = 105 - iPointerLoc; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX +346, sY + 33 + iPointerLoc, 7); for (i = 0; i < 8; i++) if (m_pChatScrollList[i + m_stDialogBoxInfo[10].sView] != NULL) { int32 r = 0,g = 0,b = 0; switch ( m_pChatScrollList[i + m_stDialogBoxInfo[10].sView]->m_dwTime ) { case CHAT_NORMAL: r = 230; g = 230; b = 230; break; case CHAT_GUILD: r = 130; g = 200; b = 130; break; case CHAT_SHOUT: r = 255; g = 130; b = 130; break; case CHAT_NATIONSHOUT: r = 130; g = 130; b = 255; break; case CHAT_PARTY: r = 230; g = 230; b = 130; break; case CHAT_GM: r = 180; g = 255; b = 180; break; case CHAT_WHISPER: r = 150; g = 150; b = 170; break; } PutString2(sX + 25, sY + 127 - i*13, m_pChatScrollList[i + m_stDialogBoxInfo[10].sView]->m_pMsg, r, g, b); } if ( (cLB != 0) && (iGetTopDialogBoxIndex()==10) ) { if ((msX >= sX + 336) && (msX <= sX + 361) && (msY >= sY + 28) && (msY <= sY + 140)) { d1 = (double)(msY - (sY + 28)); d2 = ((MAXCHATSCROLLMSGS-8)*d1)/105.0f; m_stDialogBoxInfo[10].sView = MAXCHATSCROLLMSGS - 8 - (int)d2; } if ((msX >= sX + 336) && (msX <= sX + 361) && (msY > sY + 18) && (msY < sY + 28)) m_stDialogBoxInfo[10].sView = MAXCHATSCROLLMSGS - 8; if ((msX >= sX + 336) && (msX <= sX + 361) && (msY > sY + 140) && (msY < sY + 163)) m_stDialogBoxInfo[10].sView = 0; } else m_stDialogBoxInfo[10].bIsScrollSelected = FALSE; } void CGame::DlgBoxClick_ItemUpgrade(int msX, int msY) {short sX, sY; int i, iSoX, iSoM; sX = m_stDialogBoxInfo[34].sX; sY = m_stDialogBoxInfo[34].sY; switch (m_stDialogBoxInfo[34].cMode) { case 1: // Upgrade Majestic, items in the window if ((m_stDialogBoxInfo[34].sV1 != -1) && (msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { int iValue = (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_dwAttribute & 0xF0000000) >> 28; iValue = iValue*(iValue+6)/8 + 2; if( m_iGizonItemUpgradeLeft < iValue ) break; PlaySound('E', 14, 5); PlaySound('E', 44, 0); m_stDialogBoxInfo[34].cMode = 2; m_stDialogBoxInfo[34].dwV1 = timeGetTime(); } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Cancel PlaySound('E', 14, 5); DisableDialogBox(34); } break; case 3: // sucess case 4: // Not possible case 7: // Lost item case 8: // Failed case 9: // Failed case 10:// Failed case 12:// 12 Need stone! if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { // OK PlaySound('E', 14, 5); DisableDialogBox(34); } break; case 5: // main menu if ((msX > sX +24) && (msX < sX +248) && (msY > sY +100) && (msY < sY +115)) { PlaySound('E', 14, 5); iSoX = iSoM = 0; for (i = 0; i < MAXITEMS; i++) if (m_pItemList[i] != NULL) { if ((m_pItemList[i]->m_sSprite == 6) && (m_pItemList[i]->m_sSpriteFrame == 128)) iSoX++; if ((m_pItemList[i]->m_sSprite == 6) && (m_pItemList[i]->m_sSpriteFrame == 129)) iSoM++; } if ((iSoX > 0) || (iSoM > 0)) { m_stDialogBoxInfo[34].cMode = 6; m_stDialogBoxInfo[34].sV2 = iSoX; m_stDialogBoxInfo[34].sV3 = iSoM; } else AddEventList(DRAW_DIALOGBOX_ITEMUPGRADE30, 10); //"Stone of Xelima or Merien is not present." } if ((msX > sX +24) && (msX < sX +248) && (msY > sY +120) && (msY < sY +135)) { m_stDialogBoxInfo[34].cMode = 1; PlaySound('E', 14, 5); } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Cancel PlaySound('E', 14, 5); DisableDialogBox(34); } break; case 6: // Upgrade Xelima / Merien if ((m_stDialogBoxInfo[34].sV1 != -1) && (msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Upgrade PlaySound('E', 14, 5); PlaySound('E', 44, 0); m_stDialogBoxInfo[34].cMode = 2; m_stDialogBoxInfo[34].dwV1 = timeGetTime(); } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Cancel PlaySound('E', 14, 5); DisableDialogBox(34); } break; } } void CGame::DlgBoxClick_SellList(short msX, short msY) {int i, x; short sX, sY; sX = m_stDialogBoxInfo[31].sX; sY = m_stDialogBoxInfo[31].sY; for (i = 0; i < MAXSELLLIST; i++) if ((msX > sX + 25) && (msX < sX + 250) && (msY >= sY + 55 + i*15) && (msY <= sY + 55 + 14 + i*15)) { if (m_pItemList[m_stSellItemList[i].iIndex] != NULL) { m_bIsItemDisabled[m_stSellItemList[i].iIndex] = FALSE; m_stSellItemList[i].iIndex = -1; PlaySound('E', 14, 5); for (x = 0; x < MAXSELLLIST-1; x++) if (m_stSellItemList[x].iIndex == -1) { m_stSellItemList[x].iIndex = m_stSellItemList[x+1].iIndex; m_stSellItemList[x].iAmount = m_stSellItemList[x+1].iAmount; m_stSellItemList[x+1].iIndex = -1; m_stSellItemList[x+1].iAmount = 0; } } return; } if ((msX >= sX + 30) && (msX <= sX + 30 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Sell bSendCommand(MSGID_REQUEST_SELLITEMLIST, NULL, NULL, NULL, NULL, NULL, NULL); PlaySound('E', 14, 5); DisableDialogBox(31); } if ((msX >= sX + 154) && (msX <= sX + 154 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Cancel PlaySound('E', 14, 5); DisableDialogBox(31); } } // 3.51 LevelUp Box - Diuuude void CGame::DlgBoxClick_LevelUpSettings(short msX, short msY) { short sX, sY; char cStat = NONE; int statChange; if (m_bCtrlPressed == TRUE) statChange = 5; else statChange = 1; sX = m_stDialogBoxInfo[12].sX; sY = m_stDialogBoxInfo[12].sY; if ((msY >= sY + 127) && (msY <= sY + 133)) cStat = STAT_STR; if ((msY >= sY + 146) && (msY <= sY + 152)) cStat = STAT_VIT; if ((msY >= sY + 165) && (msY <= sY + 171)) cStat = STAT_DEX; if ((msY >= sY + 184) && (msY <= sY + 190)) cStat = STAT_INT; if ((msY >= sY + 203) && (msY <= sY + 209)) cStat = STAT_MAG; if ((msY >= sY + 222) && (msY <= sY + 228)) cStat = STAT_CHR; if(cStat != NONE && (msX >= sX + 195) && (msX <= sX + 205)) { if(statChange > m_iLU_Point) statChange = m_iLU_Point; if(m_stat[cStat] - m_angelStat[cStat] + m_luStat[cStat] + statChange > 200) statChange = 200 - (m_stat[cStat] - m_angelStat[cStat] + m_luStat[cStat]); if(statChange < 0) statChange = 0; if(m_iLU_Point >= statChange) m_luStat[cStat] += statChange; else{ statChange = m_luStat[cStat]; m_luStat[cStat] = 0; } PlaySound('E', 14, 5); m_iLU_Point -= statChange; } if(cStat != NONE && (msX >= sX + 210) && (msX <= sX + 220)) { if(statChange > m_luStat[cStat]){ statChange = m_luStat[cStat]; m_luStat[cStat] = 0; }else m_luStat[cStat] -= statChange; PlaySound('E', 14, 5); m_iLU_Point += statChange; } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { if (m_stDialogBoxInfo[12].sV1 != m_iLU_Point) // Send command to HG - Diuuude, Only if changed - Snoopy bSendCommand(MSGID_LEVELUPSETTINGS, NULL, NULL, NULL, NULL, NULL, NULL); //m_luStat[STAT_STR] = m_luStat[STAT_VIT] = m_luStat[STAT_DEX] = m_luStat[STAT_INT] = m_luStat[STAT_MAG] = m_luStat[STAT_CHR] = 0; DisableDialogBox(12); PlaySound('E', 14, 5); } if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { // Change stats with Majestic if ( (m_iGizonItemUpgradeLeft >0) && (m_iLU_Point <= 0) && (m_luStat[STAT_STR] == 0)&&(m_luStat[STAT_VIT] == 0)&&(m_luStat[STAT_DEX] == 0)&&(m_luStat[STAT_INT] == 0)&&(m_luStat[STAT_MAG] == 0)&&(m_luStat[STAT_CHR] == 0)) { DisableDialogBox(12); EnableDialogBox(42, 0, 0, 0); //PlaySound('E', 14, 5); } } } void CGame::CannotConstruct(int iCode) { switch (iCode) { case 1: // SetTopMsg(CRUSADE_MESSAGE18, 5); break; case 2: // wsprintf(G_cTxt, "%s XY(%d, %d)", CRUSADE_MESSAGE19, m_iConstructLocX, m_iConstructLocY); SetTopMsg(G_cTxt, 5); break; case 3: // SetTopMsg(CRUSADE_MESSAGE20, 5); break; case 4: // SetTopMsg(CRUSADE_MESSAGE20, 5); break; } } void CGame::DisplayCommaNumber_G_cTxt(int iGold) {char cGold[20]; int iStrLen; ZeroMemory(cGold, sizeof(cGold)); ZeroMemory(G_cTxt, sizeof(G_cTxt)); _itoa(iGold, cGold, 10); #ifdef COMMA_GOLD iStrLen = strlen(cGold); iStrLen--; int cnt = 0; for (int i = 0 ; i < iStrLen+1 ; i++) { if( (cnt != 0) && ((cnt+1)%4 == 0) ) { G_cTxt[cnt] = ','; i--; }else G_cTxt[cnt] = cGold[iStrLen-i]; cnt++; } iStrLen = strlen(G_cTxt); G_cTxt[iStrLen] = '\0'; _strrev(G_cTxt); #else strcpy(G_cTxt, cGold); #endif } void CGame::DrawDialogBox_Inventory(int msX, int msY) {int i; short sX, sY; DWORD dwTime = m_dwCurTime; char cItemColor; sX = m_stDialogBoxInfo[2].sX; sY = m_stDialogBoxInfo[2].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_INVENTORY, sX, sY, 0); for (i = 0; i < MAXITEMS; i++) if ((m_cItemOrder[i] != -1) && (m_pItemList[m_cItemOrder[i]] != NULL)) { if ( ((m_stMCursor.cSelectedObjectType == SELECTEDOBJTYPE_ITEM) && (m_stMCursor.sSelectedObjectID == m_cItemOrder[i])) || (m_bIsItemEquipped[m_cItemOrder[i]] == TRUE) ) {}else { cItemColor = m_pItemList[m_cItemOrder[i]]->m_cItemColor; if (m_bIsItemDisabled[ m_cItemOrder[i] ] == TRUE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_cItemOrder[i]]->m_sSprite]->PutTransSprite2(sX + 32 + m_pItemList[m_cItemOrder[i]]->m_sX, sY + 44 + m_pItemList[m_cItemOrder[i]]->m_sY, m_pItemList[m_cItemOrder[i]]->m_sSpriteFrame, dwTime); else { if ( (m_pItemList[m_cItemOrder[i]]->m_cEquipPos == EQUIPPOS_LHAND) || (m_pItemList[m_cItemOrder[i]]->m_cEquipPos == EQUIPPOS_RHAND) || (m_pItemList[m_cItemOrder[i]]->m_cEquipPos == EQUIPPOS_TWOHAND)) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_cItemOrder[i]]->m_sSprite]->PutTransSpriteRGB(sX + 32 + m_pItemList[m_cItemOrder[i]]->m_sX, sY + 44 + m_pItemList[m_cItemOrder[i]]->m_sY, m_pItemList[m_cItemOrder[i]]->m_sSpriteFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], dwTime); }else { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_cItemOrder[i]]->m_sSprite]->PutTransSpriteRGB(sX + 32 + m_pItemList[m_cItemOrder[i]]->m_sX, sY + 44 + m_pItemList[m_cItemOrder[i]]->m_sY, m_pItemList[m_cItemOrder[i]]->m_sSpriteFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], dwTime); } } }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_cItemOrder[i]]->m_sSprite]->PutSpriteFast(sX + 32 + m_pItemList[m_cItemOrder[i]]->m_sX, sY + 44 + m_pItemList[m_cItemOrder[i]]->m_sY, m_pItemList[m_cItemOrder[i]]->m_sSpriteFrame, dwTime); else { if ( (m_pItemList[m_cItemOrder[i]]->m_cEquipPos == EQUIPPOS_LHAND) || (m_pItemList[m_cItemOrder[i]]->m_cEquipPos == EQUIPPOS_RHAND) || (m_pItemList[m_cItemOrder[i]]->m_cEquipPos == EQUIPPOS_TWOHAND)) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_cItemOrder[i]]->m_sSprite]->PutSpriteRGB(sX + 32 + m_pItemList[m_cItemOrder[i]]->m_sX, sY + 44 + m_pItemList[m_cItemOrder[i]]->m_sY, m_pItemList[m_cItemOrder[i]]->m_sSpriteFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], dwTime); }else { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_cItemOrder[i]]->m_sSprite]->PutSpriteRGB(sX + 32 + m_pItemList[m_cItemOrder[i]]->m_sX, sY + 44 + m_pItemList[m_cItemOrder[i]]->m_sY, m_pItemList[m_cItemOrder[i]]->m_sSpriteFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], dwTime); } } } if ( (m_pItemList[m_cItemOrder[i]]->m_cItemType == ITEMTYPE_CONSUME) || (m_pItemList[m_cItemOrder[i]]->m_cItemType == ITEMTYPE_ARROW) ) { DisplayCommaNumber_G_cTxt((int)m_pItemList[m_cItemOrder[i]]->m_dwCount); // nbe show, as US: 1,200,000 PutString2(sX + 29 + m_pItemList[m_cItemOrder[i]]->m_sX +10, sY + 41 + m_pItemList[m_cItemOrder[i]]->m_sY +10 , G_cTxt, 200,200,200); } } } if ((msX >= sX +23) && (msX <= sX +76) && (msY >= sY +172) && (msY <= sY +184)) { DrawNewDialogBox(SPRID_INTERFACE_ND_INVENTORY, sX+23, sY+172, 1); } if ((msX >= sX +140) && (msX <= sX +212) && (msY >= sY +172) && (msY <= sY +184)) { DrawNewDialogBox(SPRID_INTERFACE_ND_INVENTORY, sX+140, sY+172, 2); } } void CGame::CrusadeContributionResult(int iWarContribution) {int i; char cTemp[120]; DisableDialogBox(18); for (i = 0; i < TEXTDLGMAXLINES; i++) { if (m_pMsgTextList[i] != NULL) delete m_pMsgTextList[i]; m_pMsgTextList[i] = NULL; } if (iWarContribution > 0) { PlaySound('E', 23, 0, 0); PlaySound('C', 21, 0, 0); PlaySound('C', 22, 0, 0); m_pMsgTextList[0] = new class CMsg(NULL, CRUSADE_MESSAGE22, NULL); m_pMsgTextList[1] = new class CMsg(NULL, CRUSADE_MESSAGE23, NULL); m_pMsgTextList[2] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[3] = new class CMsg(NULL, CRUSADE_MESSAGE24, NULL); m_pMsgTextList[4] = new class CMsg(NULL, CRUSADE_MESSAGE25, NULL); m_pMsgTextList[5] = new class CMsg(NULL, CRUSADE_MESSAGE26, NULL); m_pMsgTextList[6] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[7] = new class CMsg(NULL, CRUSADE_MESSAGE27, NULL); m_pMsgTextList[8] = new class CMsg(NULL, " ", NULL); ZeroMemory(cTemp, sizeof(cTemp)); wsprintf(cTemp, "You Gained %dExp Points!", iWarContribution*35); m_pMsgTextList[9] = new class CMsg(NULL, cTemp, NULL); for (i = 9; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); }else if (iWarContribution < 0) { PlaySound('E', 24, 0, 0); PlaySound('C', 12, 0, 0); PlaySound('C', 13, 0, 0); m_pMsgTextList[0] = new class CMsg(NULL, CRUSADE_MESSAGE28, NULL); m_pMsgTextList[1] = new class CMsg(NULL, CRUSADE_MESSAGE29, NULL); m_pMsgTextList[2] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[3] = new class CMsg(NULL, CRUSADE_MESSAGE30, NULL); m_pMsgTextList[4] = new class CMsg(NULL, CRUSADE_MESSAGE31, NULL); m_pMsgTextList[5] = new class CMsg(NULL, CRUSADE_MESSAGE32, NULL); m_pMsgTextList[6] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[7] = new class CMsg(NULL, CRUSADE_MESSAGE33, NULL); m_pMsgTextList[8] = new class CMsg(NULL, CRUSADE_MESSAGE34, NULL); for (i = 9; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); }else if (iWarContribution == 0) { PlaySound('E', 25, 0, 0); m_pMsgTextList[0] = new class CMsg(NULL, CRUSADE_MESSAGE50, NULL); // The battle that you have participated m_pMsgTextList[1] = new class CMsg(NULL, CRUSADE_MESSAGE51, NULL); // is already finished; m_pMsgTextList[2] = new class CMsg(NULL, CRUSADE_MESSAGE52, NULL); // m_pMsgTextList[3] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[4] = new class CMsg(NULL, CRUSADE_MESSAGE53, NULL); // You must connect after finishing m_pMsgTextList[5] = new class CMsg(NULL, CRUSADE_MESSAGE54, NULL); // the previous and before starting m_pMsgTextList[6] = new class CMsg(NULL, CRUSADE_MESSAGE55, NULL); // the next battle so you can receive m_pMsgTextList[7] = new class CMsg(NULL, CRUSADE_MESSAGE56, NULL); // the prize for (i = 8; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); } EnableDialogBox(18, NULL, NULL, NULL); } void CGame::CrusadeWarResult(int iWinnerSide) { int i; DisableDialogBox(18); for (i = 0; i < TEXTDLGMAXLINES; i++) { if (m_pMsgTextList[i] != NULL) delete m_pMsgTextList[i]; m_pMsgTextList[i] = NULL; } if (m_side == 0) { switch (iWinnerSide) { case 0: PlaySound('E', 25, 0, 0); m_pMsgTextList[0] = new class CMsg(NULL, CRUSADE_MESSAGE35, NULL); // All out war finished! m_pMsgTextList[1] = new class CMsg(NULL, CRUSADE_MESSAGE36, NULL); // There was a draw in the m_pMsgTextList[2] = new class CMsg(NULL, CRUSADE_MESSAGE37, NULL); // battle m_pMsgTextList[3] = new class CMsg(NULL, " ", NULL); break; case 1: PlaySound('E', 25, 0, 0); m_pMsgTextList[0] = new class CMsg(NULL, CRUSADE_MESSAGE35, NULL); // All out war finished! m_pMsgTextList[1] = new class CMsg(NULL, CRUSADE_MESSAGE38, NULL); // Aresden was victorious m_pMsgTextList[2] = new class CMsg(NULL, CRUSADE_MESSAGE39, NULL); // and put an end to the war m_pMsgTextList[3] = new class CMsg(NULL, " ", NULL); break; case 2: PlaySound('E', 25, 0, 0); m_pMsgTextList[0] = new class CMsg(NULL, CRUSADE_MESSAGE35, NULL); // All out war finished! m_pMsgTextList[1] = new class CMsg(NULL, CRUSADE_MESSAGE40, NULL); // Elvine was victorious m_pMsgTextList[2] = new class CMsg(NULL, CRUSADE_MESSAGE41, NULL); // and put an end to the war m_pMsgTextList[3] = new class CMsg(NULL, " ", NULL); break; } for (i = 4; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); }else { if (iWinnerSide == 0) { PlaySound('E', 25, 0, 0); m_pMsgTextList[0] = new class CMsg(NULL, CRUSADE_MESSAGE35, NULL); // All out war finished! m_pMsgTextList[1] = new class CMsg(NULL, CRUSADE_MESSAGE36, NULL); // There was a draw in the m_pMsgTextList[2] = new class CMsg(NULL, CRUSADE_MESSAGE37, NULL); // battle m_pMsgTextList[3] = new class CMsg(NULL, " ", NULL); for (i = 4; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); }else { if (iWinnerSide == m_side) { PlaySound('E', 23, 0, 0); PlaySound('C', 21, 0, 0); PlaySound('C', 22, 0, 0); switch (iWinnerSide) { case 1: m_pMsgTextList[0] = new class CMsg(NULL, CRUSADE_MESSAGE35, NULL); // All out war finished!; m_pMsgTextList[1] = new class CMsg(NULL, CRUSADE_MESSAGE38, NULL); // Aresden was victorious; m_pMsgTextList[2] = new class CMsg(NULL, CRUSADE_MESSAGE39, NULL); // and put an end to the war m_pMsgTextList[3] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[4] = new class CMsg(NULL, CRUSADE_MESSAGE42, NULL); // Congratulations! m_pMsgTextList[5] = new class CMsg(NULL, CRUSADE_MESSAGE43, NULL); // As a victorious citizen m_pMsgTextList[6] = new class CMsg(NULL, CRUSADE_MESSAGE44, NULL); // You will receive m_pMsgTextList[7] = new class CMsg(NULL, CRUSADE_MESSAGE45, NULL); // a prize break; case 2: m_pMsgTextList[0] = new class CMsg(NULL, CRUSADE_MESSAGE35, NULL); // All out war finished! m_pMsgTextList[1] = new class CMsg(NULL, CRUSADE_MESSAGE40, NULL); // Elvine was victorious m_pMsgTextList[2] = new class CMsg(NULL, CRUSADE_MESSAGE41, NULL); // and put an end to the war m_pMsgTextList[3] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[4] = new class CMsg(NULL, CRUSADE_MESSAGE42, NULL); // Congratulations! m_pMsgTextList[5] = new class CMsg(NULL, CRUSADE_MESSAGE43, NULL); // As a victorious citizen m_pMsgTextList[6] = new class CMsg(NULL, CRUSADE_MESSAGE44, NULL); // You will receive m_pMsgTextList[7] = new class CMsg(NULL, CRUSADE_MESSAGE45, NULL); // a prize break; } for (i = 8; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); }else if (iWinnerSide != m_side) { PlaySound('E', 24, 0, 0); PlaySound('C', 12, 0, 0); PlaySound('C', 13, 0, 0); switch (iWinnerSide) { case 1: m_pMsgTextList[0] = new class CMsg(NULL, CRUSADE_MESSAGE35, NULL); // All out war finished! m_pMsgTextList[1] = new class CMsg(NULL, CRUSADE_MESSAGE38, NULL); // Aresden was victorious; m_pMsgTextList[2] = new class CMsg(NULL, CRUSADE_MESSAGE39, NULL); // and put an end to the war m_pMsgTextList[3] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[4] = new class CMsg(NULL, CRUSADE_MESSAGE46, NULL); // Unfortunately, m_pMsgTextList[5] = new class CMsg(NULL, CRUSADE_MESSAGE47, NULL); // As a losser citizen m_pMsgTextList[6] = new class CMsg(NULL, CRUSADE_MESSAGE48, NULL); // the prize that accomplishes m_pMsgTextList[7] = new class CMsg(NULL, CRUSADE_MESSAGE49, NULL); // will not be given. break; case 2: m_pMsgTextList[0] = new class CMsg(NULL, CRUSADE_MESSAGE35, NULL); // All out war finished! m_pMsgTextList[1] = new class CMsg(NULL, CRUSADE_MESSAGE40, NULL); // Elvine was victorious m_pMsgTextList[2] = new class CMsg(NULL, CRUSADE_MESSAGE41, NULL); // and put an end to the war m_pMsgTextList[3] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[4] = new class CMsg(NULL, CRUSADE_MESSAGE46, NULL); // Unfortunately, m_pMsgTextList[5] = new class CMsg(NULL, CRUSADE_MESSAGE47, NULL); // As a losser citizen m_pMsgTextList[6] = new class CMsg(NULL, CRUSADE_MESSAGE48, NULL); // the prize that accomplishes m_pMsgTextList[7] = new class CMsg(NULL, CRUSADE_MESSAGE49, NULL); // will not be given. break; } for (i = 8; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); } } } EnableDialogBox(18, NULL, NULL, NULL); DisableDialogBox(36); DisableDialogBox(37); DisableDialogBox(38); } void CGame::_Draw_UpdateScreen_OnCreateNewAccount() { m_DDraw.ClearBackB4(); DrawNewDialogBox(SPRID_INTERFACE_ND_NEWACCOUNT, 0,0,0, TRUE); PutString2(329, 110, m_cAccountName, 200,200,200); PutString( 329, 125, m_cAccountPassword, RGB(200,200,200), TRUE, 1); PutString( 329, 140, m_cAccountPassword, RGB(200,200,200), TRUE, 1); PutString2(194, 257, m_cEmailAddr, 200,200,200); } void CGame::DrawChatMsgBox(short sX, short sY, int iChatIndex, BOOL bIsPreDC) { char cMsg[200], cMsgA[22], cMsgB[22], cMsgC[22], * cp; int iRet, iLines, i, iSize, iSize2, iLoc, iFontSize; DWORD dwTime; COLORREF rgb; BOOL bIsTrans; RECT rcRect; SIZE Size; ZeroMemory(cMsg, sizeof(cMsg)); ZeroMemory(cMsgA, sizeof(cMsgA)); ZeroMemory(cMsgB, sizeof(cMsgB)); ZeroMemory(cMsgC, sizeof(cMsgC)); dwTime = m_pChatMsgList[iChatIndex]->m_dwTime; strcpy(cMsg, m_pChatMsgList[iChatIndex]->m_pMsg); cp = (char *)cMsg; iLines = 0; rgb = RGB(255,255,255); switch (m_pChatMsgList[iChatIndex]->m_cType) { case 1: rgb = RGB(255,255,255); break; case 20: rgb = RGB(255,255,20); if ((m_dwCurTime - dwTime) < 650) return; else dwTime += 650; break; case 41: rgb = RGB(255,80,80); break; case 42: rgb = RGB(255,80,80); if ((m_dwCurTime - dwTime) < 650) return; else dwTime += 650; break; } if (strlen(cp) != 0) { memcpy(cMsgA, cp, 20); iRet = GetCharKind(cMsgA, 19); if (iRet == CODE_HAN1) { cMsgA[20] = cp[20]; cp++; } cp += 20; iLines = 1; } if (strlen(cp) != 0) { memcpy(cMsgB, cp, 20); iRet = GetCharKind(cMsgB, 19); if (iRet == CODE_HAN1) { cMsgB[20] = cp[20]; cp++; } cp += 20; iLines = 2; } if (strlen(cp) != 0) { memcpy(cMsgC, cp, 20); iRet = GetCharKind(cMsgC, 19); if (iRet == CODE_HAN1) { cMsgC[20] = cp[20]; cp++; } cp += 20; iLines = 3; } iSize = 0; for (i = 0; i < 20; i++) if (cMsgA[i] != 0) if ((unsigned char)cMsgA[i] >= 128) { iSize += 5; //6 i++; } else iSize += 4; iLoc = m_dwCurTime - dwTime; switch (m_pChatMsgList[iChatIndex]->m_cType) { case 21: case 22: case 23://... if( iLoc > 80 ) iLoc = 10; else iLoc = iLoc>>3; break; default:// if( iLoc > 352 ) iLoc = 9; else if( iLoc > 320 ) iLoc = 10; else iLoc = iLoc>>5; break; } if (m_cDetailLevel == 0) bIsTrans = FALSE; else bIsTrans = TRUE; switch (m_pChatMsgList[iChatIndex]->m_cType) { case 41: case 42: iSize2 = 0; for (i = 0; i < 100; i++) if (cMsg[i] != 0) if ((unsigned char)cMsg[i] >= 128) { iSize2 += 5; i++; } else iSize2 += 4; if( m_Misc.bCheckIMEString(cMsg) == FALSE ) { PutString(sX - iSize2, sY - 65 - iLoc, cMsg, RGB(180, 30, 30)); PutString(sX - iSize2+1, sY - 65 - iLoc, cMsg, RGB(180, 30, 30)); } else PutString_SprFont3(sX - iSize2, sY - 65 - iLoc, cMsg, m_wR[14]*4, m_wG[14]*4, m_wB[14]*4, FALSE, 0); break; case 21: case 22: case 23: iFontSize = 23 - (int)m_pChatMsgList[iChatIndex]->m_cType; switch (iLines) { case 1: PutString_SprFont3(sX - iSize, sY - 65 - iLoc, cMsgA, m_wR[13]*2, m_wG[13]*2, m_wB[13]*2, bIsTrans, iFontSize); break; case 2: PutString_SprFont3(sX - iSize, sY - 81 - iLoc, cMsgA, m_wR[13]*2, m_wG[13]*2, m_wB[13]*2, bIsTrans, iFontSize); PutString_SprFont3(sX - iSize, sY - 65 - iLoc, cMsgB, m_wR[13]*2, m_wG[13]*2, m_wB[13]*2, bIsTrans, iFontSize); break; case 3: PutString_SprFont3(sX - iSize, sY - 97 - iLoc, cMsgA, m_wR[13]*2, m_wG[13]*2, m_wB[13]*2, bIsTrans, iFontSize); PutString_SprFont3(sX - iSize, sY - 81 - iLoc, cMsgB, m_wR[13]*2, m_wG[13]*2, m_wB[13]*2, bIsTrans, iFontSize); PutString_SprFont3(sX - iSize, sY - 65 - iLoc, cMsgC, m_wR[13]*2, m_wG[13]*2, m_wB[13]*2, bIsTrans, iFontSize); break; } break; case 20: default: if (bIsPreDC == FALSE) m_DDraw._GetBackBufferDC(); GetTextExtentPoint32(m_DDraw.m_hDC, cMsg, strlen(cMsg), &Size); switch (Size.cx / 160) { case 0: SetRect(&rcRect, sX-80 +1, sY-65 -iLoc, sX+80 +1, sY -iLoc); m_DDraw.DrawText(&rcRect, cMsg, RGB(0,0,0)); SetRect(&rcRect, sX-80, sY-65 -iLoc +1, sX+80, sY -iLoc +1); m_DDraw.DrawText(&rcRect, cMsg, RGB(0,0,0)); SetRect(&rcRect, sX-80, sY-65 -iLoc, sX+80, sY -iLoc); m_DDraw.DrawText(&rcRect, cMsg, rgb); break; case 1: SetRect(&rcRect, sX-80 +1, sY-83 -iLoc, sX+80 +1, sY -iLoc); m_DDraw.DrawText(&rcRect, cMsg, RGB(0,0,0)); SetRect(&rcRect, sX-80, sY-83 -iLoc +1, sX+80, sY -iLoc +1); m_DDraw.DrawText(&rcRect, cMsg, RGB(0,0,0)); SetRect(&rcRect, sX-80, sY-83 -iLoc, sX+80, sY -iLoc); m_DDraw.DrawText(&rcRect, cMsg, rgb); break; case 2: SetRect(&rcRect, sX-80 +1, sY-101 -iLoc, sX+80 +1, sY -iLoc); m_DDraw.DrawText(&rcRect, cMsg, RGB(0,0,0)); SetRect(&rcRect, sX-80, sY-101 -iLoc +1, sX+80, sY -iLoc +1); m_DDraw.DrawText(&rcRect, cMsg, RGB(0,0,0)); SetRect(&rcRect, sX-80, sY-101 -iLoc, sX+80, sY -iLoc); m_DDraw.DrawText(&rcRect, cMsg, rgb); break; case 3: SetRect(&rcRect, sX-80 +1, sY-119 -iLoc, sX+80 +1, sY -iLoc); m_DDraw.DrawText(&rcRect, cMsg, RGB(0,0,0)); SetRect(&rcRect, sX-80, sY-119 -iLoc +1, sX+80, sY -iLoc +1); m_DDraw.DrawText(&rcRect, cMsg, RGB(0,0,0)); SetRect(&rcRect, sX-80, sY-119 -iLoc, sX+80, sY -iLoc); m_DDraw.DrawText(&rcRect, cMsg, rgb); break; } if (bIsPreDC == FALSE) m_DDraw._ReleaseBackBufferDC(); break; } } void CGame::ClearContents_OnSelectCharacter() { m_cCurFocus = 1; } void CGame::UpdateScreen_OnSelectCharacter() { short sX, sY, msX, msY, msZ; char cLB, cRB, cMB, cTotalChar; char cMIresult; static class CMouseInterface * pMI; DWORD dwTime; static DWORD dwCTime; int iMIbuttonNum; dwTime = timeGetTime(); sX = 0; sY = 0; cTotalChar = 0; if (m_cGameModeCount == 0) { G_cSpriteAlphaDegree = 1; InitGameSettings(); pMI = new class CMouseInterface; pMI->AddRect(100, 50, 210, 250); pMI->AddRect(211, 50, 321, 250); pMI->AddRect(322, 50, 431, 250); pMI->AddRect(432, 50, 542, 250); pMI->AddRect(360,283,545,315); pMI->AddRect(360,316,545,345); pMI->AddRect(360,346,545,375); pMI->AddRect(360,376,545,405); pMI->AddRect(360,406,545,435); m_cMaxFocus = 4; if (m_cCurFocus > m_cMaxFocus) m_cCurFocus = 1; if (m_cCurFocus < 1) m_cCurFocus = 1; m_cArrowPressed = 0; m_bEnterPressed = FALSE; dwCTime = timeGetTime(); } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; if (m_cArrowPressed != 0) { switch (m_cArrowPressed) { case 2: m_cCurFocus++; if (m_cCurFocus > m_cMaxFocus) m_cCurFocus = 1; break; case 4: m_cCurFocus--; if (m_cCurFocus <= 0) m_cCurFocus = m_cMaxFocus; break; } m_cArrowPressed = 0; } if (m_bEscPressed == TRUE) { ChangeGameMode(GAMEMODE_ONMAINMENU); delete pMI; m_bEscPressed = FALSE; return; } if (m_bEnterPressed == TRUE) { m_bEnterPressed = FALSE; PlaySound('E', 14, 5); if (m_pCharList[m_cCurFocus-1] != NULL) { if (m_pCharList[m_cCurFocus-1]->m_sSex != NULL) { ZeroMemory(m_cPlayerName, sizeof(m_cPlayerName)); strcpy(m_cPlayerName, m_pCharList[m_cCurFocus-1]->m_cName); m_iLevel = (int)m_pCharList[m_cCurFocus-1]->m_sLevel; if (m_Misc.bCheckValidString(m_cPlayerName) == TRUE) { m_pSprite[SPRID_INTERFACE_ND_LOGIN]->_iCloseSprite(); m_pSprite[SPRID_INTERFACE_ND_MAINMENU]->_iCloseSprite(); m_pLSock = new class XSocket(m_hWnd, SOCKETBLOCKLIMIT); m_pLSock->bConnect(m_cLogServerAddr, m_iLogServerPort +(rand()%1), WM_USER_LOGSOCKETEVENT); m_pLSock->bInitBufferSize(30000); ChangeGameMode(GAMEMODE_ONCONNECTING); m_dwConnectMode = MSGID_REQUEST_ENTERGAME; m_wEnterGameType = ENTERGAMEMSGTYPE_NEW; ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg,"33"); ZeroMemory(m_cMapName, sizeof(m_cMapName)); memcpy(m_cMapName, m_pCharList[m_cCurFocus-1]->m_cMapName, 10); delete pMI; return; } } }else { _InitOnCreateNewCharacter(); ChangeGameMode(GAMEMODE_ONCREATENEWCHARACTER); delete pMI; return; } } m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); UpdateScreen_OnSelectCharacter(sX, sY, msX, msY); if ((dwTime - dwCTime) > 100) { m_cMenuFrame++; dwCTime = dwTime; } if (m_cMenuFrame >= 8) { m_cMenuDirCnt++; if (m_cMenuDirCnt > 8) { m_cMenuDir++; m_cMenuDirCnt = 1; } m_cMenuFrame = 0; } if (m_cMenuDir > 8) m_cMenuDir = 1; DrawVersion(); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); iMIbuttonNum = pMI->iGetStatus(msX, msY, cLB, &cMIresult); if (cMIresult == MIRESULT_CLICK) { PlaySound('E', 14, 5); switch (iMIbuttonNum) { case 1: case 2: case 3: case 4: if (m_cCurFocus != iMIbuttonNum) m_cCurFocus = iMIbuttonNum; else { if (m_pCharList[m_cCurFocus-1] != NULL) { if (m_pCharList[m_cCurFocus-1]->m_sSex != NULL) { ZeroMemory(m_cPlayerName, sizeof(m_cPlayerName)); strcpy(m_cPlayerName, m_pCharList[m_cCurFocus-1]->m_cName); m_iLevel = (int)m_pCharList[m_cCurFocus-1]->m_sLevel; if (m_Misc.bCheckValidString(m_cPlayerName) == TRUE) { m_pSprite[SPRID_INTERFACE_ND_LOGIN]->_iCloseSprite(); m_pSprite[SPRID_INTERFACE_ND_MAINMENU]->_iCloseSprite(); m_pLSock = new class XSocket(m_hWnd, SOCKETBLOCKLIMIT); m_pLSock->bConnect(m_cLogServerAddr, m_iLogServerPort +(rand()%1), WM_USER_LOGSOCKETEVENT); m_pLSock->bInitBufferSize(30000); ChangeGameMode(GAMEMODE_ONCONNECTING); m_dwConnectMode = MSGID_REQUEST_ENTERGAME; m_wEnterGameType = ENTERGAMEMSGTYPE_NEW; ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg,"33"); ZeroMemory(m_cMapName, sizeof(m_cMapName)); memcpy(m_cMapName, m_pCharList[m_cCurFocus-1]->m_cMapName, 10); delete pMI; return; } } }else { _InitOnCreateNewCharacter(); ChangeGameMode(GAMEMODE_ONCREATENEWCHARACTER); delete pMI; return; } } break; case 5: if (m_pCharList[m_cCurFocus - 1] != NULL) { if (m_pCharList[m_cCurFocus-1]->m_sSex != NULL) { ZeroMemory(m_cPlayerName, sizeof(m_cPlayerName)); strcpy(m_cPlayerName, m_pCharList[m_cCurFocus-1]->m_cName); m_iLevel = (int)m_pCharList[m_cCurFocus-1]->m_sLevel; if (m_Misc.bCheckValidString(m_cPlayerName) == TRUE) { m_pSprite[SPRID_INTERFACE_ND_LOGIN]->_iCloseSprite(); m_pSprite[SPRID_INTERFACE_ND_MAINMENU]->_iCloseSprite(); m_pLSock = new class XSocket(m_hWnd, SOCKETBLOCKLIMIT); m_pLSock->bConnect(m_cLogServerAddr, m_iLogServerPort +(rand()%1), WM_USER_LOGSOCKETEVENT); m_pLSock->bInitBufferSize(30000); ChangeGameMode(GAMEMODE_ONCONNECTING); m_dwConnectMode = MSGID_REQUEST_ENTERGAME; m_wEnterGameType = ENTERGAMEMSGTYPE_NEW; ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg,"33"); ZeroMemory(m_cMapName, sizeof(m_cMapName)); memcpy(m_cMapName, m_pCharList[m_cCurFocus-1]->m_cMapName, 10); delete pMI; return; } } } break; case 6: if (m_iTotalChar < 4) { _InitOnCreateNewCharacter(); ChangeGameMode(GAMEMODE_ONCREATENEWCHARACTER); delete pMI; return; } break; case 7: if ((m_pCharList[m_cCurFocus - 1] != NULL) && (m_pCharList[m_cCurFocus - 1]->m_sLevel <= MAXDELETELEVEL)) { ChangeGameMode(GAMEMODE_ONQUERYDELETECHARACTER); m_wEnterGameType = m_cCurFocus; delete pMI; return; } break; case 8: ChangeGameMode(GAMEMODE_ONCHANGEPASSWORD); delete pMI; return; case 9: ChangeGameMode(GAMEMODE_ONMAINMENU); delete pMI; return; } } // if (m_cGameModeCount < 6) m_DDraw.DrawShadowBox(0,0,639,479); // if (m_cGameModeCount < 2) m_DDraw.DrawShadowBox(0,0,639,479); if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } BOOL CGame::bDlgBoxPress_Character(short msX, short msY) { int i; short sX, sY, sSprH, sFrame; char cEquipPoiStatus[MAXITEMEQUIPPOS]; if (m_bIsDialogEnabled[17] == TRUE) return FALSE; sX = m_stDialogBoxInfo[1].sX; sY = m_stDialogBoxInfo[1].sY; for (i = 0; i < MAXITEMEQUIPPOS; i++) cEquipPoiStatus[i] = -1; for (i = 0; i < MAXITEMS; i++) { if ((m_pItemList[i] != NULL) && (m_bIsItemEquipped[i] == TRUE)) cEquipPoiStatus[ m_pItemList[i]->m_cEquipPos ] = i; } if ((m_sPlayerType >= 1) && (m_sPlayerType <= 3)) { if (cEquipPoiStatus[EQUIPPOS_HEAD] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_HEAD]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_HEAD]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 72, sY + 135, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_HEAD]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_RFINGER] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_RFINGER]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_RFINGER]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 32, sY + 193, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_RFINGER]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_LFINGER] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_LFINGER]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_LFINGER]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 100, sY + 185, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_LFINGER]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_NECK] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_NECK]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_NECK]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 35, sY + 120, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_NECK]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_TWOHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_TWOHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_TWOHAND]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 57, sY + 186, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_TWOHAND]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_RHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_RHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_RHAND]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 57, sY + 186, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_RHAND]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_LHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_LHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_LHAND]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 90, sY + 170, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_LHAND]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_FULLBODY] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_FULLBODY]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_FULLBODY]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_FULLBODY]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_BODY] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BODY]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BODY]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_BODY]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_BOOTS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_BOOTS]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_ARMS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_ARMS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_ARMS]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_ARMS]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_PANTS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_PANTS]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_BACK] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BACK]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BACK]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison( sX + 41, sY + 137, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_BACK]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } }else if ((m_sPlayerType >= 4) && (m_sPlayerType <= 6)) { if (cEquipPoiStatus[EQUIPPOS_HEAD] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_HEAD]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_HEAD]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 72, sY + 139, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_HEAD]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_RFINGER] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_RFINGER]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_RFINGER]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 32, sY + 193, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_RFINGER]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_LFINGER] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_LFINGER]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_LFINGER]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 100, sY + 185, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_LFINGER]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_NECK] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_NECK]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_NECK]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 35, sY + 120, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_NECK]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_TWOHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_TWOHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_TWOHAND]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 60, sY + 191, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_TWOHAND]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_RHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_RHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_RHAND]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 60, sY + 191, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_RHAND]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_LHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_LHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_LHAND]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 84, sY + 175, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_LHAND]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_BODY] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BODY]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BODY]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_BODY]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_FULLBODY] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_FULLBODY]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_FULLBODY]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_FULLBODY]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_BOOTS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_BOOTS]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_ARMS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_ARMS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_ARMS]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_ARMS]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_PANTS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_PANTS]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } if (cEquipPoiStatus[EQUIPPOS_BACK] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BACK]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BACK]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 45, sY + 143, sFrame, msX, msY ) ) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = m_sItemEquipmentStatus[EQUIPPOS_BACK]; m_stMCursor.sDistX = 0; m_stMCursor.sDistY = 0; return TRUE; } } } return FALSE; } void CGame::DlgBoxClick_CityhallMenu(short msX, short msY) { static const enum modes{ LEGIONPTSSERVICES = 9, TELEPORTLIST = 10 }; short sX, sY; int i; sX = m_stDialogBoxInfo[13].sX; sY = m_stDialogBoxInfo[13].sY; short szX = m_stDialogBoxInfo[13].sSizeX; switch (m_stDialogBoxInfo[13].cMode) { case 0: if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 70) && (msY < sY + 95)) { if (m_side != NEUTRAL) return; m_stDialogBoxInfo[13].cMode = 1; // citizenship rq PlaySound('E', 14, 5); } if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 95) && (msY < sY + 120)) { if (m_iRewardGold <= 0) return; m_stDialogBoxInfo[13].cMode = 5; // rq reward gold PlaySound('E', 14, 5); } if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 120) && (msY < sY + 145)) { if (m_iEnemyKillCount < 100) return; m_stDialogBoxInfo[13].cMode = 7; PlaySound('E', 14, 5); } if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 145) && (msY < sY + 170)) { if (m_stQuest.sQuestType == NULL) return; m_stDialogBoxInfo[13].cMode = 8; PlaySound('E', 14, 5); } // Legion point services if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 170) && (msY < sY + 195)) { m_stDialogBoxInfo[13].cMode = LEGIONPTSSERVICES; PlaySound('E', 14, 5); bSendCommand(MSGID_REQUEST_LGNPTS, NULL,NULL,0,0,0,NULL); } // Teleport List if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 195) && (msY < sY + 220)) { m_stDialogBoxInfo[13].cMode = TELEPORTLIST; bSendCommand(MSGID_REQUEST_TELEPORT_LIST, NULL, NULL, NULL, NULL, NULL, "William"); PlaySound('E', 14, 5); } if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 220) && (msY < sY + 245)) { if (m_bIsCrusadeMode == FALSE) return; EnableDialogBox(33, 1, NULL, NULL); PlaySound('E', 14, 5); } break; case 1: if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Yes Click bSendCommand(MSGID_REQUEST_CIVILRIGHT, MSGTYPE_CONFIRM, NULL, NULL, NULL, NULL, NULL); m_stDialogBoxInfo[13].cMode = 2; PlaySound('E', 14, 5); } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // No Click m_stDialogBoxInfo[13].cMode = 0; PlaySound('E', 14, 5); } break; case 3: // case 4: if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { // No Click m_stDialogBoxInfo[13].cMode = 0; PlaySound('E', 14, 5); } break; case 5: if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Yes bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_GETREWARDMONEY, NULL, NULL, NULL, NULL, NULL); m_stDialogBoxInfo[13].cMode = 0; PlaySound('E', 14, 5); } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // No m_stDialogBoxInfo[13].cMode = 0; PlaySound('E', 14, 5); } break; // 3.51 Cityhall Menu - Request Hero's Items - Diuuude - fix by Drajwer case 7: // Hero's Cape if ((msX >= sX + 35) && (msX <= sX + 220) && (msY >= sY + 95) && (msY <= sY + 110)) { ZeroMemory(m_cTakeHeroItemName,sizeof(m_cTakeHeroItemName)); memcpy(m_cTakeHeroItemName,DRAW_DIALOGBOX_CITYHALL_MENU47,strlen(DRAW_DIALOGBOX_CITYHALL_MENU47)); m_stDialogBoxInfo[13].cMode = 11; m_stDialogBoxInfo[13].sV1=HR_CAPE; PlaySound('E', 14, 5); } // Hero's Helm if ((msX >= sX + 35) && (msX <= sX + 220) && (msY >= sY + 125) && (msY <= sY + 140)) { ZeroMemory(m_cTakeHeroItemName,sizeof(m_cTakeHeroItemName)); memcpy(m_cTakeHeroItemName,DRAW_DIALOGBOX_CITYHALL_MENU48,strlen(DRAW_DIALOGBOX_CITYHALL_MENU48)); m_stDialogBoxInfo[13].cMode = 11; m_stDialogBoxInfo[13].sV1=HR_HELM; PlaySound('E', 14, 5); } // Hero's Cap if ((msX >= sX + 35) && (msX <= sX + 220) && (msY >= sY + 155) && (msY <= sY + 170)) { ZeroMemory(m_cTakeHeroItemName,sizeof(m_cTakeHeroItemName)); memcpy(m_cTakeHeroItemName,DRAW_DIALOGBOX_CITYHALL_MENU49,strlen(DRAW_DIALOGBOX_CITYHALL_MENU49)); m_stDialogBoxInfo[13].cMode = 11; m_stDialogBoxInfo[13].sV1=HR_CAP; PlaySound('E', 14, 5); } // Hero's Armor if ((msX >= sX + 35) && (msX <= sX + 220) && (msY >= sY + 185) && (msY <= sY + 200)) { ZeroMemory(m_cTakeHeroItemName,sizeof(m_cTakeHeroItemName)); memcpy(m_cTakeHeroItemName,DRAW_DIALOGBOX_CITYHALL_MENU50,strlen(DRAW_DIALOGBOX_CITYHALL_MENU50)); m_stDialogBoxInfo[13].cMode = 11; m_stDialogBoxInfo[13].sV1=HR_PLATE; PlaySound('E', 14, 5); } // Hero's Robe if ((msX >= sX + 35) && (msX <= sX + 220) && (msY >= sY + 215) && (msY <= sY + 230)) { ZeroMemory(m_cTakeHeroItemName,sizeof(m_cTakeHeroItemName)); memcpy(m_cTakeHeroItemName,DRAW_DIALOGBOX_CITYHALL_MENU51,strlen(DRAW_DIALOGBOX_CITYHALL_MENU51)); m_stDialogBoxInfo[13].cMode = 11; m_stDialogBoxInfo[13].sV1=HR_ROBE; PlaySound('E', 14, 5); } // Hero's Hauberk if ((msX >= sX + 35) && (msX <= sX + 220) && (msY >= sY + 245) && (msY <= sY + 260)) { ZeroMemory(m_cTakeHeroItemName,sizeof(m_cTakeHeroItemName)); memcpy(m_cTakeHeroItemName,DRAW_DIALOGBOX_CITYHALL_MENU52,strlen(DRAW_DIALOGBOX_CITYHALL_MENU52)); m_stDialogBoxInfo[13].cMode = 11; m_stDialogBoxInfo[13].sV1=HR_HAUBERK; PlaySound('E', 14, 5); } // Hero's Leggings if ((msX >= sX + 35) && (msX <= sX + 220) && (msY >= sY + 275) && (msY <= sY + 290)) { ZeroMemory(m_cTakeHeroItemName,sizeof(m_cTakeHeroItemName)); memcpy(m_cTakeHeroItemName,DRAW_DIALOGBOX_CITYHALL_MENU53,strlen(DRAW_DIALOGBOX_CITYHALL_MENU53)); m_stDialogBoxInfo[13].cMode = 11; m_stDialogBoxInfo[13].sV1=HR_LEGGINGS; PlaySound('E', 14, 5); } break; case 8: if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Yes bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_CANCELQUEST, NULL, NULL, NULL, NULL, NULL); m_stDialogBoxInfo[13].cMode = 0; PlaySound('E', 14, 5); break; } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // No m_stDialogBoxInfo[13].cMode = 0; PlaySound('E', 14, 5); break; } break; case LEGIONPTSSERVICES: if ((msX > sX + 160) && (msX < sX + 230) && (msY > sY + 35) && (msY < sY + 50)) { PlaySound('E', 14, 5); bSendCommand(MSGID_REQUEST_LGNPTS, NULL,NULL,0,0,0,NULL); break; } for(i =0; i < 16; i++) { if ((msX > sX + 35) && (msX < sX + szX - 20) && (msY > sY + 73 + 15*i) && (msY < sY + 87 + 15*i)) { if(m_cash >= lgnPtsSvcs[i + m_stDialogBoxInfo[13].sView].price) { bSendCommand(MSGID_REQUEST_LGNSVC, lgnPtsSvcs[i + m_stDialogBoxInfo[13].sView].cmd, NULL, NULL, NULL, NULL, NULL); m_cash -= lgnPtsSvcs[i + m_stDialogBoxInfo[13].sView].price; }else{ AddEventList(MSG_NOTIFY_LEGIONPT1, CHAT_GM, TRUE); AddEventList(MSG_NOTIFY_LEGIONPT2, CHAT_GM, TRUE); AddEventList(MSG_NOTIFY_LEGIONPT3, CHAT_GM, TRUE); } break; } } break; case TELEPORTLIST: if( m_iTeleportMapCount > 0 ) { for( int i=0 ; i<m_iTeleportMapCount ; i++ ) { if( (msX >= sX + LBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + 130 + i*15) && (msY <= sY + 144 + i*15) ) { bSendCommand(MSGID_REQUEST_CHARGED_TELEPORT, NULL, NULL, m_stTeleportList[i].iIndex, NULL, NULL, NULL); DisableDialogBox(51); return; } } } break; case 11: // Hero confirm if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_GETHEROMANTLE, NULL, m_stDialogBoxInfo[13].sV1, NULL, NULL, NULL); m_stDialogBoxInfo[13].cMode = 0; PlaySound('E', 14, 5); } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { m_stDialogBoxInfo[13].cMode = 7; PlaySound('E', 14, 5); } break; } } void CGame::CivilRightAdmissionHandler(char *pData) {WORD * wp, wResult; char * cp; wp = (WORD *)(pData + INDEX2_MSGTYPE); wResult = *wp; switch (wResult) { case 0: m_stDialogBoxInfo[13].cMode = 4; break; case 1: m_stDialogBoxInfo[13].cMode = 3; cp = (char *)(pData + INDEX2_MSGTYPE + 2); ZeroMemory(m_cLocation, sizeof(m_cLocation)); memcpy(m_cLocation, cp, 10); if (memcmp(m_cLocation, "are", 3) == 0) m_side = ARESDEN; else if (memcmp(m_cLocation, "elv", 3) == 0) m_side = ELVINE; else if (memcmp(m_cLocation, "ist", 3) == 0) m_side = ISTRIA; else m_side = NEUTRAL; break; } } void CGame::DlgBoxClick_Text(short msX, short msY) { short sX, sY; sX = m_stDialogBoxInfo[18].sX; sY = m_stDialogBoxInfo[18].sY; if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { DisableDialogBox(18); PlaySound('E', 14, 5); } } void CGame::DlgBoxClick_Inventory(short msX, short msY) {int i, sX, sY; sX = m_stDialogBoxInfo[2].sX; sY = m_stDialogBoxInfo[2].sY; if ((msX >= sX +23) && (msX <= sX +76) && (msY >= sY +172) && (msY <= sY +184)) { if( m_iGizonItemUpgradeLeft == NULL ) { m_iGizonItemUpgradeLeft = 0; } EnableDialogBox(34, 5, NULL, NULL); PlaySound('E', 14, 5); } if ((msX >= sX +140) && (msX <= sX +212) && (msY >= sY +172) && (msY <= sY +184)) { if (m_cSkillMastery[SKILL_MANUFACTURING] == 0) { AddEventList(DLGBOXCLICK_INVENTORY1, 10); AddEventList(DLGBOXCLICK_INVENTORY2, 10);//"The manufacturing manual is purchasable in Blacksmith." }else if (m_bSkillUsingStatus == TRUE) { AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY5, 10);//""You are already using another skill." return; }else if (_bIsItemOnHand() == TRUE) { AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY4, 10);//""Your hands should be free to use this item." return; }else { for (i = 0; i < MAXITEMS; i++) if ( (m_pItemList[i] != NULL) && (m_pItemList[i]->m_cItemType == ITEMTYPE_USE_SKILL_ENABLEDIALOGBOX) && (m_pItemList[i]->m_sSpriteFrame == 113) && (m_pItemList[i]->m_wCurLifeSpan > 0)) { EnableDialogBox(26, 3, NULL, NULL, NULL); AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY12, 10);//"Using a manufacturing skill..." PlaySound('E', 14, 5); return; } AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY14, 10); } PlaySound('E', 14, 5); } } void CGame::DlgBoxClick_Character(short msX, short msY) { short sX, sY; sX = m_stDialogBoxInfo[1].sX; sY = m_stDialogBoxInfo[1].sY; /* if ((msX >= sX + 100) && (msX <= sX + 150) && (msY >= sY + 90) && (msY <= sY + 110)) { MessageBox(NULL,"CRASHED!!!!","JK",MB_OK); DisableDialogBox(1); PlaySound('E', 14, 5); }*/ if ((msX >= sX + 15) && (msX <= sX + 15 + BTNSZX) && (msY >= sY + 340) && (msY <= sY + 340 + BTNSZY)) { EnableDialogBox(28, 1, NULL, NULL); DisableDialogBox(1); PlaySound('E', 14, 5); } else if ((msX >= sX + 98) && (msX <= sX + 98 + BTNSZX) && (msY >= sY + 340) && (msY <= sY + 340 + BTNSZY)) { EnableDialogBox(32, NULL, NULL, NULL); DisableDialogBox(1); PlaySound('E', 14, 5); } else if ((msX >= sX + 180) && (msX <= sX + 180 + BTNSZX) && (msY >= sY + 340) && (msY <= sY + 340 + BTNSZY)) { EnableDialogBox(12, NULL, NULL, NULL); DisableDialogBox(1); PlaySound('E', 14, 5); } } void CGame::DlgBoxClick_FeedBackCard(short msX, short msY) { } void CGame::DlgBoxClick_MagicShop(short msX, short msY) { int i, iCPivot, iYloc, iAdjX, iAdjY ; short sX, sY; sX = m_stDialogBoxInfo[16].sX; sY = m_stDialogBoxInfo[16].sY; iAdjX = -20 ; iAdjY = -35 ; iCPivot = m_stDialogBoxInfo[16].sView*10; iYloc = 0; for (i = 0; i < 9; i++) { if ((m_pMagicCfgList[iCPivot + i] != NULL) && (m_pMagicCfgList[iCPivot + i]->m_bIsVisible)) { if ((msX >= sX + iAdjX + 44) && (msX <= sX + iAdjX + 135 + 44) && (msY >= sY + iAdjY + 70 + iYloc +35) && (msY <= sY + iAdjY + 70 + 14 + iYloc +35)) { if (m_cMagicMastery[iCPivot + i] == 0) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_STUDYMAGIC, NULL, NULL, NULL, NULL, m_pMagicCfgList[iCPivot + i]->m_cName); //bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_STUDYMAGIC, NULL, iCPivot + i, NULL, NULL, NULL); PlaySound('E', 14, 5); } return; } iYloc += 18; } } if ((msX > sX + 85) && (msX < sX + 200) && (msY > sY + 260) && (msY < sY + 275)) { m_stDialogBoxInfo[16].cMode = 1; PlaySound('E', 14, 5); return; } if ((msX >= sX + iAdjX + 42 +31) && (msX <= sX + iAdjX + 50 +31) && (msY >= sY + iAdjY + 248 +35) && (msY <= sY + iAdjY + 260 +35)) m_stDialogBoxInfo[16].sView = 0; if ((msX >= sX + iAdjX + 55 +31) && (msX <= sX + iAdjX + 68 +31) && (msY >= sY + iAdjY + 248 +35) && (msY <= sY + iAdjY + 260 +35)) m_stDialogBoxInfo[16].sView = 1; if ((msX >= sX + iAdjX + 73 +31) && (msX <= sX + iAdjX + 93 +31) && (msY >= sY + iAdjY + 248 +35) && (msY <= sY + iAdjY + 260 +35)) m_stDialogBoxInfo[16].sView = 2; if ((msX >= sX + iAdjX + 98 +31) && (msX <= sX + iAdjX + 113 +31) && (msY >= sY + iAdjY + 248 +35) && (msY <= sY + iAdjY + 260 +35)) m_stDialogBoxInfo[16].sView = 3; if ((msX >= sX + iAdjX + 118 +31) && (msX <= sX + iAdjX + 129 +31) && (msY >= sY + iAdjY + 248 +35) && (msY <= sY + iAdjY + 260 +35)) m_stDialogBoxInfo[16].sView = 4; if ((msX >= sX + iAdjX + 133 +31) && (msX <= sX + iAdjX + 150 +31) && (msY >= sY + iAdjY + 248 +35) && (msY <= sY + iAdjY + 260 +35)) m_stDialogBoxInfo[16].sView = 5; if ((msX >= sX + iAdjX + 154 +31) && (msX <= sX + iAdjX + 177 +31) && (msY >= sY + iAdjY + 248 +35) && (msY <= sY + iAdjY + 260 +35)) m_stDialogBoxInfo[16].sView = 6; if ((msX >= sX + iAdjX + 181 +31) && (msX <= sX + iAdjX + 210 +31) && (msY >= sY + iAdjY + 248 +35) && (msY <= sY + iAdjY + 260 +35)) m_stDialogBoxInfo[16].sView = 7; if ((msX >= sX + iAdjX + 214 +31) && (msX <= sX + iAdjX + 230 +31) && (msY >= sY + iAdjY + 248 +35) && (msY <= sY + iAdjY + 260 +35)) m_stDialogBoxInfo[16].sView = 8; if ((msX >= sX + iAdjX + 234 +31) && (msX <= sX + iAdjX + 245 +31) && (msY >= sY + iAdjY + 248 +35) && (msY <= sY + iAdjY + 260 +35)) m_stDialogBoxInfo[16].sView = 9; } void CGame::_RemoveChatMsgListByObjectID(int iObjectID) { int i; for (i = 1; i < MAXCHATMSGS; i++) if ((m_pChatMsgList[i] != NULL) && (m_pChatMsgList[i]->m_iObjectID == iObjectID)) { delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } } void CGame::PlaySound(char cType, int iNum, int iDist, long lPan) { int iVol; if (m_bSoundFlag == FALSE) return; if (m_bSoundStat == FALSE) return; if (iDist > 10) iDist = 10; iVol = (m_cSoundVolume - 100)*20; iVol += -200 * iDist; if (iVol > 0) iVol = 0; if (iVol < -10000) iVol = -10000; if (iVol > -2000) { switch (cType) { case 'C': if (m_pCSound[iNum] == NULL) return; m_pCSound[iNum]->Play(FALSE, lPan, iVol); break; case 'M': if (m_pMSound[iNum] == NULL) return; m_pMSound[iNum]->Play(FALSE, lPan, iVol); break; case 'E': if (m_pESound[iNum] == NULL) return; m_pESound[iNum]->Play(FALSE, lPan, iVol); break; } } } void CGame::_DrawBlackRect(int iSize) { int ix, iy, sx, sy, dcx, dcy; DWORD dwTime; dwTime = timeGetTime(); dcx = 40 - iSize*2; dcy = 30 - iSize*2; sx = iSize*16; sy = iSize*16; for (ix = 0; ix < dcx; ix++) { m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(ix*16 + sx, iSize*16, 12, dwTime); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(ix*16 + sx, 464 - iSize*16, 12, dwTime); } for (iy = 0; iy < dcy; iy++) { m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(iSize*16, iy*16 + sy, 12, dwTime); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(624 - iSize*16, iy*16 + sy, 12, dwTime); } } BOOL CGame::_bCheckItemByType(char cType) { int i; for (i = 0; i < MAXITEMS; i++) if ( (m_pItemList[i] != NULL) && (m_pItemList[i]->m_cItemType == cType) ) return TRUE; return FALSE; } void CGame::DynamicObjectHandler(char * pData) { WORD * wp; char * cp; short * sp, sX, sY, sV1, sV2, sV3; cp = (char *)(pData + INDEX2_MSGTYPE); wp = (WORD *)cp; cp += 2; sp = (short *)cp; sX = *sp; cp += 2; sp = (short *)cp; sY = *sp; cp += 2; sp = (short *)cp; sV1 = *sp; cp += 2; sp = (short *)cp; sV2 = *sp; // Dyamic Object Index cp += 2; sp = (short *)cp; sV3 = *sp; cp += 2; switch (*wp) { case MSGTYPE_CONFIRM:// Dynamic Object m_pMapData->bSetDynamicObject(sX, sY, sV2, sV1, TRUE); break; case MSGTYPE_REJECT:// Dynamic object m_pMapData->bSetDynamicObject(sX, sY, sV2, NULL, TRUE); break; } } BOOL CGame::_bIsItemOnHand() // Snoopy: Fixed to remove ShieldCast {int i; WORD wWeaponType; for (i = 0; i < MAXITEMS; i++) if ((m_pItemList[i] != NULL) && (m_bIsItemEquipped[i] == TRUE)) { if ( (m_pItemList[i]->m_cEquipPos == EQUIPPOS_LHAND) || (m_pItemList[i]->m_cEquipPos == EQUIPPOS_TWOHAND)) return TRUE; } for (i = 0; i < MAXITEMS; i++) if ((m_pItemList[i] != NULL) && (m_bIsItemEquipped[i] == TRUE)) { if (m_pItemList[i]->m_cEquipPos == EQUIPPOS_RHAND) { wWeaponType = ((m_sPlayerAppr2 & 0x0FF0) >> 4); // Snoopy 34 for all wands. if ((wWeaponType >= 34) && (wWeaponType < 41)) return FALSE; //else if( wWeaponType == 27 ) return FALSE; // Farming's hoe ! else return TRUE; } } return FALSE; } int CGame::_iCalcTotalWeight() { int i, iWeight, iCnt, iTemp; iCnt = 0; iWeight = 0; for (i = 0; i < MAXITEMS; i++) if (m_pItemList[i] != NULL) { if ( (m_pItemList[i]->m_cItemType == ITEMTYPE_CONSUME) || (m_pItemList[i]->m_cItemType == ITEMTYPE_ARROW) ) { iTemp = m_pItemList[i]->m_wWeight * m_pItemList[i]->m_dwCount; if (strcmp(m_pItemList[i]->m_cName, "Gold") == 0) iTemp = iTemp / 20; iWeight += iTemp; }else iWeight += m_pItemList[i]->m_wWeight; iCnt++; } return iWeight; } void CGame::DlgBoxClick_15AgeMsg(short msX, short msY) { // Snoopy: removed feedback card short sX, sY; sX = m_stDialogBoxInfo[5].sX; sY = m_stDialogBoxInfo[5].sY; if ((msX >= sX + 120 ) && (msX <= sX + 120 + BTNSZX ) && (msY >= sY + 127 ) && (msY <= sY + 127 + BTNSZY)) DisableDialogBox(5); } void CGame::DlgBoxClick_WarningMsg(short msX, short msY) { short sX, sY; sX = m_stDialogBoxInfo[6].sX; sY = m_stDialogBoxInfo[6].sY; if ((msX >= sX + 120 ) && (msX <= sX + 120 + BTNSZX ) && (msY >= sY + 127 ) && (msY <= sY + 127 + BTNSZY)) DisableDialogBox(6); } void CGame::DlgBoxClick_ItemDrop(short msX, short msY) { short sX, sY; if (m_cCommand < 0) return; sX = m_stDialogBoxInfo[4].sX; sY = m_stDialogBoxInfo[4].sY; if ((msX >= sX + 30) && (msX <= sX + 30 + BTNSZX) && (msY >= sY + 55) && (msY <= sY + 55 + BTNSZY)) { m_stDialogBoxInfo[4].cMode = 3; bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_ITEMDROP, NULL, m_stDialogBoxInfo[4].sView, 1, NULL, m_pItemList[m_stDialogBoxInfo[4].sView]->m_cName); //m_stDialogBoxInfo[40].sView ; DisableDialogBox(4); } else if ((msX >= sX + 170 ) && (msX <= sX + 170 + BTNSZX ) && (msY >= sY + 55 ) && (msY <= sY + 55 + BTNSZY)) { for (int i = 0; i < MAXSELLLIST; i++) m_bIsItemDisabled[i] = FALSE; DisableDialogBox(4); } else if ((msX >= sX + 35) && (msX <= sX + 240 ) && (msY >= sY + 80) && (msY <= sY + 90)) { m_bItemDrop = !m_bItemDrop; } } void CGame::DlgBoxClick_ItemSellorRepair(short msX, short msY) { short sX, sY; sX = m_stDialogBoxInfo[23].sX; sY = m_stDialogBoxInfo[23].sY; switch (m_stDialogBoxInfo[23].cMode) { case 1: if ((msX >= sX + 30) && (msX <= sX + 30 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Sell bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_SELLITEMCONFIRM, NULL, m_stDialogBoxInfo[23].sV1, m_stDialogBoxInfo[23].sV4, m_stDialogBoxInfo[23].sV3, m_pItemList[m_stDialogBoxInfo[23].sV1]->m_cName); //v1.2 m_stDialogBoxInfo[23].cMode = 3; } if ((msX >= sX + 154) && (msX <= sX + 154 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Cancel m_bIsItemDisabled[ m_stDialogBoxInfo[23].sV1 ] = FALSE; DisableDialogBox(23); } break; case 2: if ((msX >= sX + 30) && (msX <= sX + 30 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Repair bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_REPAIRITEMCONFIRM, NULL, m_stDialogBoxInfo[23].sV1, NULL, NULL, m_pItemList[m_stDialogBoxInfo[23].sV1]->m_cName); m_stDialogBoxInfo[23].cMode = 4; } if ((msX >= sX + 154) && (msX <= sX + 154 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Cancel m_bIsItemDisabled[ m_stDialogBoxInfo[23].sV1 ] = FALSE; DisableDialogBox(23); } break; } } int CGame::iGetLevelExp(int iLevel) {int iRet; if (iLevel == 0) return 0; iRet = iGetLevelExp(iLevel - 1) + iLevel * ( 50 + (iLevel * (iLevel / 17) * (iLevel / 17) ) ); return iRet; } int CGame::_iGetTotalItemNum() { int i, iCnt; iCnt = 0; for (i = 0; i < MAXITEMS; i++) if (m_pItemList[i] != NULL) iCnt++; return iCnt; } void CGame::DrawWhetherEffects() { #define MAXNUM 1000 static int ix1[MAXNUM]; static int iy2[MAXNUM]; static int iFrame[MAXNUM]; static int iNum = 0; int i; short dX, dY, sCnt; char cTempFrame; DWORD dwTime = m_dwCurTime; switch (m_cWhetherEffectType) { case 1: case 2: case 3: // rain switch (m_cWhetherEffectType) { case 1: sCnt = MAXWHETHEROBJECTS / 5; break; case 2: sCnt = MAXWHETHEROBJECTS / 2; break; case 3: sCnt = MAXWHETHEROBJECTS; break; } for (i = 0; i < sCnt; i++) { if ((m_stWhetherObject[i].cStep >= 0) && (m_stWhetherObject[i].cStep < 20) && (m_stWhetherObject[i].sX != 0)) { dX = m_stWhetherObject[i].sX - m_sViewPointX; dY = m_stWhetherObject[i].sY - m_sViewPointY; cTempFrame = 16 + (m_stWhetherObject[i].cStep / 6); m_pEffectSpr[11]->PutTransSprite(dX, dY, cTempFrame, dwTime); }else if ((m_stWhetherObject[i].cStep >= 20) && (m_stWhetherObject[i].cStep < 25) && (m_stWhetherObject[i].sX != 0)) { dX = m_stWhetherObject[i].sX - m_sViewPointX; dY = m_stWhetherObject[i].sY - m_sViewPointY; m_pEffectSpr[11]->PutTransSprite(dX, dY, m_stWhetherObject[i].cStep, dwTime); } } break; case 4: case 5: case 6: // Snow switch (m_cWhetherEffectType) { case 4: sCnt = MAXWHETHEROBJECTS / 5; break; case 5: sCnt = MAXWHETHEROBJECTS / 2; break; case 6: sCnt = MAXWHETHEROBJECTS; break; } for (i = 0; i < sCnt; i++) { if ((m_stWhetherObject[i].cStep >= 0) && (m_stWhetherObject[i].cStep < 80)) { dX = m_stWhetherObject[i].sX - m_sViewPointX; dY = m_stWhetherObject[i].sY - m_sViewPointY; // Snoopy: Snow on lower bar if (dY >= 460) { cTempFrame = 39 + (m_stWhetherObject[i].cStep / 20)*3; dX = m_stWhetherObject[i].sBX; dY = 426; }else cTempFrame = 39 + (m_stWhetherObject[i].cStep / 20)*3 + (rand() % 3); m_pEffectSpr[11]->PutTransSprite(dX, dY, cTempFrame, dwTime); if (m_bIsXmas == TRUE) { if( dY == 478 - 53 ) { ix1[iNum] = dX; iy2[iNum] = dY + (rand()%5); iFrame[iNum] = cTempFrame; iNum++; } if( iNum >= MAXNUM ) iNum = 0; } } } if (m_bIsXmas == TRUE) { for (i = 0; i <= MAXNUM; i++) { if( iy2[i] > 10 ) m_pEffectSpr[11]->PutTransSprite(ix1[i], iy2[i], iFrame[i], dwTime); } } break; } } void CGame::WhetherObjectFrameCounter() { int i; short sCnt; char cAdd; DWORD dwTime = m_dwCurTime; if ((dwTime - m_dwWOFtime) < 30) return; m_dwWOFtime = dwTime; switch (m_cWhetherEffectType) { case 1: case 2: case 3: // Rain switch (m_cWhetherEffectType) { case 1: sCnt = MAXWHETHEROBJECTS / 5; break; case 2: sCnt = MAXWHETHEROBJECTS / 2; break; case 3: sCnt = MAXWHETHEROBJECTS; break; } for (i = 0; i < sCnt; i++) { m_stWhetherObject[i].cStep++; if ((m_stWhetherObject[i].cStep >= 0) && (m_stWhetherObject[i].cStep < 20)) { cAdd = (40 - m_stWhetherObject[i].cStep); if (cAdd < 0) cAdd = 0; m_stWhetherObject[i].sY = m_stWhetherObject[i].sY + cAdd; if (cAdd != 0) m_stWhetherObject[i].sX = m_stWhetherObject[i].sX - 1; }else if (m_stWhetherObject[i].cStep >= 25) { if (m_bIsWhetherEffect == FALSE) { m_stWhetherObject[i].sX = 0; m_stWhetherObject[i].sY = 0; m_stWhetherObject[i].cStep = 30; }else { m_stWhetherObject[i].sX = (m_pMapData->m_sPivotX*32) + ((rand() % 940) - 200) + 300; m_stWhetherObject[i].sY = (m_pMapData->m_sPivotY*32) + ((rand() % 800) - 600) + 240; m_stWhetherObject[i].cStep = -1*(rand() % 10); } } } break; case 4: case 5: case 6: switch (m_cWhetherEffectType) { case 4: sCnt = MAXWHETHEROBJECTS / 5; break; case 5: sCnt = MAXWHETHEROBJECTS / 2; break; case 6: sCnt = MAXWHETHEROBJECTS; break; } for (i = 0; i < sCnt; i++) { m_stWhetherObject[i].cStep++; if ((m_stWhetherObject[i].cStep >= 0) && (m_stWhetherObject[i].cStep < 80)) { cAdd = (80 - m_stWhetherObject[i].cStep)/10; if (cAdd < 0) cAdd = 0; m_stWhetherObject[i].sY = m_stWhetherObject[i].sY + cAdd; //Snoopy: Snow on lower bar if (m_stWhetherObject[i].sY > (426 + m_sViewPointY)) { m_stWhetherObject[i].sY = 470 + m_sViewPointY; if ((rand() % 10) !=2) m_stWhetherObject[i].cStep--; if (m_stWhetherObject[i].sBX == 0) m_stWhetherObject[i].sBX = m_stWhetherObject[i].sX - m_sViewPointX; }else m_stWhetherObject[i].sX += 1 - (rand() % 3); }else if (m_stWhetherObject[i].cStep >= 80) { if (m_bIsWhetherEffect == FALSE) { m_stWhetherObject[i].sX = 0; m_stWhetherObject[i].sY = 0; m_stWhetherObject[i].sBX = 0; m_stWhetherObject[i].cStep = 80; }else { m_stWhetherObject[i].sX = (m_pMapData->m_sPivotX*32) + ((rand() % 940) - 200) + 300; m_stWhetherObject[i].sY = (m_pMapData->m_sPivotY*32) + ((rand() % 800) - 600) + 600; m_stWhetherObject[i].cStep = -1*(rand() % 10); m_stWhetherObject[i].sBX = 0; } } } break; } } void CGame::SetWhetherStatus(BOOL bStart, char cType) {SYSTEMTIME SysTime; GetLocalTime(&SysTime); if (bStart == TRUE) { m_bIsWhetherEffect = TRUE; m_cWhetherEffectType = cType; if ((m_bSoundStat == TRUE) && (m_bSoundFlag) && (cType >= 1) && (cType <= 3)) m_pESound[38]->Play(TRUE); for (int i = 0; i < MAXWHETHEROBJECTS; i++) { m_stWhetherObject[i].sX = 1; m_stWhetherObject[i].sBX = 1; m_stWhetherObject[i].sY = 1; m_stWhetherObject[i].cStep = -1*(rand() % 40); } if( cType >= 4 && cType <= 6 ) { if( m_bMusicStat ) StartBGM(); } }else { m_bIsWhetherEffect = FALSE; m_cWhetherEffectType = NULL; if ((m_bSoundStat == TRUE) && (m_bSoundFlag)) m_pESound[38]->bStop(); } } void CGame::DlgBoxClick_ShutDownMsg(short msX, short msY) { short sX, sY; sX = m_stDialogBoxInfo[25].sX; sY = m_stDialogBoxInfo[25].sY; if ((msX >= sX + 210) && (msX <= sX + 210 + BTNSZX) && (msY > sY + 127) && (msY < sY + 127 + BTNSZY)) { DisableDialogBox(25); PlaySound('E', 14, 5); } } void CGame::DrawLine(int x0, int y0, int x1, int y1, int iR, int iG, int iB) { int dx, dy, x_inc, y_inc, error, index, dstR, dstG, dstB; int iResultX, iResultY; WORD * pDst; if ((x0 == x1) && (y0 == y1)) return; error = 0; iResultX = x0; iResultY = y0; dx = x1-x0; dy = y1-y0; if(dx>=0) { x_inc = 1; }else { x_inc = -1; dx = -dx; } if(dy>=0) { y_inc = 1; }else { y_inc = -1; dy = -dy; } if(dx>dy) { for(index = 0; index <= dx; index++) { error += dy; if(error > dx) { error -= dx; iResultY += y_inc; } iResultX += x_inc; if ((iResultX >= 0) && (iResultX < 640) && (iResultY >= 0) && (iResultY < 480)) { pDst = (WORD *)m_DDraw.m_pBackB4Addr + iResultX + ((iResultY)*m_DDraw.m_sBackB4Pitch); switch (m_DDraw.m_cPixelFormat) { case 1: dstR = (int)m_DDraw.m_lTransRB100[(pDst[0]&0xF800)>>11][iR]; dstG = (int)m_DDraw.m_lTransG100[(pDst[0]&0x7E0)>>5][iG]; dstB = (int)m_DDraw.m_lTransRB100[(pDst[0]&0x1F)][iB]; *pDst = (WORD)((dstR<<11) | (dstG<<5) | dstB); break; case 2: dstR = (int)m_DDraw.m_lTransRB100[(pDst[0]&0x7C00)>>10][iR]; dstG = (int)m_DDraw.m_lTransG100[(pDst[0]&0x3E0)>>5][iG]; dstB = (int)m_DDraw.m_lTransRB100[(pDst[0]&0x1F)][iB]; *pDst = (WORD)((dstR<<10) | (dstG<<5) | dstB); break; } } } }else { for(index = 0; index <= dy; index++) { error += dx; if(error > dy) { error -= dy; iResultX += x_inc; } iResultY += y_inc; if ((iResultX >= 0) && (iResultX < 640) && (iResultY >= 0) && (iResultY < 480)) { pDst = (WORD *)m_DDraw.m_pBackB4Addr + iResultX + ((iResultY)*m_DDraw.m_sBackB4Pitch); switch (m_DDraw.m_cPixelFormat) { case 1: dstR = (int)m_DDraw.m_lTransRB100[(pDst[0]&0xF800)>>11][iR]; dstG = (int)m_DDraw.m_lTransG100[(pDst[0]&0x7E0)>>5][iG]; dstB = (int)m_DDraw.m_lTransRB100[(pDst[0]&0x1F)][iB]; *pDst = (WORD)((dstR<<11) | (dstG<<5) | dstB); break; case 2: dstR = (int)m_DDraw.m_lTransRB100[(pDst[0]&0x7C00)>>10][iR]; dstG = (int)m_DDraw.m_lTransG100[(pDst[0]&0x3E0)>>5][iG]; dstB = (int)m_DDraw.m_lTransRB100[(pDst[0]&0x1F)][iB]; *pDst = (WORD)((dstR<<10) | (dstG<<5) | dstB); break; } } } } } void CGame::DrawLine2(int x0, int y0, int x1, int y1, int iR, int iG, int iB) {int dx, dy, x_inc, y_inc, error, index, dstR, dstG, dstB; int iResultX, iResultY; WORD * pDst; if ((x0 == x1) && (y0 == y1)) return; error = 0; iResultX = x0; iResultY = y0; dx = x1-x0; dy = y1-y0; if(dx>=0) { x_inc = 1; }else { x_inc = -1; dx = -dx; } if(dy>=0) { y_inc = 1; }else { y_inc = -1; dy = -dy; } if(dx>dy) { for(index = 0; index <= dx; index++) { error += dy; if(error > dx) { error -= dx; iResultY += y_inc; } iResultX += x_inc; if ((iResultX >= 0) && (iResultX < 640) && (iResultY >= 0) && (iResultY < 480)) { pDst = (WORD *)m_DDraw.m_pBackB4Addr + iResultX + ((iResultY)*m_DDraw.m_sBackB4Pitch); switch (m_DDraw.m_cPixelFormat) { case 1: dstR = (int)m_DDraw.m_lTransRB50[(pDst[0]&0xF800)>>11][iR]; dstG = (int)m_DDraw.m_lTransG50[(pDst[0]&0x7E0)>>5][iG]; dstB = (int)m_DDraw.m_lTransRB50[(pDst[0]&0x1F)][iB]; *pDst = (WORD)((dstR<<11) | (dstG<<5) | dstB); break; case 2: dstR = (int)m_DDraw.m_lTransRB50[(pDst[0]&0x7C00)>>10][iR]; dstG = (int)m_DDraw.m_lTransG50[(pDst[0]&0x3E0)>>5][iG]; dstB = (int)m_DDraw.m_lTransRB50[(pDst[0]&0x1F)][iB]; *pDst = (WORD)((dstR<<10) | (dstG<<5) | dstB); break; } } } }else { for(index = 0; index <= dy; index++) { error += dx; if(error > dy) { error -= dy; iResultX += x_inc; } iResultY += y_inc; if ((iResultX >= 0) && (iResultX < 640) && (iResultY >= 0) && (iResultY < 480)) { pDst = (WORD *)m_DDraw.m_pBackB4Addr + iResultX + ((iResultY)*m_DDraw.m_sBackB4Pitch); switch (m_DDraw.m_cPixelFormat) { case 1: dstR = (int)m_DDraw.m_lTransRB50[(pDst[0]&0xF800)>>11][iR]; dstG = (int)m_DDraw.m_lTransG50[(pDst[0]&0x7E0)>>5][iG]; dstB = (int)m_DDraw.m_lTransRB50[(pDst[0]&0x1F)][iB]; *pDst = (WORD)((dstR<<11) | (dstG<<5) | dstB); break; case 2: dstR = (int)m_DDraw.m_lTransRB50[(pDst[0]&0x7C00)>>10][iR]; dstG = (int)m_DDraw.m_lTransG50[(pDst[0]&0x3E0)>>5][iG]; dstB = (int)m_DDraw.m_lTransRB50[(pDst[0]&0x1F)][iB]; *pDst = (WORD)((dstR<<10) | (dstG<<5) | dstB); break; } } } } } void CGame::_DrawThunderEffect(int sX, int sY, int dX, int dY, int rX, int rY, char cType) {int j, iErr, pX1, pY1, iX1, iY1, tX, tY; char cDir; DWORD dwTime; WORD wR1, wG1, wB1, wR2, wG2, wB2, wR3, wG3, wB3, wR4, wG4, wB4; dwTime = m_dwCurTime; sX = pX1 = iX1 = tX = sX; sY = pY1 = iY1 = tY = sY; m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB(50, 50, 100), &wR1, &wG1, &wB1); m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB(30, 30, 100), &wR2, &wG2, &wB2); m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB(0, 0, 30), &wR3, &wG3, &wB3); m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB(50, 50, 200), &wR4, &wG4, &wB4); for (j = 0; j < 100; j++) { switch (cType) { case 1: DrawLine(pX1, pY1, iX1, iY1, 15, 15, 20); DrawLine(pX1-1, pY1, iX1-1, iY1, wR1, wG1, wB1); DrawLine(pX1+1, pY1, iX1+1, iY1, wR1, wG1, wB1); DrawLine(pX1, pY1-1, iX1, iY1-1, wR1, wG1, wB1); DrawLine(pX1, pY1+1, iX1, iY1+1, wR1, wG1, wB1); DrawLine(pX1-2, pY1, iX1-2, iY1, wR2, wG2, wB2); DrawLine(pX1+2, pY1, iX1+2, iY1, wR2, wG2, wB2); DrawLine(pX1, pY1-2, iX1, iY1-2, wR2, wG2, wB2); DrawLine(pX1, pY1+2, iX1, iY1+2, wR2, wG2, wB2); DrawLine(pX1-1, pY1-1, iX1-1, iY1-1, wR3, wG3, wB3); DrawLine(pX1+1, pY1-1, iX1+1, iY1-1, wR3, wG3, wB3); DrawLine(pX1+1, pY1-1, iX1+1, iY1-1, wR3, wG3, wB3); DrawLine(pX1-1, pY1+1, iX1-1, iY1+1, wR3, wG3, wB3); break; case 2: DrawLine2(pX1, pY1, iX1, iY1, wR4, wG4, wB4); break; } iErr = 0; m_Misc.GetPoint(sX, sY, dX, dY, &tX, &tY, &iErr, j*10); pX1 = iX1; pY1 = iY1; cDir = m_Misc.cGetNextMoveDir(iX1, iY1, tX, tY); switch (cDir) { case 1: rY -= 5; break; case 2: rY -= 5; rX += 5; break; case 3: rX += 5; break; case 4: rX += 5; rY += 5; break; case 5: rY += 5; break; case 6: rX -= 5; rY += 5; break; case 7: rX -= 5; break; case 8: rX -= 5; rY -= 5; break; } if (rX < -20) rX = -20; if (rX > 20) rX = 20; if (rY < -20) rY = -20; if (rY > 20) rY = 20; iX1 = iX1 + rX; iY1 = iY1 + rY; if ((abs(tX - dX) < 5) && (abs(tY - dY) < 5)) break; } switch (cType) { case 1: m_pEffectSpr[6]->PutTransSprite(iX1, iY1, (rand() % 2), dwTime); break; } } BOOL CGame::bDlgBoxPress_SkillDlg(short msX, short msY) {int i , iAdjX, iAdjY ; char cItemID; short sX, sY, x1, y1, x2, y2, sArray[10]; sX = m_stDialogBoxInfo[26].sX; sY = m_stDialogBoxInfo[26].sY; iAdjX = 5 ; iAdjY = 10 ; switch (m_stDialogBoxInfo[26].cMode) { case 1: ZeroMemory(sArray, sizeof(sArray)); sArray[1] = m_stDialogBoxInfo[26].sV1; sArray[2] = m_stDialogBoxInfo[26].sV2; sArray[3] = m_stDialogBoxInfo[26].sV3; sArray[4] = m_stDialogBoxInfo[26].sV4; sArray[5] = m_stDialogBoxInfo[26].sV5; sArray[6] = m_stDialogBoxInfo[26].sV6; for (i = 1; i <= 6; i++) if ((sArray[i] != -1) && (m_pItemList[sArray[i]] != NULL)) { cItemID = (char)sArray[i]; switch (i) { case 1: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 55, sY + iAdjY + 55, m_pItemList[cItemID]->m_sSpriteFrame); break; case 2: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 55+45*1, sY + iAdjY + 55, m_pItemList[cItemID]->m_sSpriteFrame); break; case 3: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 55+45*2, sY + iAdjY + 55, m_pItemList[cItemID]->m_sSpriteFrame); break; case 4: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 55, sY + iAdjY + 100, m_pItemList[cItemID]->m_sSpriteFrame); break; case 5: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 55+45*1, sY + iAdjY + 100, m_pItemList[cItemID]->m_sSpriteFrame); break; case 6: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 55+45*2, sY + iAdjY + 100, m_pItemList[cItemID]->m_sSpriteFrame); break; } x1 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.left; y1 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.top; x2 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.right; y2 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.bottom; if ((msX > x1) && (msX < x2) && (msY > y1) && (msY < y2)) { switch (i) { case 1: m_stDialogBoxInfo[26].sV1 = -1; break; case 2: m_stDialogBoxInfo[26].sV2 = -1; break; case 3: m_stDialogBoxInfo[26].sV3 = -1; break; case 4: m_stDialogBoxInfo[26].sV4 = -1; break; case 5: m_stDialogBoxInfo[26].sV5 = -1; break; case 6: m_stDialogBoxInfo[26].sV6 = -1; break; } m_bIsItemDisabled[cItemID] = FALSE; m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = cItemID; m_stMCursor.sDistX = msX + iAdjX - x1 + (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_sPivotX; m_stMCursor.sDistY = msY + iAdjY - y1 + (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_sPivotY; return TRUE; } } break; case 4: ZeroMemory(sArray, sizeof(sArray)); sArray[1] = m_stDialogBoxInfo[26].sV1; sArray[2] = m_stDialogBoxInfo[26].sV2; sArray[3] = m_stDialogBoxInfo[26].sV3; sArray[4] = m_stDialogBoxInfo[26].sV4; sArray[5] = m_stDialogBoxInfo[26].sV5; sArray[6] = m_stDialogBoxInfo[26].sV6; for (i = 1; i <= 6; i++) if ((sArray[i] != -1) && (m_pItemList[sArray[i]] != NULL)) { cItemID = (char)sArray[i]; switch (i) { case 1: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 55 +30 +13, sY + iAdjY + 55 +180, m_pItemList[cItemID]->m_sSpriteFrame); break; case 2: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 55+45*1 +30 +13, sY + iAdjY + 55 +180, m_pItemList[cItemID]->m_sSpriteFrame); break; case 3: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 55+45*2 +30 +13, sY + iAdjY + 55 +180, m_pItemList[cItemID]->m_sSpriteFrame); break; case 4: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 55 +30 +13, sY + iAdjY + 100 +180, m_pItemList[cItemID]->m_sSpriteFrame); break; case 5: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 55+45*1 +30 +13, sY + iAdjY + 100 +180, m_pItemList[cItemID]->m_sSpriteFrame); break; case 6: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 55+45*2 +30 +13, sY + iAdjY + 100 +180, m_pItemList[cItemID]->m_sSpriteFrame); break; } x1 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.left; y1 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.top; x2 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.right; y2 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.bottom; if ((msX > x1) && (msX < x2) && (msY > y1) && (msY < y2)) { switch (i) { case 1: m_stDialogBoxInfo[26].sV1 = -1; break; case 2: m_stDialogBoxInfo[26].sV2 = -1; break; case 3: m_stDialogBoxInfo[26].sV3 = -1; break; case 4: m_stDialogBoxInfo[26].sV4 = -1; break; case 5: m_stDialogBoxInfo[26].sV5 = -1; break; case 6: m_stDialogBoxInfo[26].sV6 = -1; break; } m_bIsItemDisabled[cItemID] = FALSE; m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = cItemID; m_stMCursor.sDistX = msX + iAdjX - x1 + (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_sPivotX; m_stMCursor.sDistY = msY + iAdjY - y1 + (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_sPivotY; m_stDialogBoxInfo[26].cStr[4] = (char)_bCheckCurrentBuildItemStatus(); return TRUE; } } break; // Crafting case 7: ZeroMemory(sArray, sizeof(sArray)); sArray[1] = m_stDialogBoxInfo[26].sV1; sArray[2] = m_stDialogBoxInfo[26].sV2; sArray[3] = m_stDialogBoxInfo[26].sV3; sArray[4] = m_stDialogBoxInfo[26].sV4; sArray[5] = m_stDialogBoxInfo[26].sV5; sArray[6] = m_stDialogBoxInfo[26].sV6; for (i = 1; i <= 6; i++) if ((sArray[i] != -1) && (m_pItemList[sArray[i]] != NULL)) { cItemID = (char)sArray[i]; switch (i) { case 1: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 55, sY + iAdjY + 55, m_pItemList[cItemID]->m_sSpriteFrame); break; case 2: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 65+45*1, sY + iAdjY + 40, m_pItemList[cItemID]->m_sSpriteFrame); break; case 3: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 65+45*2, sY + iAdjY + 55, m_pItemList[cItemID]->m_sSpriteFrame); break; case 4: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 65, sY + iAdjY + 100, m_pItemList[cItemID]->m_sSpriteFrame); break; case 5: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 65+45*1, sY + iAdjY + 115, m_pItemList[cItemID]->m_sSpriteFrame); break; case 6: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + iAdjX + 75+45*2, sY + iAdjY + 100, m_pItemList[cItemID]->m_sSpriteFrame); break; } x1 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.left; y1 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.top; x2 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.right; y2 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.bottom; if ((msX > x1) && (msX < x2) && (msY > y1) && (msY < y2)) { switch (i) { case 1: m_stDialogBoxInfo[26].sV1 = -1; break; case 2: m_stDialogBoxInfo[26].sV2 = -1; break; case 3: m_stDialogBoxInfo[26].sV3 = -1; break; case 4: m_stDialogBoxInfo[26].sV4 = -1; break; case 5: m_stDialogBoxInfo[26].sV5 = -1; break; case 6: m_stDialogBoxInfo[26].sV6 = -1; break; } m_bIsItemDisabled[cItemID] = FALSE; m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = cItemID; m_stMCursor.sDistX = msX + iAdjX - x1 + (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_sPivotX; m_stMCursor.sDistY = msY + iAdjY - y1 + (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_sPivotY; return TRUE; } } break; } return FALSE; } int CGame::_iGetAttackType() { WORD wWeaponType; wWeaponType = ((m_sPlayerAppr2 & 0x0FF0) >> 4); if (wWeaponType == 0) { if ((m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (m_cSkillMastery[SKILL_HANDATTACK] >= 100)) return 20; else return 1; // Boxe }else if ((wWeaponType >= 1) && (wWeaponType <= 2)) { if ((m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (m_cSkillMastery[SKILL_SHORTSWORD] >= 100)) return 21; else return 1; //Dag, SS }else if ((wWeaponType > 2) && (wWeaponType < 20)) { if ((wWeaponType == 7)||(wWeaponType == 18)) // Added Kloness Esterk { if ((m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (m_cSkillMastery[SKILL_FENCING] >= 100)) return 22; else return 1; // Esterk }else if (wWeaponType == 15) { if ((m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (m_cSkillMastery[SKILL_LONGSWORD] >= 100)) return 30; else return 5; // StormBlade }else { if ((m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (m_cSkillMastery[SKILL_LONGSWORD] >= 100)) return 23; else return 1; // LongSwords } }else if ((wWeaponType >= 20) && (wWeaponType < 29)) { if ((m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (m_cSkillMastery[SKILL_AXE] >= 100)) return 24; else return 1; // Haches }else if ((wWeaponType >= 30) && (wWeaponType < 33)) { if ((m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (m_cSkillMastery[SKILL_HAMMER] >= 100)) return 26; else return 1; // Hammers }else if ((wWeaponType >= 34) && (wWeaponType < 41)) { if ((m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (m_cSkillMastery[SKILL_STAFF] >= 100)) return 27; else return 1; // Wands }else if (wWeaponType >= 41) { if ((m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (m_cSkillMastery[SKILL_ARCHERY] >= 100)) return 25; else return 2; // Bows }else if ((wWeaponType == 29) || (wWeaponType == 33)) { if ((m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (m_cSkillMastery[SKILL_LONGSWORD] >= 100)) return 23; else return 1; // LS } return 0; } int CGame::_iGetWeaponSkillType() { WORD wWeaponType = ((m_sPlayerAppr2 & 0x0FF0) >> 4); if (wWeaponType == 0) { return SKILL_HANDATTACK; }else if ((wWeaponType >= 1) && (wWeaponType < 3)) { return SKILL_SHORTSWORD; }else if ((wWeaponType >= 3) && (wWeaponType < 20)) { if ((wWeaponType == 7)||(wWeaponType == 18)) // Esterk or KlonessEsterk return SKILL_FENCING; else return SKILL_LONGSWORD; }else if ((wWeaponType >= 20) && (wWeaponType < 29)) { return SKILL_AXE; }else if ((wWeaponType >= 30) && (wWeaponType < 33)) { return SKILL_HAMMER; }else if ((wWeaponType >= 34) && (wWeaponType < 41)) { return SKILL_STAFF; }else if (wWeaponType >= 41) { return SKILL_ARCHERY; }else if ((wWeaponType == 29) || (wWeaponType == 33)) { return SKILL_LONGSWORD; // LS LightingBlade || BlackShadow } return SKILL_FISHING; } void CGame::NotifyMsg_AdminInfo(char *pData) { char * cp, cStr[256]; int * ip, iV1, iV2, iV3, iV4, iV5; cp = (char *)(pData + 6); ip = (int *)cp; iV1 = *ip; cp += 4; ip = (int *)cp; iV2 = *ip; cp += 4; ip = (int *)cp; iV3 = *ip; cp += 4; ip = (int *)cp; iV4 = *ip; cp += 4; ip = (int *)cp; iV5 = *ip; cp += 4; ZeroMemory(cStr, sizeof(cStr)); wsprintf(cStr, "%d %d %d %d %d", iV1, iV2, iV3, iV4, iV5); AddEventList(cStr); } /********************************************************************************************************************* ** void CGame::bItemDrop_ExchangeDialog(short msX, short msY) (snoopy) ** ** description :: modifyed for MultiTrade ** **********************************************************************************************************************/ void CGame::bItemDrop_ExchangeDialog(short msX, short msY) {char cItemID; if (m_cCommand < 0) return; if (m_stDialogBoxExchangeInfo[3].sV1 != -1) return; //Do not accept item's drop if already 4 items. cItemID = (char)m_stMCursor.sSelectedObjectID; if (m_stDialogBoxExchangeInfo[0].sV1 == cItemID || m_stDialogBoxExchangeInfo[1].sV1 == cItemID || m_stDialogBoxExchangeInfo[2].sV1 == cItemID) return; if ( ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_ARROW)) && (m_pItemList[cItemID]->m_dwCount > 1) ) { m_stDialogBoxInfo[17].sX = msX - 140; m_stDialogBoxInfo[17].sY = msY - 70; if (m_stDialogBoxInfo[17].sY < 0) m_stDialogBoxInfo[17].sY = 0; m_stDialogBoxInfo[17].sV1 = m_sPlayerX+1; m_stDialogBoxInfo[17].sV2 = m_sPlayerY+1; m_stDialogBoxInfo[17].sV3 = 1000; m_stDialogBoxInfo[17].sV4 = cItemID; //m_stDialogBoxInfo[27].sView = cItemID; if (m_stDialogBoxExchangeInfo[0].sV1 == -1) m_stDialogBoxExchangeInfo[0].sItemID = cItemID; else if (m_stDialogBoxExchangeInfo[1].sV1 == -1) m_stDialogBoxExchangeInfo[1].sItemID = cItemID; else if (m_stDialogBoxExchangeInfo[2].sV1 == -1) m_stDialogBoxExchangeInfo[2].sItemID = cItemID; else if (m_stDialogBoxExchangeInfo[3].sV1 == -1) m_stDialogBoxExchangeInfo[3].sItemID = cItemID; else return; // Impossible case, tested at function beginning ZeroMemory(m_stDialogBoxInfo[17].cStr, sizeof(m_stDialogBoxInfo[17].cStr)); EnableDialogBox(17, cItemID, m_pItemList[cItemID]->m_dwCount, NULL); return; }else // hum? déjà on affiche? , bon je désactive, ca devrait plutôt s'afficher lors du retour du serveur. { /*m_stDialogBoxInfo[27].sV1 = m_pItemList[cItemID]->m_sSprite; m_stDialogBoxInfo[27].sV2 = m_pItemList[cItemID]->m_sSpriteFrame; m_stDialogBoxInfo[27].sV3 = 1; m_stDialogBoxInfo[27].sV4 = m_pItemList[cItemID]->m_cItemColor; m_stDialogBoxInfo[27].sView = cItemID;*/ if (m_stDialogBoxExchangeInfo[0].sV1 == -1) m_stDialogBoxExchangeInfo[0].sItemID = cItemID; else if (m_stDialogBoxExchangeInfo[1].sV1 == -1) m_stDialogBoxExchangeInfo[1].sItemID = cItemID; else if (m_stDialogBoxExchangeInfo[2].sV1 == -1) m_stDialogBoxExchangeInfo[2].sItemID = cItemID; else if (m_stDialogBoxExchangeInfo[3].sV1 == -1) m_stDialogBoxExchangeInfo[3].sItemID = cItemID; else return; // Impossible case, tested at function beginning m_bIsItemDisabled[cItemID] = TRUE; bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SETEXCHANGEITEM, NULL, cItemID, 1, NULL, NULL); // :bSendCommand(DWORD dwMsgID, WORD wCommand, char cDir, int iV1, int iV2, int iV3, char * pString, int iV4) return; } } /********************************************************************************************************************* ** void CGame::DlgBoxClick_Exchange(short msX, short msY) (snoopy) ** ** description :: modifyed for MultiTrade ** **********************************************************************************************************************/ void CGame::DlgBoxClick_Exchange(short msX, short msY) {short sX, sY; sX = m_stDialogBoxInfo[27].sX ; sY = m_stDialogBoxInfo[27].sY ; switch (m_stDialogBoxInfo[27].cMode) { case 1: // Not yet confirmed the exchange if ((msX >= sX + 220) && (msX <= sX + 220 + BTNSZX) && (msY >= sY + 310) && (msY <= sY + 310 + BTNSZY)) // Exchange { if ( (m_stDialogBoxExchangeInfo[0].sV1 != -1) && (m_stDialogBoxExchangeInfo[4].sV1 != -1)) { /*bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_CONFIRMEXCHANGEITEM, NULL , m_stDialogBoxExchangeInfo[0].sV1 // ItemID; inutilisé par serveur , m_stDialogBoxExchangeInfo[0].sV3 // Amount; inutilisé par serveur , NULL, NULL); */ PlaySound('E', 14, 5); m_stDialogBoxInfo[27].cMode = 2; // Show confirmation Diag instead. EnableDialogBox(41, NULL, NULL, NULL); m_stDialogBoxInfo[41].cMode = 1; } return; } if ( (msX >= sX + 450) && (msX <= sX + 450 + BTNSZX) && (msY >= sY + 310) && (msY <= sY + 310 + BTNSZY) && (m_bIsDialogEnabled[41] == FALSE)) // Cancel only possible if confirmation is not activated { DisableDialogBox(27); DisableDialogBox(22); bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_CANCELEXCHANGEITEM, NULL, NULL, NULL, NULL, NULL); PlaySound('E', 14, 5); return; } break; case 2: // Someone already confirmed the exchange /* if ((msX >= sX + 450) && (msX <= sX + 450 + BTNSZX) && (msY >= sY + 310) && (msY <= sY + 310 + BTNSZY)) // Cancel { DisableDialogBox(27); DisableDialogBox(22); bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_CANCELEXCHANGEITEM, NULL, NULL, NULL, NULL, NULL); PlaySound('E', 14, 5); return; }*/ break; } } /********************************************************************************************************************* ** void CGame::DlgBoxClick_ConfirmExchange(short msX, short msY) (snoopy) ** ** description :: click on confirmation diag ** **********************************************************************************************************************/ void CGame::DlgBoxClick_ConfirmExchange(short msX, short msY) {short sX, sY; sX = m_stDialogBoxInfo[41].sX ; sY = m_stDialogBoxInfo[41].sY ; switch (m_stDialogBoxInfo[41].cMode) { case 1: // Not yet confirmed the exchange // yes if ((msX >= sX + 30) && (msX <= sX + 30 + BTNSZX) && (msY >= sY + 55) && (msY <= sY + 55 + BTNSZY)) { if ( (m_stDialogBoxExchangeInfo[0].sV1 != -1) && (m_stDialogBoxExchangeInfo[4].sV1 != -1)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_CONFIRMEXCHANGEITEM, NULL , m_stDialogBoxExchangeInfo[0].sV1 // ItemID; inutilisé par serveur , m_stDialogBoxExchangeInfo[0].sV3 // Amount; inutilisé par serveur , NULL, NULL); PlaySound('E', 14, 5); m_stDialogBoxInfo[27].cMode = 2; m_stDialogBoxInfo[41].cMode = 2; } return; } // No if ((msX >= sX + 170 ) && (msX <= sX + 170 + BTNSZX ) && (msY >= sY + 55 ) && (msY <= sY + 55 + BTNSZY)) { DisableDialogBox(41); DisableDialogBox(27); DisableDialogBox(22); bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_CANCELEXCHANGEITEM, NULL, NULL, NULL, NULL, NULL); PlaySound('E', 14, 5); return; } break; case 2: // waiting for other side to confirm break; } } void CGame::DlgBoxClick_Quest(int msX, int msY) { short sX, sY; sX = m_stDialogBoxInfo[28].sX; sY = m_stDialogBoxInfo[28].sY; if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { DisableDialogBox(28); PlaySound('E', 14, 5); } } int CGame::_iGetBankItemCount() { int i, iCnt; iCnt = 0; for (i = 0; i < MAXBANKITEMS; i++) if (m_pBankList[i] != NULL) iCnt++; return iCnt; } BOOL CGame::_bDecodeBuildItemContents() {char cFileName[255], cTemp[255]; HANDLE hFile; FILE * pFile; DWORD dwFileSize; char * pBuffer; BOOL bRet; int i; for (i = 0; i < MAXBUILDITEMS; i++) if (m_pBuildItemList[i] != NULL) { delete m_pBuildItemList[i]; m_pBuildItemList[i] = NULL; } ZeroMemory(cTemp, sizeof(cTemp)); ZeroMemory(cFileName, sizeof(cFileName)); strcpy(cTemp, "BItemcfg"); strcat(cFileName, "contents"); strcat(cFileName, "\\"); strcat(cFileName, "\\"); strcat(cFileName, cTemp); strcat(cFileName, ".txt"); hFile = CreateFile(cFileName, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); dwFileSize = GetFileSize(hFile, NULL); if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); pFile = fopen(cFileName, "rt"); if (pFile == NULL) return FALSE; else { pBuffer = new char[dwFileSize+1]; ZeroMemory(pBuffer, dwFileSize+1); fread(pBuffer, dwFileSize, 1, pFile); bRet = __bDecodeBuildItemContents(pBuffer); delete[] pBuffer; } fclose(pFile); return bRet; } BOOL CGame::_bCheckBuildItemStatus() {int iIndex, i, j, iMatch, iCount; char cTempName[21]; int iItemCount[MAXITEMS]; for (i = 0; i < MAXBUILDITEMS; i++) if (m_pDispBuildItemList[i] != NULL) { delete m_pDispBuildItemList[i]; m_pDispBuildItemList[i] = NULL; } iIndex = 0; for (i = 0; i < MAXBUILDITEMS; i++) if (m_pBuildItemList[i] != NULL) { // Skill-Limit if (m_cSkillMastery[SKILL_MANUFACTURING] >= m_pBuildItemList[i]->m_iSkillLimit) { iMatch = 0; m_pDispBuildItemList[iIndex] = new class CBuildItem; memcpy(m_pDispBuildItemList[iIndex]->m_cName, m_pBuildItemList[i]->m_cName, 20); memcpy(m_pDispBuildItemList[iIndex]->m_cElementName1, m_pBuildItemList[i]->m_cElementName1, 20); memcpy(m_pDispBuildItemList[iIndex]->m_cElementName2, m_pBuildItemList[i]->m_cElementName2, 20); memcpy(m_pDispBuildItemList[iIndex]->m_cElementName3, m_pBuildItemList[i]->m_cElementName3, 20); memcpy(m_pDispBuildItemList[iIndex]->m_cElementName4, m_pBuildItemList[i]->m_cElementName4, 20); memcpy(m_pDispBuildItemList[iIndex]->m_cElementName5, m_pBuildItemList[i]->m_cElementName5, 20); memcpy(m_pDispBuildItemList[iIndex]->m_cElementName6, m_pBuildItemList[i]->m_cElementName6, 20); m_pDispBuildItemList[iIndex]->m_iElementCount[1] = m_pBuildItemList[i]->m_iElementCount[1]; m_pDispBuildItemList[iIndex]->m_iElementCount[2] = m_pBuildItemList[i]->m_iElementCount[2]; m_pDispBuildItemList[iIndex]->m_iElementCount[3] = m_pBuildItemList[i]->m_iElementCount[3]; m_pDispBuildItemList[iIndex]->m_iElementCount[4] = m_pBuildItemList[i]->m_iElementCount[4]; m_pDispBuildItemList[iIndex]->m_iElementCount[5] = m_pBuildItemList[i]->m_iElementCount[5]; m_pDispBuildItemList[iIndex]->m_iElementCount[6] = m_pBuildItemList[i]->m_iElementCount[6]; m_pDispBuildItemList[iIndex]->m_iSprH = m_pBuildItemList[i]->m_iSprH; m_pDispBuildItemList[iIndex]->m_iSprFrame = m_pBuildItemList[i]->m_iSprFrame; m_pDispBuildItemList[iIndex]->m_iMaxSkill = m_pBuildItemList[i]->m_iMaxSkill; m_pDispBuildItemList[iIndex]->m_iSkillLimit = m_pBuildItemList[i]->m_iSkillLimit; // ItemCount for (j = 0; j < MAXITEMS; j++) if (m_pItemList[j] != NULL) iItemCount[j] = m_pItemList[j]->m_dwCount; else iItemCount[j] = 0; // Element1 ZeroMemory(cTempName, sizeof(cTempName)); memcpy(cTempName, m_pBuildItemList[i]->m_cElementName1, 20); iCount = m_pBuildItemList[i]->m_iElementCount[1]; if (iCount == 0) iMatch++; else { for (j = 0; j < MAXITEMS; j++) if (m_pItemList[j] != NULL) { if ((memcmp(m_pItemList[j]->m_cName, cTempName, 20) == 0) && (m_pItemList[j]->m_dwCount >= (DWORD)(iCount)) && (iItemCount[j] > 0)) { iMatch++; m_pDispBuildItemList[iIndex]->m_bElementFlag[1] = TRUE; iItemCount[j] -= iCount; goto CBIS_STEP2; } } } CBIS_STEP2:; // Element2 ZeroMemory(cTempName, sizeof(cTempName)); memcpy(cTempName, m_pBuildItemList[i]->m_cElementName2, 20); iCount = m_pBuildItemList[i]->m_iElementCount[2]; if (iCount == 0) iMatch++; else { for (j = 0; j < MAXITEMS; j++) if (m_pItemList[j] != NULL) { if ((memcmp(m_pItemList[j]->m_cName, cTempName, 20) == 0) && (m_pItemList[j]->m_dwCount >= (DWORD)(iCount)) && (iItemCount[j] > 0)) { iMatch++; m_pDispBuildItemList[iIndex]->m_bElementFlag[2] = TRUE; iItemCount[j] -= iCount; goto CBIS_STEP3; } } } CBIS_STEP3:; // Element3 ZeroMemory(cTempName, sizeof(cTempName)); memcpy(cTempName, m_pBuildItemList[i]->m_cElementName3, 20); iCount = m_pBuildItemList[i]->m_iElementCount[3]; if (iCount == 0) iMatch++; else { for (j = 0; j < MAXITEMS; j++) if (m_pItemList[j] != NULL) { if ((memcmp(m_pItemList[j]->m_cName, cTempName, 20) == 0) && (m_pItemList[j]->m_dwCount >= (DWORD)(iCount)) && (iItemCount[j] > 0)) { iMatch++; m_pDispBuildItemList[iIndex]->m_bElementFlag[3] = TRUE; iItemCount[j] -= iCount; goto CBIS_STEP4; } } } CBIS_STEP4:; ZeroMemory(cTempName, sizeof(cTempName)); memcpy(cTempName, m_pBuildItemList[i]->m_cElementName4, 20); iCount = m_pBuildItemList[i]->m_iElementCount[4]; if (iCount == 0) iMatch++; else { for (j = 0; j < MAXITEMS; j++) if (m_pItemList[j] != NULL) { if ((memcmp(m_pItemList[j]->m_cName, cTempName, 20) == 0) && (m_pItemList[j]->m_dwCount >= (DWORD)(iCount)) && (iItemCount[j] > 0)) { iMatch++; m_pDispBuildItemList[iIndex]->m_bElementFlag[4] = TRUE; iItemCount[j] -= iCount; goto CBIS_STEP5; } } } CBIS_STEP5:; // Element5 ZeroMemory(cTempName, sizeof(cTempName)); memcpy(cTempName, m_pBuildItemList[i]->m_cElementName5, 20); iCount = m_pBuildItemList[i]->m_iElementCount[5]; if (iCount == 0) iMatch++; else { for (j = 0; j < MAXITEMS; j++) if (m_pItemList[j] != NULL) { if ((memcmp(m_pItemList[j]->m_cName, cTempName, 20) == 0) && (m_pItemList[j]->m_dwCount >= (DWORD)(iCount)) && (iItemCount[j] > 0)) { iMatch++; m_pDispBuildItemList[iIndex]->m_bElementFlag[5] = TRUE; iItemCount[j] -= iCount; goto CBIS_STEP6; } } } CBIS_STEP6:; // Element6 ZeroMemory(cTempName, sizeof(cTempName)); memcpy(cTempName, m_pBuildItemList[i]->m_cElementName6, 20); iCount = m_pBuildItemList[i]->m_iElementCount[6]; if (iCount == 0) iMatch++; else { for (j = 0; j < MAXITEMS; j++) if (m_pItemList[j] != NULL) { if ((memcmp(m_pItemList[j]->m_cName, cTempName, 20) == 0) && (m_pItemList[j]->m_dwCount >= (DWORD)(iCount)) && (iItemCount[j] > 0)) { iMatch++; m_pDispBuildItemList[iIndex]->m_bElementFlag[6] = TRUE; iItemCount[j] -= iCount; goto CBIS_STEP7; } } } CBIS_STEP7:; if (iMatch == 6) m_pDispBuildItemList[iIndex]->m_bBuildEnabled = TRUE; iIndex++; } } return TRUE; } BOOL CGame::_ItemDropHistory(char * ItemName) {BOOL bFlag = FALSE; if (m_iItemDropCnt == 0 ) { strcpy(m_cItemDrop[m_iItemDropCnt], ItemName); m_iItemDropCnt++; return TRUE; } if ( (1 <= m_iItemDropCnt) && (20 >= m_iItemDropCnt) ) { for (int i = 0; i < m_iItemDropCnt; i++) { if (strcmp(m_cItemDrop[i], ItemName) == 0) { bFlag = TRUE; break; } } if (bFlag) { if (m_bItemDrop) return FALSE; else return TRUE; } if( 20 < m_iItemDropCnt ) { for (int i = 0; i < m_iItemDropCnt ; i++) strcpy(m_cItemDrop[i-1], ItemName); strcpy(m_cItemDrop[20], ItemName); m_iItemDropCnt = 21; }else { strcpy(m_cItemDrop[m_iItemDropCnt], ItemName); m_iItemDropCnt++; } } return TRUE; } BOOL CGame::__bDecodeBuildItemContents(char *pBuffer) {char * pContents, * token; char seps[] = "= ,\t\n"; char cReadModeA = 0; char cReadModeB = 0; int iIndex = 0; class CStrTok * pStrTok; pContents = pBuffer; pStrTok = new class CStrTok(pContents, seps); token = pStrTok->pGet(); while( token != NULL ) { if (cReadModeA != 0) { switch (cReadModeA) { case 1: switch (cReadModeB) { case 1: ZeroMemory(m_pBuildItemList[iIndex]->m_cName, sizeof(m_pBuildItemList[iIndex]->m_cName)); memcpy(m_pBuildItemList[iIndex]->m_cName, token, strlen(token)); cReadModeB = 2; break; case 2: m_pBuildItemList[iIndex]->m_iSkillLimit = atoi(token); cReadModeB = 3; break; case 3: // m_cElementName1 ZeroMemory(m_pBuildItemList[iIndex]->m_cElementName1, sizeof(m_pBuildItemList[iIndex]->m_cElementName1)); memcpy(m_pBuildItemList[iIndex]->m_cElementName1, token, strlen(token)); cReadModeB = 4; break; case 4: // m_iElementCount1 m_pBuildItemList[iIndex]->m_iElementCount[1] = atoi(token); cReadModeB = 5; break; case 5: // m_cElementName2 ZeroMemory(m_pBuildItemList[iIndex]->m_cElementName2, sizeof(m_pBuildItemList[iIndex]->m_cElementName2)); memcpy(m_pBuildItemList[iIndex]->m_cElementName2, token, strlen(token)); cReadModeB = 6; break; case 6: // m_iElementCount2 m_pBuildItemList[iIndex]->m_iElementCount[2] = atoi(token); cReadModeB = 7; break; case 7: // m_cElementName3 ZeroMemory(m_pBuildItemList[iIndex]->m_cElementName3, sizeof(m_pBuildItemList[iIndex]->m_cElementName3)); memcpy(m_pBuildItemList[iIndex]->m_cElementName3, token, strlen(token)); cReadModeB = 8; break; case 8: // m_iElementCount3 m_pBuildItemList[iIndex]->m_iElementCount[3] = atoi(token); cReadModeB = 9; break; case 9: // m_cElementName4 ZeroMemory(m_pBuildItemList[iIndex]->m_cElementName4, sizeof(m_pBuildItemList[iIndex]->m_cElementName4)); memcpy(m_pBuildItemList[iIndex]->m_cElementName4, token, strlen(token)); cReadModeB = 10; break; case 10: // m_iElementCount4 m_pBuildItemList[iIndex]->m_iElementCount[4] = atoi(token); cReadModeB = 11; break; case 11: // m_cElementName5 ZeroMemory(m_pBuildItemList[iIndex]->m_cElementName5, sizeof(m_pBuildItemList[iIndex]->m_cElementName5)); memcpy(m_pBuildItemList[iIndex]->m_cElementName5, token, strlen(token)); cReadModeB = 12; break; case 12: // m_iElementCount5 m_pBuildItemList[iIndex]->m_iElementCount[5] = atoi(token); cReadModeB = 13; break; case 13: // m_cElementName6 ZeroMemory(m_pBuildItemList[iIndex]->m_cElementName6, sizeof(m_pBuildItemList[iIndex]->m_cElementName6)); memcpy(m_pBuildItemList[iIndex]->m_cElementName6, token, strlen(token)); cReadModeB = 14; break; case 14: // m_iElementCount6 m_pBuildItemList[iIndex]->m_iElementCount[6] = atoi(token); cReadModeB = 15; break; case 15: m_pBuildItemList[iIndex]->m_iSprH = atoi(token); cReadModeB = 16; break; case 16: m_pBuildItemList[iIndex]->m_iSprFrame = atoi(token); cReadModeB = 17; break; case 17: m_pBuildItemList[iIndex]->m_iMaxSkill = atoi(token); cReadModeA = 0; cReadModeB = 0; iIndex++; break; } break; default: break; } }else { if (memcmp(token, "BuildItem", 9) == 0) { cReadModeA = 1; cReadModeB = 1; m_pBuildItemList[iIndex] = new class CBuildItem; } } token = pStrTok->pGet(); } delete pStrTok; if ((cReadModeA != 0) || (cReadModeB != 0)) return FALSE; return TRUE; } BOOL CGame::_bCheckCurrentBuildItemStatus() { int i, iCount2, iMatch, iIndex, iItemIndex[7]; int iCount; int iItemCount[7]; char cTempName[21]; BOOL bItemFlag[7]; iIndex = m_stDialogBoxInfo[26].cStr[0]; if (m_pBuildItemList[iIndex] == NULL) return FALSE; iItemIndex[1] = m_stDialogBoxInfo[26].sV1; iItemIndex[2] = m_stDialogBoxInfo[26].sV2; iItemIndex[3] = m_stDialogBoxInfo[26].sV3; iItemIndex[4] = m_stDialogBoxInfo[26].sV4; iItemIndex[5] = m_stDialogBoxInfo[26].sV5; iItemIndex[6] = m_stDialogBoxInfo[26].sV6; for (i = 1; i <= 6; i++) if (iItemIndex[i] != -1) iItemCount[i] = m_pItemList[iItemIndex[i]]->m_dwCount; else iItemCount[i] = 0; iMatch = 0; for (i = 1; i <= 6; i++) bItemFlag[i] = FALSE; // Element1 ZeroMemory(cTempName, sizeof(cTempName)); memcpy(cTempName, m_pDispBuildItemList[iIndex]->m_cElementName1, 20); iCount = m_pDispBuildItemList[iIndex]->m_iElementCount[1]; if (iCount == 0) iMatch++; else { for (i = 1; i <= 6; i++) { if ((iItemIndex[i] != -1) && (memcmp(m_pItemList[iItemIndex[i]]->m_cName, cTempName, 20) == 0) && (m_pItemList[iItemIndex[i]]->m_dwCount >= (DWORD)(iCount)) && (iItemCount[i] > 0) && (bItemFlag[i] == FALSE)) { iMatch++; iItemCount[i] -= iCount; bItemFlag[i] = TRUE; goto CCBIS_STEP2; } } } CCBIS_STEP2:; // Element2 ZeroMemory(cTempName, sizeof(cTempName)); memcpy(cTempName, m_pDispBuildItemList[iIndex]->m_cElementName2, 20); iCount = m_pDispBuildItemList[iIndex]->m_iElementCount[2]; if (iCount == 0) iMatch++; else { for (i = 1; i <= 6; i++) { if ((iItemIndex[i] != -1) && (memcmp(m_pItemList[iItemIndex[i]]->m_cName, cTempName, 20) == 0) && (m_pItemList[iItemIndex[i]]->m_dwCount >= (DWORD)(iCount)) && (iItemCount[i] > 0) && (bItemFlag[i] == FALSE)) { iMatch++; iItemCount[i] -= iCount; bItemFlag[i] = TRUE; goto CCBIS_STEP3; } } } CCBIS_STEP3:; // Element3 ZeroMemory(cTempName, sizeof(cTempName)); memcpy(cTempName, m_pDispBuildItemList[iIndex]->m_cElementName3, 20); iCount = m_pDispBuildItemList[iIndex]->m_iElementCount[3]; if (iCount == 0) iMatch++; else { for (i = 1; i <= 6; i++) { if ((iItemIndex[i] != -1) && (memcmp(m_pItemList[iItemIndex[i]]->m_cName, cTempName, 20) == 0) && (m_pItemList[iItemIndex[i]]->m_dwCount >= (DWORD)(iCount)) && (iItemCount[i] > 0) && (bItemFlag[i] == FALSE)) { iMatch++; iItemCount[i] -= iCount; bItemFlag[i] = TRUE; goto CCBIS_STEP4; } } } CCBIS_STEP4:; // Element4 ZeroMemory(cTempName, sizeof(cTempName)); memcpy(cTempName, m_pDispBuildItemList[iIndex]->m_cElementName4, 20); iCount = m_pDispBuildItemList[iIndex]->m_iElementCount[4]; if (iCount == 0) iMatch++; else { for (i = 1; i <= 6; i++) { if ((iItemIndex[i] != -1) && (memcmp(m_pItemList[iItemIndex[i]]->m_cName, cTempName, 20) == 0) && (m_pItemList[iItemIndex[i]]->m_dwCount >= (DWORD)(iCount)) && (iItemCount[i] > 0) && (bItemFlag[i] == FALSE)) { iMatch++; iItemCount[i] -= iCount; bItemFlag[i] = TRUE; goto CCBIS_STEP5; } } } CCBIS_STEP5:; // Element5 ZeroMemory(cTempName, sizeof(cTempName)); memcpy(cTempName, m_pDispBuildItemList[iIndex]->m_cElementName5, 20); iCount = m_pDispBuildItemList[iIndex]->m_iElementCount[5]; if (iCount == 0) iMatch++; else { for (i = 1; i <= 6; i++) { if ((iItemIndex[i] != -1) && (memcmp(m_pItemList[iItemIndex[i]]->m_cName, cTempName, 20) == 0) && (m_pItemList[iItemIndex[i]]->m_dwCount >= (DWORD)(iCount)) && (iItemCount[i] > 0) && (bItemFlag[i] == FALSE)) { iMatch++; iItemCount[i] -= iCount; bItemFlag[i] = TRUE; goto CCBIS_STEP6; } } } CCBIS_STEP6:; // Element6 ZeroMemory(cTempName, sizeof(cTempName)); memcpy(cTempName, m_pDispBuildItemList[iIndex]->m_cElementName6, 20); iCount = m_pDispBuildItemList[iIndex]->m_iElementCount[6]; if (iCount == 0) iMatch++; else { for (i = 1; i <= 6; i++) { if ((iItemIndex[i] != -1) && (memcmp(m_pItemList[iItemIndex[i]]->m_cName, cTempName, 20) == 0) && (m_pItemList[iItemIndex[i]]->m_dwCount >= (DWORD)(iCount)) && (iItemCount[i] > 0) && (bItemFlag[i] == FALSE)) { iMatch++; iItemCount[i] -= iCount; bItemFlag[i] = TRUE; goto CCBIS_STEP7; } } } CCBIS_STEP7:; iCount = 0; for (i = 1; i <= 6; i++) if (m_pDispBuildItemList[iIndex]->m_iElementCount[i] != 0) iCount++; iCount2 = 0; for (i = 1; i <= 6; i++) if (iItemIndex[i] != -1) iCount2++; if ((iMatch == 6) && (iCount == iCount2)) return TRUE; return FALSE; } void CGame::NoticementHandler(char * pData) { char * cp; FILE * pFile; WORD * wp; wp = (WORD *)(pData + INDEX2_MSGTYPE); switch (*wp) { case MSGTYPE_CONFIRM: break; case MSGTYPE_REJECT: cp = (char *)(pData + INDEX2_MSGTYPE + 2); pFile = fopen("contents\\contents1000.txt", "wt"); if (pFile == NULL) return; fwrite(cp, strlen(cp), 1, pFile); fclose(pFile); m_stDialogBoxInfo[18].sX = 20; m_stDialogBoxInfo[18].sY = 65; EnableDialogBox(18, 1000, NULL, NULL); break; } AddEventList(MSG_NOTIFY_HELP, 10); if (m_iLevel < 42) EnableDialogBox(35, NULL, NULL, NULL); } int CGame::_iGetFOE(int iStatus) { Side foeSide = (Side)(iStatus >> 28); if( m_iPKCount != 0 ) return -1; if( iStatus & STATUS_PK ) return -2; if( m_iIlusionOwnerH != NULL) return -1; if(foeSide == HOSTILE) return -1; else if(foeSide == NEUTRAL || m_side == NEUTRAL) return 0; else if(foeSide == m_side) return 1; return -1; } void CGame::_SetIlusionEffect(int iOwnerH) { char cDir; m_iIlusionOwnerH = iOwnerH; ZeroMemory(m_cName_IE, sizeof(m_cName_IE)); m_pMapData->GetOwnerStatusByObjectID(iOwnerH, &m_cIlusionOwnerType, &cDir, &m_sAppr1_IE, &m_sAppr2_IE, &m_sAppr3_IE, &m_sAppr4_IE, &m_iStatus_IE, &m_iApprColor_IE, m_cName_IE); if (!m_cIlusionOwnerType){ m_cIlusionOwnerType = 1; } if (m_iStatus_IE & STATUS_INVISIBILITY){ m_iStatus_IE = m_iStatus_IE & (STATUS_ALL - STATUS_INVISIBILITY); } } void CGame::ResponsePanningHandler(char *pData) { char * cp, cDir; short * sp, sX, sY; cp = (char *)(pData + INDEX2_MSGTYPE +2); sp = (short *)cp; sX = *sp; cp += 2; sp = (short *)cp; sY = *sp; cp += 2; cDir = *cp; cp++; switch (cDir) { case 1: m_sViewDstY -= 32; m_sPlayerY--; break; case 2: m_sViewDstY -= 32; m_sPlayerY--; m_sViewDstX += 32; m_sPlayerX++; break; case 3: m_sViewDstX += 32; m_sPlayerX++; break; case 4: m_sViewDstY += 32; m_sPlayerY++; m_sViewDstX += 32; m_sPlayerX++; break; case 5: m_sViewDstY += 32; m_sPlayerY++;break; case 6: m_sViewDstY += 32; m_sPlayerY++; m_sViewDstX -= 32; m_sPlayerX--; break; case 7: m_sViewDstX -= 32; m_sPlayerX--; break; case 8: m_sViewDstY -= 32; m_sPlayerY--; m_sViewDstX -= 32; m_sPlayerX--; break; } m_pMapData->ShiftMapData(cDir); _ReadMapData(sX, sY, cp); m_bIsRedrawPDBGS = TRUE; m_bIsObserverCommanded = FALSE; } BOOL CGame::bReadItemNameConfigFile() { FILE * pFile; HANDLE hFile; DWORD dwFileSize; char * cp, * token, cReadModeA, cReadModeB; char seps[] = "=\n"; int iIndex; cReadModeA = 0; cReadModeB = 0; iIndex = 0; hFile = CreateFile("contents\\ItemName.cfg", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); dwFileSize = GetFileSize(hFile, NULL); if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); pFile = fopen("contents\\ItemName.cfg", "rt"); if (pFile == NULL) return FALSE; else { cp = new char[dwFileSize+2]; ZeroMemory(cp, dwFileSize+2); fread(cp, dwFileSize, 1, pFile); token = strtok( cp, seps ); while( token != NULL ) { if (cReadModeA != 0) { switch (cReadModeA) { case 1: switch (cReadModeB) { case 1: m_pItemNameList[iIndex] = new class CItemName; strcpy(m_pItemNameList[iIndex]->m_cOriginName, token); cReadModeB = 2; break; case 2: strcpy(m_pItemNameList[iIndex]->m_cName, token); cReadModeA = 0; cReadModeB = 0; iIndex++; break; } } } else { if (memcmp(token, "Item", 4) == 0) { cReadModeA = 1; cReadModeB = 1; } } token = strtok( NULL, seps ); } delete[] cp; } if (pFile != NULL) fclose(pFile); return TRUE; } void CGame::DrawDialogBox_Map() { short sX, sY; DWORD dwTime = m_dwCurTime; double dV1, dV2, dV3; int tX, tY, szX, szY, dX, dY; sX = m_stDialogBoxInfo[22].sX; sY = m_stDialogBoxInfo[22].sY; szX = 0; szY = 0; switch (m_stDialogBoxInfo[22].sV1) { case 1: switch (m_stDialogBoxInfo[22].sV2) { case 0: // aresden if (m_bDialogTrans) m_pSprite[SPRID_INTERFACE_NEWMAPS1]->PutTransSprite2(sX, sY, 0, dwTime); else m_pSprite[SPRID_INTERFACE_NEWMAPS1]->PutSpriteFast(sX, sY, 0, dwTime); dX = 19; dY = 20; szX = 260; szY = 260; break; case 1: // elvine if (m_bDialogTrans) m_pSprite[SPRID_INTERFACE_NEWMAPS1]->PutTransSprite2(sX, sY, 1, dwTime); else m_pSprite[SPRID_INTERFACE_NEWMAPS1]->PutSpriteFast(sX, sY, 1, dwTime); dX = 20; dY = 18; szX = 260; szY = 260; break; case 2: // middleland if (m_bDialogTrans) m_pSprite[SPRID_INTERFACE_NEWMAPS2]->PutTransSprite2(sX, sY, 0, dwTime); else m_pSprite[SPRID_INTERFACE_NEWMAPS2]->PutSpriteFast(sX, sY, 0, dwTime); dX = 11; dY = 31; szX = 280; szY = 253; break; case 3: // default if (m_bDialogTrans) m_pSprite[SPRID_INTERFACE_NEWMAPS2]->PutTransSprite2(sX, sY, 1, dwTime); else m_pSprite[SPRID_INTERFACE_NEWMAPS2]->PutSpriteFast(sX, sY, 1, dwTime); dX = 52; dY = 42; szX = 200; szY = 200; break; case 4: if (m_bDialogTrans) m_pSprite[SPRID_INTERFACE_NEWMAPS3]->PutTransSprite2(sX, sY, 0, dwTime); else m_pSprite[SPRID_INTERFACE_NEWMAPS3]->PutSpriteFast(sX, sY, 0, dwTime); dX = 40; dY = 40; szX = 220; szY = 220; break; case 5: if (m_bDialogTrans) m_pSprite[SPRID_INTERFACE_NEWMAPS3]->PutTransSprite2(sX, sY, 1, dwTime); else m_pSprite[SPRID_INTERFACE_NEWMAPS3]->PutSpriteFast(sX, sY, 1, dwTime); dX = 40; dY = 40; szX = 220; szY = 220; break; case 6: // aresden if (m_bDialogTrans) m_pSprite[SPRID_INTERFACE_NEWMAPS4]->PutTransSprite2(sX, sY, 0, dwTime); else m_pSprite[SPRID_INTERFACE_NEWMAPS4]->PutSpriteFast(sX, sY, 0, dwTime); dX = 40; dY = 40; szX = 220; szY = 220; break; case 7: // elvine if (m_bDialogTrans) m_pSprite[SPRID_INTERFACE_NEWMAPS4]->PutTransSprite2(sX, sY, 1, dwTime); else m_pSprite[SPRID_INTERFACE_NEWMAPS4]->PutSpriteFast(sX, sY, 1, dwTime); dX = 40; dY = 40; szX = 220; szY = 220; break; case 8: // aresden if (m_bDialogTrans) m_pSprite[SPRID_INTERFACE_NEWMAPS5]->PutTransSprite2(sX, sY, 0, dwTime); else m_pSprite[SPRID_INTERFACE_NEWMAPS5]->PutSpriteFast(sX, sY, 0, dwTime); dX = 40; dY = 32; szX = 220; szY = 220; break; case 9: // elvine if (m_bDialogTrans) m_pSprite[SPRID_INTERFACE_NEWMAPS5]->PutTransSprite2(sX, sY, 1, dwTime); else m_pSprite[SPRID_INTERFACE_NEWMAPS5]->PutSpriteFast(sX, sY, 1, dwTime); dX = 40; dY = 38; szX = 220; szY = 220; break; } dV1 = (double)m_pMapData->m_sMapSizeX; dV2 = (double)m_sPlayerX; dV3 = (dV2*(double)szX)/dV1; tX = (int)dV3 +dX; dV1 = (double)m_pMapData->m_sMapSizeY; if( dV1 == 752 ) dV1 = 680; dV2 = (double)m_sPlayerY; dV3 = (dV2*(double)szY)/dV1; tY = (int)dV3 +dY; //m_pSprite[SPRID_INTERFACE_MAPS1]->PutSpriteFast(sX +tX, sY +tY, 4, dwTime); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, sX +tX, sY +tY, 43); wsprintf(G_cTxt, "%d,%d", m_sPlayerX, m_sPlayerY); PutString_SprFont3(sX + 10 +tX -5, sY + 10 + tY -6, G_cTxt, m_wR[13]*4, m_wG[13]*4, m_wB[13]*4, FALSE, 2); break; } } /********************************************************************************************************************* ** void CGame::NotifyMsg_SetExchangeItem(char *pData) (snoopy) ** ** description :: Recieve a msg from gserver and sets the item ** **********************************************************************************************************************/ void CGame::NotifyMsg_SetExchangeItem(char *pData) {short * sp, sDir, sSprite, sSpriteFrame, sCurLife, sMaxLife, sPerformance; int * ip, iAmount, i; char * cp, cColor, cItemName[24], cCharName[12]; DWORD * dwp, dwAttribute; ZeroMemory(cItemName, sizeof(cItemName)); ZeroMemory(cCharName, sizeof(cCharName)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sDir = *sp; cp += 2; sp = (short *)cp; sSprite = *sp; cp += 2; sp = (short *)cp; sSpriteFrame = *sp; cp += 2; ip = (int *)cp; iAmount = *ip; cp += 4; cColor = *cp; cp++; sp = (short *)cp; sCurLife = *sp; cp += 2; sp = (short *)cp; sMaxLife = *sp; cp += 2; sp = (short *)cp; sPerformance = *sp; cp += 2; memcpy(cItemName, cp, 20); cp += 20; memcpy(cCharName, cp, 10); cp += 10; dwp = (DWORD *)cp; dwAttribute = *dwp; cp += 4; if (sDir >= 1000) // Set the item I want to exchange { i = 0; while (m_stDialogBoxExchangeInfo[i].sV1 !=-1) { i++; if (i>=4) return; // Error situation } }else // Set the item he proposes me. { i = 4; while (m_stDialogBoxExchangeInfo[i].sV1 !=-1) { i++; if (i>=8) return; // Error situation } } m_stDialogBoxExchangeInfo[i].sV1 = sSprite; m_stDialogBoxExchangeInfo[i].sV2 = sSpriteFrame; m_stDialogBoxExchangeInfo[i].sV3 = iAmount; m_stDialogBoxExchangeInfo[i].sV4 = cColor; m_stDialogBoxExchangeInfo[i].sV5 = (int)sCurLife; m_stDialogBoxExchangeInfo[i].sV6 = (int)sMaxLife; m_stDialogBoxExchangeInfo[i].sV7 = (int)sPerformance; memcpy(m_stDialogBoxExchangeInfo[i].cStr1, cItemName, 20); memcpy(m_stDialogBoxExchangeInfo[i].cStr2, cCharName, 10); m_stDialogBoxExchangeInfo[i].dwV1 = dwAttribute; //if (i<4) m_stDialogBoxExchangeInfo[i].sItemID = sDir -1000; } void CGame::NotifyMsg_DismissGuildApprove(char * pData) { char * cp, cName[24], cLocation[12]; ZeroMemory(cName, sizeof(cName)); ZeroMemory(cLocation, sizeof(cLocation)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); memcpy(cName, cp, 20); cp += 20; cp += 2; memcpy(cLocation, cp, 10); cp += 10; ZeroMemory(m_cGuildName, sizeof(m_cGuildName)); m_iGuildRank = -1; ZeroMemory(m_cLocation, sizeof(m_cLocation)); memcpy(m_cLocation, cLocation, 10); if (memcmp(m_cLocation, "are", 3) == 0) m_side = ARESDEN; else if (memcmp(m_cLocation, "elv", 3) == 0) m_side = ELVINE; else if (memcmp(m_cLocation, "ist", 3) == 0) m_side = ISTRIA; else m_side = NEUTRAL; EnableDialogBox(8, NULL, NULL, NULL); _PutGuildOperationList(cName, 5); } void CGame::NotifyMsg_DismissGuildReject(char * pData) {char * cp, cName[21]; ZeroMemory(cName, sizeof(cName)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); memcpy(cName, cp, 20); cp += 20; EnableDialogBox(8, NULL, NULL, NULL); _PutGuildOperationList(cName, 6); } void CGame::NotifyMsg_DownSkillIndexSet(char *pData) { WORD * wp; short sSkillIndex; char * cp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; sSkillIndex = (short)*wp; cp += 2; m_iDownSkillIndex = sSkillIndex; m_stDialogBoxInfo[15].bFlag = FALSE; } void CGame::NotifyMsg_FishChance(char * pData) { int iFishChance; char * cp; WORD * wp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; iFishChance = (int)*wp; cp += 2; m_stDialogBoxInfo[24].sV1 = iFishChance; } void CGame::NotifyMsg_GuildDisbanded(char * pData) {char * cp, cName[24], cLocation[12]; ZeroMemory(cName, sizeof(cName)); ZeroMemory(cLocation, sizeof(cLocation)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); memcpy(cName, cp, 20); cp += 20; memcpy(cLocation, cp, 10); cp += 10; m_Misc.ReplaceString(cName, '_', ' '); EnableDialogBox(8, NULL, NULL, NULL); _PutGuildOperationList(cName, 7); ZeroMemory(m_cGuildName, sizeof(m_cGuildName)); m_iGuildRank = -1; ZeroMemory(m_cLocation, sizeof(m_cLocation)); memcpy(m_cLocation, cLocation, 10); if (memcmp(m_cLocation, "are", 3) == 0) m_side = ARESDEN; else if (memcmp(m_cLocation, "elv", 3) == 0) m_side = ELVINE; else if (memcmp(m_cLocation, "ist", 3) == 0) m_side = ISTRIA; else m_side = NEUTRAL; } void CGame::NotifyMsg_WhetherChange(char * pData) { char * cp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); m_cWhetherStatus = *cp; cp++; if (m_cWhetherStatus != NULL) SetWhetherStatus(TRUE, m_cWhetherStatus); else SetWhetherStatus(FALSE, NULL); } void CGame::NotifyMsg_TimeChange(char * pData) { char * cp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); G_cSpriteAlphaDegree = *cp; switch (G_cSpriteAlphaDegree) { case 1: m_bIsXmas = FALSE; PlaySound('E', 32, 0); break; case 2: m_bIsXmas = FALSE; PlaySound('E', 31, 0); break; case 3: // Snoopy Special night with chrismas bulbs if (m_cWhetherEffectType >3) m_bIsXmas = TRUE; else m_bIsXmas = FALSE; PlaySound('E', 31, 0); G_cSpriteAlphaDegree = 2;break; } m_cGameModeCount = 1; m_bIsRedrawPDBGS = TRUE; } void CGame::NotifyMsg_RepairItemPrice(char * pData) {char * cp, cName[21]; DWORD * dwp, wV1, wV2, wV3, wV4; cp = (char *)(pData + INDEX2_MSGTYPE + 2); dwp = (DWORD *)cp; wV1 = *dwp; cp += 4; dwp = (DWORD *)cp; wV2 = *dwp; cp += 4; dwp = (DWORD *)cp; wV3 = *dwp; cp += 4; dwp = (DWORD *)cp; wV4 = *dwp; cp += 4; ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 20); cp += 20; EnableDialogBox(23, 2, wV1, wV2); m_stDialogBoxInfo[23].sV3 = wV3; } void CGame::NotifyMsg_SellItemPrice(char * pData) {char * cp, cName[21]; DWORD * dwp, wV1, wV2, wV3, wV4; cp = (char *)(pData + INDEX2_MSGTYPE + 2); dwp = (DWORD *)cp; wV1 = *dwp; cp += 4; dwp = (DWORD *)cp; wV2 = *dwp; cp += 4; dwp = (DWORD *)cp; wV3 = *dwp; cp += 4; dwp = (DWORD *)cp; wV4 = *dwp; cp += 4; ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 20); cp += 20; EnableDialogBox(23, 1, wV1, wV2); m_stDialogBoxInfo[23].sV3 = wV3; m_stDialogBoxInfo[23].sV4 = wV4; } void CGame::NotifyMsg_QueryDismissGuildPermission(char * pData) {char * cp, cName[12]; ZeroMemory(cName, sizeof(cName)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); memcpy(cName, cp, 10); cp += 10; EnableDialogBox(8, NULL, NULL, NULL); _PutGuildOperationList(cName, 2); } void CGame::NotifyMsg_QueryJoinGuildPermission(char * pData) {char * cp, cName[12]; ZeroMemory(cName, sizeof(cName)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); memcpy(cName, cp, 10); cp += 10; EnableDialogBox(8, NULL, NULL, NULL); _PutGuildOperationList(cName, 1); } void CGame::NotifyMsg_QuestContents(char *pData) {short * sp; char * cp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; m_stQuest.sWho = *sp; cp += 2; sp = (short *)cp; m_stQuest.sQuestType = *sp; cp += 2; sp = (short *)cp; m_stQuest.sContribution = *sp; cp += 2; sp = (short *)cp; m_stQuest.sTargetType = *sp; cp += 2; sp = (short *)cp; m_stQuest.sTargetCount = *sp; cp += 2; sp = (short *)cp; m_stQuest.sX = *sp; cp += 2; sp = (short *)cp; m_stQuest.sY = *sp; cp += 2; sp = (short *)cp; m_stQuest.sRange = *sp; cp += 2; sp = (short *)cp; m_stQuest.bIsQuestCompleted = (BOOL)*sp; cp += 2; ZeroMemory(m_stQuest.cTargetName, sizeof(m_stQuest.cTargetName)); memcpy(m_stQuest.cTargetName, cp, 20); cp += 20; //AddEventList(NOTIFYMSG_QUEST_STARTED, 10); } void CGame::NotifyMsg_PlayerProfile(char * pData) {char * cp; char cTemp[500]; int i; ZeroMemory(cTemp, sizeof(cTemp)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); strcpy(cTemp, cp); for (i = 0; i < 500; i++) if (cTemp[i] == '_') cTemp[i] = ' '; AddEventList(cTemp, 10); } void CGame::NotifyMsg_NoticeMsg(char * pData) {char * cp, cMsg[1000]; cp = (char *)(pData + INDEX2_MSGTYPE + 2); strcpy(cMsg, cp); AddEventList(cMsg, 10); } /********************************************************************************************************************* ** void CGame::NotifyMsg_OpenExchageWindow(char *pData) (snoopy) ** ** description :: Recieve a msg from gserver and sets the item and opens trade windows ** **********************************************************************************************************************/ void CGame::NotifyMsg_OpenExchageWindow(char *pData) {short * sp, sDir, sSprite, sSpriteFrame, sCurLife, sMaxLife, sPerformance; int * ip, iAmount; char * cp, cColor, cItemName[24], cCharName[12]; DWORD * dwp, dwAttribute; ZeroMemory(cItemName, sizeof(cItemName)); ZeroMemory(cCharName, sizeof(cCharName)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sDir = *sp; cp += 2; sp = (short *)cp; sSprite = *sp; cp += 2; sp = (short *)cp; sSpriteFrame = *sp; cp += 2; ip = (int *)cp; iAmount = *ip; cp += 4; cColor = *cp; cp++; sp = (short *)cp; sCurLife = *sp; cp += 2; sp = (short *)cp; sMaxLife = *sp; cp += 2; sp = (short *)cp; sPerformance = *sp; cp += 2; memcpy(cItemName, cp, 20); cp += 20; memcpy(cCharName, cp, 10); cp += 10; dwp = (DWORD *)cp; dwAttribute = *dwp; cp += 4; EnableDialogBox(27, 1, 0, 0, NULL); int i; if (sDir >= 1000) // Set the item I want to exchange { i = 0; while (m_stDialogBoxExchangeInfo[i].sV1 !=-1) { i++; if (i>=4) return; // Error situation } if ((sDir >1000) && (i == 0)) { m_bIsItemDisabled[sDir -1000] = TRUE; m_stDialogBoxExchangeInfo[0].sItemID = sDir -1000; } }else // Set the item he proposes me. { i = 4; while (m_stDialogBoxExchangeInfo[i].sV1 !=-1) { i++; if (i>=8) return; // Error situation } } m_stDialogBoxExchangeInfo[i].sV1 = sSprite; m_stDialogBoxExchangeInfo[i].sV2 = sSpriteFrame; m_stDialogBoxExchangeInfo[i].sV3 = iAmount; m_stDialogBoxExchangeInfo[i].sV4 = cColor; m_stDialogBoxExchangeInfo[i].sV5 = (int)sCurLife; m_stDialogBoxExchangeInfo[i].sV6 = (int)sMaxLife; m_stDialogBoxExchangeInfo[i].sV7 = (int)sPerformance; memcpy(m_stDialogBoxExchangeInfo[i].cStr1, cItemName, 20); memcpy(m_stDialogBoxExchangeInfo[i].cStr2, cCharName, 10); m_stDialogBoxExchangeInfo[i].dwV1 = dwAttribute; } void CGame::NotifyMsg_JoinGuildApprove(char * pData) {char * cp, cName[21]; short * sp; ZeroMemory(cName, sizeof(cName)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); memcpy(cName, cp, 20); cp += 20; sp = (short *)cp; cp += 2; ZeroMemory(m_cGuildName, sizeof(m_cGuildName)); strcpy(m_cGuildName, cName); m_iGuildRank = *sp; EnableDialogBox(8, NULL, NULL, NULL); _PutGuildOperationList(cName, 3); } void CGame::NotifyMsg_JoinGuildReject(char * pData) {char * cp, cName[21]; ZeroMemory(cName, sizeof(cName)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); memcpy(cName, cp, 20); cp += 20; EnableDialogBox(8, NULL, NULL, NULL); _PutGuildOperationList(cName, 4); } void CGame::DlgBoxClick_Help(int msX, int msY) { short sX, sY; sX = m_stDialogBoxInfo[35].sX; sY = m_stDialogBoxInfo[35].sY; if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*0) && (msY < sY +50+15*1)) { DisableDialogBox(18); EnableDialogBox(18, 1000, NULL, NULL); } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*1) && (msY < sY +50+15*2)) { DisableDialogBox(18); #ifdef DEF_HTMLCOMMOM WebDialog("http://www.helbreathlegion.net/"); #else EnableDialogBox(18, 900, NULL, NULL); #endif } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*2) && (msY < sY +50+15*3)) { DisableDialogBox(18); EnableDialogBox(18, 901, NULL, NULL); } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*3) && (msY < sY +50+15*4)) { DisableDialogBox(18); EnableDialogBox(18, 902, NULL, NULL); } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*4) && (msY < sY +50+15*5)) { DisableDialogBox(18); EnableDialogBox(18, 903, NULL, NULL); m_bIsF1HelpWindowEnabled = TRUE; } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*5) && (msY < sY +50+15*6)) { DisableDialogBox(18); EnableDialogBox(18, 904, NULL, NULL); // } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*6) && (msY < sY +50+15*7)) { DisableDialogBox(18); EnableDialogBox(18, 905, NULL, NULL); // } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*7) && (msY < sY +50+15*8)) { DisableDialogBox(18); EnableDialogBox(18, 906, NULL, NULL); // } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*8) && (msY < sY +50+15*9)) { DisableDialogBox(18); EnableDialogBox(18, 907, NULL, NULL); // } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*9) && (msY < sY +50+15*10)) { DisableDialogBox(18); EnableDialogBox(18, 908, NULL, NULL); // } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*10) && (msY < sY +50+15*11)) { DisableDialogBox(18); EnableDialogBox(18, 909, NULL, NULL); // } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*11) && (msY < sY +50+15*12)) { DisableDialogBox(18); EnableDialogBox(18, 910, NULL, NULL); // } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*12) && (msY < sY +50+15*13)) { DisableDialogBox(18); EnableDialogBox(18, 911, NULL, NULL); // FAQ } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*13) && (msY < sY +50+15*14)) { DisableDialogBox(18); EnableDialogBox(18, 912, NULL, NULL); // } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { PlaySound('E', 14, 5); DisableDialogBox(35); } } /********************************************************************************************************************* ** void CGame::CreateScreenShot() (snoopy) ** ** description :: Fixed Screen Shots ** **********************************************************************************************************************/ void CGame::CreateScreenShot() { int i; FILE * pFile; char cFn[256]; char LongMapName[128]; char SStime[32]; SYSTEMTIME SysTime; GetLocalTime(&SysTime); ZeroMemory(LongMapName, sizeof(LongMapName)); GetOfficialMapName(m_cMapName, LongMapName); ZeroMemory(SStime, sizeof(SStime)); wsprintf(SStime, "%02d:%02d - %02d:%02d:%02d" , SysTime.wMonth, SysTime.wDay , SysTime.wHour, SysTime.wMinute, SysTime.wSecond , LongMapName); PutAlignedString(500, 600, 30, SStime, 255, 255, 255); PutString_SprFont3(500, 390, "www.helbreathlegion.net", 20, 20, 0, TRUE, 2); _mkdir("SAVE"); for (i = 0; i < 1000; i++) { ZeroMemory(cFn, sizeof(cFn)); wsprintf(cFn, "SAVE\\Helbreath Legion #%d.bmp", i); if(_access(cFn, 0 ) == -1){ pFile = fopen(cFn, "rb"); m_DDraw.Screenshot(cFn, m_DDraw.m_lpBackB4); wsprintf(G_cTxt, NOTIFYMSG_CREATE_SCREENSHOT1, cFn); AddEventList(G_cTxt, 10); return; } } AddEventList(NOTIFYMSG_CREATE_SCREENSHOT2, 10); } void CGame::UpdateScreen_OnConnecting() { short sX, sY, msX, msY, msZ; char cLB, cRB, cMB; DWORD dwTime = timeGetTime(); static class CMouseInterface * pMI; static DWORD dwMTime, dwCTime; if (m_cGameModeCount == 0) { m_bEnterPressed = FALSE; m_bEscPressed = FALSE; dwCTime = dwMTime = timeGetTime(); } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; if (m_bEscPressed == TRUE) { if ((dwTime - m_dwTime) > 1000) { ChangeGameMode(GAMEMODE_ONMAINMENU); if (m_pLSock != NULL) { delete m_pLSock; m_pLSock = NULL; } if (m_pGSock != NULL) { delete m_pGSock; m_pGSock = NULL; } } m_bEscPressed = FALSE; return; } if ((dwTime - dwMTime) > 150) dwMTime = dwTime; if ((dwTime - dwCTime) > 100) { m_cMenuFrame++; dwCTime = dwTime; } if (m_cMenuFrame >= 8) { m_cMenuDirCnt++; if (m_cMenuDirCnt > 8) { m_cMenuDir++; m_cMenuDirCnt = 1; } m_cMenuFrame = 0; } if (m_cMenuDir > 8) m_cMenuDir = 1; m_DDraw.ClearBackB4(); m_bIsHideLocalCursor = TRUE; switch (m_cMsg[0]) { case '0': _Draw_UpdateScreen_OnCreateNewAccount(); break; case '1': sX = 146; sY = 114; _Draw_OnLogin(m_cAccountName, m_cAccountPassword, 0, 0); break; case '2': _bDraw_OnCreateNewCharacter(m_cPlayerName, 0, 0, 0); break; case '3': UpdateScreen_OnSelectCharacter(0, 0, 0, 0); break; case '4': // Change Password UpdateScreen_OnSelectCharacter(0, 0, 0, 0, TRUE); break; case '5': m_DDraw.ClearBackB4(); break; } m_bIsHideLocalCursor = FALSE; m_DDraw.DrawShadowBox(0,0,639,479); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, 162,125,2); wsprintf(G_cTxt, "Connecting to Server... %3dSec", (dwTime - m_dwTime)/1000); PutString_SprFont(172 + 35, 190, G_cTxt, 7,0,0); if ((dwTime - m_dwTime) > 7000) { PutAlignedString(180, 463, 195+30, UPDATE_SCREEN_ON_CONNECTING1);//"Press ESC key during long time of no" PutAlignedString(180, 463, 195+45, UPDATE_SCREEN_ON_CONNECTING2);//"connection and return to the main menu." } else PutAlignedString(180, 463, 195+30, UPDATE_SCREEN_ON_CONNECTING3);//" Connecting to server. Please wait..." DrawVersion(); m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 8, dwTime); if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } void CGame::UpdateScreen_OnWaitInitData() { short msX, msY, msZ; char cLB, cRB, cMB; DWORD dwTime = timeGetTime(); if (m_cGameModeCount == 0) { m_bEnterPressed = FALSE; m_bEscPressed = FALSE; } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; if (m_bEscPressed == TRUE) { if ((dwTime - m_dwTime) > 7000) { ChangeGameMode(GAMEMODE_ONMAINMENU); if (m_pLSock != NULL) { delete m_pLSock; m_pLSock = NULL; } if (m_pGSock != NULL) { delete m_pGSock; m_pGSock = NULL; } } m_bEscPressed = FALSE; return; } m_DDraw.ClearBackB4(); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, 162,125,2); wsprintf(G_cTxt,"Waiting for response... %dsec", (dwTime - m_dwTime)/1000); PutString_SprFont(172+ 44, 190, G_cTxt, 7,0,0); if ((dwTime - m_dwTime) > 7000) { PutAlignedString(174, 467, 190+30, UPDATE_SCREEN_ON_WAIT_INIT_DATA1);//"Press ESC key during long time of no" PutAlignedString(174, 467, 190+45, UPDATE_SCREEN_ON_WAIT_INIT_DATA2);//"connection and return to the main menu." } else PutAlignedString(174, 467, 195+30, UPDATE_SCREEN_ON_WAIT_INIT_DATA3);// Connecting to server. Please wait..." DrawVersion(); m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 8, dwTime); if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } void CGame::UpdateScreen_OnConnectionLost() {short msX, msY, msZ; char cLB, cRB, cMB; static DWORD dwTime; if (m_cGameModeCount == 0) { dwTime = timeGetTime(); if (m_bSoundFlag) m_pESound[38]->bStop(); if ((m_bSoundFlag) && (m_bMusicStat == TRUE)) { if (m_pBGM != NULL) m_pBGM->bStop(); } } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; m_DDraw.ClearBackB4(); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, 162,125,2); PutString_SprFont(172 + 54, 180, "Connection Lost!", 7,0,0); PutString(172+50, 180+30, UPDATE_SCREEN_ON_CONNECTION_LOST, RGB(0,0,0));//" DrawVersion(); m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); if ((timeGetTime() - m_dwTime) > 5000) { if (strlen(G_cCmdLineTokenA) != 0) ChangeGameMode(GAMEMODE_ONQUIT); else { ChangeGameMode(GAMEMODE_ONMAINMENU); } } } BOOL CGame::_bDraw_OnCreateNewCharacter(char * pName, short msX, short msY, int iPoint) { BOOL bFlag = TRUE; DWORD dwTime = timeGetTime(); int i=0; m_DDraw.ClearBackB4(); DrawNewDialogBox(SPRID_INTERFACE_ND_NEWCHAR, 0, 0, 0, TRUE); DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 0, 0, 69, TRUE); PutAlignedString(64, 282, 90, _BDRAW_ON_CREATE_NEW_CHARACTER1, 5,5,5);//" PutAlignedString(57, 191, 110, MSG_CHARACTERNAME, 5,5,5);//"Character Name" if (m_cCurFocus != 1) PutString(197, 112, pName, RGB(25,35,25)); PutAlignedString(64, 282, 140, _BDRAW_ON_CREATE_NEW_CHARACTER2, 5,5,5);//" PutString(100, 160, MSG_GENDER, RGB(5,5,5));//"Gender" PutString(100, 175, MSG_SKINCOLOR, RGB(5,5,5));//"Skin Color" PutString(100, 190, MSG_HAIRSTYLE, RGB(5,5,5));//"Hair Style" PutString(100, 205, MSG_HAIRCOLOR, RGB(5,5,5));//"Hair Color" PutString(100, 220, MSG_UNDERWEARCOLOR, RGB(5,5,5));//"Underwear Color" //PutAlignedString(64, 282, 245, _BDRAW_ON_CREATE_NEW_CHARACTER3, 5,5,5); //wsprintf(G_cTxt, _BDRAW_ON_CREATE_NEW_CHARACTER4, iPoint);//" %d points" //PutAlignedString(64, 282, 260, G_cTxt, 15,10,10); PutString(100, 275, MSG_STRENGTH, RGB(5,5,5));//"Strength" PutString(100, 292, MSG_VITALITY, RGB(5,5,5));//"Vitality" PutString(100, 309, MSG_DEXTERITY, RGB(5,5,5));//"Dexterity" PutString(100, 326, MSG_INTELLIGENCE, RGB(5,5,5));//"Intelligence" PutString(100, 343, MSG_MAGIC, RGB(5,5,5));//"Magic" PutString(100, 360, MSG_CHARISMA, RGB(5,5,5));//"Charisma" wsprintf(G_cTxt, "%d", m_createStat[STAT_STR]); PutString(204 , 277+ 16*i++ , G_cTxt, RGB(25,35,25)); wsprintf(G_cTxt, "%d", m_createStat[STAT_VIT]); PutString(204 , 277+ 16*i++ , G_cTxt, RGB(25,35,25)); wsprintf(G_cTxt, "%d", m_createStat[STAT_DEX]); PutString(204 , 277+ 16*i++ , G_cTxt, RGB(25,35,25)); wsprintf(G_cTxt, "%d", m_createStat[STAT_INT]); PutString(204 , 277+ 16*i++ , G_cTxt, RGB(25,35,25)); wsprintf(G_cTxt, "%d", m_createStat[STAT_MAG]); PutString(204 , 277+ 16*i++ , G_cTxt, RGB(25,35,25)); wsprintf(G_cTxt, "%d", m_createStat[STAT_CHR]); PutString(204 , 277+ 16*i++ , G_cTxt, RGB(25,35,25)); if (strlen(pName) <= 0) bFlag = FALSE; if (iPoint > 0) bFlag = FALSE; if (m_Misc.bCheckValidName(pName) == FALSE) bFlag = FALSE; if ( (bFlag == TRUE) && (m_cCurFocus == 2) ) m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(384, 445, 25, dwTime); else m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(384, 445, 24, dwTime); if (m_cCurFocus == 3) m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(500, 445, 17, dwTime); else m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(500, 445, 16, dwTime); if (m_cCurFocus == 4) m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(60, 445, 68, dwTime); else m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(60, 445, 67, dwTime); if (m_cCurFocus == 5) m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(145, 445, 66, dwTime); else m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(145, 445, 65, dwTime); if (m_cCurFocus == 6) m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(230, 445, 64, dwTime); else m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(230, 445, 63, dwTime); /*if (m_cCurFocus == 4) m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(60, 245, 68, dwTime); else m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(60, 245, 67, dwTime); if (m_cCurFocus == 5) m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(145, 245, 66, dwTime); else m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(145, 245, 65, dwTime); if (m_cCurFocus == 6) m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(230, 245, 64, dwTime); else m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(230, 245, 63, dwTime);*/ ShowReceivedString(); switch (m_cGender) { case 1: _tmp_sOwnerType = 1; break; case 2: _tmp_sOwnerType = 4; break; //@@@@@@@@@@@@@@@@@!!!!!!!!!!!!!!!!! } _tmp_sOwnerType += m_cSkinCol - 1; _tmp_cDir = m_cMenuDir; _tmp_sAppr1 = 0; _tmp_sAppr1 = _tmp_sAppr1 | (m_cUnderCol); _tmp_sAppr1 = _tmp_sAppr1 | (m_cHairStyle << 8); _tmp_sAppr1 = _tmp_sAppr1 | (m_cHairCol << 4); _tmp_sAppr2 = 0; _tmp_sAppr3 = 0; _tmp_sAppr4 = 0; ZeroMemory(_tmp_cName, sizeof(_tmp_cName)); memcpy(_tmp_cName, m_cPlayerName,10); _tmp_cAction = OBJECTMOVE; _tmp_cFrame = m_cMenuFrame; _Draw_CharacterBody( 507 , 267, _tmp_sOwnerType); DrawObject_OnMove_ForMenu(0, 0, 500 , 174, FALSE, dwTime, msX, msY); i = 0 ; PutString(445, 192, MSG_HITPOINT, RGB(5,5,5));//"Hit Point" wsprintf(G_cTxt, "%d", m_createStat[STAT_VIT]*3 + 2 + m_createStat[STAT_STR]/2); PutString(550, 192 + 16*i++, G_cTxt, RGB(25,35,25)); PutString(445, 208, MSG_MANAPOINT, RGB(5,5,5));//"Mana Point" wsprintf(G_cTxt, "%d", m_createStat[STAT_MAG]*2 + 2 + m_createStat[STAT_INT]/2); PutString(550, 192 + 16*i++, G_cTxt, RGB(25,35,25)); PutString(445, 224, MSG_STAMINARPOINT, RGB(5,5,5));//"Staminar Point" wsprintf(G_cTxt, "%d", m_createStat[STAT_STR]*2 + 2); PutString(550, 192 + 16*i++, G_cTxt, RGB(25,35,25)); return bFlag; } void CGame::UpdateScreen_OnCreateNewCharacter() {static class CMouseInterface * pMI; int i=0; int iMIbuttonNum; static int iPoint; char cLB, cRB, cMB, cMIresult; static char cName[12]; static char cPrevFocus; short msX, msY, msZ; BOOL bFlag; static DWORD dwMTime; DWORD dwTime = timeGetTime(); if (m_cGameModeCount == 0) { pMI = new class CMouseInterface; pMI->AddRect(65+4, 65+45, 275+4, 82+45); pMI->AddRect(232+4, 111+45, 274+4 -21, 124+45); pMI->AddRect(255+4, 111+45, 289+4 -13, 124+45); pMI->AddRect(232+4, 126+45, 274+4 -21, 139+45); pMI->AddRect(255+4, 126+45, 289+4 -13, 139+45); pMI->AddRect(232+4, 141+45, 274+4 -21, 154+45); pMI->AddRect(255+4, 141+45, 289+4 -13, 154+45); pMI->AddRect(232+4, 156+45, 274+4 -21, 169+45); pMI->AddRect(255+4, 156+45, 289+4 -13, 169+45); pMI->AddRect(232+4, 171+45, 274+4 -21, 184+45); pMI->AddRect(255+4, 171+45, 289+4 -13, 184+45); pMI->AddRect(232+4, 231+45, 253+4, 244+45); pMI->AddRect(255+4, 231+45, 276+4, 244+45); pMI->AddRect(232+4, 246+45, 253+4, 259+45); pMI->AddRect(255+4, 246+45, 276+4, 259+45); pMI->AddRect(232+4, 261+45, 253+4, 274+45); pMI->AddRect(255+4, 261+45, 276+4, 274+45); pMI->AddRect(232+4, 276+45, 253+4, 289+45); pMI->AddRect(255+4, 276+45, 276+4, 289+45); pMI->AddRect(232+4, 291+45, 253+4, 304+45); pMI->AddRect(255+4, 291+45, 276+4, 304+45); pMI->AddRect(232+4, 306+45, 253+4, 319+45); pMI->AddRect(255+4, 306+45, 276+4, 319+45); pMI->AddRect(384, 445, 384+72, 445+15); pMI->AddRect(500, 445, 500+72, 445+15); pMI->AddRect(60, 445, 60+72, 445+15); pMI->AddRect(145, 445, 145+72, 445+15); pMI->AddRect(230, 445, 230+72, 445+15); iPoint = m_createStat[STAT_STR] + m_createStat[STAT_VIT] + m_createStat[STAT_DEX] + m_createStat[STAT_INT] + m_createStat[STAT_MAG] + m_createStat[STAT_CHR]; iPoint = 70 - iPoint; cPrevFocus = 1; m_cCurFocus = 1; m_cMaxFocus = 6; m_bEnterPressed = FALSE; m_cArrowPressed = 0; dwMTime = timeGetTime(); StartInputString(193+4, 65+45, 11, cName); ClearInputString(); } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; if (m_cArrowPressed != 0) { switch (m_cArrowPressed) { case 1: m_cCurFocus--; if (m_cCurFocus <= 0) m_cCurFocus = m_cMaxFocus; break; case 3: m_cCurFocus++; if (m_cCurFocus > m_cMaxFocus) m_cCurFocus = 1; break; } m_cArrowPressed = 0; } if (cPrevFocus != m_cCurFocus) { EndInputString(); switch (m_cCurFocus) { case 1: StartInputString(193+4, 65+45, 11, cName); break; } cPrevFocus = m_cCurFocus; } if (m_bEscPressed == TRUE) { ChangeGameMode(GAMEMODE_ONSELECTCHARACTER); delete pMI; m_bEscPressed = FALSE; return; } m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); bFlag = _bDraw_OnCreateNewCharacter(cName, msX, msY, iPoint); if ((dwTime - dwMTime) > 100) { m_cMenuFrame++; dwMTime = dwTime; } if (m_cMenuFrame >= 8) { m_cMenuDirCnt++; if (m_cMenuDirCnt > 8) { m_cMenuDir++; m_cMenuDirCnt = 1; } m_cMenuFrame = 0; } if (m_cMenuDir > 8) m_cMenuDir = 1; DrawVersion(); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); iMIbuttonNum = pMI->iGetStatus(msX, msY, cLB, &cMIresult); if (cMIresult == MIRESULT_CLICK) { PlaySound('E', 14, 5); switch (iMIbuttonNum) { case 1: m_cCurFocus = 1; break; case 2: m_cGender--; if (m_cGender < 1) m_cGender = 2; break; case 3: m_cGender++; if (m_cGender > 2) m_cGender = 1; break; case 4: m_cSkinCol--; if (m_cSkinCol < 1) m_cSkinCol = 3; break; case 5: m_cSkinCol++; if (m_cSkinCol > 3) m_cSkinCol = 1; break; case 6: m_cHairStyle--; if (m_cHairStyle < 0) m_cHairStyle = 7; break; case 7: m_cHairStyle++; if (m_cHairStyle > 7) m_cHairStyle = 0; break; case 8: m_cHairCol--; if (m_cHairCol < 0) m_cHairCol = 15; break; case 9: m_cHairCol++; if (m_cHairCol > 15) m_cHairCol = 0; break; case 10: m_cUnderCol--; if (m_cUnderCol < 0) m_cUnderCol = 7; break; case 11: m_cUnderCol++; if (m_cUnderCol > 7) m_cUnderCol = 0; break; case 12: if (iPoint > 0) { if (m_createStat[STAT_STR] < 14) { m_createStat[STAT_STR]++; iPoint--; } } break; case 13: if (m_createStat[STAT_STR] > 10) { m_createStat[STAT_STR]--; iPoint++; } break; case 14: if (iPoint > 0) { if (m_createStat[STAT_VIT] < 14) { m_createStat[STAT_VIT]++; iPoint--; } } break; case 15: if (m_createStat[STAT_VIT] > 10) { m_createStat[STAT_VIT]--; iPoint++; } break; case 16: if (iPoint > 0) { if (m_createStat[STAT_DEX] < 14) { m_createStat[STAT_DEX]++; iPoint--; } } break; case 17: if (m_createStat[STAT_DEX] > 10) { m_createStat[STAT_DEX]--; iPoint++; } break; case 18: if (iPoint > 0) { if (m_createStat[STAT_INT] < 14) { m_createStat[STAT_INT]++; iPoint--; } } break; case 19: if (m_createStat[STAT_INT] > 10) { m_createStat[STAT_INT]--; iPoint++; } break; case 20: if (iPoint > 0) { if (m_createStat[STAT_MAG] < 14) { m_createStat[STAT_MAG]++; iPoint--; } } break; case 21: if (m_createStat[STAT_MAG] > 10) { m_createStat[STAT_MAG]--; iPoint++; } break; case 22: if (iPoint > 0) { if (m_createStat[STAT_CHR] < 14) { m_createStat[STAT_CHR]++; iPoint--; } } break; case 23: if (m_createStat[STAT_CHR] > 10) { m_createStat[STAT_CHR]--; iPoint++; } break; case 24: if (m_cCurFocus != 2) { m_cCurFocus = 2; return; } if (bFlag == FALSE) return; //if (m_Misc.bCheckValidName(m_cPlayerName) == FALSE) break; if (m_Misc.bCheckValidName(cName) == FALSE) break; ZeroMemory(m_cPlayerName, sizeof(m_cPlayerName)); strcpy(m_cPlayerName, cName); m_pLSock = new class XSocket(m_hWnd, SOCKETBLOCKLIMIT); m_pLSock->bConnect(m_cLogServerAddr, m_iLogServerPort, WM_USER_LOGSOCKETEVENT); m_pLSock->bInitBufferSize(30000); ChangeGameMode(GAMEMODE_ONCONNECTING); m_dwConnectMode = MSGID_REQUEST_CREATENEWCHARACTER; ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg,"22"); delete pMI; return; case 25: if (m_cCurFocus != 3) { m_cCurFocus = 3; return; } ChangeGameMode(GAMEMODE_ONSELECTCHARACTER); delete pMI; return; case 26: // WARRIOR if (m_cCurFocus != 4) { m_cCurFocus = 4; return; } m_createStat[STAT_MAG] = 10 ; m_createStat[STAT_INT] = 10 ; m_createStat[STAT_CHR] = 10 ; m_createStat[STAT_STR] = 14 ; m_createStat[STAT_VIT] = 12 ; m_createStat[STAT_DEX] = 14 ; iPoint = m_createStat[STAT_STR] + m_createStat[STAT_VIT] + m_createStat[STAT_DEX] + m_createStat[STAT_INT] + m_createStat[STAT_MAG] + m_createStat[STAT_CHR]; iPoint = 70 - iPoint; break; case 27: // MAGE if (m_cCurFocus != 5) { m_cCurFocus = 5; return; } m_createStat[STAT_MAG] = 14 ; m_createStat[STAT_INT] = 14 ; m_createStat[STAT_CHR] = 10 ; m_createStat[STAT_STR] = 10 ; m_createStat[STAT_VIT] = 12 ; m_createStat[STAT_DEX] = 10 ; iPoint = m_createStat[STAT_STR] + m_createStat[STAT_VIT] + m_createStat[STAT_DEX] + m_createStat[STAT_INT] + m_createStat[STAT_MAG] + m_createStat[STAT_CHR]; iPoint = 70 - iPoint; break; case 28: // PRIEST if (m_cCurFocus != 6) { m_cCurFocus = 6; return; } m_createStat[STAT_MAG] = 12 ; m_createStat[STAT_INT] = 10 ; m_createStat[STAT_CHR] = 14 ; m_createStat[STAT_STR] = 14 ; m_createStat[STAT_VIT] = 10 ; m_createStat[STAT_DEX] = 10 ; iPoint = m_createStat[STAT_STR] + m_createStat[STAT_VIT] + m_createStat[STAT_DEX] + m_createStat[STAT_INT] + m_createStat[STAT_MAG] + m_createStat[STAT_CHR]; iPoint = 70 - iPoint; break; } } if ((msX >= 65+4-127) && (msX <= 275+4) && (msY >= 65+45) && (msY <= 82+45)) { PutAlignedString(370, 580, 345, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER1); } else if ((msX >= 261+4-212) && (msX <= 289+4) && (msY >= 111+45) && (msY <= 124+45)) { PutAlignedString(370, 580, 345, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER2); } else if ((msX >= 261+4-212) && (msX <= 289+4) && (msY >= 126+45) && (msY <= 139+45)) { PutAlignedString(370, 580, 345, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER3); } else if ((msX >= 261+4-212) && (msX <= 289+4) && (msY >= 141+45) && (msY <= 154+45)) { PutAlignedString(370, 580, 345, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER4); } else if ((msX >= 261+4-212) && (msX <= 289+4) && (msY >= 156+45) && (msY <= 169+45)) { PutAlignedString(370, 580, 345, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER5); } else if ((msX >= 261+4-212) && (msX <= 289+4) && (msY >= 171+45) && (msY <= 184+45)) { PutAlignedString(370, 580, 345, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER6); } else if ((msX >= 240+4-175) && (msX <= 268+4) && (msY >= 231+45) && (msY <= 244+45)) { // Str i= 0 ; PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER7); PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER8); PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER9); PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER10); PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER11); } else if ((msX >= 240+4-175) && (msX <= 268+4) && (msY >= 246+45) && (msY <= 259+45)) { i= 0 ; PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER12);//" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER13);//" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER14);//" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER15);//" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER16);//" } else if ((msX >= 240+4-175) && (msX <= 268+4) && (msY >= 261+45) && (msY <= 274+45)) { // Dex i= 0 ; PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER17);//" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER18);//" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER19);//" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER20);//" } else if ((msX >= 240+4-175) && (msX <= 268+4) && (msY >= 276+45) && (msY <= 289+45)) { // Int i= 0 ; PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER21);//" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER22);//" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER23);//" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER24); } else if ((msX >= 240+4-175) && (msX <= 268+4) && (msY >= 291+45) && (msY <= 304+45)) { // Mag i= 0 ; PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER25); PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER26); PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER27); PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER28); } else if ((msX >= 240+4-175) && (msX <= 268+4) && (msY >= 306+45) && (msY <= 319+45)) { // Charisma i= 0 ; PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER29); PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER30); PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER31); PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER32); } else if ((msX >= 384) && (msX <= 384+72) && (msY >= 445) && (msY <= 445+15)) { m_cCurFocus = 2; if (strlen(cName) <= 0) { i= 0 ; PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER35);//"Please enter a character name." } else if (iPoint > 0) { i= 0 ; PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER36);//"You need to select your character class." }else if (m_Misc.bCheckValidName(cName) == FALSE) { i= 0 ; PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER39);//"Cannot use special characters " PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER40);//"in your character's name. Please" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER41);//"type another name." }else { i= 0 ; PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER44);//" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER45);//" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER46);//" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER47);//" PutAlignedString(370, 580, 345 + 16*i++, UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER48);//" } }else if ((msX >= 500) && (msX <= 500+72) && (msY >= 445) && (msY <= 445+15)) { m_cCurFocus = 3; PutAlignedString(370, 580, 345 , UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER49); } if ((msX >= 60) && (msX <= 60+72) && (msY >= 445) && (msY <= 445+15)) { m_cCurFocus = 4; PutAlignedString(370, 580, 345 , UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER50); } if ((msX >= 145) && (msX <= 145+72) && (msY >= 445) && (msY <= 445+15)) { m_cCurFocus = 5; PutAlignedString(370, 580, 345 , UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER51); } if ((msX >= 230) && (msX <= 230+72) && (msY >= 445) && (msY <= 445+15)) { m_cCurFocus = 6; PutAlignedString(370, 580, 345 , UPDATE_SCREEN_ON_CREATE_NEW_CHARACTER52); } // if (m_cGameModeCount < 6) m_DDraw.DrawShadowBox(0,0,639,479); // if (m_cGameModeCount < 2) m_DDraw.DrawShadowBox(0,0,639,479); if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } #ifdef MAKE_ACCOUNT void CGame::_LoadAgreementTextContents(char cType) { char * pContents, * token, cTemp[120], cFileName[120]; char seps[] = "\n"; int iIndex = 0, i; class CStrTok * pStrTok; DWORD dwFileSize; HANDLE hFile; FILE * pFile; for (i = 0; i < TEXTDLGMAXLINES; i++) { if (m_pAgreeMsgTextList[i] != NULL) delete m_pAgreeMsgTextList[i]; m_pAgreeMsgTextList[i] = NULL; } ZeroMemory(cTemp, sizeof(cTemp)); ZeroMemory(cFileName, sizeof(cFileName)); wsprintf(cTemp, "contents%d", cType); strcat(cFileName, "contents"); strcat(cFileName, "\\"); strcat(cFileName, "\\"); strcat(cFileName, cTemp); strcat(cFileName, ".txt"); hFile = CreateFile(cFileName, GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); dwFileSize = GetFileSize(hFile, NULL); if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); pFile = fopen(cFileName, "rt"); if (pFile == NULL) return; else { pContents = new char[dwFileSize+1]; ZeroMemory(pContents, dwFileSize+1); fread(pContents, dwFileSize, 1, pFile); } fclose(pFile); pStrTok = new class CStrTok(pContents, seps); token = pStrTok->pGet(); while( token != NULL ) { m_pAgreeMsgTextList[iIndex] = new class CMsg(NULL, token, NULL); token = pStrTok->pGet(); iIndex++; } delete pStrTok; delete[] pContents; } void CGame::UpdateScreen_OnAgreement() { short sX, sY, msX, msY, msZ; char cLB, cRB, cMB; char cMIresult; static class CMouseInterface * pMI; int i, iTotalLines, iPointerLoc; DWORD dwTime = timeGetTime(); double d1,d2,d3; int iMIbuttonNum; sX = 121; sY = 22; if (m_cGameModeCount == 0) { m_iAgreeView = 0; _LoadAgreementTextContents(0); pMI = new class CMouseInterface; pMI->AddRect(sX+82 -105, sY+355,sX+131 -105,sY+374); pMI->AddRect(sX+235 -105, sY+355,sX+303 -105,sY+375); } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; if (m_bEnterPressed == TRUE) { PlaySound('E', 14, 5); ChangeGameMode(GAMEMODE_ONCREATENEWACCOUNT); ClearContents_OnCreateNewAccount(); delete pMI; return; } if (m_bEscPressed == TRUE) { PlaySound('E', 14, 5); ChangeGameMode(GAMEMODE_ONMAINMENU); delete pMI; m_bEscPressed = FALSE; return; } m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); iMIbuttonNum = pMI->iGetStatus(msX, msY, cLB, &cMIresult); if (cMIresult == MIRESULT_CLICK) { switch (iMIbuttonNum) { case 1: // Agree PlaySound('E', 14, 5); ChangeGameMode(GAMEMODE_ONCREATENEWACCOUNT); ClearContents_OnCreateNewAccount(); delete pMI; return; case 2: // Disagree PlaySound('E', 14, 5); ChangeGameMode(GAMEMODE_ONMAINMENU); delete pMI; return; } } //DrawNewDialogBox(SPRID_INTERFACE_ND_AGREEMENT, 0,0,0, TRUE); DrawNewDialogBox(SPRID_INTERFACE_ND_MAINMENU, 0, 0, 0, TRUE); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, 43, 38, 0); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, 43, 38,12, FALSE); iTotalLines = 0; for (i = 0; i < TEXTDLGMAXLINES; i++) if (m_pAgreeMsgTextList[i] != NULL) iTotalLines++; d1 = (double)m_iAgreeView; d2 = (double)(iTotalLines - 20); d3 = (double)d1 / d2; d1 = 338.0f * d3; iPointerLoc = (int)d1; m_pSprite[SPRID_INTERFACE_ND_GAME2]->PutSpriteFast(sX +361 -112, sY +37 +13 +iPointerLoc, 7, dwTime); for (i = 0; i < 20; i++) if (m_pAgreeMsgTextList[i + m_iAgreeView] != NULL) { PutAlignedString(60, 360, sY + 65 +i*13, m_pAgreeMsgTextList[i + m_iAgreeView]->m_pMsg, 45,25,25); } if( msZ != 0 ) { m_iAgreeView = m_iAgreeView - msZ/60; m_DInput.m_sZ = 0; } if (cLB != 0 && iTotalLines > 20) { if ((msX >= sX +345 -112) && (msX <= sX +380 -112) && (msY >= sY +50) && (msY <= sY +395)) { d1 = (double)(msY - (sY + 37 +13)); d2 = (double)(iTotalLines - 17); d3 = (double)(d1 * d2)/(338.0f); m_iAgreeView = (int)d3; m_pSprite[SPRID_INTERFACE_ND_GAME2]->PutTransSprite(sX +361 -112, sY +37 +13 +iPointerLoc, 4, dwTime); } } if( m_iAgreeView < 0 ) m_iAgreeView = 0; if( iTotalLines > 20 && m_iAgreeView > iTotalLines-20 ) m_iAgreeView = iTotalLines-20; if ((msX > sX + 82 -105) && (msX < sX + 131 -105) && (msY > sY + 355 -3) && (msY < sY + 374 +3)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 43 + 20 -23 +45 -105, sY + 265 +90, 13); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 43 + 20 -23 +45 -105, sY + 265 +90, 12); if ((msX > sX + 235 -105) && (msX < sX + 303 -105) && (msY > sY + 355 -3) && (msY < sY + 375 +3)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 158 + 57 -23 +45 -105, sY + 265 +90, 15); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 158 + 57 -23 +45 -105, sY + 265 +90, 14); DrawVersion(); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); // if (m_cGameModeCount < 6) m_DDraw.DrawShadowBox(0,0,639,479); // if (m_cGameModeCount < 2) m_DDraw.DrawShadowBox(0,0,639,479); if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } void CGame::UpdateScreen_OnCreateNewAccount() { short msX, msY, msZ; char cLB, cRB, cMB; char cMIresult; int iMIbuttonNum; RECT buttons[3]; static class CMouseInterface * pMI; static char cName[12], cPassword[12], cConfirm[12], cPrevFocus, cQuiz[44] ,cAnswer[20], cTempQuiz[44] ; DWORD dwTime = timeGetTime(); int iFlag = 0; SetRect(&buttons[0], 349, 396, 387, 406); SetRect(&buttons[1], 414, 396, 446, 406); SetRect(&buttons[2], 473, 396, 528, 406); if (m_cGameModeCount == 0) { pMI = new class CMouseInterface; pMI->AddRect(460, 173, 545, 173+15); // Account 1 pMI->AddRect(460, 195, 545, 195+15); // Password 2 pMI->AddRect(460, 219, 545, 219+15); // Confirm 3 pMI->AddRect(434, 250, 545, 250+15); // Email 4 // 6 pMI->AddRect(414, 306, 545, 306+15); // Quiz 5 // 4 pMI->AddRect(414, 330, 545, 330+15); // Answer 6 // 5 pMI->AddRect(&buttons[0]); // Create 7 pMI->AddRect(&buttons[1]); // Clear 8 pMI->AddRect(&buttons[2]); // Cancel 9 //pMI->AddRect(330,250+(20*1),348,250+(20*1)); // Conf Email 10 cPrevFocus = 1; m_cCurFocus = 1; m_cMaxFocus = 9; //12 m_bEnterPressed = FALSE; m_cArrowPressed = 0; ZeroMemory(m_cEmailAddr, sizeof(m_cEmailAddr)); ZeroMemory(cName, sizeof(cName)); ZeroMemory(cPassword, sizeof(cPassword)); ZeroMemory(cConfirm, sizeof(cConfirm)); ZeroMemory(cQuiz, sizeof(cQuiz)); ZeroMemory(cTempQuiz, sizeof(cTempQuiz)); ZeroMemory(cAnswer, sizeof(cAnswer)); StartInputString(460, 173, 11, cName); ClearInputString(); } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; if (m_cArrowPressed != 0) { switch (m_cArrowPressed) { case 1: m_cCurFocus--; if (m_cCurFocus <= 0) m_cCurFocus = m_cMaxFocus; break; case 3: m_cCurFocus++; if (m_cCurFocus > m_cMaxFocus) m_cCurFocus = 1; break; } m_cArrowPressed = 0; } if (m_bEscPressed == TRUE) { ChangeGameMode(GAMEMODE_ONMAINMENU); delete pMI; m_bEscPressed = FALSE; return; } if (cPrevFocus != m_cCurFocus) { EndInputString(); switch (m_cCurFocus) { case 1: StartInputString(460,173, 11, cName); break; case 2: StartInputString(460,195, 11, cPassword); break; case 3: StartInputString(460,219, 11, cConfirm); break; case 4: StartInputString(434,250, 51, m_cEmailAddr); break; case 5: StartInputString(414,306, 46, cQuiz); break; case 6: StartInputString(414,330, 21, cAnswer); break; } cPrevFocus = m_cCurFocus; } m_DDraw.ClearBackB4(); DrawNewDialogBox(SPRID_INTERFACE_ND_NEWACCOUNT, 0,0,0, TRUE); if ((m_cCurFocus == 2) || (m_cCurFocus == 3)) ShowReceivedString(TRUE); else if ((m_cCurFocus == 1) || (m_cCurFocus == 4) || (m_cCurFocus == 5) || (m_cCurFocus == 6)) ShowReceivedString(); if (m_cCurFocus != 1) { if (m_Misc.bCheckValidName(cName) != FALSE) PutString2(460, 173, cName, 100,200,100); else PutString2(460, 173, cName, 200,100,100); } if (m_cCurFocus != 2) { if (m_Misc.bCheckValidName(cPassword) != FALSE) PutString(460, 195, cPassword, RGB(100,200,100), TRUE, 1); else PutString(460, 195, cPassword, RGB(200,100,100), TRUE, 1); } if (m_cCurFocus != 3) { if (memcmp(cPassword, cConfirm, 10) == 0) PutString(460, 219, cConfirm, RGB(100,200,100), TRUE, 1); else PutString(460, 219, cConfirm, RGB(200,100,100), TRUE, 1); } if (memcmp(cPassword, cConfirm, 10) != 0) iFlag = 9; if (m_cCurFocus != 4) { if( m_Misc.bIsValidEmail(m_cEmailAddr) ) PutString2(434, 250, m_cEmailAddr, 100,200,100); else PutString2(434, 250, m_cEmailAddr, 200,100,100); } wsprintf(cTempQuiz,"%s",cQuiz) ; m_Misc.ReplaceString(cTempQuiz, ' ', '_'); if (m_cCurFocus != 5) { PutString2(414, 306, cQuiz, 100,200,100); } if (m_cCurFocus != 6) { PutString2(414, 330, cAnswer, 100,200,100); } if (strlen(cAnswer) == 0) iFlag = 11; if (strlen(cTempQuiz) == 0) iFlag = 10; if (m_Misc.bCheckValidName(cPassword) == FALSE) iFlag = 7; if (m_Misc.bCheckValidName(cName) == FALSE) iFlag = 6; if (m_Misc.bIsValidEmail(m_cEmailAddr) == FALSE) iFlag = 5; if (strlen(cConfirm) == 0) iFlag = 3; if (strlen(cPassword) == 0) iFlag = 2; if ((strlen(cName) == 0 )) iFlag = 1; switch (m_cCurFocus) { case 1: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT1, 255, 245, 0 ); PutAlignedString(270, 600, 359, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT2, 255, 245, 0 ); break; case 2: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT4, 255, 245, 0 ); break; case 3: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT8, 255, 245, 0 ); break; case 4: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT21, 255, 245, 0 ); PutAlignedString(270, 600, 359, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT22, 255, 245, 0 ); PutAlignedString(270, 600, 374, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT23, 255, 245, 0 ); break; case 5: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT25, 255, 245, 0 ); PutAlignedString(270, 600, 359, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT26, 255, 245, 0 ); break; case 6: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT29, 255, 245, 0 ); break; case 7: switch (iFlag) { case 0: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT33, 255, 245, 0 ); break; case 1: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT35, 255, 245, 0 ); break; case 2: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT38, 255, 245, 0 ); break; case 3: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT42, 255, 245, 0 ); break; case 5: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT50, 255, 245, 0 ); break; case 6: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT52, 255, 245, 0 ); PutAlignedString(270, 600, 359, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT53, 255, 245, 0 ); break; case 7: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT56, 255, 245, 0 ); PutAlignedString(270, 600, 359, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT57, 255, 245, 0 ); break; case 9: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT63, 255, 245, 0 ); PutAlignedString(270, 600, 359, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT64, 255, 245, 0 ); PutAlignedString(270, 600, 374, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT65, 255, 245, 0 ); break; case 10: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT67, 255, 245, 0 ); break; case 11: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT69, 255, 245, 0 ); break; case 12: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT73, 255, 245, 0 ); PutAlignedString(270, 600, 359, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT74, 255, 245, 0 ); break; case 13: PutAlignedString(270, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT77, 255, 245, 0 ); PutAlignedString(270, 600, 359, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT78, 255, 245, 0 ); break; } break; case 8: PutAlignedString(150, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT80, 255, 245, 0 ); break; case 9: PutAlignedString(190, 600, 344, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT81, 255, 245, 0 ); break; } DrawVersion(TRUE); m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); for(int n=0; n < 3; n++) { if((msX >= buttons[n].left) && (msY >= buttons[n].top) && (msX <= buttons[n].right) && (msY <= buttons[n].bottom)) { m_cCurFocus = 7+n; } } if(m_cCurFocus >= 7) m_pSprite[SPRID_INTERFACE_ND_NEWACCOUNT]->PutSpriteFast(buttons[m_cCurFocus-7].left , buttons[m_cCurFocus-7].top, m_cCurFocus-6, dwTime); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); if (m_bEnterPressed == TRUE) { PlaySound('E', 14, 5); switch (m_cCurFocus) { case 1: case 2: case 3: case 4: case 5: case 6: m_cCurFocus++; if (m_cCurFocus > m_cMaxFocus) m_cCurFocus = 1; break; case 7: if (iFlag != 0) return; ZeroMemory(m_cAccountName, sizeof(m_cAccountName)); ZeroMemory(m_cAccountPassword, sizeof(m_cAccountPassword)); ZeroMemory(m_cAccountQuiz, sizeof(m_cAccountQuiz)); ZeroMemory(m_cAccountAnswer, sizeof(m_cAccountAnswer)); strcpy(m_cAccountName, cName); strcpy(m_cAccountPassword, cPassword); strcpy(m_cAccountQuiz, cQuiz); strcpy(m_cAccountAnswer, cAnswer); if (memcmp(cPassword, cConfirm, 10) != 0) { ChangeGameMode(GAMEMODE_ONMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT82); //"Cannot create account! - password not match!" delete pMI; return; } m_pLSock = new class XSocket(m_hWnd, SOCKETBLOCKLIMIT); m_pLSock->bConnect(m_cLogServerAddr, m_iLogServerPort, WM_USER_LOGSOCKETEVENT); m_pLSock->bInitBufferSize(30000); ChangeGameMode(GAMEMODE_ONCONNECTING); m_dwConnectMode = MSGID_REQUEST_CREATENEWACCOUNT; ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "00"); delete pMI; return; case 8: ZeroMemory(cName, sizeof(cName)); ZeroMemory(cPassword, sizeof(cPassword)); ZeroMemory(cConfirm, sizeof(cConfirm)); ZeroMemory(m_cEmailAddr, sizeof(m_cEmailAddr)); ZeroMemory(cQuiz, sizeof(cQuiz)); ZeroMemory(cTempQuiz, sizeof(cTempQuiz)); ZeroMemory(cAnswer, sizeof(cAnswer)); break; case 9: ChangeGameMode(GAMEMODE_ONMAINMENU); delete pMI; return; } m_bEnterPressed = FALSE; } iMIbuttonNum = pMI->iGetStatus(msX, msY, cLB, &cMIresult); if (cMIresult == MIRESULT_CLICK) { PlaySound('E', 14, 5); switch (iMIbuttonNum) { default: m_cCurFocus = iMIbuttonNum; break; case 7: if (iFlag != 0) return; ZeroMemory(m_cAccountName, sizeof(m_cAccountName)); ZeroMemory(m_cAccountPassword, sizeof(m_cAccountPassword)); ZeroMemory(m_cAccountQuiz, sizeof(m_cAccountQuiz)); ZeroMemory(m_cAccountAnswer, sizeof(m_cAccountAnswer)); strcpy(m_cAccountName, cName); strcpy(m_cAccountPassword, cPassword); strcpy(m_cAccountQuiz, cQuiz); strcpy(m_cAccountAnswer, cAnswer); if (memcmp(cPassword, cConfirm, 10) != 0) { ChangeGameMode(GAMEMODE_ONMSG); ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, UPDATE_SCREEN_ON_CREATE_NEW_ACCOUNT82); //"Cannot create account! - password not match!" delete pMI; return; } m_pLSock = new class XSocket(m_hWnd, SOCKETBLOCKLIMIT); m_pLSock->bConnect(m_cLogServerAddr, m_iLogServerPort, WM_USER_LOGSOCKETEVENT); m_pLSock->bInitBufferSize(30000); ChangeGameMode(GAMEMODE_ONCONNECTING); m_dwConnectMode = MSGID_REQUEST_CREATENEWACCOUNT; ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "00"); delete pMI; return; case 8: ZeroMemory(cName, sizeof(cName)); ZeroMemory(cPassword, sizeof(cPassword)); ZeroMemory(cConfirm, sizeof(cConfirm)); ZeroMemory(m_cEmailAddr, sizeof(m_cEmailAddr)); ZeroMemory(cQuiz, sizeof(cQuiz)); ZeroMemory(cTempQuiz, sizeof(cTempQuiz)); ZeroMemory(cAnswer, sizeof(cAnswer)); break; case 9: ChangeGameMode(GAMEMODE_ONMAINMENU); delete pMI; return; } } if ((msX >= 349) && (msX <= 387) && (msY >= 396) && (msY <= 406)) m_cCurFocus = 7; //12 if ((msX >= 414) && (msX <= 446) && (msY >= 396) && (msY <= 406)) m_cCurFocus = 8; //13 if ((msX >= 472) && (msX <= 528) && (msY >= 396) && (msY <= 406)) m_cCurFocus = 9; //14 // if (m_cGameModeCount < 6) m_DDraw.DrawShadowBox(0,0,639,479); // if (m_cGameModeCount < 2) m_DDraw.DrawShadowBox(0,0,639,479); if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } #endif //endif from #ifdef MAKE_ACCOUNT void CGame::UpdateScreen_OnLogin() // here { short msX, msY, msZ, sX, sY; char cLB, cRB, cMB; char cMIresult; int iMIbuttonNum; static class CMouseInterface * pMI; static char cPassword[12], cPrevFocus; static char cName[12]; sX = 146; sY = 114; if (m_cGameModeCount == 0) { EndInputString(); pMI = new class CMouseInterface; pMI->AddRect(308, 192, 408, 208); // Username pMI->AddRect(308, 224, 408, 240); // Password pMI->AddRect(240, 306, 286, 318); // Connect pMI->AddRect(340, 306, 396, 318); // Cancel cPrevFocus = 1; m_cCurFocus = 1; m_cMaxFocus = 4; m_bEnterPressed = FALSE; m_cArrowPressed = 0; ZeroMemory(cName, sizeof(cName)); ZeroMemory(cPassword, sizeof(cPassword)); StartInputString(312, 192, 11, cName); ClearInputString(); } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; if (m_cArrowPressed != 0) { switch (m_cArrowPressed) { case 1: m_cCurFocus--; if (m_cCurFocus <= 0) m_cCurFocus = m_cMaxFocus; break; case 2: if (m_cCurFocus == 3) m_cCurFocus = 4; else if (m_cCurFocus == 4) m_cCurFocus = 3; break; case 3: m_cCurFocus++; if (m_cCurFocus > m_cMaxFocus) m_cCurFocus = 1; break; case 4: if (m_cCurFocus == 3) m_cCurFocus = 4; else if (m_cCurFocus == 4) m_cCurFocus = 3; break; } m_cArrowPressed = 0; } if (m_bEnterPressed == TRUE) { m_bEnterPressed = FALSE; PlaySound('E', 14, 5); switch (m_cCurFocus) { case 1: m_cCurFocus++; if( m_cCurFocus > m_cMaxFocus) m_cCurFocus = 1; break; case 2: case 3: if ((strlen(cName) == 0) || (strlen(cPassword) == 0)) break; ZeroMemory(m_cAccountName, sizeof(m_cAccountName)); ZeroMemory(m_cAccountPassword, sizeof(m_cAccountPassword)); strcpy(m_cAccountName, cName); strcpy(m_cAccountPassword, cPassword); m_pLSock = new class XSocket(m_hWnd, SOCKETBLOCKLIMIT); m_pLSock->bConnect(m_cLogServerAddr, m_iLogServerPort +(rand()%1), WM_USER_LOGSOCKETEVENT); m_pLSock->bInitBufferSize(30000); ChangeGameMode(GAMEMODE_ONCONNECTING); m_dwConnectMode = MSGID_REQUEST_LOGIN; ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "11"); delete pMI; return; case 4: // Cancel #ifdef SELECTSERVER ChangeGameMode(GAMEMODE_ONSELECTSERVER); #else ChangeGameMode(GAMEMODE_ONMAINMENU); #endif delete pMI; return; } } if (m_bEscPressed == TRUE) { EndInputString(); ChangeGameMode(GAMEMODE_ONMAINMENU); delete pMI; m_bEscPressed = FALSE; return; } if (cPrevFocus != m_cCurFocus) { EndInputString(); switch (m_cCurFocus) { case 1: StartInputString(312, 192, 11, cName); break; case 2: StartInputString(312, 224, 11, cPassword, TRUE); break; case 3: case 4: break; } cPrevFocus = m_cCurFocus; } m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); iMIbuttonNum = pMI->iGetStatus(msX, msY, cLB, &cMIresult); if (cMIresult == MIRESULT_CLICK) { PlaySound('E', 14, 5); switch (iMIbuttonNum) { case 1: m_cCurFocus = 1; break; case 2: m_cCurFocus = 2; break; case 3: if ((strlen(cName) == 0) || (strlen(cPassword) == 0)) break; EndInputString(); ZeroMemory(m_cAccountName, sizeof(m_cAccountName)); ZeroMemory(m_cAccountPassword, sizeof(m_cAccountPassword)); strcpy(m_cAccountName, cName); strcpy(m_cAccountPassword, cPassword); m_pLSock = new class XSocket(m_hWnd, SOCKETBLOCKLIMIT); m_pLSock->bConnect(m_cLogServerAddr, m_iLogServerPort +(rand()%1), WM_USER_LOGSOCKETEVENT); m_pLSock->bInitBufferSize(30000); ChangeGameMode(GAMEMODE_ONCONNECTING); m_dwConnectMode = MSGID_REQUEST_LOGIN; ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "11"); delete pMI; return; case 4: #ifdef SELECTSERVER ChangeGameMode(GAMEMODE_ONSELECTSERVER); // ONMAINMENU #else ChangeGameMode(GAMEMODE_ONMAINMENU); #endif delete pMI; return; } } if ((msX >= 240) && (msY >= 307) && (msX <= 286) && (msY <= 318)) m_cCurFocus = 3; if ((msX >= 340) && (msY >= 307) && (msX <= 395) && (msY <= 318)) m_cCurFocus = 4; _Draw_OnLogin(cName, cPassword, msX, msY, m_cGameModeCount); if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } void CGame::UpdateScreen_OnSelectServer() { short msX, msY, msZ, sX, sY; char cLB, cRB, cMB; char cMIresult; int iMIbuttonNum; static class CMouseInterface * pMI; static char cPrevFocus; DWORD dwTime = timeGetTime(); BOOL bFlag = TRUE; sX = 146; sY = 114; if (m_cGameModeCount == 0) { EndInputString(); pMI = new class CMouseInterface; pMI->AddRect(130,177,270,198); pMI->AddRect(130,199,270,225); pMI->AddRect(256,279,331,308); cPrevFocus = 1; m_cCurFocus = 1; m_cMaxFocus = 3; m_bEnterPressed = FALSE; m_cArrowPressed = 0; } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; if (m_cArrowPressed != 0) { switch (m_cArrowPressed) { case 1: m_cCurFocus--; if (m_cCurFocus <= 0) m_cCurFocus = m_cMaxFocus; break; case 3: m_cCurFocus++; if (m_cCurFocus > m_cMaxFocus) m_cCurFocus = 1; break; } m_cArrowPressed = 0; } if (m_bEnterPressed == TRUE) { m_bEnterPressed = FALSE; PlaySound('E', 14, 5); switch (m_cCurFocus) { case 1: if (strlen(m_cWorldServerName) ==0) ZeroMemory(m_cWorldServerName, sizeof(m_cWorldServerName)); strcpy(m_cWorldServerName, NAME_WORLDNAME1); ChangeGameMode(GAMEMODE_ONLOGIN); delete pMI; return; case 2: ZeroMemory(m_cWorldServerName, sizeof(m_cWorldServerName)); strcpy(m_cWorldServerName, "WS2"); ChangeGameMode(GAMEMODE_ONLOGIN); delete pMI; return; case 3: // Cancel ChangeGameMode(GAMEMODE_ONMAINMENU); delete pMI; return; } } if (m_bEscPressed == TRUE) { ChangeGameMode(GAMEMODE_ONMAINMENU); delete pMI; m_bEscPressed = FALSE; return; } if (cPrevFocus != m_cCurFocus) { cPrevFocus = m_cCurFocus; } m_DDraw.ClearBackB4(); DrawNewDialogBox(SPRID_INTERFACE_ND_LOGIN, 0,0,0, TRUE); if (m_cGameModeCount > 20) DrawNewDialogBox(SPRID_INTERFACE_ND_LOGIN, 40,121,1, TRUE); else if ((m_cGameModeCount >= 15) && (m_cGameModeCount <= 20)) m_pSprite[SPRID_INTERFACE_ND_LOGIN]->PutTransSprite25(40,121,1, TRUE); if (m_cGameModeCount > 20) { if (m_cCurFocus == 1) DrawNewDialogBox(SPRID_INTERFACE_ND_LOGIN, 138, 177, 5, TRUE); if (m_cCurFocus == 2) DrawNewDialogBox(SPRID_INTERFACE_ND_LOGIN, 130, 205, 6, TRUE); if (m_cCurFocus == 3) DrawNewDialogBox(SPRID_INTERFACE_ND_LOGIN, 256, 282, 4, TRUE); } DrawVersion(); m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); iMIbuttonNum = pMI->iGetStatus(msX, msY, cLB, &cMIresult); if (cMIresult == MIRESULT_CLICK) { PlaySound('E', 14, 5); switch (iMIbuttonNum) { case 1: if (m_cCurFocus == 1) { ZeroMemory(m_cWorldServerName, sizeof(m_cWorldServerName)); strcpy(m_cWorldServerName, NAME_WORLDNAME1); ChangeGameMode(GAMEMODE_ONLOGIN); delete pMI; return; } else m_cCurFocus = 1; break; case 2: if (m_cCurFocus == 2) { ZeroMemory(m_cWorldServerName, sizeof(m_cWorldServerName)); strcpy(m_cWorldServerName, "WS2"); ChangeGameMode(GAMEMODE_ONLOGIN); delete pMI; return; } else m_cCurFocus = 2; break; case 3: ChangeGameMode(GAMEMODE_ONMAINMENU); delete pMI; return; } } if ((msX >= 130) && (msX <= 295) && (msY >= 175) && (msY <= 198)) m_cCurFocus = 1; if ((msX >= 130) && (msX <= 295) && (msY >= 199) && (msY <= 225)) m_cCurFocus = 2; if ((msX >= 256) && (msX <= 331) && (msY >= 279) && (msY <= 308)) m_cCurFocus = 3; // if (m_cGameModeCount < 6) m_DDraw.DrawShadowBox(0,0,639,479); // if (m_cGameModeCount < 2) m_DDraw.DrawShadowBox(0,0,639,479); if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } void CGame::OnSysKeyDown(WPARAM wParam) { switch( wParam ) { case VK_SHIFT: m_bShiftPressed = TRUE; break; case VK_CONTROL: m_bCtrlPressed = TRUE; break; case VK_RETURN: m_bEnterPressed = TRUE; break; case VK_MENU: m_altPressed = TRUE; break; } } void CGame::OnSysKeyUp(WPARAM wParam) { switch( wParam ) { case VK_SHIFT: m_bShiftPressed = FALSE; break; case VK_CONTROL: m_bCtrlPressed = FALSE; break; case VK_RETURN: m_bEnterPressed = FALSE; if( m_bToggleScreen == TRUE ) { m_bIsRedrawPDBGS = TRUE; m_DDraw.ChangeDisplayMode(G_hWnd); } break; case VK_ESCAPE: m_bEscPressed = FALSE; case VK_MENU: m_altPressed = FALSE; break; } } void CGame::OnKeyUp(WPARAM wParam) { int i=0; DWORD dwTime = timeGetTime(); static DWORD dwPrevTabTime = 0; switch (wParam) { case VK_SHIFT: m_bShiftPressed = FALSE; break; case VK_CONTROL: m_bCtrlPressed = FALSE; break; case 65://'A' if (m_bCtrlPressed && m_cGameMode == GAMEMODE_ONMAINGAME && (!m_bInputStatus) ) { if( m_bForceAttack ) { m_bForceAttack = FALSE; AddEventList( MSG_FORCEATTACK_OFF, 10 ); }else { m_bForceAttack = TRUE; AddEventList( MSG_FORCEATTACK_ON, 10 ); } } break; case 68://'D' if (m_bCtrlPressed == TRUE && m_cGameMode == GAMEMODE_ONMAINGAME && (!m_bInputStatus) ) { m_cDetailLevel++; if( m_cDetailLevel > 2 ) m_cDetailLevel = 0; switch( m_cDetailLevel ) { case 0: AddEventList( NOTIFY_MSG_DETAIL_LEVEL_LOW, 10 ); break; case 1: AddEventList( NOTIFY_MSG_DETAIL_LEVEL_MEDIUM, 10 ); break; case 2: AddEventList( NOTIFY_MSG_DETAIL_LEVEL_HIGH, 10 ); break; } } break; case 70: //'F' if( m_bCtrlPressed ) { LoadFriendList(); UpdateFriendsStatus(); EnableDialogBox(43, NULL, NULL, NULL); } break; case 72: // 'H' // Snoopy: Mimics VK_F1 if (m_bCtrlPressed && m_cGameMode == GAMEMODE_ONMAINGAME && (!m_bInputStatus) ) { if (m_bIsDialogEnabled[35] == FALSE) EnableDialogBox(35, NULL, NULL, NULL); else { DisableDialogBox(35); DisableDialogBox(18); } } break; case 87: // 'W' // Snoopy: mimics VK_F11 Togles transparency if (m_bCtrlPressed && m_cGameMode == GAMEMODE_ONMAINGAME && (!m_bInputStatus) ) { m_bDialogTrans = !m_bDialogTrans; } break; case 88: // 'X' // Snoopy: mimics VK_F12 Logout Window if (m_bCtrlPressed && m_cGameMode == GAMEMODE_ONMAINGAME && (!m_bInputStatus) ) { if (m_bIsDialogEnabled[19] == FALSE) EnableDialogBox(19, NULL, NULL, NULL); else DisableDialogBox(19); } break; case 77://'M' if( m_cGameMode == GAMEMODE_ONMAINGAME ) { if( m_bCtrlPressed ) { if( m_bIsDialogEnabled[9] == TRUE ) DisableDialogBox(9); else EnableDialogBox(9, 0, 0, 0, NULL); } } break; case 80://'P' if( ( m_bCtrlPressed == TRUE ) && ( m_cGameMode == GAMEMODE_ONMAINGAME ) && (!m_bInputStatus) ) { if( _tmp_sOwnerType < 7 && (strlen(_tmp_cName)>0) && (m_iIlusionOwnerH==NULL) && (strcmp(m_cMCName, m_cPlayerName) != 0) && m_cMCName[0] != '_') { m_stDialogBoxInfo[32].cMode = 3; PlaySound('E', 14, 5); ZeroMemory(m_stDialogBoxInfo[32].cStr, sizeof(m_stDialogBoxInfo[32].cStr)); strcpy(m_stDialogBoxInfo[32].cStr, _tmp_cName); bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_JOINPARTY, NULL, 1, NULL, NULL, _tmp_cName); } else { m_stDialogBoxInfo[32].cMode = 0; PlaySound('E', 14, 5); AddEventList(POINT_COMMAND_HANDLER1, 10); } } break; #ifdef _DEBUG case 81://'Q' if( ( m_bCtrlPressed == TRUE ) && ( m_cGameMode == GAMEMODE_ONMAINGAME ) ) { ZeroMemory(m_cChatMsg, sizeof(m_cChatMsg) ); strcpy(m_cChatMsg, "/enableadmincommand 147258 "); StartInputString(10, 414, sizeof(m_cChatMsg), m_cChatMsg); //ClearInputString(); } break; #endif case 82://'R' if (m_bCtrlPressed == TRUE && m_cGameMode == GAMEMODE_ONMAINGAME && (!m_bInputStatus) ) { if( m_bRunningMode ) { m_bRunningMode = FALSE; AddEventList( NOTIFY_MSG_CONVERT_WALKING_MODE, 10 ); }else { m_bRunningMode = TRUE; AddEventList( NOTIFY_MSG_CONVERT_RUNNING_MODE, 10 ); } } break; case 83://'S' if (m_bCtrlPressed == TRUE && m_cGameMode == GAMEMODE_ONMAINGAME && (!m_bInputStatus) ) { if (m_bMusicStat == TRUE) // Music Off { m_bMusicStat = FALSE; if (m_bSoundFlag) { if (m_pBGM != NULL) { m_pBGM->bStop(); delete m_pBGM; m_pBGM = NULL; } } AddEventList( NOTIFY_MSG_MUSIC_OFF, 10 ); break; }else if( m_bSoundStat == TRUE ) { m_pESound[38]->bStop(); m_bSoundStat = FALSE; AddEventList( NOTIFY_MSG_SOUND_OFF, 10 ); break; }else // Music On { if( m_bSoundFlag ) { m_bMusicStat = TRUE; AddEventList( NOTIFY_MSG_MUSIC_ON, 10 ); } if( m_bSoundFlag ) { m_bSoundStat = TRUE; AddEventList( NOTIFY_MSG_SOUND_ON, 10 ); } StartBGM(); } } break; case 84: //'T' if (m_bCtrlPressed == TRUE && m_cGameMode == GAMEMODE_ONMAINGAME && (!m_bInputStatus) ) { char tempid[100], cLB, cRB, cMB; short sX, sY, msX, msY, msZ; sX = m_stDialogBoxInfo[10].sX; sY = m_stDialogBoxInfo[10].sY; ZeroMemory( tempid, sizeof( tempid ) ); m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); if( m_bIsDialogEnabled[10] == TRUE && (msX >= sX + 20) && (msX <= sX + 360) && (msY >= sY + 35) && (msY <= sY + 139) ) { CStrTok *pStrTok; char * token, cBuff[128]; char seps[] = "]: "; int i = (139-msY+sY)/13; if( m_pChatScrollList[i + m_stDialogBoxInfo[10].sView] == NULL ) return; if( m_pChatScrollList[i + m_stDialogBoxInfo[10].sView]->m_pMsg[0] == ' ' ) i++; strcpy(cBuff, m_pChatScrollList[i + m_stDialogBoxInfo[10].sView]->m_pMsg); pStrTok = new class CStrTok(cBuff, seps); token = pStrTok->pGet(); if(cBuff[0] == '[') // Time stamped msg { token = pStrTok->pGet(); token = pStrTok->pGet(); token = pStrTok->pGet(); } if(token != NULL){ wsprintf( tempid, "/to %s", token ); bSendCommand(MSGID_COMMAND_CHATMSG, NULL, NULL, NULL, NULL, NULL, tempid); } delete pStrTok; }else if( _tmp_sOwnerType < 7 && (strlen(_tmp_cName)>0) && (m_iIlusionOwnerH==NULL) && ((m_bIsCrusadeMode == FALSE) || _iGetFOE(_tmp_iStatus) >= 0)) { wsprintf( tempid, "/to %s", _tmp_cName ); bSendCommand(MSGID_COMMAND_CHATMSG, NULL, NULL, NULL, NULL, NULL, tempid); }else { EndInputString(); wsprintf( m_cChatMsg, "/to " ); StartInputString(10, 414, sizeof(m_cChatMsg), m_cChatMsg); } } break; case 107: //'+' if(m_bInputStatus == FALSE) m_bZoomMap = TRUE; break; case 109: //'-' if(m_bInputStatus == FALSE) m_bZoomMap = FALSE; break; case VK_F2: UseShortCut( 1 ); break; case VK_F3: UseShortCut( 2 ); break; case VK_INSERT: if (m_iHP <= 0) return; if (m_bItemUsingStatus == TRUE) { AddEventList(USE_RED_POTION1, 10); return; } if (m_bIsDialogEnabled[27] == TRUE) { AddEventList(USE_RED_POTION2, 10); return; } for (i = 0; i < MAXITEMS; i++) if ( (m_pItemList[i] != NULL) && (m_bIsItemDisabled[i] != TRUE) && (m_pItemList[i]->m_sSprite == 6) && (m_pItemList[i]->m_sSpriteFrame == 1)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_USEITEM, NULL, i, NULL, NULL, NULL); m_bIsItemDisabled[i] = TRUE; m_bItemUsingStatus = TRUE; return; } for (i = 0; i < MAXITEMS; i++) if ( (m_pItemList[i] != NULL) && (m_bIsItemDisabled[i] != TRUE) && (m_pItemList[i]->m_sSprite == 6) && (m_pItemList[i]->m_sSpriteFrame == 2)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_USEITEM, NULL, i, NULL, NULL, NULL); m_bIsItemDisabled[i] = TRUE; m_bItemUsingStatus = TRUE; return; } break; case VK_DELETE: if (m_iHP <= 0) return; if (m_bItemUsingStatus == TRUE) { AddEventList(USE_BLUE_POTION1, 10); return; } if (m_bIsDialogEnabled[27] == TRUE) { AddEventList(USE_BLUE_POTION2, 10); return; } for (i = 0; i < MAXITEMS; i++) if ( (m_pItemList[i] != NULL) && (m_bIsItemDisabled[i] != TRUE) && (m_pItemList[i]->m_sSprite == 6) && (m_pItemList[i]->m_sSpriteFrame == 3)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_USEITEM, NULL, i, NULL, NULL, NULL); m_bIsItemDisabled[i] = TRUE; m_bItemUsingStatus = TRUE; return; } for (i = 0; i < MAXITEMS; i++) if ( (m_pItemList[i] != NULL) && (m_bIsItemDisabled[i] != TRUE) && (m_pItemList[i]->m_sSprite == 6) && (m_pItemList[i]->m_sSpriteFrame == 4)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_USEITEM, NULL, i, NULL, NULL, NULL); m_bIsItemDisabled[i] = TRUE; m_bItemUsingStatus = TRUE; return; } break; case VK_END: if ( ((m_bIsDialogEnabled[7] == TRUE) && (m_stDialogBoxInfo[7].cMode == 1) && (iGetTopDialogBoxIndex() == 7)) || ((m_bIsDialogEnabled[17] == TRUE) && (m_stDialogBoxInfo[17].cMode == 1) && (iGetTopDialogBoxIndex() == 17)) ) {}else if ((!m_bInputStatus) && (m_cBackupChatMsg[0] != '!') && (m_cBackupChatMsg[0] != '~') && (m_cBackupChatMsg[0] != '^') && (m_cBackupChatMsg[0] != '@')) { ZeroMemory(m_cChatMsg, sizeof(m_cChatMsg)); strcpy(m_cChatMsg, m_cBackupChatMsg); StartInputString(10, 414, sizeof(m_cChatMsg), m_cChatMsg); } break; case VK_F4: if(m_cGameMode != GAMEMODE_ONMAINGAME) return; UseMagic(m_sMagicShortCut); break; case VK_F5: if (m_bIsDialogEnabled[1] == FALSE) EnableDialogBox(1, NULL, NULL, NULL); else DisableDialogBox(1); break; case VK_F6: if (m_bIsDialogEnabled[2] == FALSE) EnableDialogBox(2, NULL, NULL, NULL); else DisableDialogBox(2); break; case VK_F7: if (m_bIsDialogEnabled[3] == FALSE) EnableDialogBox(3, NULL, NULL, NULL); else DisableDialogBox(3); break; case VK_F8: if (m_bIsDialogEnabled[15] == FALSE) EnableDialogBox(15, NULL, NULL, NULL); else DisableDialogBox(15); break; case VK_F9: if (m_bIsDialogEnabled[10] == FALSE) EnableDialogBox(10, NULL, NULL, NULL); else DisableDialogBox(10); break; case VK_F11: m_bDialogTrans = !m_bDialogTrans; break; case VK_F12: if(m_bInputStatus) return; if (m_bIsDialogEnabled[19] == FALSE) EnableDialogBox(19, NULL, NULL, NULL); else DisableDialogBox(19); break; case VK_F1: if (m_bInputStatus) return; if (m_bIsDialogEnabled[35] == FALSE) // 35 CLEROTH EnableDialogBox(35, NULL, NULL, NULL); else { DisableDialogBox(35); DisableDialogBox(18); } break; case VK_UP: m_cArrowPressed = 1; if( m_cGameMode == GAMEMODE_ONMAINGAME ) { int iTotalMsg=0; for( int i=MAXWHISPERMSG-1 ; i>=0 ; i-- ) { if( m_pWhisperMsg[i] != NULL ) { iTotalMsg = i; break; } } m_cWhisperIndex ++; if( m_cWhisperIndex > iTotalMsg ) m_cWhisperIndex = 0; if( m_cWhisperIndex < 0 ) m_cWhisperIndex = iTotalMsg; if( m_pWhisperMsg[m_cWhisperIndex] != NULL ) { EndInputString(); wsprintf( m_cChatMsg, "/to %s", m_pWhisperMsg[m_cWhisperIndex]->m_pMsg ); StartInputString(10, 414, sizeof(m_cChatMsg), m_cChatMsg); } } break; case VK_RIGHT: m_cArrowPressed = 2; break; case VK_DOWN: m_cArrowPressed = 3; if( m_cGameMode == GAMEMODE_ONMAINGAME ) { int iTotalMsg=0; for( int i=MAXWHISPERMSG-1 ; i>=0 ; i-- ) { if( m_pWhisperMsg[i] != NULL ) { iTotalMsg = i; break; } } m_cWhisperIndex --; if( m_cWhisperIndex < 0 ) m_cWhisperIndex = iTotalMsg; if( m_cWhisperIndex > iTotalMsg ) m_cWhisperIndex = 0; if( m_pWhisperMsg[m_cWhisperIndex] != NULL ) { EndInputString(); wsprintf( m_cChatMsg, "/to %s", m_pWhisperMsg[m_cWhisperIndex]->m_pMsg ); StartInputString(10, 414, sizeof(m_cChatMsg), m_cChatMsg); } } break; case VK_LEFT: m_cArrowPressed = 4; break; case VK_SNAPSHOT: CreateScreenShot(); break; #ifndef USING_WIN_IME case VK_TAB: if( m_bShiftPressed ) { m_cCurFocus--; if( m_cCurFocus < 1 ) m_cCurFocus = m_cMaxFocus; }else { m_cCurFocus++; if( m_cCurFocus > m_cMaxFocus) m_cCurFocus = 1; } if ((dwTime - dwPrevTabTime) > 500 && m_cGameMode == GAMEMODE_ONMAINGAME) { dwPrevTabTime = dwTime; bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TOGGLECOMBATMODE, NULL, NULL, NULL, NULL, NULL); } break; case VK_RETURN: m_bEnterPressed = TRUE; break; #endif case VK_HOME: if (m_cGameMode == GAMEMODE_ONMAINGAME) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TOGGLESAFEATTACKMODE, NULL, NULL, NULL, NULL, NULL); } break; case VK_ESCAPE: m_bEscPressed = TRUE; if (m_cGameMode == GAMEMODE_ONMAINGAME) { if ((m_bIsObserverMode == TRUE) && (m_bShiftPressed)) { //ObserverMode Shift+Esc // Log Out if (m_cLogOutCount == -1) m_cLogOutCount = 1; DisableDialogBox(19); PlaySound('E', 14, 5); } else if(m_cLogOutCount != -1) { if (m_bForceDisconn == FALSE) { //Esc m_cLogOutCount = -1; AddEventList(DLGBOX_CLICK_SYSMENU2, 10); } } if (m_bIsGetPointingMode == TRUE) { m_bIsGetPointingMode = FALSE; AddEventList(COMMAND_PROCESSOR1, 10); } m_bIsF1HelpWindowEnabled = FALSE; } break; case 33: if (m_cGameMode != GAMEMODE_ONMAINGAME) return; if (m_bInputStatus) return; if (m_bIsSpecialAbilityEnabled == TRUE) { if (m_iSpecialAbilityType != 0) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_ACTIVATESPECABLTY, NULL, NULL, NULL, NULL, NULL); m_bIsSpecialAbilityEnabled = FALSE; } else AddEventList(ON_KEY_UP26, 10); } else { if (m_iSpecialAbilityType == 0) AddEventList(ON_KEY_UP26, 10); else { if ((m_sPlayerAppr4 & 0x00F0) != 0) { AddEventList(ON_KEY_UP28, 10); return; } i = (dwTime - m_dwSpecialAbilitySettingTime)/1000; i = m_iSpecialAbilityTimeLeftSec - i; if (i < 0) i = 0; ZeroMemory(G_cTxt, sizeof(G_cTxt)); if (i < 60) { switch (m_iSpecialAbilityType) { case 1: wsprintf(G_cTxt, ON_KEY_UP29, i); break;//" case 2: wsprintf(G_cTxt, ON_KEY_UP30, i); break;//" case 3: wsprintf(G_cTxt, ON_KEY_UP31, i); break;//" case 4: wsprintf(G_cTxt, ON_KEY_UP32, i); break;//" case 5: wsprintf(G_cTxt, ON_KEY_UP33, i); break;//" case 50:wsprintf(G_cTxt, ON_KEY_UP34, i); break;//" case 51:wsprintf(G_cTxt, ON_KEY_UP35, i); break;//" case 52:wsprintf(G_cTxt, ON_KEY_UP36, i); break;//" } } else { switch (m_iSpecialAbilityType) { case 1: wsprintf(G_cTxt, ON_KEY_UP37, i/60); break;//" case 2: wsprintf(G_cTxt, ON_KEY_UP38, i/60); break;//" case 3: wsprintf(G_cTxt, ON_KEY_UP39, i/60); break;//" case 4: wsprintf(G_cTxt, ON_KEY_UP40, i/60); break;//" case 5: wsprintf(G_cTxt, ON_KEY_UP41, i/60); break;//" case 50:wsprintf(G_cTxt, ON_KEY_UP42, i/60); break;//" case 51:wsprintf(G_cTxt, ON_KEY_UP43, i/60); break;//" case 52:wsprintf(G_cTxt, ON_KEY_UP44, i/60); break;//" } } AddEventList(G_cTxt, 10); } } break; } } void CGame::OnKeyDown(WPARAM wParam) { switch (wParam) { case VK_CONTROL: m_bCtrlPressed = TRUE; break; case VK_SHIFT: m_bShiftPressed = TRUE; break; case VK_INSERT: case VK_DELETE: case VK_TAB: case VK_RETURN: case VK_ESCAPE: case VK_END: case VK_HOME: case VK_F1: case VK_F2: case VK_F3: case VK_F4: case VK_F5: case VK_F6: case VK_F7: case VK_F8: case VK_F9: case VK_F10: case VK_F11: case VK_F12: case VK_PRIOR: // Page-Up case VK_NEXT: // Page-Down case VK_LWIN: case VK_RWIN: case VK_MULTIPLY: case VK_ADD: //'+' case VK_SEPARATOR: case VK_SUBTRACT: //'-' case VK_DECIMAL: case VK_DIVIDE: case VK_NUMLOCK: case VK_SCROLL: break; default: if (m_cGameMode == GAMEMODE_ONMAINGAME) { if (m_bCtrlPressed) { switch (wParam) { case 48: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 9; break; // 0 case 49: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 0; break; // 1 case 50: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 1; break; // 2 case 51: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 2; break; // 3 case 52: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 3; break; // 4 case 53: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 4; break; // 5 case 54: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 5; break; // 6 case 55: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 6; break; // 7 case 56: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 7; break; // 8 case 57: EnableDialogBox(3, NULL, NULL, NULL); m_stDialogBoxInfo[3].sView = 8; break; // 9 } }else if ((m_bInputStatus == FALSE) && (GetAsyncKeyState(VK_MENU)>>15 == FALSE)) { StartInputString(10, 414, sizeof(m_cChatMsg), m_cChatMsg); ClearInputString(); } } break; } } void CGame::UpdateScreen_OnQuit() { short msX, msY, msZ; char cLB, cRB, cMB; char cMIresult; int iMIbuttonNum; static class CMouseInterface * pMI; DWORD dwTime = timeGetTime(); if (m_cGameModeCount == 0) { if (G_pCalcSocket != NULL) { delete G_pCalcSocket; G_pCalcSocket = NULL; } if (m_pGSock != NULL) { delete m_pGSock; m_pGSock = NULL; } m_bEscPressed = FALSE; m_bEnterPressed = FALSE; pMI = new class CMouseInterface; pMI->AddRect(0,0,640,480); m_bEnterPressed = FALSE; } m_cGameModeCount++; if (m_cGameModeCount > 120) m_cGameModeCount = 120; m_DDraw.ClearBackB4(); if (m_bEscPressed == TRUE || m_bEnterPressed == TRUE) { m_bEscPressed = FALSE; m_bEnterPressed = FALSE; delete pMI; ChangeGameMode(GAMEMODE_NULL); SendMessage(m_hWnd, WM_DESTROY, NULL, NULL); return; } DrawNewDialogBox(SPRID_INTERFACE_ND_QUIT, 0,0,0, TRUE); if (m_cGameModeCount > 20) DrawNewDialogBox(SPRID_INTERFACE_ND_QUIT, 255,123,1, TRUE); else if ((m_cGameModeCount >= 15) && (m_cGameModeCount <= 20)) m_pSprite[SPRID_INTERFACE_ND_QUIT]->PutTransSprite25(255,123,1, TRUE); DrawVersion(TRUE); //if(m_cGameModeCount == 1000) //{ ChangeGameMode(GAMEMODE_NULL); // delete pMI; // SendMessage(m_hWnd, WM_DESTROY, NULL, NULL); // //GoHomepage(); // return; //} m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); iMIbuttonNum = pMI->iGetStatus(msX, msY, cLB, &cMIresult); if ((cMIresult == MIRESULT_CLICK) && (iMIbuttonNum == 1)) { ChangeGameMode(GAMEMODE_NULL); SendMessage(m_hWnd, WM_DESTROY, NULL, NULL); delete pMI; return; } if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } void CGame::UpdateScreen_OnQueryForceLogin() { short msX, msY, msZ; char cLB, cRB, cMB; char cMIresult; int iMIbuttonNum; static class CMouseInterface * pMI; static DWORD dwCTime; DWORD dwTime = timeGetTime(); if (m_cGameModeCount == 0) { pMI = new class CMouseInterface; pMI->AddRect(200,244,200+BTNSZX,244+BTNSZY); pMI->AddRect(370,244,370+BTNSZX,244+BTNSZY); m_bEnterPressed = FALSE; m_bEscPressed = FALSE; m_cArrowPressed = 0; dwCTime = timeGetTime(); PlaySound('E', 25, 0); } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; if (m_bEscPressed == TRUE) { ChangeGameMode(GAMEMODE_ONSELECTCHARACTER); delete pMI; m_bEscPressed = FALSE; return; } m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); UpdateScreen_OnSelectCharacter(0, 0, 0, 0); if ((m_cGameModeCount >= 0) && (m_cGameModeCount < 6)) { m_DDraw.DrawShadowBox(0,0,639,479); } else if (m_cGameModeCount >= 6) { m_DDraw.DrawShadowBox(0,0,639,479); m_DDraw.DrawShadowBox(0,0,639,479); } DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, 162, 130, 2); PutString_SprFont(172 + 86, 160, "Account in use", 7,0,0); PutAlignedString(178, 453, 195, UPDATE_SCREEN_ON_QUERY_FORCE_LOGIN1); PutAlignedString(178, 453, 215, UPDATE_SCREEN_ON_QUERY_FORCE_LOGIN2); if ((msX >= 200) && (msX <= 200 + BTNSZX) && (msY >= 244) && (msY <= 244 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 200, 244, 19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 200, 244, 18); if ((msX >= 370) && (msX <= 370 + BTNSZX) && (msY >= 244) && (msY <= 244 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 370, 244, 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 370, 244, 2); if ((dwTime - dwCTime) > 100) { m_cMenuFrame++; dwCTime = dwTime; } if (m_cMenuFrame >= 8) { m_cMenuDirCnt++; if (m_cMenuDirCnt > 8) { m_cMenuDir++; m_cMenuDirCnt = 1; } m_cMenuFrame = 0; } if (m_cMenuDir > 8) m_cMenuDir = 1; iMIbuttonNum = pMI->iGetStatus(msX, msY, cLB, &cMIresult); if (cMIresult == MIRESULT_CLICK) { PlaySound('E', 14, 5); switch (iMIbuttonNum) { case 1: m_pLSock = new class XSocket(m_hWnd, SOCKETBLOCKLIMIT); m_pLSock->bConnect(m_cLogServerAddr, m_iLogServerPort, WM_USER_LOGSOCKETEVENT); m_pLSock->bInitBufferSize(30000); ChangeGameMode(GAMEMODE_ONCONNECTING); m_dwConnectMode = MSGID_REQUEST_ENTERGAME; m_wEnterGameType = ENTERGAMEMSGTYPE_NOENTER_FORCEDISCONN; ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg,"33"); delete pMI; return; case 2: ChangeGameMode(GAMEMODE_ONSELECTCHARACTER); delete pMI; break; } } DrawVersion(); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } void CGame::UpdateScreen_OnSelectCharacter(short sX, short sY, short msX, short msY, BOOL bIgnoreFocus) {int i; int iYear, iMonth, iDay, iHour, iMinute; __int64 iTemp1, iTemp2; char cTotalChar = 0; DWORD dwTime = timeGetTime(); sY = 10; m_DDraw.ClearBackB4(); DrawNewDialogBox(SPRID_INTERFACE_ND_SELECTCHAR, 0, 0, 0); DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 0, 0, 50); iTemp1 = 0; iTemp2 = 0; iYear = iMonth = iDay = iHour = iMinute = 0; for (i = 0; i < 4; i++) { if ((m_cCurFocus - 1 == i) && (bIgnoreFocus == FALSE)) m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(sX + 110 + i*109 -7, 63 -9, 62, dwTime); else m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(sX + 110 + i*109 -7, 63 -9, 61, dwTime); if (m_pCharList[i] != NULL) { cTotalChar++; switch (m_pCharList[i]->m_sSex) { case 1: _tmp_sOwnerType = 1; break; case 2: _tmp_sOwnerType = 4; break; } _tmp_sOwnerType += m_pCharList[i]->m_sSkinCol - 1; _tmp_cDir = m_cMenuDir; _tmp_sAppr1 = m_pCharList[i]->m_sAppr1; _tmp_sAppr2 = m_pCharList[i]->m_sAppr2; _tmp_sAppr3 = m_pCharList[i]->m_sAppr3; _tmp_sAppr4 = m_pCharList[i]->m_sAppr4; _tmp_iApprColor = m_pCharList[i]->m_iApprColor; ZeroMemory(_tmp_cName, sizeof(_tmp_cName)); memcpy(_tmp_cName, m_pCharList[i]->m_cName, 10); // CLEROTH - NO USE _tmp_cAction = OBJECTMOVE; _tmp_cFrame = m_cMenuFrame; if (m_pCharList[i]->m_sSex != NULL) { if (m_Misc.bCheckValidString(m_pCharList[i]->m_cName) == TRUE) { m_pEffectSpr[0]->PutTransSprite(sX +157 +i*109, sY +138, 1, dwTime); DrawObject_OnMove_ForMenu(0, 0, sX +157 +i*109, sY +138, FALSE, dwTime, 0, 0); PutString(sX +112 +i*109, sY +179 -9, m_pCharList[i]->m_cName, RGB(51,0,51));//25,35,25); int _sLevel = m_pCharList[i]->m_sLevel; wsprintf(G_cTxt, "%d", _sLevel); PutString(sX + 138 +i*109, sY +196 -10, G_cTxt, RGB(51,0,51)); //25,35,25); wsprintf(G_cTxt, "%d", m_pCharList[i]->m_iExp); PutString(sX + 138 +i*109, sY +211 -10, G_cTxt, RGB(51,0,51)); //25,35,25); } iTemp2 = m_pCharList[i]->m_iYear*1000000 + m_pCharList[i]->m_iMonth*60000 + m_pCharList[i]->m_iDay*1700 + m_pCharList[i]->m_iHour*70 + m_pCharList[i]->m_iMinute; if (iTemp1 < iTemp2) { iYear = m_pCharList[i]->m_iYear; iMonth = m_pCharList[i]->m_iMonth; iDay = m_pCharList[i]->m_iDay; iHour = m_pCharList[i]->m_iHour; iMinute = m_pCharList[i]->m_iMinute; iTemp1 = iTemp2; } } } } i = 0 ; DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 0,0,51); DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 0,0,52); DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 0,0,53); DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 0,0,54); DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 0,0,55); if ((msX > 360) && (msY >= 283) && (msX < 545) & (msY <= 315)) { DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 0,0,56); PutAlignedString(98, 357, 290 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER1);//" PutAlignedString(98, 357, 305 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER2);//" PutAlignedString(98, 357, 320 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER3);//" PutAlignedString(98, 357, 335 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER4);//" } else if ((msX > 360) && (msY >= 316) && (msX < 545) & (msY <= 345)) { DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 0,0,57); PutAlignedString(98, 357, 305 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER5);//" } else if ((msX > 360) && (msY >= 346) && (msX < 545) & (msY <= 375)) { DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 0,0,58); PutAlignedString(98, 357, 275 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER6);//" PutAlignedString(98, 357, 290 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER7);//" PutAlignedString(98, 357, 305 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER8);//" PutAlignedString(98, 357, 320 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER9);//" PutAlignedString(98, 357, 335 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER10);//" PutAlignedString(98, 357, 350 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER11);//" }else if ((msX > 360) && (msY >= 376) && (msX < 545) & (msY <= 405)) { DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 0,0,59); PutAlignedString(98, 357, 305 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER12);//" }else if ((msX > 360) && (msY >= 406) && (msX < 545) & (msY <= 435)) { DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 0,0,60); PutAlignedString(98, 357, 305 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER13);//" }else { if (cTotalChar == 0) { PutAlignedString(98, 357, 275 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER14);//" PutAlignedString(98, 357, 290 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER15);//" PutAlignedString(98, 357, 305 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER16);//" PutAlignedString(98, 357, 320 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER17);//"New Character PutAlignedString(98, 357, 335 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER18);//" }else if (cTotalChar < 4) { PutAlignedString(98, 357, 275 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER19);//" PutAlignedString(98, 357, 290 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER20); PutAlignedString(98, 357, 305 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER21);//" PutAlignedString(98, 357, 320 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER22);//" PutAlignedString(98, 357, 335 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER23);//"Delete Character PutAlignedString(98, 357, 350 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER24);//" } if (cTotalChar == 4) { PutAlignedString(98, 357, 290 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER25);//" PutAlignedString(98, 357, 305 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER26);//"Play PutAlignedString(98, 357, 320 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER27);//"Delete Character PutAlignedString(98, 357, 335 +15, UPDATE_SCREEN_ON_SELECT_CHARACTER28);//" } } int iTempMon, iTempDay, iTempHour, iTempMin ; iTempMon = iTempDay = iTempHour =iTempMin = 0; if (m_iAccntYear != 0) { iTempMin = (m_iTimeLeftSecAccount / 60 ) ; wsprintf(G_cTxt, UPDATE_SCREEN_ON_SELECT_CHARACTER37, m_iAccntYear, m_iAccntMonth, m_iAccntDay, iTempMin); }else { if (m_iTimeLeftSecAccount > 0) { iTempDay = (m_iTimeLeftSecAccount /(60*60*24)) ; iTempHour = (m_iTimeLeftSecAccount /(60*60)) % 24; iTempMin = (m_iTimeLeftSecAccount / 60 ) % 60; wsprintf(G_cTxt, UPDATE_SCREEN_ON_SELECT_CHARACTER38, iTempDay, iTempHour, iTempMin); }else strcpy(G_cTxt, UPDATE_SCREEN_ON_SELECT_CHARACTER39); } PutAlignedString(98, 357, 385 +10, G_cTxt); if (m_iIpYear != 0) { iTempHour = (m_iTimeLeftSecIP / (60*60)) ; iTempMin = (m_iTimeLeftSecIP / 60 ) % 60; wsprintf(G_cTxt, UPDATE_SCREEN_ON_SELECT_CHARACTER40, m_iIpYear, m_iIpMonth, m_iIpDay, iTempHour, iTempMin) ; }else { if (m_iTimeLeftSecIP > 0) { iTempDay = (m_iTimeLeftSecIP / (60*60*24)) ; iTempHour = (m_iTimeLeftSecIP / (60*60)) % 24; iTempMin = (m_iTimeLeftSecIP / 60 ) % 60; wsprintf(G_cTxt, UPDATE_SCREEN_ON_SELECT_CHARACTER41, iTempDay, iTempHour, iTempMin); } else strcpy(G_cTxt, UPDATE_SCREEN_ON_SELECT_CHARACTER42); } PutAlignedString(98, 357, 400 +10, G_cTxt); if (iYear != 0) { wsprintf(G_cTxt, UPDATE_SCREEN_ON_SELECT_CHARACTER43, iYear, iMonth, iDay, iHour, iMinute); PutAlignedString(98, 357, 415 +10, G_cTxt); } #ifdef _DEBUG PutAlignedString(122, 315, 456, UPDATE_SCREEN_ON_SELECT_CHARACTER36);//"Test Server" #else if (strcmp(m_cWorldServerName, NAME_WORLDNAME1) == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME1);//"ABADDON Server" else if (strcmp(m_cWorldServerName, "WS2") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME2);//"APOCALYPSE Server" else if (strcmp(m_cWorldServerName, "WS3") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME3);//"3rd Server" else if (strcmp(m_cWorldServerName, "WS4") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME4);//"4th Server" else if (strcmp(m_cWorldServerName, "WS5") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME5);//"5th Server" else if (strcmp(m_cWorldServerName, "WS6") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME6);//"6th Server" else if (strcmp(m_cWorldServerName, "WS7") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME7);//"7th Server" else if (strcmp(m_cWorldServerName, "WS8") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME8);//"8th Server" else if (strcmp(m_cWorldServerName, "WS9") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME9);//"9th Server" else if (strcmp(m_cWorldServerName, "WS10") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME10);//"10th Server" else if (strcmp(m_cWorldServerName, "WS11") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME11);//"11th Server" else if (strcmp(m_cWorldServerName, "WS12") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME12);//"12th Server" else if (strcmp(m_cWorldServerName, "WS13") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME13);//"13th Server" else if (strcmp(m_cWorldServerName, "WS14") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME14);//"14th Server" else if (strcmp(m_cWorldServerName, "WS15") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME15);//"15th Server" else if (strcmp(m_cWorldServerName, "WS16") == 0) PutAlignedString(129, 321, 456, MSG_WORLDNAME16);//"16th Server" #endif } void CGame::UpdateScreen_OnWaitingResponse() { short sX, sY, msX, msY, msZ; char cLB, cRB, cMB; DWORD dwTime = timeGetTime(); //static class CMouseInterface * pMI; static DWORD dwCTime; if (m_cGameModeCount == 0) { m_bEnterPressed = FALSE; m_bEscPressed = FALSE; dwCTime = timeGetTime(); } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; if (m_bEscPressed == TRUE) { if ((dwTime - m_dwTime) > 7000) { ChangeGameMode(GAMEMODE_ONMAINMENU); if (m_pLSock != NULL) { delete m_pLSock; m_pLSock = NULL; } if (m_pGSock != NULL) { delete m_pGSock; m_pGSock = NULL; } } m_bEscPressed = FALSE; return; } if ((dwTime - dwCTime) > 100) { m_cMenuFrame++; dwCTime = dwTime; } if (m_cMenuFrame >= 8) { m_cMenuDirCnt++; if (m_cMenuDirCnt > 8) { m_cMenuDir++; m_cMenuDirCnt = 1; } m_cMenuFrame = 0; } if (m_cMenuDir > 8) m_cMenuDir = 1; m_bIsHideLocalCursor = TRUE; m_DDraw.ClearBackB4(); switch (m_cMsg[0]) { case '0': _Draw_UpdateScreen_OnCreateNewAccount(); break; case '1': sX = 146; sY = 114; _Draw_OnLogin(m_cAccountName, m_cAccountPassword, 0, 0); break; case '2': _bDraw_OnCreateNewCharacter(m_cPlayerName, 0, 0, 0); break; case '3': UpdateScreen_OnSelectCharacter(0, 0, 0, 0); break; case '4':// Change Password UpdateScreen_OnSelectCharacter(0, 0, 0, 0, TRUE); break; case '5': m_DDraw.ClearBackB4(); break; } m_bIsHideLocalCursor = FALSE; m_DDraw.DrawShadowBox(0,0, 639,479); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, 162,125,2); PutString_SprFont(172 + 44 -17, 190, "Connected. Waiting for response...", 7,0,0); if ((dwTime - m_dwTime) > 7000) { PutAlignedString(180, 463, 195+30, UPDATE_SCREEN_ON_WATING_RESPONSE1); PutAlignedString(180, 463, 195+45, UPDATE_SCREEN_ON_WATING_RESPONSE2); }else PutAlignedString(180, 463, 195+30, UPDATE_SCREEN_ON_WATING_RESPONSE3); DrawVersion(); m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 8, dwTime); if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } void CGame::UpdateScreen_OnQueryDeleteCharacter() { short msX, msY, msZ; char cLB, cRB, cMB; char cMIresult; int iMIbuttonNum; static class CMouseInterface * pMI; static DWORD dwCTime; DWORD dwTime = timeGetTime(); if (m_cGameModeCount == 0) { pMI = new class CMouseInterface; pMI->AddRect(200, 244, 200 + BTNSZX, 244 + BTNSZY); pMI->AddRect(370, 244, 370 + BTNSZX, 244 + BTNSZY); //m_cCurFocus = 1; //m_cMaxFocus = 2; m_bEnterPressed = FALSE; m_cArrowPressed = 0; dwCTime = timeGetTime(); PlaySound('E', 25, 0); } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; if (m_bEscPressed == TRUE) { ChangeGameMode(GAMEMODE_ONSELECTCHARACTER); delete pMI; m_bEscPressed = FALSE; return; } m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); UpdateScreen_OnSelectCharacter(0, 0, 500, 70); if ((m_cGameModeCount >= 0) && (m_cGameModeCount < 6)) { m_DDraw.DrawShadowBox(0,0,639,479); }else if (m_cGameModeCount >= 6) { m_DDraw.DrawShadowBox(0,0,639,479); m_DDraw.DrawShadowBox(0,0,639,479); } DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, 162,125,2); PutString_SprFont(172 + 86, 160, "Delete Character", 7,0,0); PutString(215, 195, UPDATE_SCREEN_ON_QUERY_DELETE_CHARACTER1, RGB(5,5,5));//"Character Name" //"Character Name" PutString(335, 199, "__________", RGB(5,5,5)); PutString(335, 195, m_pCharList[m_wEnterGameType - 1]->m_cName, RGB(25,35,25)); PutAlignedString(178, 453, 220, UPDATE_SCREEN_ON_QUERY_DELETE_CHARACTER2);//"Do you want to delete the character above?" if ((msX >= 200) && (msX <= 200 + BTNSZX) && (msY >= 244) && (msY <= 244 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 200, 244, 19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 200, 244, 18); if ((msX >= 370) && (msX <= 370 + BTNSZX) && (msY >= 244) && (msY <= 244 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 370, 244, 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 370, 244, 2); if ((dwTime - dwCTime) > 100) { m_cMenuFrame++; dwCTime = dwTime; } if (m_cMenuFrame >= 8) { m_cMenuDirCnt++; if (m_cMenuDirCnt > 8) { m_cMenuDir++; m_cMenuDirCnt = 1; } m_cMenuFrame = 0; } if (m_cMenuDir > 8) m_cMenuDir = 1; iMIbuttonNum = pMI->iGetStatus(msX, msY, cLB, &cMIresult); if (cMIresult == MIRESULT_CLICK) { PlaySound('E', 14, 5); switch (iMIbuttonNum) { case 1: m_pLSock = new class XSocket(m_hWnd, SOCKETBLOCKLIMIT); m_pLSock->bConnect(m_cLogServerAddr, m_iLogServerPort, WM_USER_LOGSOCKETEVENT); m_pLSock->bInitBufferSize(30000); ChangeGameMode(GAMEMODE_ONCONNECTING); m_dwConnectMode = MSGID_REQUEST_DELETECHARACTER; ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg,"33"); delete pMI; return; case 2: ChangeGameMode(GAMEMODE_ONSELECTCHARACTER); delete pMI; break; } } DrawVersion(); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } void CGame::NotifyMsgHandler(char * pData) { DWORD * dwp, dwTime, dwTemp; WORD * wp, wEventType; char * cp, cTemp[510], cTxt[120]; short * sp, sX, sY, sV1, sV2, sV3, sV4, sV5, sV6, sV7, sV8, sV9; int * ip, i, iV1, iV2, iV3, iV4; dwTime = timeGetTime(); wp = (WORD *)(pData + INDEX2_MSGTYPE); wEventType = *wp; switch (wEventType) { case NOTIFY_LGNPTS: dwp = (DWORD *)(pData + INDEX2_MSGTYPE + 2); m_cash = *dwp; break; case NOTIFY_SLATE_BERSERK: // reversed by Snoopy: 0x0BED AddEventList( MSG_NOTIFY_SLATE_BERSERK, 10 );//"Berserk magic casted!" m_bUsingSlate = TRUE; break; case NOTIFY_LOTERY_LOST: // reversed by Snoopy: 0x0BEE: AddEventList( MSG_NOTIFY_LOTERY_LOST, 10 );//"You draw a blank. Please try again next time.." break; case NOTIFY_TELEPORT_REJECTED: sp = (short *)(pData + INDEX2_MSGTYPE + 2); sV1 = *sp; sp++; sV2 = *sp; sp++; m_pMapData->m_tile[sV1][sV2].m_bIsTeleport = FALSE; m_bIsTeleportRequested = false; ChangeGameMode(GAMEMODE_ONMAINGAME); AddEventList(NOTIFYMSG_TELEPORT_REJECTED, 10); break; case NOTIFY_0BEF: // 0x0BEF: // Snoopy: Crash or closes the client? (Calls SE entry !) // I'm noot sure at all of this function's result, so let's quit game... break; case NOTIFY_EVENTILLUSION: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sV1 = *cp; cp++; if(sV1 == 1) AddEventList(NOTIFYMSG_EVENTILLUSIONON, 10); else AddEventList(NOTIFYMSG_EVENTILLUSIONOFF, 10); break; case NOTIFY_EVENTTP: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sV1 = *cp; cp++; if(sV1 == 1) AddEventList(NOTIFYMSG_EVENTTPOPEN, 10); else AddEventList(NOTIFYMSG_EVENTTPCLOSE, 10); break; case NOTIFY_EVENTSPELL: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sV1 = *cp; cp++; sV2 = *cp; cp++; sV3 = *cp; cp++; if(sV2 < MAXMAGICTYPE && sV2 > 0){ if(sV1 == 1){ if(!sV3) m_magicDisabled[sV2] = true; wsprintf(cTemp, NOTIFYMSG_SPELLDISABLED, m_pMagicCfgList[sV2]->m_cName); } else{ m_magicDisabled[sV2] = false; wsprintf(cTemp, NOTIFYMSG_SPELLENABLED, m_pMagicCfgList[sV2]->m_cName); } AddEventList(cTemp, 10 ); } break; case NOTIFY_EVENTARMOR: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sV1 = *cp; cp++; sV2 = *cp; cp++; if(sV1 == 1){ if(!sV2) m_armorDisabled = true; AddEventList(NOTIFYMSG_ARMORDISABLED, 10); } else { m_armorDisabled = false; AddEventList(NOTIFYMSG_ARMORENABLED, 10); } break; case NOTIFY_EVENTSHIELD: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sV1 = *cp; cp++; sV2 = *cp; cp++; if(sV1 == 1){ AddEventList(NOTIFYMSG_SHIELDDISABLED, 10); if(!sV2) m_shieldDisabled = true; } else { AddEventList(NOTIFYMSG_SHIELDENABLED, 10); m_shieldDisabled = false; } break; case NOTIFY_EVENTCHAT: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sV1 = *cp; cp++; sV2 = *cp; cp++; if(sV1 == 1) AddEventList(NOTIFYMSG_CHATDISABLED, 10); else AddEventList(NOTIFYMSG_CHATENABLED, 10); break; case NOTIFY_EVENTPARTY: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sV1 = *cp; cp++; sV2 = *cp; cp++; if(sV1 == 1) AddEventList(NOTIFYMSG_PARTYDISABLED, 10); else AddEventList(NOTIFYMSG_PARTYENABLED, 10); break; case NOTIFY_EVENTRESET: m_shieldDisabled = false; m_armorDisabled = false; for(i = 0; i < MAXMAGICTYPE; i++) m_magicDisabled[i] = false; AddEventList(NOTIFYMSG_EVENTRESET, 10 ); break; case NOTIFY_CRAFTING_SUCCESS: //reversed by Snoopy: 0x0BF0: m_iContribution -= m_iContributionPrice; m_iContributionPrice = 0; DisableDialogBox(25); AddEventList(NOTIFY_MSG_HANDLER42, 10); // "Item manufacture success!" PlaySound('E', 23, 5); switch (m_sPlayerType) { case 1: case 2: case 3: PlaySound('C', 21, 0); break; case 4: case 5: case 6: PlaySound('C', 22, 0); break; } break; case NOTIFY_CRAFTING_FAIL: AddEventList(MSG_NOTIFY_CRAFTING_FAILED, 10); // "Crafting failed" PlaySound('E', 24, 5); break; case NOTIFY_NOMATCHINGCRAFTING: AddEventList(MSG_NOTIFY_CRAFTING_NO_PART, 10); // "There is not enough material" PlaySound('E', 24, 5); break; case NOTIFY_NO_CRAFT_CONTRIB: AddEventList(MSG_NOTIFY_CRAFTING_NO_CONTRIB, 10); // "There is not enough Contribution Point" PlaySound('E', 24, 5); break; case NOTIFY_ANGELIC_STATS: // reversed by Snoopy: 0x0BF2 cp = (char *)(pData + INDEX2_MSGTYPE + 2); ip = (int *)cp; m_angelStat[STAT_STR] = *ip; // m_angelStat[STAT_STR] cp +=4; ip = (int *)cp; m_angelStat[STAT_INT] = *ip; // m_angelStat[STAT_INT] cp +=4; ip = (int *)cp; m_angelStat[STAT_DEX] = *ip; // m_angelStat[STAT_DEX] cp +=4; ip = (int *)cp; m_angelStat[STAT_MAG] = *ip; // m_angelStat[STAT_MAG] break; case NOTIFY_ITEM_CANT_RELEASE: // reversed by Snoopy: 0x0BF3 AddEventList(MSG_NOTIFY_NOT_RELEASED , 10 );//"Item cannot be released" cp = (char *)(pData + INDEX2_MSGTYPE + 2); ItemEquipHandler(*cp); break; case NOTIFY_ANGEL_FAILED: // reversed by Snoopy: 0x0BF4 cp = (char *)(pData + INDEX2_MSGTYPE + 2); ip = (int *)cp; iV1 = *ip; // Error reason switch (iV1) { case 1: // "BFB9BBF3C4A120BECAC0BA20B9F6B1D7C0D4B4CFB4D92E20A4D02E2EA4D0" (Stolen bytes ?) AddEventList(MSG_NOTIFY_ANGEL_FAILED , 10 ); //"Impossible to get a Tutelary Angel." // Invented by Snoopy. break; case 2: // AddEventList(MSG_NOTIFY_ANGEL_MAJESTIC , 10 );//"You need additional Majesty Points." break; case 3: // AddEventList(MSG_NOTIFY_ANGEL_LOW_LVL , 10 ); //"Only Majesty characters can receive Tutelary Angel" break; } break; case NOTIFY_ANGEL_RECEIVED: // reversed by Snoopy: 0x0BF5: AddEventList(MSG_NOTIFY_ANGEL_RECEIVED, 10 );// "You have received the Tutelary Angel." break; case NOTIFY_SPELL_SKILL: // reversed by Snoopy: 0x0BF6 cp = (char *)(pData + INDEX2_MSGTYPE + 2); for (i = 0; i < MAXMAGICTYPE; i++) { m_cMagicMastery[i] = *cp; cp++; } for (i = 0; i < MAXSKILLTYPE; i++) { m_cSkillMastery[i] = (unsigned char)*cp; if (m_pSkillCfgList[i] != NULL) m_pSkillCfgList[i]->m_iLevel = (int)*cp; cp++; } break; case NOTIFY_NORECALL: // Snoopy 0x0BD1 AddEventList( "You can not recall in this map.", 10 ); break; case NOTIFY_APOCGATESTARTMSG: // Snoopy 0x0BD2 SetTopMsg("The portal to the Apocalypse is opened.", 10); break; case NOTIFY_APOCGATEENDMSG: // Snoopy 0x0BD3 SetTopMsg("The portal to the Apocalypse is closed.", 10); break; case NOTIFY_APOCGATEOPEN: // Snoopy ; Case BD4 of switch 00454077 cp = (char *)(pData + INDEX2_MSGTYPE + 2); ip = (int *)cp; m_iGatePositX = *ip; cp += 4; ip = (int *)cp; m_iGatePositY = *ip; cp += 4; ZeroMemory(m_cGateMapName, sizeof(m_cGateMapName)); memcpy(m_cGateMapName, cp, 10); cp += 10; break; case NOTIFY_QUESTCOUNTER: // Snoopy; Case BE2 of switch 00454077 cp = (char *)(pData + INDEX2_MSGTYPE + 2); ip = (int *)cp; m_stQuest.sCurrentCount = (short)*ip; cp += 4; break; case NOTIFY_MONSTERCOUNT: // Snoopy ; Case BE3 of switch 00454077 cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp+=2; wsprintf(cTxt,"Rest Monster :%d", sV1) ; AddEventList(cTxt, 10); break; case NOTIFY_APOCGATECLOSE: // Snoopy ; Case BD5 of switch 00454077 m_iGatePositX = m_iGatePositY = -1; ZeroMemory(m_cGateMapName, sizeof(m_cGateMapName)); break; case NOTIFY_APOCFORCERECALLPLAYERS: // Snoopy ; Case BD7 of switch 00454077 AddEventList( "You are recalled by force, because the Apocalypse is started.", 10 ); break; case NOTIFY_ABADDONKILLED: // Snoopy ; Case BD6 of switch 00454077 cp = (char *)(pData + INDEX2_MSGTYPE + 2); ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, cp, 10); cp += 10; wsprintf(G_cTxt, "Abaddon is destroyed by %s", cTxt); AddEventList(G_cTxt, 10); break; case NOTIFY_RESURRECTPLAYER: // Case BE9 of switch 00454077 EnableDialogBox(50, 0, NULL, NULL); break; case NOTIFY_HELDENIANTELEPORT: m_bIsHeldenianMode = TRUE; m_bIsHeldenianMap = ((m_cMapIndex == 35) || (m_cMapIndex == 36) || (m_cMapIndex == 37)); SetTopMsg("Teleport to Heldenian field is available from now. Magic casting is forbidden until real battle.", 10); break; case NOTIFY_HELDENIANEND: m_bIsHeldenianMode = FALSE; SetTopMsg("Heldenian holy war has been closed.", 10); break; case NOTIFY_HELDENIANSTART: m_bIsHeldenianMode = TRUE; m_bIsHeldenianMap = ((m_cMapIndex == 35) || (m_cMapIndex == 36) || (m_cMapIndex == 37)); SetTopMsg("Heldenian real battle has been started from now on.", 10); break; case NOTIFY_HELDENIANVICTORY: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp+=2; ShowHeldenianVictory(sV1); m_iHeldenianAresdenLeftTower = -1; m_iHeldenianElvineLeftTower = -1; m_iHeldenianAresdenFlags = -1; m_iHeldenianElvineFlags = -1; m_iHeldenianAresdenDead = -1; m_iHeldenianElvineDead = -1; m_iHeldenianAresdenKill = -1; break; case NOTIFY_HELDENIANCOUNT: NotifyMsg_Heldenian(pData); break; // Slates - Diuuude case NOTIFY_SLATE_CREATESUCCESS: // 0x0BC1 AddEventList( MSG_NOTIFY_SLATE_CREATESUCCESS, 10 ); break; case NOTIFY_SLATE_CREATEFAIL: // 0x0BC2 AddEventList( MSG_NOTIFY_SLATE_CREATEFAIL, 10 ); break; case NOTIFY_SLATE_INVINCIBLE: // 0x0BD8 AddEventList( MSG_NOTIFY_SLATE_INVINCIBLE, 10 ); m_bUsingSlate = TRUE; break; case NOTIFY_SLATE_MANA: // 0x0BD9 AddEventList( MSG_NOTIFY_SLATE_MANA, 10 ); m_bUsingSlate = TRUE; break; case NOTIFY_SLATE_EXP: // 0x0BE0 AddEventList( MSG_NOTIFY_SLATE_EXP, 10 ); m_bUsingSlate = TRUE; break; case NOTIFY_SLATE_STATUS: // 0x0BE1 AddEventList( MSG_NOTIFY_SLATECLEAR, 10 ); // "The effect of the prophecy-slate is disappeared." m_bUsingSlate = FALSE; break; // MJ Stats Change - Diuuude: Erreur, ici il s'agit de sorts et skills, le serveur comme la v351 sont aussi bugués ! case NOTIFY_STATECHANGE_SUCCESS: // 0x0BB5 cp = (char *)(pData + INDEX2_MSGTYPE + 2); for (i = 0; i < MAXMAGICTYPE; i++) { m_cMagicMastery[i] = *cp; cp++; } for (i = 0; i < MAXSKILLTYPE; i++) { m_cSkillMastery[i] = (unsigned char)*cp; if (m_pSkillCfgList[i] != NULL) m_pSkillCfgList[i]->m_iLevel = (int)*cp; //else m_pSkillCfgList[i]->m_iLevel = 0; cp++; } // MJ Stats Change - Diuuude m_stat[STAT_STR] += m_luStat[STAT_STR]; m_stat[STAT_VIT] += m_luStat[STAT_VIT]; m_stat[STAT_DEX] += m_luStat[STAT_DEX]; m_stat[STAT_INT] += m_luStat[STAT_INT]; m_stat[STAT_MAG] += m_luStat[STAT_MAG]; m_stat[STAT_CHR] += m_luStat[STAT_CHR]; m_iLU_Point = m_iLevel*3 - ( (m_stat[STAT_STR] + m_stat[STAT_VIT] + m_stat[STAT_DEX] + m_stat[STAT_INT] + m_stat[STAT_MAG] + m_stat[STAT_CHR]) - 70) - 3 + m_angelStat[STAT_STR] + m_angelStat[STAT_DEX] + m_angelStat[STAT_INT] + m_angelStat[STAT_MAG]; m_luStat[STAT_STR] = m_luStat[STAT_VIT] = m_luStat[STAT_DEX] = m_luStat[STAT_INT] = m_luStat[STAT_MAG] = m_luStat[STAT_CHR] = 0; AddEventList( "Your stat has been changed.", 10 ); // "Your stat has been changed." break; case NOTIFY_LEVELUP: // 0x0B16 NotifyMsg_LevelUp(pData); break; case NOTIFY_STATECHANGE_FAILED: // 0x0BB6 m_luStat[STAT_STR] = m_luStat[STAT_VIT] = m_luStat[STAT_DEX] = m_luStat[STAT_INT] = m_luStat[STAT_MAG] = m_luStat[STAT_CHR] = 0; m_iLU_Point = m_iLevel*3 - ( (m_stat[STAT_STR] + m_stat[STAT_VIT] + m_stat[STAT_DEX] + m_stat[STAT_INT] + m_stat[STAT_MAG] + m_stat[STAT_CHR]) - 70) - 3 + m_angelStat[STAT_STR] + m_angelStat[STAT_DEX] + m_angelStat[STAT_INT] + m_angelStat[STAT_MAG]; AddEventList( "Your stat has not been changed.", 10 ); break; case NOTIFY_SETTING_FAILED: // 0x0BB4 - Case BB4 of switch 00454077 AddEventList( "Your stat has not been changed.", 10 ); m_luStat[STAT_STR] = m_luStat[STAT_VIT] = m_luStat[STAT_DEX] = m_luStat[STAT_INT] = m_luStat[STAT_MAG] = m_luStat[STAT_CHR] = 0; m_iLU_Point = m_iLevel*3 - ( (m_stat[STAT_STR] + m_stat[STAT_VIT] + m_stat[STAT_DEX] + m_stat[STAT_INT] + m_stat[STAT_MAG] + m_stat[STAT_CHR]) - 70) - 3 + m_angelStat[STAT_STR] + m_angelStat[STAT_DEX] + m_angelStat[STAT_INT] + m_angelStat[STAT_MAG]; break; // CLEROTH - LU case NOTIFY_SETTING_SUCCESS: // 0x0BB3 - envoie le niv et les stats NotifyMsg_SettingSuccess(pData); break; case NOTIFY_AGRICULTURENOAREA: // 0x0BB2 AddEventList( MSG_NOTIFY_AGRICULTURENOAREA, 10 ); break; case NOTIFY_AGRICULTURESKILLLIMIT: // 0x0BB1 AddEventList( MSG_NOTIFY_AGRICULTURESKILLLIMIT, 10 ); break; case NOTIFY_NOMOREAGRICULTURE: // 0x0BB0 AddEventList( MSG_NOTIFY_NOMOREAGRICULTURE, 10 ); break; case NOTIFY_MONSTEREVENT_POSITION: // 0x0BAA cp = (char *)(pData + INDEX2_MSGTYPE + 2); m_sMonsterID = (short)(*cp); cp++; sp = (short *)cp; m_sEventX = *sp; cp+=2; sp = (short *)cp; m_sEventY = *sp; cp+=2; m_dwMonsterEventTime = dwTime; break; case NOTIFY_RESPONSE_HUNTMODE: // 0x0BA9 cp = (char *)(pData + INDEX2_MSGTYPE + 2); memcpy(m_cLocation, cp, 10); cp += 10; if (memcmp(m_cLocation, "are", 3) == 0) m_side = ARESDEN; else if (memcmp(m_cLocation, "elv", 3) == 0) m_side = ELVINE; else if (memcmp(m_cLocation, "ist", 3) == 0) m_side = ISTRIA; else m_side = NEUTRAL; AddEventList( MSG_GAMEMODE_CHANGED, 10 ); break; case NOTIFY_REQGUILDNAMEANSWER: // 0x0BA6 cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp += 2; sp = (short *)cp; sV2 = *sp; cp += 2; ZeroMemory(cTemp, sizeof(cTemp)); memcpy(cTemp, cp, 20); cp += 20; ZeroMemory( m_stGuildName[sV2].cGuildName, sizeof(m_stGuildName[sV2].cGuildName) ); strcpy(m_stGuildName[sV2].cGuildName, cTemp); m_stGuildName[sV2].iGuildRank = sV1; for (i = 0; i < 20; i++) if (m_stGuildName[sV2].cGuildName[i] == '_') m_stGuildName[sV2].cGuildName[i] = ' '; break; case NOTIFY_FORCERECALLTIME: // 0x0BA7 cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp += 2; if ( (int)(sV1/20) > 0) wsprintf(G_cTxt,NOTIFY_MSG_FORCERECALLTIME1,(int) (sV1/20)) ; else wsprintf(G_cTxt,NOTIFY_MSG_FORCERECALLTIME2) ; AddEventList(G_cTxt, 10); break; case NOTIFY_GIZONITEMUPGRADELEFT: // 0x0BA4// Item upgrade is possible. cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp += 2; m_iGizonItemUpgradeLeft = sV1; dwp = (DWORD *)cp; switch (*dwp) { case 1: // AddEventList(NOTIFY_MSG_HANDLER_GIZONITEMUPGRADELEFT1, 10); break; } //wsprintf(G_cTxt,"majesty: %d", m_iGizonItemUpgradeLeft); //DebugLog(G_cTxt); cp += 4; break; case NOTIFY_GIZONEITEMCHANGE: // 0x0BA5 cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp += 2; m_pItemList[sV1]->m_cItemType = *cp ; cp++ ; wp = (WORD *)cp; m_pItemList[sV1]->m_wCurLifeSpan = *wp; cp += 2; sp = (short *)cp; m_pItemList[sV1]->m_sSprite = *sp; cp += 2; sp = (short *)cp; m_pItemList[sV1]->m_sSpriteFrame = *sp; cp += 2; m_pItemList[sV1]->m_cItemColor = *cp ; cp++ ; m_pItemList[sV1]->m_sItemSpecEffectValue2 = *cp ; cp++ ; dwp = (DWORD *) cp ; m_pItemList[sV1]->m_dwAttribute = *dwp ; cp +=4 ; ZeroMemory( m_pItemList[sV1]->m_cName, sizeof(m_pItemList[sV1]->m_cName) ); memcpy(m_pItemList[sV1]->m_cName,cp,20) ; cp += 20 ; if (m_bIsDialogEnabled[34] == TRUE) { m_stDialogBoxInfo[34].cMode = 3; // succes } PlaySound('E', 23, 5); switch (m_sPlayerType) { case 1: case 2: case 3: PlaySound('C', 21, 0); break; case 4: case 5: case 6: PlaySound('C', 22, 0); break; } break; case NOTIFY_ITEMATTRIBUTECHANGE: // 0x0BA3 case 0x0BC0: // 0x0BC0 Unknown msg, but real in client v3.51 cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp += 2; dwTemp = m_pItemList[sV1]->m_dwAttribute; dwp = (DWORD *)cp; m_pItemList[sV1]->m_dwAttribute = *dwp; cp += 4; dwp = (DWORD *)cp; if (*dwp != 0) m_pItemList[sV1]->m_sItemSpecEffectValue1 = (short)*dwp; cp += 4; dwp = (DWORD *)cp; if (*dwp != 0) m_pItemList[sV1]->m_sItemSpecEffectValue2 = (short)*dwp; cp += 4; if (dwTemp == m_pItemList[sV1]->m_dwAttribute) { if (m_bIsDialogEnabled[34] == TRUE) { m_stDialogBoxInfo[34].cMode = 4;// Failed } PlaySound('E', 24, 5); }else { if (m_bIsDialogEnabled[34] == TRUE) { m_stDialogBoxInfo[34].cMode = 3; // Success } PlaySound('E', 23, 5); switch (m_sPlayerType) { case 1: case 2: case 3: PlaySound('C', 21, 0); break; case 4: case 5: case 6: PlaySound('C', 22, 0); break; } } break; case NOTIFY_ITEMUPGRADEFAIL: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp += 2; if (m_bIsDialogEnabled[34] == FALSE) return ; PlaySound('E', 24, 5); switch(sV1){ case 1: m_stDialogBoxInfo[34].cMode = 8 ; // Failed break ; case 2: m_stDialogBoxInfo[34].cMode = 9 ; // Failed break ; case 3: m_stDialogBoxInfo[34].cMode = 10 ; // Failed break ; } break; case NOTIFY_PARTY: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp += 2; sp = (short *)cp; sV2 = *sp; cp += 2; sp = (short *)cp; sV3 = *sp; cp += 2; switch (sV1) { case 1: //Create Party switch (sV2) { case 0: //Create party failure EnableDialogBox(32, NULL, NULL, NULL); m_stDialogBoxInfo[32].cMode = 9; break; case 1: //Create party success m_iPartyStatus = 1; EnableDialogBox(32, NULL, NULL, NULL); m_stDialogBoxInfo[32].cMode = 8; m_stPartyMember.clear(); bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_JOINPARTY, NULL, 2, NULL, NULL, m_cMCName); break; } break; case 2: //Delete party m_iPartyStatus = 0; EnableDialogBox(32, NULL, NULL, NULL); m_stDialogBoxInfo[32].cMode = 10; m_stPartyMember.clear(); break; case 4: //Join party ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, cp, 10); cp += 10; switch (sV2) { case 0: //Join party failure EnableDialogBox(32, NULL, NULL, NULL); m_stDialogBoxInfo[32].cMode = 9; break; case 1: //Join party success if (strcmp(cTxt, m_cPlayerName) == 0) { m_iPartyStatus = 2; EnableDialogBox(32, NULL, NULL, NULL); m_stDialogBoxInfo[32].cMode = 8; } else { wsprintf(G_cTxt, NOTIFY_MSG_HANDLER1, cTxt); AddEventList(G_cTxt, 10); } m_stPartyMember.push_back(new partyMember(cTxt)); break; } break; case 5: //Get list of names m_iTotalPartyMember = sV3; for (i = 0; i < sV3; i++) { ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, cp, 10); for (sV6 = 0, sV5 = false; sV6 < m_stPartyMember.size(); sV6++) if(m_stPartyMember[sV6]->cName.compare(cTxt) == 0){ sV5 = true; break;} if(sV5 == false){ m_stPartyMember.push_back(new partyMember(cTxt)); } cp+= 11; } break; default: sp = (short *)cp; sV4 = *sp; cp += 2; break; case 6: //Dismissed party member ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, cp, 10); cp += 10; switch (sV2) { case 0: // EnableDialogBox(32, NULL, NULL, NULL); m_stDialogBoxInfo[32].cMode = 7; break; case 1: //Party member successfully dismissed if (strcmp(cTxt, m_cPlayerName) == 0) { m_iPartyStatus = 0; EnableDialogBox(32, NULL, NULL, NULL); m_stDialogBoxInfo[32].cMode = 6; } else { wsprintf(G_cTxt, NOTIFY_MSG_HANDLER2 , cTxt); AddEventList(G_cTxt, 10); } for (partyIterator it = m_stPartyMember.begin(); it < m_stPartyMember.end(); it++) if ((*it)->cName.compare(cTxt) == 0) { m_stPartyMember.erase(it); break; } break; } break; case 7: //Party join rejected EnableDialogBox(32, NULL, NULL, NULL); m_stDialogBoxInfo[32].cMode = 9; break; case 8: //You left the party m_iPartyStatus = 0; m_iTotalPartyMember = NULL; m_stPartyMember.clear(); break; } break; case NOTIFY_PARTY_COORDS: cp = (char *)(pData + INDEX2_MSGTYPE + 2); ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, cp, 10); cp += 10; sp = (short *)cp; sV4 = *sp; cp += 2; sp = (short *)cp; sV5 = *sp; // cp += 2; for (i = 0; i < m_stPartyMember.size(); i++){ if(m_stPartyMember[i]->cName.compare(cTxt) ==0){ m_stPartyMember[i]->sX = sV4; m_stPartyMember[i]->sY = sV5; } } break; case NOTIFY_CANNOTCONSTRUCT: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp += 2; CannotConstruct(sV1); PlaySound('E', 25, 0, 0); break; case NOTIFY_TCLOC: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; m_iTeleportLocX = *sp; cp += 2; sp = (short *)cp; m_iTeleportLocY = *sp; cp += 2; ZeroMemory(m_cTeleportMapName, sizeof(m_cTeleportMapName)); memcpy(m_cTeleportMapName, cp, 10); cp += 10; sp = (short *)cp; m_iConstructLocX = *sp; cp += 2; sp = (short *)cp; m_iConstructLocY = *sp; cp += 2; ZeroMemory(m_cConstructMapName, sizeof(m_cConstructMapName)); memcpy(m_cConstructMapName, cp, 10); cp += 10; break; case NOTIFY_CONSTRUCTIONPOINT: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp += 2; sp = (short *)cp; sV2 = *sp; cp += 2; sp = (short *)cp; sV3 = *sp; cp += 2; if (sV3 == 0) { if ((sV1 > m_iConstructionPoint) && (sV2 > m_iWarContribution)) { wsprintf(G_cTxt, "%s +%d, %s +%d", CRUSADE_MESSAGE13, (sV1 - m_iConstructionPoint), CRUSADE_MESSAGE21, (sV2 - m_iWarContribution)); SetTopMsg(G_cTxt, 5); PlaySound('E', 23, 0, 0); } if ((sV1 > m_iConstructionPoint) && (sV2 == m_iWarContribution)) { if (m_iCrusadeDuty == 3) { wsprintf(G_cTxt, "%s +%d", CRUSADE_MESSAGE13, sV1 - m_iConstructionPoint); SetTopMsg(G_cTxt, 5); PlaySound('E', 23, 0, 0); } } if ((sV1 == m_iConstructionPoint) && (sV2 > m_iWarContribution)) { wsprintf(G_cTxt, "%s +%d", CRUSADE_MESSAGE21, sV2 - m_iWarContribution); SetTopMsg(G_cTxt, 5); PlaySound('E', 23, 0, 0); } if (sV1 < m_iConstructionPoint) { if (m_iCrusadeDuty == 3) { wsprintf(G_cTxt, "%s -%d", CRUSADE_MESSAGE13, m_iConstructionPoint - sV1); SetTopMsg(G_cTxt, 5); PlaySound('E', 25, 0, 0); } } if (sV2 < m_iWarContribution) { wsprintf(G_cTxt, "%s -%d", CRUSADE_MESSAGE21, m_iWarContribution - sV2); SetTopMsg(G_cTxt, 5); PlaySound('E', 24, 0, 0); } } m_iConstructionPoint = sV1; m_iWarContribution = sV2; break; case NOTIFY_NOMORECRUSADESTRUCTURE: SetTopMsg(CRUSADE_MESSAGE12, 5); PlaySound('E', 25, 0, 0); break; case NOTIFY_GRANDMAGICRESULT: cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; sV1 = *wp; cp += 2; wp = (WORD *)cp; sV2 = *wp; cp += 2; wp = (WORD *)cp; sV3 = *wp; cp += 2; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, cp, 10); cp += 10; wp = (WORD *)cp; sV4 = *wp; cp += 2; wp = (WORD *)cp; sV5 = *wp; // cp += 2; if (sV5 > 0 ) { wp = (WORD *)cp; sV6 = *wp; cp += 2; sV5-- ; } else sV6 = 0 ; if ( sV5 > 0 ) { wp = (WORD *)cp; sV7 = *wp; cp += 2; sV5-- ; } else sV7 = 0 ; if ( sV5 > 0 ) { wp = (WORD *)cp; sV8 = *wp; cp += 2; sV5-- ; } else sV8 = 0 ; if ( sV5 > 0 ) { wp = (WORD *)cp; sV9 = *wp; cp += 2; sV5-- ; } else sV9 = 0 ; GrandMagicResult(cTxt, sV1, sV2, sV3, sV4, sV6, sV7, sV8, sV9); break; case NOTIFY_METEORSTRIKECOMING: cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; sV1 = *wp; cp += 2; MeteorStrikeComing(sV1); PlaySound('E', 25, 0, 0); break; case NOTIFY_METEORSTRIKEHIT: SetTopMsg(CRUSADE_MESSAGE17, 5); //StartMeteorStrikeEffect for( i=0 ; i<36 ; i++ ) bAddNewEffect(60, m_sViewPointX +(rand() % 640), m_sViewPointY +(rand() % 480), NULL, NULL, -(rand() % 80)); break; case NOTIFY_MAPSTATUSNEXT: AddMapStatusInfo(pData, FALSE); break; case NOTIFY_MAPSTATUSLAST: AddMapStatusInfo(pData, TRUE); break; case NOTIFY_LOCKEDMAP: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp += 2; ZeroMemory(cTemp, sizeof(cTemp)); ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, cp, 10); cp += 10; GetOfficialMapName(cTxt, cTemp); wsprintf( G_cTxt, NOTIFY_MSG_HANDLER3, sV1, cTemp ); SetTopMsg(G_cTxt, 10); PlaySound('E', 25, 0, 0); break; case NOTIFY_CRUSADE: // Crusade msg cp = (char *)(pData + INDEX2_MSGTYPE + 2); ip = (int *)cp; iV1 = *ip; // Crusademode cp += 4; ip = (int *)cp; iV2 = *ip; // crusade duty cp += 4; ip = (int *)cp; iV3 = *ip; cp += 4; ip = (int *)cp; iV4 = *ip; cp += 4; if (m_bIsCrusadeMode == FALSE) { if (iV1 != 0) // begin crusade { m_bIsCrusadeMode = TRUE; m_iCrusadeDuty = iV2; if( (m_iCrusadeDuty != 3) && m_side == NEUTRAL ) _RequestMapStatus("middleland", 3); if (m_iCrusadeDuty != NULL) EnableDialogBox(33, 2, iV2, NULL); else EnableDialogBox(33, 1, NULL, NULL); if( m_side == NEUTRAL ) EnableDialogBox(18, 800, NULL, NULL); else if( m_side == ARESDEN ) EnableDialogBox(18, 801, NULL, NULL); else if( m_side == ELVINE ) EnableDialogBox(18, 802, NULL, NULL); if (m_side == NEUTRAL) SetTopMsg(NOTIFY_MSG_CRUSADESTART_NONE, 10); else SetTopMsg(CRUSADE_MESSAGE9, 10); PlaySound('E', 25, 0, 0); } if (iV3 != 0) // Crusade finished, show XP result screen { CrusadeContributionResult(iV3); } if (iV4 == -1) // The crusade you played in was finished. { CrusadeContributionResult(0); // You connect in this crusade, but did not connect after previous one => no XP.... } }else { if (iV1 == 0) // crusade finished show result (1st result: winner) { m_bIsCrusadeMode = FALSE; m_iCrusadeDuty = NULL; CrusadeWarResult(iV4); SetTopMsg(CRUSADE_MESSAGE57, 8); }else { if (m_iCrusadeDuty != iV2) { m_iCrusadeDuty = iV2; EnableDialogBox(33, 2, iV2, NULL); PlaySound('E', 25, 0, 0); } } if (iV4 == -1) { CrusadeContributionResult(0); // You connect in this crusade, but did not connect after previous one => no XP.... } } break; case NOTIFY_SPECIALABILITYSTATUS: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp += 2; sp = (short *)cp; sV2 = *sp; cp += 2; sp = (short *)cp; sV3 = *sp; cp += 2; if (sV1 == 1) // Use SA { PlaySound('E', 35, 0); AddEventList(NOTIFY_MSG_HANDLER4, 10); // "Use special ability!" switch (sV2) { case 1: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER5,sV3); break;//"You are untouchable for %d seconds!" case 2: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER6, sV3); break;//" case 3: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER7, sV3); break;//" case 4: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER8, sV3); break;//" case 5: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER9, sV3); break;//" case 50:wsprintf(G_cTxt, NOTIFY_MSG_HANDLER10, sV3); break;//" case 51:wsprintf(G_cTxt, NOTIFY_MSG_HANDLER11, sV3); break;//" case 52:wsprintf(G_cTxt, NOTIFY_MSG_HANDLER12, sV3); break;//" case 55: // Spell effect if (sV3 >90) wsprintf(G_cTxt, "You cast a powerfull incantation, you can't use it again before %d minutes.", sV3/60); else wsprintf(G_cTxt, "You cast a powerfull incantation, you can't use it again before %d seconds.", sV3); break; } AddEventList(G_cTxt, 10); }else if (sV1 == 2) // Finished using { if (m_iSpecialAbilityType != (int)sV2) { PlaySound('E', 34, 0); AddEventList(NOTIFY_MSG_HANDLER13, 10);//"Special ability has been set!" if (sV3 >= 60) { switch (sV2) { case 1: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER14, sV3/60); AddEventList(G_cTxt, 10); break;//"Ability that decreases enemy's HP by 50%: Can use after %dMin" case 2: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER15, sV3/60); AddEventList(G_cTxt, 10); break;//" case 3: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER16, sV3/60); AddEventList(G_cTxt, 10); break;//" case 4: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER17, sV3/60); AddEventList(G_cTxt, 10); break;//" case 5: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER18, sV3/60); AddEventList(G_cTxt, 10); break;//" case 50:wsprintf(G_cTxt, NOTIFY_MSG_HANDLER19, sV3/60); AddEventList(G_cTxt, 10); break;//" case 51:wsprintf(G_cTxt, NOTIFY_MSG_HANDLER20, sV3/60); AddEventList(G_cTxt, 10); break;//" case 52:wsprintf(G_cTxt, NOTIFY_MSG_HANDLER21, sV3/60); AddEventList(G_cTxt, 10); break;//" } }else { switch (sV2) { case 1: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER22, sV3); AddEventList(G_cTxt, 10); break;//" case 2: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER23, sV3); AddEventList(G_cTxt, 10); break;//" case 3: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER24, sV3); AddEventList(G_cTxt, 10); break;//" case 4: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER25, sV3); AddEventList(G_cTxt, 10); break;//" case 5: wsprintf(G_cTxt, NOTIFY_MSG_HANDLER26, sV3); AddEventList(G_cTxt, 10); break;//" case 50:wsprintf(G_cTxt, NOTIFY_MSG_HANDLER27, sV3); AddEventList(G_cTxt, 10); break;//" case 51:wsprintf(G_cTxt, NOTIFY_MSG_HANDLER28, sV3); AddEventList(G_cTxt, 10); break;//" case 52:wsprintf(G_cTxt, NOTIFY_MSG_HANDLER29, sV3); AddEventList(G_cTxt, 10); break;//""Ability that makes character untouchable: Can use after %dSec" } } } m_iSpecialAbilityType = (int)sV2; m_dwSpecialAbilitySettingTime = dwTime; m_iSpecialAbilityTimeLeftSec = (int)sV3; }else if (sV1 == 3) // End of using time { m_bIsSpecialAbilityEnabled = FALSE; m_dwSpecialAbilitySettingTime = dwTime; if (sV3 == 0) { m_iSpecialAbilityTimeLeftSec = 1200; AddEventList(NOTIFY_MSG_HANDLER30, 10);//"Special ability has run out! Will be available in 20 minutes." }else { m_iSpecialAbilityTimeLeftSec = (int)sV3; if (sV3 >90) wsprintf(G_cTxt, "Special ability has run out! Will be available in %d minutes." , sV3/60); else wsprintf(G_cTxt, "Special ability has run out! Will be available in %d seconds." , sV3); AddEventList(G_cTxt, 10); } }else if (sV1 == 4) // Unequiped the SA item { AddEventList(NOTIFY_MSG_HANDLER31, 10);//"Special ability has been released." m_iSpecialAbilityType = 0; }else if (sV1 == 5) // Angel { PlaySound('E', 52, 0); // Angel } break; case NOTIFY_SPECIALABILITYENABLED: if (m_bIsSpecialAbilityEnabled == FALSE) { PlaySound('E', 30, 5); AddEventList(NOTIFY_MSG_HANDLER32, 10);//" } m_bIsSpecialAbilityEnabled = TRUE; break; case NOTIFY_ENERGYSPHEREGOALIN: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp += 2; sp = (short *)cp; sV2 = *sp; cp += 2; sp = (short *)cp; sV3 = *sp; cp += 2; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, cp, 20); if (sV2 == sV3) { PlaySound('E', 24, 0); if (strcmp(cTxt, m_cPlayerName) == 0) { AddEventList(NOTIFY_MSG_HANDLER33, 10);//You pushed energy sphere to enemy's energy portal! Contribution point will be decreased by 10 points." m_iContribution += sV1; // fixed, server must match... m_iContributionPrice = 0; if (m_iContribution < 0) m_iContribution = 0; } else { ZeroMemory(G_cTxt, sizeof(G_cTxt)); if( m_side == ARESDEN ) wsprintf(G_cTxt, NOTIFY_MSG_HANDLER34, cTxt);//"%s(Aresden) pushed energy sphere to enemy's portal!!..." else if (m_side == ELVINE) wsprintf(G_cTxt, NOTIFY_MSG_HANDLER34_ELV, cTxt);//"%s(Elvine) pushed energy sphere to enemy's portal!!..." AddEventList(G_cTxt, 10); } }else { PlaySound('E', 23, 0); if (strcmp(cTxt, m_cPlayerName) == 0) { switch (m_sPlayerType) { case 1: case 2: case 3: PlaySound('C', 21, 0); break; case 4: case 5: case 6: PlaySound('C', 22, 0); break; } AddEventList(NOTIFY_MSG_HANDLER35, 10);//"Congulaturations! You brought energy sphere to energy portal and earned experience and prize gold!" m_iContribution += 5; if (m_iContribution < 0) m_iContribution = 0; }else { ZeroMemory(G_cTxt, sizeof(G_cTxt)); if (sV3 == 1) { wsprintf(G_cTxt, NOTIFY_MSG_HANDLER36, cTxt);//"Elvine %s : Goal in!" AddEventList(G_cTxt, 10); }else if (sV3 == 2) { wsprintf(G_cTxt, NOTIFY_MSG_HANDLER37, cTxt);//"Aresden %s : Goal in!" AddEventList(G_cTxt, 10); } } } break; case NOTIFY_ENERGYSPHERECREATED: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp += 2; sp = (short *)cp; sV2 = *sp; cp += 2; ZeroMemory(G_cTxt, sizeof(G_cTxt)); wsprintf(G_cTxt, NOTIFY_MSG_HANDLER38, sV1, sV2);//"Energy sphere was dropped in (%d, %d) of middleland!" AddEventList(G_cTxt, 10); AddEventList(NOTIFY_MSG_HANDLER39, 10);//"A player who pushed energy sphere to the energy portal of his city will earn many Exp and Contribution." break; case NOTIFY_QUERY_JOINPARTY: ZeroMemory(m_stDialogBoxInfo[32].cStr, sizeof(m_stDialogBoxInfo[32].cStr)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); strcpy(m_stDialogBoxInfo[32].cStr, cp); if(m_partyAutoAccept) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_ACCEPTJOINPARTY, NULL, 1, NULL, NULL, m_stDialogBoxInfo[32].cStr); } else { EnableDialogBox(32, NULL, NULL, NULL); m_stDialogBoxInfo[32].cMode = 1; } break; case NOTIFY_RESPONSE_CREATENEWPARTY: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; if ((BOOL)*sp == TRUE) { m_stDialogBoxInfo[32].cMode = 2; }else { m_stDialogBoxInfo[32].cMode = 3; } break; case NOTIFY_DAMAGEMOVE: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; m_sDamageMove = *sp; cp += 2; sp = (short *)cp; m_sDamageMoveAmount = *sp; cp += 2; break; case NOTIFY_OBSERVERMODE: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; if (*sp == 1) { AddEventList(NOTIFY_MSG_HANDLER40);//"Observer Mode On. Press 'SHIFT + ESC' to Log Out..." m_bIsObserverMode = TRUE; m_dwObserverCamTime = timeGetTime(); char cName[12]; ZeroMemory(cName, sizeof(cName)); memcpy(cName, m_cPlayerName, 10); m_pMapData->bSetOwner(m_sPlayerObjectID, -1, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, cName, NULL, NULL, NULL, NULL); }else { AddEventList(NOTIFY_MSG_HANDLER41);//"Observer Mode Off" m_bIsObserverMode = FALSE; m_pMapData->bSetOwner(m_sPlayerObjectID, m_sPlayerX, m_sPlayerY, m_sPlayerType, m_cPlayerDir, m_sPlayerAppr1, m_sPlayerAppr2, m_sPlayerAppr3, m_sPlayerAppr4, m_iPlayerApprColor, m_iPlayerStatus, m_cPlayerName, OBJECTSTOP, NULL, NULL, NULL); } break; case NOTIFY_BUILDITEMSUCCESS: DisableDialogBox(26); cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sV1 = *sp; cp += 2; sp = (short *)cp; sV2 = *sp; cp += 2; if (sV1 < 10000) { EnableDialogBox(26, 6, 1, sV1, NULL); m_stDialogBoxInfo[26].sV1 = sV2; }else { EnableDialogBox(26, 6, 1, -1*(sV1 - 10000), NULL); m_stDialogBoxInfo[26].sV1 = sV2; } AddEventList(NOTIFY_MSG_HANDLER42, 10); PlaySound('E', 23, 5); switch (m_sPlayerType) { case 1: case 2: case 3: PlaySound('C', 21, 0); break; case 4: case 5: case 6: PlaySound('C', 22, 0); break; } break; case NOTIFY_BUILDITEMFAIL: DisableDialogBox(26); EnableDialogBox(26, 6, 0, NULL); AddEventList(NOTIFY_MSG_HANDLER43, 10); PlaySound('E', 24, 5); break; case NOTIFY_QUESTREWARD: NotifyMsg_QuestReward(pData); break; case NOTIFY_QUESTCOMPLETED: m_stQuest.bIsQuestCompleted = TRUE; DisableDialogBox(28); EnableDialogBox(28, 1, NULL, NULL); switch (m_sPlayerType) { case 1: case 2: case 3: PlaySound('C', 21, 0); break; case 4: case 5: case 6: PlaySound('C', 22, 0); break; } PlaySound('E', 23, 0); AddEventList(NOTIFY_MSG_HANDLER44, 10); break; case NOTIFY_QUESTABORTED: m_stQuest.sQuestType = NULL; DisableDialogBox(28); EnableDialogBox(28, 2, NULL, NULL); break; case NOTIFY_QUESTCONTENTS: NotifyMsg_QuestContents(pData); break; case NOTIFY_ITEMCOLORCHANGE: NotifyMsg_ItemColorChange(pData); break; case NOTIFY_DROPITEMFIN_COUNTCHANGED: NotifyMsg_DropItemFin_CountChanged(pData); break; case NOTIFY_CANNOTGIVEITEM: NotifyMsg_CannotGiveItem(pData); break; case NOTIFY_GIVEITEMFIN_COUNTCHANGED: NotifyMsg_GiveItemFin_CountChanged(pData); break; case NOTIFY_EXCHANGEITEMCOMPLETE: AddEventList(NOTIFYMSG_EXCHANGEITEM_COMPLETE1, 10); DisableDialogBox(27); //Snoopy: MultiTrade DisableDialogBox(41); PlaySound('E', 23, 5); break; case NOTIFY_CANCELEXCHANGEITEM: PlaySound('E', 24, 5); AddEventList(NOTIFYMSG_CANCEL_EXCHANGEITEM1, 10); AddEventList(NOTIFYMSG_CANCEL_EXCHANGEITEM2, 10); //Snoopy: MultiTrade DisableDialogBox(41); DisableDialogBox(27); break; case NOTIFY_SETEXCHANGEITEM: NotifyMsg_SetExchangeItem(pData); break; case NOTIFY_OPENEXCHANGEWINDOW: NotifyMsg_OpenExchageWindow(pData); break; case NOTIFY_NOTFLAGSPOT: AddEventList(NOTIFY_MSG_HANDLER45, 10); break; case NOTIFY_ITEMPOSLIST: cp = (char *)(pData + INDEX2_MSGTYPE + 2); for (i = 0; i < MAXITEMS; i++) { sp = (short *)cp; sX = *sp; cp += 2; sp = (short *)cp; sY = *sp; cp += 2; if (m_pItemList[i] != NULL) { if (sY < -10) sY = -10; if (sX < 0) sX = 0; if (sX > 170) sX = 170; if (sY > 95) sY = 95; m_pItemList[i]->m_sX = sX; m_pItemList[i]->m_sY = sY; } } break; case NOTIFY_ENEMYKILLS: cp = (char *)(pData + INDEX2_MSGTYPE + 2); ip = (int *)cp; m_iEnemyKillCount = *ip; break; case NOTIFY_DOWNSKILLINDEXSET: NotifyMsg_DownSkillIndexSet(pData); break; case NOTIFY_ADMINIFO: NotifyMsg_AdminInfo(pData); break; case NOTIFY_NPCTALK: NpcTalkHandler(pData); break; case NOTIFY_PORTIONSUCCESS: AddEventList(NOTIFY_MSG_HANDLER46, 10); break; case NOTIFY_PORTIONFAIL: AddEventList(NOTIFY_MSG_HANDLER47, 10); break; case NOTIFY_LOWPORTIONSKILL: AddEventList(NOTIFY_MSG_HANDLER48, 10); break; case NOTIFY_NOMATCHINGPORTION: AddEventList(NOTIFY_MSG_HANDLER49, 10); break; case NOTIFY_SUPERATTACKLEFT: sp = (short *)(pData + INDEX2_MSGTYPE + 2); m_iSuperAttackLeft = (int)*sp; break; case NOTIFY_SAFEATTACKMODE: cp = (char *)(pData + INDEX2_MSGTYPE + 2); switch (*cp) { case 1: if(!m_bIsSafeAttackMode) AddEventList(NOTIFY_MSG_HANDLER50, 10);//" m_bIsSafeAttackMode = TRUE; break; case 0: if(m_bIsSafeAttackMode) AddEventList(NOTIFY_MSG_HANDLER51, 10);//" m_bIsSafeAttackMode = FALSE; break; } break; case NOTIFY_IPACCOUNTINFO: ZeroMemory(cTemp, sizeof(cTemp)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); strcpy(cTemp, cp); AddEventList(cTemp); break; case NOTIFY_REWARDGOLD: dwp = (DWORD *)(pData + INDEX2_MSGTYPE + 2); m_iRewardGold = *dwp; break; case NOTIFY_SERVERSHUTDOWN: cp = (char *)(pData + INDEX2_MSGTYPE + 2); if (m_bIsDialogEnabled[25] == FALSE) EnableDialogBox(25, *cp, NULL, NULL); else m_stDialogBoxInfo[25].cMode = *cp; PlaySound('E', 27, NULL); break; case NOTIFY_GLOBALATTACKMODE: NotifyMsg_GlobalAttackMode(pData); break; case NOTIFY_WHETHERCHANGE: NotifyMsg_WhetherChange(pData); break; case NOTIFY_FISHCANCELED: cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; switch (*wp) { case NULL: AddEventList(NOTIFY_MSG_HANDLER52, 10); DisableDialogBox(24); break; case 1: AddEventList(NOTIFY_MSG_HANDLER53, 10); DisableDialogBox(24); break; case 2: AddEventList(NOTIFY_MSG_HANDLER54, 10); DisableDialogBox(24); break; } break; case NOTIFY_FISHSUCCESS: AddEventList(NOTIFY_MSG_HANDLER55, 10); PlaySound('E', 23, 5); PlaySound('E', 17, 5); switch (m_sPlayerType) { case 1: case 2: case 3: PlaySound('C', 21, 0); break; case 4: case 5: case 6: PlaySound('C', 22, 0); break; } break; case NOTIFY_FISHFAIL: AddEventList(NOTIFY_MSG_HANDLER56, 10); PlaySound('E', 24, 5); break; case NOTIFY_FISHCHANCE: NotifyMsg_FishChance(pData); break; case NOTIFY_EVENTFISHMODE: NotifyMsg_EventFishMode(pData); break; case NOTIFY_NOTICEMSG: NotifyMsg_NoticeMsg(pData); break; case NOTIFY_RATINGPLAYER: NotifyMsg_RatingPlayer(pData); break; case NOTIFY_CANNOTRATING: NotifyMsg_CannotRating(pData); break; case NOTIFY_ADMINUSERLEVELLOW: AddEventList(NOTIFY_MSG_HANDLER58, 10); break; case NOTIFY_NOGUILDMASTERLEVEL: AddEventList(NOTIFY_MSG_HANDLER59, 10); break; case NOTIFY_SUCCESSBANGUILDMAN: AddEventList(NOTIFY_MSG_HANDLER60, 10); break; case NOTIFY_CANNOTBANGUILDMAN: AddEventList(NOTIFY_MSG_HANDLER61, 10); break; case NOTIFY_PLAYERSHUTUP: NotifyMsg_PlayerShutUp(pData); break; case NOTIFY_TIMECHANGE: NotifyMsg_TimeChange(pData); break; case NOTIFY_TOBERECALLED: AddEventList(NOTIFY_MSG_HANDLER62, 10); break; case NOTIFY_HUNGER: NotifyMsg_Hunger(pData); break; case NOTIFY_PLAYERPROFILE: NotifyMsg_PlayerProfile(pData); break; case NOTIFY_WHISPERMODEON: NotifyMsg_WhisperMode(TRUE, pData); break; case NOTIFY_WHISPERMODEOFF: NotifyMsg_WhisperMode(FALSE, pData); break; case NOTIFY_PLAYERONGAME: NotifyMsg_PlayerStatus(TRUE, pData); break; case NOTIFY_PLAYERNOTONGAME: NotifyMsg_PlayerStatus(FALSE, pData); break; case NOTIFY_CHARISMA: NotifyMsg_Charisma(pData); break; case NOTIFY_ITEMSOLD: DisableDialogBox(23); break; case NOTIFY_ITEMREPAIRED: DisableDialogBox(23); NotifyMsg_ItemRepaired(pData); break; case NOTIFY_CANNOTREPAIRITEM: NotifyMsg_CannotRepairItem(pData); break; case NOTIFY_CANNOTSELLITEM: NotifyMsg_CannotSellItem(pData); break; case NOTIFY_REPAIRITEMPRICE: NotifyMsg_RepairItemPrice(pData); break; case NOTIFY_SELLITEMPRICE: NotifyMsg_SellItemPrice(pData); break; case NOTIFY_SHOWMAP: NotifyMsg_ShowMap(pData); break; case NOTIFY_SKILLUSINGEND: NotifyMsg_SkillUsingEnd(pData); break; case NOTIFY_TOTALUSERS: NotifyMsg_TotalUsers(pData); break; case NOTIFY_EVENTSTART: NotifyMsg_EventStart(pData); break; case NOTIFY_EVENTSTARTING: case NOTIFY_EVENTSTARTING2: case NOTIFY_EVENTSTARTING3: NotifyMsg_EventStarting(pData); break; case NOTIFY_CASUALTIES: NotifyMsg_Casualties(pData); break; case NOTIFY_RELICINALTAR: NotifyMsg_RelicInAltar(pData); break; case NOTIFY_RELICGRABBED: NotifyMsg_RelicGrabbed(pData); break; case NOTIFY_CTRWINNER: NotifyMsg_CTRWinner(pData); break; case NOTIFY_RELICPOSITION: cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; m_relicX = *sp; sp++; m_relicY = *sp; break; case NOTIFY_MAGICEFFECTOFF: NotifyMsg_MagicEffectOff(pData); break; case NOTIFY_MAGICEFFECTON: NotifyMsg_MagicEffectOn(pData); break; case NOTIFY_CANNOTITEMTOBANK: AddEventList(NOTIFY_MSG_HANDLER63, 10); break; case NOTIFY_SERVERCHANGE: NotifyMsg_ServerChange(pData); break; case NOTIFY_SKILL: NotifyMsg_Skill(pData); break; case NOTIFY_SETITEMCOUNT: NotifyMsg_SetItemCount(pData); break; case NOTIFY_ITEMDEPLETED_ERASEITEM: NotifyMsg_ItemDepleted_EraseItem(pData); break; case NOTIFY_DROPITEMFIN_ERASEITEM: NotifyMsg_DropItemFin_EraseItem(pData); break; case NOTIFY_GIVEITEMFIN_ERASEITEM: NotifyMsg_GiveItemFin_EraseItem(pData); break; case NOTIFY_ENEMYKILLREWARD: NotifyMsg_EnemyKillReward(pData); break; case NOTIFY_PKCAPTURED: NotifyMsg_PKcaptured(pData); break; case NOTIFY_PKPENALTY: NotifyMsg_PKpenalty(pData); break; case NOTIFY_ITEMTOBANK: NotifyMsg_ItemToBank(pData); break; case NOTIFY_TRAVELERLIMITEDLEVEL: AddEventList(NOTIFY_MSG_HANDLER64, 10); break; case NOTIFY_LIMITEDLEVEL: AddEventList(NOTIFYMSG_LIMITED_LEVEL1, 10); break; case NOTIFY_ITEMLIFESPANEND: NotifyMsg_ItemLifeSpanEnd(pData); break; case NOTIFY_ITEMRELEASED: NotifyMsg_ItemReleased(pData); break; case NOTIFY_ITEMOBTAINED: NotifyMsg_ItemObtained(pData); break; case NOTIFY_ITEMPURCHASED: NotifyMsg_ItemPurchased(pData); break; case NOTIFY_QUERY_JOINGUILDREQPERMISSION: NotifyMsg_QueryJoinGuildPermission(pData); break; case NOTIFY_QUERY_DISMISSGUILDREQPERMISSION: NotifyMsg_QueryDismissGuildPermission(pData); break; case COMMONTYPE_JOINGUILDAPPROVE: NotifyMsg_JoinGuildApprove(pData); break; case COMMONTYPE_JOINGUILDREJECT: NotifyMsg_JoinGuildReject(pData); break; case COMMONTYPE_DISMISSGUILDAPPROVE: NotifyMsg_DismissGuildApprove(pData); break; case COMMONTYPE_DISMISSGUILDREJECT: NotifyMsg_DismissGuildReject(pData); break; case NOTIFY_CANNOTCARRYMOREITEM: AddEventList(NOTIFY_MSG_HANDLER65, 10);//" AddEventList(NOTIFY_MSG_HANDLER66, 10);//" // Bank dialog Box m_stDialogBoxInfo[14].cMode = 0; break; case NOTIFY_NOTENOUGHGOLD: DisableDialogBox(23); AddEventList(NOTIFY_MSG_HANDLER67, 10);//"Gold cp = (char *)(pData + INDEX2_MSGTYPE + 2); if (*cp >= 0) { m_bIsItemDisabled[*cp] = FALSE; } break; case NOTIFY_HP: NotifyMsg_HP(pData); break; case NOTIFY_MP: NotifyMsg_MP(pData); break; case NOTIFY_SP: NotifyMsg_SP(pData); break; case NOTIFY_KILLED: NotifyMsg_Killed(pData); break; case NOTIFY_EXP: NotifyMsg_Exp(pData); break; case NOTIFY_GUILDDISBANDED: NotifyMsg_GuildDisbanded(pData); break; case NOTIFY_CANNOTJOINMOREGUILDSMAN: NotifyMsg_CannotJoinMoreGuildsMan(pData); break; case NOTIFY_NEWGUILDSMAN: NotifyMsg_NewGuildsMan(pData); break; case NOTIFY_DISMISSGUILDSMAN: NotifyMsg_DismissGuildsMan(pData); break; case NOTIFY_MAGICSTUDYSUCCESS: NotifyMsg_MagicStudySuccess(pData); break; case NOTIFY_MAGICSTUDYFAIL: NotifyMsg_MagicStudyFail(pData); break; case NOTIFY_SKILLTRAINSUCCESS: NotifyMsg_SkillTrainSuccess(pData); break; case NOTIFY_SKILLTRAINFAIL: break; case NOTIFY_FORCEDISCONN: NotifyMsg_ForceDisconn(pData); break; case NOTIFY_FRIENDONGAME: NotifyMsg_FriendOnGame(pData); break; case NOTIFY_CANNOTRECALL: AddEventList(NOTIFY_MSG_HANDLER74, 10); //"You can't recall within 10 seconds of taking damage." break; case NOTIFY_FIGHTZONERESERVE: cp = (char *)(pData + INDEX2_MSGTYPE + 2); ip = (int *)cp; switch (*ip) { case -5: AddEventList(NOTIFY_MSG_HANDLER68, 10); break; case -4: AddEventList(NOTIFY_MSG_HANDLER69, 10); break; case -3: AddEventList(NOTIFY_MSG_HANDLER70, 10); break; case -2: m_iFightzoneNumber = 0; AddEventList(NOTIFY_MSG_HANDLER71, 10); break; case -1: m_iFightzoneNumber = m_iFightzoneNumber * -1 ; AddEventList(NOTIFY_MSG_HANDLER72, 10); break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: wsprintf(cTxt, NOTIFY_MSG_HANDLER73, *ip);//" AddEventList(cTxt, 10); break; } break; } } void CGame::ReserveFightzoneResponseHandler(char * pData) { WORD * wpResult; char * cp ; int * ip ; wpResult = (WORD *)(pData + INDEX2_MSGTYPE); switch (*wpResult) { case MSGTYPE_CONFIRM: AddEventList(RESERVE_FIGHTZONE_RESPONSE_HANDLER1, 10); m_stDialogBoxInfo[7].cMode = 14; m_iFightzoneNumber = m_iFightzoneNumberTemp ; break; case MSGTYPE_REJECT: cp = (char *)(pData + INDEX2_MSGTYPE + 2); ip = (int *)cp; cp += 4; AddEventList(RESERVE_FIGHTZONE_RESPONSE_HANDLER2, 10); m_iFightzoneNumberTemp = 0 ; if (*ip == 0) { m_stDialogBoxInfo[7].cMode = 15; }else if (*ip == -1){ m_stDialogBoxInfo[7].cMode = 16; } else if (*ip == -2) { m_stDialogBoxInfo[7].cMode = 17; }else if (*ip == -3) { m_stDialogBoxInfo[7].cMode = 21; }else if (*ip == -4) { m_stDialogBoxInfo[7].cMode = 22; } break; } } void CGame::UpdateScreen_OnLogResMsg() { short msX, msY, msZ, sX, sY; char cLB, cRB, cMB; DWORD dwTime = timeGetTime(); static DWORD dwCTime; static class CMouseInterface * pMI; int iMIbuttonNum; char cMIresult; if (m_cGameModeCount == 0) { pMI = new class CMouseInterface; pMI->AddRect(370, 240, 370 + BTNSZX, 240 + BTNSZY); m_bEnterPressed = FALSE; m_bEscPressed = FALSE; m_cArrowPressed = 0; dwCTime = timeGetTime(); if (m_bSoundFlag) m_pESound[38]->bStop(); } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; if (m_bEscPressed == TRUE || m_bEnterPressed) { switch (m_cMsg[0]) { case '0': ChangeGameMode(GAMEMODE_ONCREATENEWACCOUNT); break; case '1': ChangeGameMode(GAMEMODE_ONMAINMENU); break; case '2': ChangeGameMode(GAMEMODE_ONCREATENEWCHARACTER); break; case '3': ChangeGameMode(GAMEMODE_ONSELECTCHARACTER); break; case '4': ChangeGameMode(GAMEMODE_ONSELECTCHARACTER); break; case '5': ChangeGameMode(GAMEMODE_ONMAINMENU); break; case '6': switch (m_cMsg[1]) { case 'B': ChangeGameMode(GAMEMODE_ONMAINMENU); break; case 'C': ChangeGameMode(GAMEMODE_ONCHANGEPASSWORD); break; case 'M': ChangeGameMode(GAMEMODE_ONCHANGEPASSWORD); break; } break; case '7': case '8': ChangeGameMode(GAMEMODE_ONMAINMENU); break; } delete pMI; m_bEscPressed = FALSE; return; } m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); m_DDraw.ClearBackB4(); switch (m_cMsg[0]) { case '0': case '5': _Draw_UpdateScreen_OnCreateNewAccount(); break; case '1': case '7': sX = 146; sY = 114; _Draw_OnLogin(m_cAccountName, m_cAccountPassword, 0, 0); break; case '2': case '4': _bDraw_OnCreateNewCharacter(m_cPlayerName, 0, 0, 0); break; case '3': sX = 0; sY = 0; UpdateScreen_OnSelectCharacter(sX, sY, 0, 0); break; case '6': sX = 146; sY = 114; UpdateScreen_OnSelectCharacter(0, 0, 0, 0, TRUE); break; case '8': DrawNewDialogBox(SPRID_INTERFACE_ND_MAINMENU, -1, -1, 0, TRUE); break; } m_DDraw.DrawShadowBox(0,0,639,479); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, 162,125,2); if ((msX >= 370) && (msX <= 370 + BTNSZX) && (msY >= 244) && (msY <= 244 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 370, 244, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, 370, 244, 0); switch (m_cMsg[1]) { case '1': PutString_SprFont(172 + 70, 165, "Password is not correct!", 7,0,0); PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG5);//" break; case '2': PutString_SprFont(172 + 70, 165, "Not existing account!", 7,0,0); PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG6);//" PutAlignedString(198, 453, 215, UPDATE_SCREEN_ON_LOG_MSG7);//" break; case '3': PutString_SprFont(172 + 10 +34, 165, "Can not connect to game server!", 7,0,0); PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG8);//" PutAlignedString(198, 453, 210, UPDATE_SCREEN_ON_LOG_MSG9);//" PutAlignedString(198, 453, 225, UPDATE_SCREEN_ON_LOG_MSG10);//" break; case '4': PutString_SprFont(172 + 58, 165, "New account created.", 7,0,0); PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG11);//" PutAlignedString(198, 453, 210, UPDATE_SCREEN_ON_LOG_MSG12);//" break; case '5': PutString_SprFont(172 + 58, 165, "Can not create new account!", 7,0,0); PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG13);//" break; case '6': PutString_SprFont(172 + 36, 165, "Can not create new account!", 7,0,0); PutString_SprFont(172 + 24, 180, "Already existing account name.", 7,0,0); PutAlignedString(198, 453, 205, UPDATE_SCREEN_ON_LOG_MSG14);//" PutAlignedString(198, 453, 220, UPDATE_SCREEN_ON_LOG_MSG15);//" break; case '7': PutString_SprFont(172 + 58, 165, "New character created.", 7,0,0); PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG16);//" break; case '8': PutString_SprFont(172 + 58, 165, "Can not create new character!", 7,0,0); PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG17);//" break; case '9': PutString_SprFont(172 + 36, 165, "Can not create new character!", 7,0,0); PutString_SprFont(172 + 24, 180, "Already existing character name.", 7,0,0); PutAlignedString(198, 453, 205, UPDATE_SCREEN_ON_LOG_MSG18);//" PutAlignedString(198, 453, 220, UPDATE_SCREEN_ON_LOG_MSG19);//" break; case 'A': PutString_SprFont(172 + 36 +45, 165, "Character deleted.", 7,0,0); PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG20);//" break; case 'B': PutString_SprFont(172 + 36 +45, 165, "Password changed.", 7,0,0); PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG21);//" break; case 'C': PutString_SprFont(172 + 36, 165, "Can not change password!", 7,0,0); PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG22);//" break; case 'D': PutString_SprFont(172 + 10 +34, 165, "Can not connect to game server!", 7,0,0); PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG23);//" PutAlignedString(198, 453, 210, UPDATE_SCREEN_ON_LOG_MSG24);//" break; case 'E': PutString_SprFont(172 + 10 +34, 165, "Can not connect to game server!", 7,0,0); PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG25);//" PutAlignedString(198, 453, 210, UPDATE_SCREEN_ON_LOG_MSG26);//" PutAlignedString(198, 453, 225, UPDATE_SCREEN_ON_LOG_MSG27);//" break; case 'F': PutString_SprFont(172 + 10 +34, 165, "Can not connect to game server!", 7,0,0); PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG28);//" PutAlignedString(198, 453, 210, UPDATE_SCREEN_ON_LOG_MSG29);//" break; case 'G': PutString_SprFont(172 + 10 +34, 165, "Can not connect to game server!", 7,0,0); PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG30);//" PutAlignedString(198, 453, 210, UPDATE_SCREEN_ON_LOG_MSG31);//" break; case 'H': PutString_SprFont(172 + 68, 165, "Connection Rejected!", 7,0,0); if (m_iBlockYear == 0) { PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG32);//" PutAlignedString(198, 453, 210, UPDATE_SCREEN_ON_LOG_MSG33);//" } else { PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG34);//" wsprintf(G_cTxt, UPDATE_SCREEN_ON_LOG_MSG35, m_iBlockYear, m_iBlockMonth, m_iBlockDay);//" PutAlignedString(198, 453, 210, G_cTxt); } break; case 'I': // PutString_SprFont(172 + 68, 165, "Not Enough Point!", 7,0,0); PutAlignedString(198, 453, 210, "ÂI¼Æ¨Ï¥Î´Á­­¤wµ²§ô, ½Ð¦ÜGD2S.gamania.com©µªø¨Ï¥Î´Á­­"); break; case 'J': PutString_SprFont(172 + 68, 165, "World Server Full", 7,0,0); PutAlignedString(198, 453, 210, "Please ! Try Other World Server"); break; case 'M': PutString_SprFont(172 + 68, 165, "Your password expired", 7,0,0); PutAlignedString(198, 453, 210, "Please! Change password"); break; case 'U': PutString_SprFont(172 + 68, 165, "Keycode input Success!", 7,0,0); PutAlignedString(198, 453, 210, "Keycode Registration successed."); break; case 'X': PutAlignedString(198, 453, 195, UPDATE_SCREEN_ON_LOG_MSG38);//" PutAlignedString(198, 453, 210, UPDATE_SCREEN_ON_LOG_MSG39);//" break; case 'Y': PutAlignedString(178, 453, 195, UPDATE_SCREEN_ON_LOG_MSG40);//" PutAlignedString(178, 453, 210, UPDATE_SCREEN_ON_LOG_MSG41);//" break; case 'Z': PutAlignedString(178, 453, 195, UPDATE_SCREEN_ON_LOG_MSG42);//" PutAlignedString(178, 453, 210, UPDATE_SCREEN_ON_LOG_MSG41);//" break; } iMIbuttonNum = pMI->iGetStatus(msX, msY, cLB, &cMIresult); if (cMIresult == MIRESULT_CLICK) { switch (iMIbuttonNum) { case 1: switch (m_cMsg[0]) { case '0': ChangeGameMode(GAMEMODE_ONCREATENEWACCOUNT); break; case '1': ChangeGameMode(GAMEMODE_ONMAINMENU); break; case '2': ChangeGameMode(GAMEMODE_ONCREATENEWCHARACTER); break; case '3': ChangeGameMode(GAMEMODE_ONSELECTCHARACTER); break; case '4': ChangeGameMode(GAMEMODE_ONSELECTCHARACTER); break; case '5': ChangeGameMode(GAMEMODE_ONMAINMENU); break; case '6': switch (m_cMsg[1]) { case 'B': ChangeGameMode(GAMEMODE_ONMAINMENU); break; case 'C': ChangeGameMode(GAMEMODE_ONCHANGEPASSWORD); break; case 'M': ChangeGameMode(GAMEMODE_ONCHANGEPASSWORD); break; } break; case '7': case '8': ChangeGameMode(GAMEMODE_ONMAINMENU); break; } delete pMI; return; } } if ((dwTime - dwCTime) > 100) { m_cMenuFrame++; dwCTime = dwTime; } if (m_cMenuFrame >= 8) { m_cMenuDirCnt++; if (m_cMenuDirCnt > 8) { m_cMenuDir++; m_cMenuDirCnt = 1; } m_cMenuFrame = 0; } if (m_cMenuDir > 8) m_cMenuDir = 1; DrawVersion(); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } void CGame::RetrieveItemHandler(char *pData) {char * cp, cBankItemIndex, cItemIndex, cTxt[120]; WORD * wp; int j; wp = (WORD *)(pData + INDEX2_MSGTYPE); if (*wp != MSGTYPE_REJECT) { cp = (char *)(pData + INDEX2_MSGTYPE + 2); cBankItemIndex = *cp; cp++; cItemIndex = *cp; cp++; if (m_pBankList[cBankItemIndex] != NULL) { char cStr1[64], cStr2[64], cStr3[64]; GetItemName(m_pBankList[cBankItemIndex], cStr1, cStr2, cStr3); ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, RETIEVE_ITEM_HANDLER4, cStr1);//""You took out %s." AddEventList(cTxt, 10); if ( (m_pBankList[cBankItemIndex]->m_cItemType == ITEMTYPE_CONSUME) || (m_pBankList[cBankItemIndex]->m_cItemType == ITEMTYPE_ARROW) ) { if (m_pItemList[cItemIndex] == NULL) goto RIH_STEP2; delete m_pBankList[cBankItemIndex]; m_pBankList[cBankItemIndex] = NULL; for ( j = 0; j <= MAXBANKITEMS - 2; j++) { if ((m_pBankList[j+1] != NULL) && (m_pBankList[j] == NULL)) { m_pBankList[j] = m_pBankList[j+1]; m_pBankList[j+1] = NULL; } } }else { RIH_STEP2:; if (m_pItemList[cItemIndex] != NULL) return; short nX, nY; nX = 40; nY = 30; for (j = 0; j < MAXITEMS; j++) { if ( ( m_pItemList[j] != NULL) && (memcmp(m_pItemList[j]->m_cName, cStr1, 20) == 0)) { nX = m_pItemList[j]->m_sX+1; nY = m_pItemList[j]->m_sY+1; break; } } m_pItemList[cItemIndex] = m_pBankList[cBankItemIndex]; m_pItemList[cItemIndex]->m_sX = nX; m_pItemList[cItemIndex]->m_sY = nY; bSendCommand(MSGID_REQUEST_SETITEMPOS, NULL, cItemIndex, nX, nY, NULL, NULL); for (j = 0; j < MAXITEMS; j++) if (m_cItemOrder[j] == -1) { m_cItemOrder[j] = cItemIndex; break; } m_bIsItemEquipped[cItemIndex] = FALSE; m_bIsItemDisabled[cItemIndex] = FALSE; m_pBankList[cBankItemIndex] = NULL; for ( j = 0; j <= MAXBANKITEMS - 2; j++) { if ((m_pBankList[j+1] != NULL) && (m_pBankList[j] == NULL)) { m_pBankList[j] = m_pBankList[j+1]; m_pBankList[j+1] = NULL; } } } } } m_stDialogBoxInfo[14].cMode = 0; } void CGame::EraseItem(char cItemID) {int i; char cStr1[64], cStr2[64], cStr3[64]; ZeroMemory(cStr1, sizeof(cStr1)); ZeroMemory(cStr2, sizeof(cStr2)); ZeroMemory(cStr3, sizeof(cStr3)); for( i=0 ; i<6 ; i++ ) { if (m_sShortCut[i] == cItemID) { GetItemName(m_pItemList[cItemID], cStr1, cStr2, cStr3); if( i < 3 ) wsprintf(G_cTxt, ERASE_ITEM, cStr1, cStr2, cStr3, i+1); else wsprintf(G_cTxt, ERASE_ITEM, cStr1, cStr2, cStr3, i+7); AddEventList(G_cTxt, 10); m_sShortCut[i] = -1; } } if (cItemID == m_sRecentShortCut) m_sRecentShortCut = -1; // ItemOrder for (i = 0; i < MAXITEMS; i++) if (m_cItemOrder[i] == cItemID) m_cItemOrder[i] = -1; for (i = 1; i < MAXITEMS; i++) if ((m_cItemOrder[i-1] == -1) && (m_cItemOrder[i] != -1)) { m_cItemOrder[i-1] = m_cItemOrder[i]; m_cItemOrder[i] = -1; } // ItemList delete m_pItemList[cItemID]; m_pItemList[cItemID] = NULL; m_bIsItemEquipped[cItemID] = FALSE; m_bIsItemDisabled[cItemID] = FALSE; } void CGame::DlbBoxDoubleClick_Character(short msX, short msY) { char cEquipPoiStatus[MAXITEMEQUIPPOS], cItemID = -1; short sX, sY, sSprH, sFrame; int i; if (m_bIsDialogEnabled[17] == TRUE) return; sX = m_stDialogBoxInfo[1].sX; sY = m_stDialogBoxInfo[1].sY; for (i = 0; i < MAXITEMEQUIPPOS; i++) cEquipPoiStatus[i] = -1; for (i = 0; i < MAXITEMS; i++) { if ((m_pItemList[i] != NULL) && (m_bIsItemEquipped[i] == TRUE)) cEquipPoiStatus[ m_pItemList[i]->m_cEquipPos ] = i; } if ((m_sPlayerType >= 1) && (m_sPlayerType <= 3)) { if (cEquipPoiStatus[EQUIPPOS_BACK] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BACK]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BACK]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison( sX + 41, sY + 137, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_BACK]; } if (cEquipPoiStatus[EQUIPPOS_PANTS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_PANTS]; } if (cEquipPoiStatus[EQUIPPOS_ARMS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_ARMS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_ARMS]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_ARMS]; } if (cEquipPoiStatus[EQUIPPOS_BOOTS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_BOOTS]; } if (cEquipPoiStatus[EQUIPPOS_BODY] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BODY]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BODY]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_BODY]; } if (cEquipPoiStatus[EQUIPPOS_FULLBODY] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_FULLBODY]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_FULLBODY]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_FULLBODY]; } if (cEquipPoiStatus[EQUIPPOS_LHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_LHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_LHAND]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 90, sY + 170, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_LHAND]; } if (cEquipPoiStatus[EQUIPPOS_RHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_RHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_RHAND]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 57, sY + 186, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_RHAND]; } if (cEquipPoiStatus[EQUIPPOS_TWOHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_TWOHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_TWOHAND]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 57, sY + 186, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_TWOHAND]; } if (cEquipPoiStatus[EQUIPPOS_NECK] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_NECK]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_NECK]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 35, sY + 120, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_NECK]; } if (cEquipPoiStatus[EQUIPPOS_RFINGER] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_RFINGER]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_RFINGER]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 32, sY + 193, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_RFINGER]; } if (cEquipPoiStatus[EQUIPPOS_LFINGER] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_LFINGER]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_LFINGER]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 100, sY + 185, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_LFINGER]; } if (cEquipPoiStatus[EQUIPPOS_HEAD] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_HEAD]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_HEAD]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 72, sY + 135, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_HEAD]; } } else if ((m_sPlayerType >= 4) && (m_sPlayerType <= 6)) { if (cEquipPoiStatus[EQUIPPOS_BACK] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BACK]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BACK]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 45, sY + 143, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_BACK]; } if (cEquipPoiStatus[EQUIPPOS_BOOTS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_BOOTS]; } if (cEquipPoiStatus[EQUIPPOS_PANTS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_PANTS]; } if (cEquipPoiStatus[EQUIPPOS_ARMS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_ARMS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_ARMS]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_ARMS]; } if (cEquipPoiStatus[EQUIPPOS_BOOTS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_BOOTS]; } if (cEquipPoiStatus[EQUIPPOS_BODY] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BODY]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BODY]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_BODY]; } if (cEquipPoiStatus[EQUIPPOS_FULLBODY] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_FULLBODY]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_FULLBODY]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_FULLBODY]; } if (cEquipPoiStatus[EQUIPPOS_LHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_LHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_LHAND]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 84, sY + 175, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_LHAND]; } if (cEquipPoiStatus[EQUIPPOS_RHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_RHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_RHAND]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 60, sY + 191, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_RHAND]; } if (cEquipPoiStatus[EQUIPPOS_TWOHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_TWOHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_TWOHAND]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 60, sY + 191, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_TWOHAND]; } if (cEquipPoiStatus[EQUIPPOS_NECK] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_NECK]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_NECK]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 35, sY + 120, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_NECK]; } if (cEquipPoiStatus[EQUIPPOS_RFINGER] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_RFINGER]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_RFINGER]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 32, sY + 193, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_RFINGER]; } if (cEquipPoiStatus[EQUIPPOS_LFINGER] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_LFINGER]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_LFINGER]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 100, sY + 185, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_LFINGER]; } if (cEquipPoiStatus[EQUIPPOS_HEAD] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_HEAD]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_HEAD]]->m_sSpriteFrame; if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 72, sY + 139, sFrame, msX, msY ) ) cItemID = cEquipPoiStatus[EQUIPPOS_HEAD]; } } if( cItemID == -1 || m_pItemList[cItemID] == NULL ) return; if ( (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_EAT) || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_ARROW) || (m_pItemList[cItemID]->m_dwCount > 1) ) return; if ( (m_bIsDialogEnabled[11]==TRUE) && (m_bIsDialogEnabled[23] == FALSE) && (m_stDialogBoxInfo[39].sV3 == 24)) bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_REPAIRITEM, NULL, cItemID, m_stDialogBoxInfo[39].sV3, NULL, m_pItemList[cItemID]->m_cName, m_stDialogBoxInfo[39].sV4); else { if (m_bIsItemEquipped[m_stMCursor.sSelectedObjectID] == TRUE) { char cStr1[64], cStr2[64], cStr3[64]; GetItemName(m_pItemList[m_stMCursor.sSelectedObjectID], cStr1, cStr2, cStr3); ZeroMemory(G_cTxt, sizeof(G_cTxt) ); wsprintf(G_cTxt, ITEM_EQUIPMENT_RELEASED, cStr1);//" AddEventList(G_cTxt, 10); if(memcmp(m_pItemList[m_stMCursor.sSelectedObjectID]->m_cName, "AngelicPendant", 14) == 0) PlaySound('E', 53, 0); else PlaySound('E', 29, 0); // Remove Angelic Stats if ( (m_pItemList[m_stMCursor.sSelectedObjectID]->m_cEquipPos >= 11) && (m_pItemList[m_stMCursor.sSelectedObjectID]->m_cItemType == 1)) { char cItemID = m_stMCursor.sSelectedObjectID; if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(STR)", 19) == 0) { m_angelStat[STAT_STR] = 0; }else if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(DEX)", 19) == 0) { m_angelStat[STAT_DEX] = 0; }else if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(INT)", 19) == 0) { m_angelStat[STAT_INT] = 0; }else if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(MAG)", 19) == 0) { m_angelStat[STAT_MAG] = 0; } } bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_RELEASEITEM, NULL, m_stMCursor.sSelectedObjectID, NULL, NULL, NULL); m_bIsItemEquipped[m_stMCursor.sSelectedObjectID] = FALSE; m_sItemEquipmentStatus[ m_pItemList[m_stMCursor.sSelectedObjectID]->m_cEquipPos ] = -1; m_stMCursor.cSelectedObjectType = NULL; m_stMCursor.sSelectedObjectID = NULL; } } } void CGame::DlbBoxDoubleClick_GuideMap(short msX, short msY) {short si = m_stMCursor.sCursorFrame; if( si != 0 ) return; if( m_cMapIndex < 0 ) return; short sX, sY, shX, shY, szX, szY; sX = m_stDialogBoxInfo[9].sX; sY = m_stDialogBoxInfo[9].sY; szX = m_stDialogBoxInfo[9].sSizeX; szY = m_stDialogBoxInfo[9].sSizeY; if( sX < 20 ) sX = 0; if( sY < 20 ) sY = 0; if( sX > 640-128-20 ) sX = 640-128; if( sY > 427-128-20 ) sY = 427-128; if( m_bZoomMap ) { shX = m_sPlayerX-64; shY = m_sPlayerY-64; if( shX < 0 ) shX = 0; if( shY < 0 ) shY = 0; if( shX > m_pMapData->m_sMapSizeX-128 ) shX = m_pMapData->m_sMapSizeX-128; if( shY > m_pMapData->m_sMapSizeY-128 ) shY = m_pMapData->m_sMapSizeY-128; shX = shX + msX - sX; shY = shY + msY - sY; }else { shX = (m_pMapData->m_sMapSizeX*(msX-sX))/128; shY = (m_pMapData->m_sMapSizeX*(msY-sY))/128; } if( shX < 20 || shY < 20 ) return; if( shX > m_pMapData->m_sMapSizeX-20 || shY > m_pMapData->m_sMapSizeY-20 ) return; m_sCommX = shX; m_sCommY = shY; if(m_bCtrlPressed) { wsprintf(G_cTxt, "/tp %s %u %u", m_cMapName, m_sCommX, m_sCommY); bSendCommand(MSGID_COMMAND_CHATMSG, NULL, NULL, NULL, NULL, NULL, G_cTxt); return; } if(m_bRunningMode && m_iSP>0) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; GetPlayerTurn(); } void CGame::DlbBoxDoubleClick_Inventory(short msX, short msY) { register int i; char cItemID, cTxt[120]; short sX, sY, x1, x2, y1, y2; char cStr1[64], cStr2[64], cStr3[64]; //if (m_iHP <= 0) return; if (m_bItemUsingStatus == TRUE) { AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY1, 10); return; } sX = m_stDialogBoxInfo[2].sX; sY = m_stDialogBoxInfo[2].sY; for (i = 0; i < MAXITEMS; i++) { if (m_cItemOrder[MAXITEMS - 1 - i] == -1) continue; cItemID = m_cItemOrder[MAXITEMS - 1 - i]; if (m_pItemList[cItemID] == NULL) continue; m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->_GetSpriteRect(sX + 32 + m_pItemList[cItemID]->m_sX, sY + 44 + m_pItemList[cItemID]->m_sY, m_pItemList[cItemID]->m_sSpriteFrame); // Order x1 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.left; y1 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.top; x2 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.right; y2 = (short)m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->m_rcBound.bottom; if ((m_bIsItemDisabled[cItemID] == FALSE) && (m_bIsItemEquipped[cItemID] == FALSE) && (msX > x1) && (msX < x2) && (msY > y1) && (msY < y2)) { // Order _SetItemOrder(0, cItemID); GetItemName(m_pItemList[cItemID], cStr1, cStr2, cStr3); if ( m_bIsDialogEnabled[11] && (m_bIsDialogEnabled[23] == FALSE) && (m_bIsDialogEnabled[23] == FALSE) && (m_stDialogBoxInfo[39].sV3 == 24) ) { if (m_pItemList[cItemID]->m_cEquipPos != EQUIPPOS_NONE) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_REPAIRITEM, NULL, cItemID, m_stDialogBoxInfo[39].sV3, NULL, m_pItemList[cItemID]->m_cName, m_stDialogBoxInfo[39].sV4); return; } } if ( (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_USE_DEPLETE) || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_USE_PERM) || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_ARROW) || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_EAT) ) { if (bCheckItemOperationEnabled(cItemID) == FALSE) return; if ((timeGetTime() - m_dwDamagedTime) < 20 _s) { if ((m_pItemList[cItemID]->m_sSprite == 6) && (m_pItemList[cItemID]->m_sSpriteFrame == 9)) { wsprintf(G_cTxt, BDLBBOX_DOUBLE_CLICK_INVENTORY3, cStr1);//"Item %s: Scrolls cannot be used until 20 seconds after taking damage." AddEventList(G_cTxt, 10); return; } if ((m_pItemList[cItemID]->m_sSprite == 6) && (m_pItemList[cItemID]->m_sSpriteFrame == 89)) { wsprintf(G_cTxt, BDLBBOX_DOUBLE_CLICK_INVENTORY3, cStr1);//"Item %s: Scrolls cannot be used until 20 seconds after taking damage." AddEventList(G_cTxt, 10); return; } } bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_USEITEM, NULL, cItemID, NULL, NULL, NULL); if ( (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_USE_DEPLETE) || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_EAT) ) { m_bIsItemDisabled[cItemID] = TRUE; m_bItemUsingStatus = TRUE; } } if ( m_pItemList[cItemID]->m_cItemType == ITEMTYPE_USE_SKILL ) { if (_bIsItemOnHand() == TRUE) { AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY4, 10);//"Your hands should be free to use this item." return; } if (m_bSkillUsingStatus == TRUE) { AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY5, 10);//"You are already using another skill." return; } if (m_pItemList[cItemID]->m_wCurLifeSpan == 0) { AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY6, 10);//"You can't use this item because it is exhausted." }else { m_bIsGetPointingMode = TRUE; m_iPointCommandType = cItemID; wsprintf(cTxt, BDLBBOX_DOUBLE_CLICK_INVENTORY7, cStr1);//"Item %s: Select a position which you want to use." AddEventList(cTxt, 10); } } if ( m_pItemList[cItemID]->m_cItemType == ITEMTYPE_USE_DEPLETE_DEST ) { if (_bIsItemOnHand() == TRUE) { AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY4, 10);//"Your hands should be free to use this item." return; } if (m_bSkillUsingStatus == TRUE) { AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY13, 10);//"You are already using another skill." return; } if (m_pItemList[cItemID]->m_wCurLifeSpan == 0) { AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY6, 10);//"You can't use this item because it is exhausted." }else { m_bIsGetPointingMode = TRUE; m_iPointCommandType = cItemID; wsprintf(cTxt, BDLBBOX_DOUBLE_CLICK_INVENTORY8, cStr1);//"Item %s: Select an item which you want to use." AddEventList(cTxt, 10); } } if (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_USE_SKILL_ENABLEDIALOGBOX) { if (_bIsItemOnHand() == TRUE) { AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY4, 10);//"Your hands should be free to use this item." return; } if (m_bSkillUsingStatus == TRUE) { AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY5, 10);//"You are already using another skill." return; } if (m_pItemList[cItemID]->m_wCurLifeSpan == 0) { AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY6, 10);//"You can't use this item because it is exhausted." }else { switch (m_pItemList[cItemID]->m_sSpriteFrame) { case 55: // Alchemy pot if (m_cSkillMastery[SKILL_ALCHEMY] == 0) { AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY9, 10);//"You should learn alchemy skill to use this item." }else { EnableDialogBox(26, 1, NULL, NULL, NULL); AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY10, 10);//"Using alchemy skill..." } break; case 113: // Smith's Anvil if (m_cSkillMastery[SKILL_MANUFACTURING] == 0) { AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY11, 10);//"You should learn manufacturing skill to use this item.." }else { EnableDialogBox(26, 3, NULL, NULL, NULL); AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY12, 10);//"Using a manufacturing skill..." } break; // Crafting case 0: //if (m_pItemList[i]->m_sSprite == 22) { EnableDialogBox(26, 7, NULL, NULL, NULL); AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY17, 10); // "Initiating item Crafting..." } break; case 151: case 152: case 153: case 154: EnableDialogBox(40, 1, NULL, NULL, NULL); break; } } } // Dblclick Alchemy bowl if (( m_bIsDialogEnabled[26] == TRUE) && (m_stDialogBoxInfo[26].cMode == 1)) { bItemDrop_SkillDialog(); bItemDrop_ExternalScreen(cItemID, m_stDialogBoxInfo[26].sX+50, m_stDialogBoxInfo[26].sY+50); } // Dblclick Manuf box if (( m_bIsDialogEnabled[26] == TRUE) && (m_stDialogBoxInfo[26].cMode == 4)) { bItemDrop_SkillDialog(); bItemDrop_ExternalScreen(cItemID, m_stDialogBoxInfo[26].sX+50, m_stDialogBoxInfo[26].sY+50); } // Crafting // Dblclick Crafting box if (( m_bIsDialogEnabled[26] == TRUE) && (m_stDialogBoxInfo[26].cMode == 7)) { bItemDrop_SkillDialog(); bItemDrop_ExternalScreen(cItemID, m_stDialogBoxInfo[26].sX+50, m_stDialogBoxInfo[26].sY+50); } if (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_EQUIP) { m_stMCursor.cSelectedObjectType = SELECTEDOBJTYPE_ITEM; m_stMCursor.sSelectedObjectID = (short)cItemID; bItemDrop_Character(); m_stMCursor.cSelectedObjectType = NULL; m_stMCursor.sSelectedObjectID = NULL; } return; } } } void CGame::UpdateScreen_OnChangePassword() { short msX, msY, msZ; char cLB, cRB, cMB; char cMIresult; int iMIbuttonNum; static class CMouseInterface * pMI; static char cName[12], cPassword[12], cNewPassword[12], cNewPassConfirm[12], cPrevFocus; static DWORD dwCTime; DWORD dwTime = timeGetTime(); BOOL bFlag = TRUE; if (m_cGameModeCount == 0) { EndInputString(); pMI = new class CMouseInterface; pMI->AddRect(300, 148, 425, 170); pMI->AddRect(300, 172, 425, 194); pMI->AddRect(300, 196, 425, 218); pMI->AddRect(300, 220, 425, 242); pMI->AddRect(197, 320, 197 + BTNSZX, 320 + BTNSZY); pMI->AddRect(370, 320, 370 + BTNSZX, 320 + BTNSZY); cPrevFocus = 2; //1 m_cCurFocus = 2; //1 m_cMaxFocus = 6; m_bEnterPressed = FALSE; m_cArrowPressed = 0; ZeroMemory(cName, sizeof(cName)); ZeroMemory(cPassword, sizeof(cPassword)); ZeroMemory(cNewPassword, sizeof(cNewPassword)); ZeroMemory(cNewPassConfirm, sizeof(cNewPassConfirm)); strcpy( cName, m_cAccountName ); //StartInputString(314, 155, 11, cName); StartInputString(314, 179, 11, cPassword); ClearInputString(); dwCTime = dwTime; } m_cGameModeCount++; if (m_cGameModeCount > 100) m_cGameModeCount = 100; if ((dwTime - dwCTime) > 100) { m_cMenuFrame++; dwCTime = dwTime; } if (m_cMenuFrame >= 8) { m_cMenuDirCnt++; if (m_cMenuDirCnt > 8) { m_cMenuDir++; m_cMenuDirCnt = 1; } m_cMenuFrame = 0; } if (m_cMenuDir > 8) m_cMenuDir = 1; if (m_cArrowPressed != 0) { switch (m_cArrowPressed) { case 1: m_cCurFocus--; if (m_cCurFocus <= 0) m_cCurFocus = m_cMaxFocus; break; case 2: if (m_cCurFocus == 3) m_cCurFocus = 4; else if (m_cCurFocus == 4) m_cCurFocus = 3; break; case 3: m_cCurFocus++; if (m_cCurFocus > m_cMaxFocus) m_cCurFocus = 1; break; case 4: if (m_cCurFocus == 3) m_cCurFocus = 4; else if (m_cCurFocus == 4) m_cCurFocus = 3; break; } m_cArrowPressed = 0; } if (m_bEnterPressed == TRUE) { PlaySound('E', 14, 5); switch (m_cCurFocus) { case 1: case 2: case 3: case 4: m_cCurFocus++; if( m_cCurFocus > m_cMaxFocus) m_cCurFocus = 1; break; case 5: // Connect if ( (m_Misc.bCheckValidString(cPassword) == FALSE) || (strlen(cPassword) == 0) || (m_Misc.bCheckValidName(cNewPassword) == FALSE) || (m_Misc.bCheckValidName(cNewPassConfirm) == FALSE) || (strlen(cNewPassword) == 0) || (memcmp(cNewPassword, cNewPassConfirm, 10) != 0) ) break; ZeroMemory(m_cAccountName, sizeof(m_cAccountName)); ZeroMemory(m_cAccountPassword, sizeof(m_cAccountPassword)); ZeroMemory(m_cNewPassword, sizeof(m_cNewPassword)); ZeroMemory(m_cNewPassConfirm, sizeof(m_cNewPassConfirm)); strcpy(m_cAccountName, cName); strcpy(m_cAccountPassword, cPassword); strcpy(m_cNewPassword, cNewPassword); strcpy(m_cNewPassConfirm, cNewPassConfirm); m_pLSock = new class XSocket(m_hWnd, SOCKETBLOCKLIMIT); m_pLSock->bConnect(m_cLogServerAddr, m_iLogServerPort, WM_USER_LOGSOCKETEVENT); m_pLSock->bInitBufferSize(30000); ChangeGameMode(GAMEMODE_ONCONNECTING); m_dwConnectMode = MSGID_REQUEST_CHANGEPASSWORD; ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "41"); delete pMI; return; case 6: // Cancel ChangeGameMode(GAMEMODE_ONSELECTCHARACTER); //m_dwLoginMode = MSGID_REQUEST_LOGIN; delete pMI; return; } m_bEnterPressed = FALSE; } if (m_bEscPressed == TRUE) { ChangeGameMode(GAMEMODE_ONMAINMENU); delete pMI; m_bEscPressed = FALSE; return; } if (cPrevFocus != m_cCurFocus) { EndInputString(); switch (m_cCurFocus) { case 1: StartInputString(314, 155, 11, cName); break; case 2: StartInputString(314, 179, 11, cPassword); break; case 3: StartInputString(314, 203, 11, cNewPassword); break; case 4: StartInputString(314, 227, 11, cNewPassConfirm); break; } cPrevFocus = m_cCurFocus; } m_DDraw.ClearBackB4(); UpdateScreen_OnSelectCharacter(0, 0, 0, 0, TRUE); m_DDraw.DrawShadowBox(0,0,639,479);//SelectCharacter DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, 153, 112, 0); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT , 153, 112, 13); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, 153 + 157, 112 + 109, 7);// PutString(206, 155, UPDATE_SCREEN_ON_CHANGE_PASSWORD1, RGB(25,35,25)); PutString(206, 179, UPDATE_SCREEN_ON_CHANGE_PASSWORD2, RGB(25,35,25)); PutString(206, 203, UPDATE_SCREEN_ON_CHANGE_PASSWORD3, RGB(25,35,25)); PutString(206, 227, UPDATE_SCREEN_ON_CHANGE_PASSWORD4, RGB(25,35,25)); if (m_cCurFocus != 1) { if (m_Misc.bCheckValidString(cName) != FALSE) PutString(314, 155, cName, RGB(25,35,25)); else PutString(314, 155, cName, RGB(55,18,13)); } if ((m_Misc.bCheckValidString(cName) == FALSE) || (strlen(cName) == 0)) bFlag = FALSE; if (m_cCurFocus != 2) { if ((m_Misc.bCheckValidString(cPassword) != FALSE)) PutString(314, 179, cPassword, RGB(25,35,25), TRUE, 3); else PutString(314, 179, cPassword, RGB(55,18,13), TRUE, 3); } if (m_cCurFocus != 3) { if ((m_Misc.bCheckValidName(cNewPassword) != FALSE)) PutString(314, 203, cNewPassword, RGB(25,35,25), TRUE, 3); else PutString(314, 203, cNewPassword, RGB(55,18,13), TRUE, 3); } if (m_cCurFocus != 4) { if ((m_Misc.bCheckValidName(cNewPassConfirm) != FALSE)) PutString(314, 227, cNewPassConfirm, RGB(25,35,25), TRUE, 3); else PutString(314, 227, cNewPassConfirm, RGB(55,18,13), TRUE, 3); } if ( (m_Misc.bCheckValidString(cPassword) == FALSE) || (strlen(cPassword) == 0) || (strlen(cNewPassword) < 8) || (memcmp(cNewPassword, cNewPassConfirm, 10) != 0) || ( memcmp(cPassword, cNewPassword, 10) == 0 ) ) bFlag = FALSE; if (m_cCurFocus == 1) ShowReceivedString(); else if ((m_cCurFocus == 2) || (m_cCurFocus == 3) || (m_cCurFocus == 4)) ShowReceivedString(TRUE); PutAlignedString(153, 487, 258, UPDATE_SCREEN_ON_CHANGE_PASSWORD5);//" PutAlignedString(153, 487, 273, UPDATE_SCREEN_ON_CHANGE_PASSWORD6);//" PutAlignedString(153, 487, 288, UPDATE_SCREEN_ON_CHANGE_PASSWORD7);//" if ( (bFlag == TRUE) && (m_cCurFocus == 5) ) m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(197, 320, 21, dwTime); else m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(197, 320, 20, dwTime); if (m_cCurFocus == 6) m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(370, 320, 17, dwTime); else m_pSprite[SPRID_INTERFACE_ND_BUTTON]->PutSpriteFast(370, 320, 16, dwTime); DrawVersion(); m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); iMIbuttonNum = pMI->iGetStatus(msX, msY, cLB, &cMIresult); if (cMIresult == MIRESULT_CLICK) { PlaySound('E', 14, 5); switch (iMIbuttonNum) { case 1: case 2: case 3: case 4: m_cCurFocus = iMIbuttonNum; break; case 5: if ( (m_Misc.bCheckValidString(cPassword) == FALSE) || (strlen(cPassword) == 0) || (m_Misc.bCheckValidName(cNewPassword) == FALSE) || (m_Misc.bCheckValidName(cNewPassConfirm) == FALSE) || (strlen(cNewPassword) == 0) || (memcmp(cNewPassword, cNewPassConfirm, 10) != 0) ) break; EndInputString(); ZeroMemory(m_cAccountName, sizeof(m_cAccountName)); ZeroMemory(m_cAccountPassword, sizeof(m_cAccountPassword)); ZeroMemory(m_cNewPassword, sizeof(m_cNewPassword)); ZeroMemory(m_cNewPassConfirm, sizeof(m_cNewPassConfirm)); strcpy(m_cAccountName, cName); strcpy(m_cAccountPassword, cPassword); strcpy(m_cNewPassword, cNewPassword); strcpy(m_cNewPassConfirm, cNewPassConfirm); m_pLSock = new class XSocket(m_hWnd, SOCKETBLOCKLIMIT); m_pLSock->bConnect(m_cLogServerAddr, m_iLogServerPort, WM_USER_LOGSOCKETEVENT); m_pLSock->bInitBufferSize(30000); ChangeGameMode(GAMEMODE_ONCONNECTING); m_dwConnectMode = MSGID_REQUEST_CHANGEPASSWORD; ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg, "41"); delete pMI; return; case 6: // Cancel ChangeGameMode(GAMEMODE_ONSELECTCHARACTER); delete pMI; return; } } if ((msX >= 197) && (msX <= 197 + BTNSZX) && (msY >= 320) && (msY <= 320 + BTNSZY)) m_cCurFocus = 5; if ((msX >= 370) && (msX <= 370 + BTNSZX) && (msY >= 320) && (msY <= 320 + BTNSZY)) m_cCurFocus = 6; if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } void CGame::DlgBoxClick_SysMenu(short msX, short msY) { short sX, sY; sX = m_stDialogBoxInfo[19].sX; sY = m_stDialogBoxInfo[19].sY; if ((msX >= sX + 120) && (msX <= sX + 150) && (msY >= sY + 63) && (msY <= sY + 74)) { m_cDetailLevel = 0; AddEventList( NOTIFY_MSG_DETAIL_LEVEL_LOW, 10 ); PlaySound('E', 14, 5); } if ((msX >= sX + 151) && (msX <= sX + 200) && (msY >= sY + 63) && (msY <= sY + 74)) { m_cDetailLevel = 1; AddEventList( NOTIFY_MSG_DETAIL_LEVEL_MEDIUM, 10 ); PlaySound('E', 14, 5); } if ((msX >= sX + 201) && (msX <= sX + 234) && (msY >= sY + 63) && (msY <= sY + 74)) { m_cDetailLevel = 2; AddEventList( NOTIFY_MSG_DETAIL_LEVEL_HIGH, 10 ); PlaySound('E', 14, 5); } if ((msX >= sX + 24) && (msX <= sX + 115) && (msY >= sY + 81) && (msY <= sY + 100)) { if( m_bSoundFlag ) { if (m_bSoundStat == TRUE) { m_pESound[38]->bStop(); m_bSoundStat = FALSE; AddEventList( NOTIFY_MSG_SOUND_OFF, 10 ); }else { m_bSoundStat = TRUE; AddEventList( NOTIFY_MSG_SOUND_ON, 10 ); } } } if ((msX >= sX + 116) && (msX <= sX + 202) && (msY >= sY + 81) && (msY <= sY + 100)) { if( m_bSoundFlag ) { if (m_bMusicStat == TRUE) // Music Off { m_bMusicStat = FALSE; AddEventList( NOTIFY_MSG_MUSIC_OFF, 10 ); if (m_bSoundFlag) { if (m_pBGM != NULL) { m_pBGM->bStop(); delete m_pBGM; m_pBGM = NULL; } } }else // Music On { if (m_bSoundFlag) { m_bMusicStat = TRUE; AddEventList( NOTIFY_MSG_MUSIC_ON, 10 ); StartBGM(); } } } } if ((msX >= sX + 23) && (msX <= sX + 108) && (msY >= sY + 108) && (msY <= sY + 119)) { if (m_bWhisper == TRUE) { m_bWhisper = FALSE; AddEventList(BCHECK_LOCAL_CHAT_COMMAND7, 10 ); }else { m_bWhisper = TRUE; AddEventList(BCHECK_LOCAL_CHAT_COMMAND6, 10 ); } } if ((msX >= sX + 123) && (msX <= sX + 203) && (msY >= sY + 108) && (msY <= sY + 119)) { if (m_bShout == TRUE) { m_bShout = FALSE; AddEventList(BCHECK_LOCAL_CHAT_COMMAND9, 10 ); }else { m_bShout = TRUE; AddEventList(BCHECK_LOCAL_CHAT_COMMAND8, 10 ); } } //Transparency Change if ((msX >= sX + 28) && (msX <= sX + 235) && (msY >= sY + 156) && (msY <= sY + 171)) m_bDialogTrans = !m_bDialogTrans; //Guide Map Toggle if ((msX >= sX + 28) && (msX <= sX + 127) && (msY >= sY + 178) && (msY <= sY + 193)) { if( m_bIsDialogEnabled[9] ) DisableDialogBox(9); else EnableDialogBox(9, 0, 0, 0, NULL); } if (m_bForceDisconn) return; if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + 225) && (msY <= sY + 225 + BTNSZY)) { if( m_cLogOutCount == -1 ) #ifdef _DEBUG m_cLogOutCount = 1; #else m_cLogOutCount = 11; #endif else { m_cLogOutCount = -1; AddEventList(DLGBOX_CLICK_SYSMENU2, 10); DisableDialogBox(19); } PlaySound('E', 14, 5); } if ((m_iHP <= 0) && (m_cRestartCount == -1)) { if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + 225) && (msY <= sY + 225 + BTNSZY)) { m_cRestartCount = 5; m_dwRestartCountTime = timeGetTime(); DisableDialogBox(19); wsprintf(G_cTxt, DLGBOX_CLICK_SYSMENU1, m_cRestartCount); // "Restarting game....%d" AddEventList(G_cTxt, 10); PlaySound('E', 14, 5); } } } void CGame::DrawNpcName(short sX, short sY, short sOwnerType, int iStatus) { char cTxt[42], cTxt2[64]; ZeroMemory(cTxt, sizeof(cTxt)); ZeroMemory(cTxt2, sizeof(cTxt2)); GetNpcName(sOwnerType, cTxt); if ((iStatus & STATUS_BERSERK) != 0) strcat(cTxt, DRAW_OBJECT_NAME50);//" Berserk" if ((iStatus & STATUS_FROZEN) != 0) strcat(cTxt, DRAW_OBJECT_NAME51);//" Frozen" PutString2(sX, sY, cTxt, 255,255,255); if (m_bIsObserverMode == TRUE) PutString2(sX, sY+14, cTxt, 50,50,255); else if (m_bIsConfusion || (m_iIlusionOwnerH != NULL)) { ZeroMemory(cTxt, sizeof(cTxt)); strcpy(cTxt, DRAW_OBJECT_NAME87); PutString2(sX, sY+14, cTxt, 150,150,150); } else { switch( _iGetFOE(iStatus) ) { case -2: PutString2(sX, sY+14, DRAW_OBJECT_NAME90, 255, 0, 0); break; case -1: PutString2(sX, sY+14, DRAW_OBJECT_NAME90, 255, 0, 0); break; case 0: PutString2(sX, sY+14, DRAW_OBJECT_NAME88, 50,50,255); break; case 1: PutString2(sX, sY+14, DRAW_OBJECT_NAME89, 30,255,30); break; } } switch ((iStatus & 0x0F00) >> 8) { case 0: break; case 1: strcpy(cTxt2, DRAW_OBJECT_NAME52); break;//"Clairvoyant" case 2: strcpy(cTxt2, DRAW_OBJECT_NAME53); break;//"Destruction of Magic Protection" case 3: strcpy(cTxt2, DRAW_OBJECT_NAME54); break;//"Anti-Physical Damage" case 4: strcpy(cTxt2, DRAW_OBJECT_NAME55); break;//"Anti-Magic Damage" case 5: strcpy(cTxt2, DRAW_OBJECT_NAME56); break;//"Poisonous" case 6: strcpy(cTxt2, DRAW_OBJECT_NAME57); break;//"Critical Poisonous" case 7: strcpy(cTxt2, DRAW_OBJECT_NAME58); break;//"Explosive" case 8: strcpy(cTxt2, DRAW_OBJECT_NAME59); break;//"Critical Explosive" case 9: strcpy(cTxt2, DRAW_OBJECT_NAME59B); break;//"Highly Trained" } if( m_Misc.bCheckIMEString(cTxt2) ) PutString_SprFont3(sX, sY + 28, cTxt2, m_wR[13]*4, m_wG[13]*4, m_wB[13]*4, FALSE, 2); else PutString2(sX, sY + 28, cTxt2, 240,240,70); #ifdef _DEBUG wsprintf(G_cTxt,"Status: 0x%.8X ",iStatus); PutString2(sX+70, sY+(14*0), G_cTxt, 30,255,30); #endif } void CGame::DrawObjectName(short sX, short sY, char * pName, int iStatus) { char cTxt[64], cTxt2[64]; short sR, sG, sB; int i, iGuildIndex, iFOE, iAddY=0; BOOL bPK; iFOE = _iGetFOE(iStatus); Side side = (Side)(iStatus >> 28); if( iFOE < 0 ) { sR = 255; sG = 0; sB = 0; } else if( iFOE == 0 ) { sR = 50; sG = 50; sB = 255; } else { sR = 30; sG = 200; sB = 30; } ZeroMemory(cTxt, sizeof(cTxt)); ZeroMemory(cTxt2, sizeof(cTxt2)); if (m_iIlusionOwnerH == NULL) { if (m_bIsCrusadeMode == FALSE) wsprintf(cTxt, "%s", pName); else { if (_tmp_wObjectID >= 10000) strcpy(cTxt, NPC_NAME_MERCENARY); else { if( iFOE == -1 ) wsprintf(cTxt, "%d", _tmp_wObjectID); else strcpy(cTxt, pName); } } if (m_iPartyStatus != NULL) { for (i = 0; i < m_stPartyMember.size(); i++) { if (m_stPartyMember[i]->cName.compare(pName) == 0) { strcat(cTxt, BGET_NPC_NAME23); break; } } } } else strcpy(cTxt, "?????"); if ((iStatus & STATUS_BERSERK) != 0) strcat(cTxt, DRAW_OBJECT_NAME50);//" Berserk" if ((iStatus & STATUS_FROZEN) != 0) strcat(cTxt, DRAW_OBJECT_NAME51);//" Frozen" PutString2(sX, sY, cTxt, 255,255,255); ZeroMemory(cTxt, sizeof(cTxt)); if( memcmp(m_cPlayerName, pName, 10) == 0 ) { if( m_iGuildRank == 0 ) { wsprintf( G_cTxt, MSG_GUILDMASTER, m_cGuildName ); PutString2(sX, sY+14, G_cTxt, 180,180,180); iAddY = 14; } if( m_iGuildRank > 0 ) { wsprintf( G_cTxt, MSG_GUILDSMAN, m_cGuildName ); PutString2(sX, sY+14, G_cTxt, 180,180,180); iAddY = 14; } if( m_iPKCount != 0 ) { bPK = TRUE; //sR = 255; sG = 0; sB = 0; } else { bPK = FALSE; //sR = 30; sG = 200; sB = 30; } side = m_side; } else { side = (Side)( (0xF0000000 & iStatus) >> 28 ); if( iStatus & STATUS_PK) bPK = TRUE; else bPK = FALSE; if( (m_bIsCrusadeMode==FALSE || iFOE>=0) && m_iIlusionOwnerH == NULL ) { if( FindGuildName(pName, &iGuildIndex) == TRUE ) { if (m_stGuildName[iGuildIndex].cGuildName[0] != NULL) { if( strcmp(m_stGuildName[iGuildIndex].cGuildName, "NONE" )!=0 ) { if( m_stGuildName[iGuildIndex].iGuildRank == 0 ) { wsprintf( G_cTxt, MSG_GUILDMASTER, m_stGuildName[iGuildIndex].cGuildName ); PutString2(sX, sY+14, G_cTxt, 180,180,180); m_stGuildName[iGuildIndex].dwRefTime = m_dwCurTime; iAddY = 14; } else if( m_stGuildName[iGuildIndex].iGuildRank > 0 ) { wsprintf( G_cTxt, MSG_GUILDSMAN, m_stGuildName[iGuildIndex].cGuildName ); PutString2(sX, sY+14, G_cTxt, 180,180,180); m_stGuildName[iGuildIndex].dwRefTime = m_dwCurTime; iAddY = 14; } } else { m_stGuildName[iGuildIndex].dwRefTime = 0; } } } else bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQGUILDNAME, NULL, _tmp_wObjectID, iGuildIndex, NULL, NULL); } } strcpy(cTxt, sideName[side]); if(side != NEUTRAL && !bPK) strcat(cTxt, MSG_COMBATANT); if(bPK) strcat(cTxt, MSG_PK); PutString2(sX, sY+14 +iAddY, cTxt, sR, sG, sB); #ifdef _DEBUG wsprintf(G_cTxt,"Status: 0x%.8X ",iStatus); PutString2(sX+70, sY+(14*0), G_cTxt, 30,255,30); #endif } BOOL CGame::FindGuildName(char* pName, int* ipIndex) { int i, iRet = 0; DWORD dwTmpTime; for( i=0 ; i < MAXGUILDNAMES ; i++ ) { if( memcmp(m_stGuildName[i].cCharName, pName, 10) == 0 ) { m_stGuildName[i].dwRefTime = m_dwCurTime; *ipIndex = i; return TRUE; } } dwTmpTime = m_stGuildName[0].dwRefTime; for( i=0 ; i < MAXGUILDNAMES ; i++ ) { if( m_stGuildName[i].dwRefTime < dwTmpTime ) { iRet = i; dwTmpTime = m_stGuildName[i].dwRefTime; } } ZeroMemory( m_stGuildName[iRet].cGuildName, sizeof(m_stGuildName[iRet].cGuildName) ); memcpy( m_stGuildName[iRet].cCharName, pName, 10 ); m_stGuildName[iRet].dwRefTime = m_dwCurTime; m_stGuildName[iRet].iGuildRank = -1; *ipIndex = iRet; return FALSE; } void CGame::UpdateScreen_OnVersionNotMatch() { short msX, msY, msZ; char cLB, cRB, cMB; char cMIresult; int iMIbuttonNum; static class CMouseInterface * pMI; DWORD dwTime = timeGetTime(); if (m_cGameModeCount == 0) { if (G_pCalcSocket != NULL) { delete G_pCalcSocket; G_pCalcSocket = NULL; } if (m_pGSock != NULL) { delete m_pGSock; m_pGSock = NULL; } pMI = new class CMouseInterface; pMI->AddRect(0,0,640,480); m_bEnterPressed = FALSE; } m_cGameModeCount++; if (m_cGameModeCount > 120) m_cGameModeCount = 120; m_DDraw.ClearBackB4(); if (m_bEscPressed == TRUE || m_bEnterPressed == TRUE) { m_bEscPressed = FALSE; m_bEnterPressed = FALSE; delete pMI; ChangeGameMode(GAMEMODE_NULL); SendMessage(m_hWnd, WM_DESTROY, NULL, NULL); return; } DrawNewDialogBox(SPRID_INTERFACE_ND_QUIT, 0,0,0, TRUE); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, 162,125,2); PutAlignedString(168, 474, 160, UPDATE_SCREEN_ON_VERSION_NO_MATCH1); PutAlignedString(168, 474, 180, UPDATE_SCREEN_ON_VERSION_NO_MATCH2); PutAlignedString(168, 474, 250, MSG_HOMEPAGE); DrawVersion(); m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); iMIbuttonNum = pMI->iGetStatus(msX, msY, cLB, &cMIresult); if ((cMIresult == MIRESULT_CLICK) && (iMIbuttonNum == 1)) { ChangeGameMode(GAMEMODE_NULL); delete pMI; SendMessage(m_hWnd, WM_DESTROY, NULL, NULL); return; } if (m_DDraw.iFlip() == DDERR_SURFACELOST) RestoreSprites(); } void CGame::DrawVersion(BOOL bAuthor) { DWORD dwTime = timeGetTime(); WORD wR, wG, wB; m_Misc.ColorTransfer(m_DDraw.m_cPixelFormat, RGB(140, 140, 140), &wR, &wG, &wB); m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutTransSpriteRGB(14, 463, 19, wR, wG, wB, dwTime); // Upper Version wsprintf(G_cTxt, "%d", UPPER_VERSION); PutString_SprNum(36, 463, G_cTxt, 140, 140, 140); // . m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutTransSpriteRGB(42, 463, 18, wR, wG, wB, dwTime); // Lower Version wsprintf(G_cTxt, "%d", LOWER_VERSION); PutString_SprNum(46, 463, G_cTxt, 140, 140, 140); if (bAuthor == FALSE) return; //PutString2(14, 375, "V3.51 compatibility by Cleroth", 220, 200, 200); //PutString2(14, 390, "V3.51 dialogs by Diuuude", 220, 200, 200); //PutString2(14, 405, "Effects, mobs, Apocalypse, Heldenian,", 220, 200, 200); //PutString2(14, 420, "& finalizing by Snoopy81", 220, 200, 200); //PutString2(14, 435, "Angels & Crafting by Snoopy81", 220, 200, 200); } char CGame::GetOfficialMapName(char * pMapName, char * pName) { // MapIndex if (strcmp(pMapName, "middleland") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME28); // Middleland return 4; }else if (strcmp(pMapName, "huntzone3") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME31); // Death Valley return 0; }else if (strcmp(pMapName, "huntzone1") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME29); // Rocky Highland return 1; }else if (strcmp(pMapName, "elvuni") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME57); // Eldiniel Garden return 2; }else if (strcmp(pMapName, "elvine") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME24); // Elvine City return 3; }else if (strcmp(pMapName, "elvfarm") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME2); // Elvine Farm return 5; }else if (strcmp(pMapName, "arefarm") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME1); // Aresden Farm return 6; }else if (strcmp(pMapName, "default") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME3); // Beginner Zone return 7; }else if (strcmp(pMapName, "huntzone4") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME32); // Silent Wood return 8; }else if (strcmp(pMapName, "huntzone2") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME30); // Eternal Field return 9; }else if (strcmp(pMapName, "areuni") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME56); // Aresien Garden return 10; }else if (strcmp(pMapName, "aresden") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME22); // Aresden City return 11; }else if (strcmp(pMapName, "dglv2") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME25); // Dungeon L2 return 12; }else if (strcmp(pMapName, "dglv3") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME26); // Dungeon L3 return 13; }else if (strcmp(pMapName, "dglv4") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME53); // Dungeon L4 return 14; }else if (strcmp(pMapName, "elvined1") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME23); // Elvine Dungeon return 15; }else if (strcmp(pMapName, "aresdend1") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME21); // Aresden Dungeon return 16; }else if (strcmp(pMapName, "bisle") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME27); // Bleeding Island return 17; }else if (strcmp(pMapName, "toh1") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME60); // Tower of Hell 1 return 18; }else if (strcmp(pMapName, "toh2") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME61); // Tower of Hell 2 return 19; }else if (strcmp(pMapName, "toh3") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME62); // Tower of Hell 3 return 20; }else if (strcmp(pMapName, "middled1x") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME58); // Middleland Mine return 21; }else if (strcmp(pMapName, "middled1n") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME59); // Middleland Dungeon return 22; }else if (strcmp(pMapName, "2ndmiddle") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME65); // Promiseland return 23; }else if (strcmp(pMapName, "icebound") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME66); // Ice Map return 24; // Snoopy: }else if (strcmp(pMapName, "druncncity") == 0) // Snoopy: Apocalypse maps { strcpy(pName, GET_OFFICIAL_MAP_NAME70); return 25; }else if (strcmp(pMapName, "inferniaA") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME71); return 26; }else if (strcmp(pMapName, "inferniaB") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME72); return 27; }else if (strcmp(pMapName, "maze") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME73); return 28; }else if (strcmp(pMapName, "procella") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME74); return 29; }else if (strcmp(pMapName, "abaddon") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME75); return 30; }else if (strcmp(pMapName, "BtField") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME76); return 35; }else if (strcmp(pMapName, "GodH") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME77); return 36; }else if (strcmp(pMapName, "HRampart") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME78); return 37; }else if (strcmp(pMapName, "cityhall_1") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME35); // Aresden Cityhall return -1; }else if (strcmp(pMapName, "cityhall_2") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME36); // Elvine Cityhall return -1; }else if (strcmp(pMapName, "gldhall_1") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME37); // Aresden Guildhall return -1; }else if (strcmp(pMapName, "gldhall_2") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME38); // Elvine Guildhall return -1; }else if (memcmp(pMapName, "bsmith_1", 8) == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME33); // Aresden Blacksmith return -1; }else if (memcmp(pMapName, "bsmith_2", 8) == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME34); // Elvine Blacksmith return -1; }else if (memcmp(pMapName, "gshop_1", 7) == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME39); // Aresden Shop return -1; }else if (memcmp(pMapName, "gshop_2", 7) == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME40); // Elvine Shop return -1; }else if (memcmp(pMapName, "wrhus_1", 7) == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME43); // Aresden Warehouse return -1; }else if (memcmp(pMapName, "wrhus_2", 7) == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME44); // Elvine Warehouse return -1; }else if (strcmp(pMapName, "arewrhus") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME45); // Aresden Warehouse return -1; }else if (strcmp(pMapName, "elvwrhus") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME46); // Elvine Warehouse return -1; }else if (strcmp(pMapName, "istwrhus") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME84); return -1; } else if (strcmp(pMapName, "wzdtwr_1") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME41); // Magic Tower return -1; }else if (strcmp(pMapName, "wzdtwr_2") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME42); // Magic Tower return -1; }else if (strcmp(pMapName, "cath_1") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME47); // Aresien Church return -1; }else if (strcmp(pMapName, "cath_2") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME48); // Eldiniel Church return -1; } else if (memcmp(pMapName, "resurr", 6) == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME54); // Revival Zone return -1; } else if (strcmp(pMapName, "arebrk11") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME4); // Aresden Barrack 1 return -1; }else if (strcmp(pMapName, "arebrk12") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME5); // Aresden Barrack 1 return -1; }else if (strcmp(pMapName, "arebrk21") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME6); // Aresden Barrack 2 return -1; }else if (strcmp(pMapName, "arebrk22") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME7); // Aresden Barrack 2 return -1; }else if (strcmp(pMapName, "elvbrk11") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME8); // Elvine Barrack 1 return -1; }else if (strcmp(pMapName, "elvbrk12") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME9); // Elvine Barrack 1 return -1; }else if (strcmp(pMapName, "elvbrk21") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME10); // Elvine Barrack 2 return -1; }else if (strcmp(pMapName, "elvbrk22") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME11); // Elvine Barrack 2 return -1; } else if (strcmp(pMapName, "istbrk1") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME85); return -1; } else if (strcmp(pMapName, "istbrk2") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME86); return -1; } else if (strcmp(pMapName, "fightzone1") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME12); // Arena 1 return -1; }else if (strcmp(pMapName, "fightzone2") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME13); // Arena 2 return -1; }else if (strcmp(pMapName, "fightzone3") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME14); // Arena 3 return -1; }else if (strcmp(pMapName, "fightzone4") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME15); // Arena 4 return -1; }else if (strcmp(pMapName, "fightzone5") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME16); // Arena 5 return -1; }else if (strcmp(pMapName, "fightzone6") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME17); // Arena 6 return -1; }else if (strcmp(pMapName, "fightzone7") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME18); // Arena 7 return -1; }else if (strcmp(pMapName, "fightzone8") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME19); // Arena 8 return -1; }else if (strcmp(pMapName, "fightzone9") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME20); // Arena 9 return -1; }else if (strcmp(pMapName, "arejail") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME63); // Aresden Jail return -1; }else if (strcmp(pMapName, "elvjail") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME64); // Elvine Jail return -1; } else if (strcmp(pMapName, "istjail") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME87); return -1; } else if (memcmp(pMapName, "CmdHall", 7) == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME79); return -1; } else if (strcmp(pMapName, "Barracks1") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME80); return -1; }else if (strcmp(pMapName, "Barracks2") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME81); return -1; }else if (strcmp(pMapName, "Bsmith") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME82); return -1; } else if (memcmp(pMapName, "bsmith_3", 8) == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME88); return -1; }else if (memcmp(pMapName, "gshop_3", 7) == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME89); return -1; }else if (memcmp(pMapName, "wrhus_3", 7) == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME90); return -1; } else if (memcmp(pMapName, "wrhus_m3", 8) == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME90); return -1; } else if (strcmp(pMapName, "wzdtwr_3") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME91); return -1; } else if (strcmp(pMapName, "gldhall_3") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME92); return -1; } else if (strcmp(pMapName, "CmdHall_3") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME93); return -1; } else if (strcmp(pMapName, "cityhall_3") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME94); return -1; } else if (strcmp(pMapName, "cath_3") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME95); return -1; } else if (strcmp(pMapName, "huntzone5") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME96); return 39; } else if (strcmp(pMapName, "huntzone6") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME97); return 40; } else if (strcmp(pMapName, "istria") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME98); return 41; } else if (strcmp(pMapName, "istfarm") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME99); return 42; } else if (strcmp(pMapName, "garden") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME100); return 43; } else if (strcmp(pMapName, "astoria") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME101); return 44; } else if (strcmp(pMapName, "default2") == 0) { strcpy(pName, GET_OFFICIAL_MAP_NAME83); return -1; } else { strcpy(pName, pMapName); toupper(pName[0]); return -1; } } BOOL CGame::bCheckLocalChatCommand(char * pMsg) { class CStrTok * pStrTok = NULL; char * token, cBuff[256], cTxt[120], cName[12]; char seps[] = " \t\n"; ZeroMemory(cBuff, sizeof(cBuff)); ZeroMemory(cName, sizeof(cName)); strcpy(cBuff, pMsg); if (memcmp(cBuff, "/showframe", 10)==0 || memcmp(cBuff, "/fps", 4)==0) { m_bShowFPS = !m_bShowFPS; return TRUE; }else if (memcmp(cBuff, "/timestamp", 10)==0) { if(!m_showTimeStamp) AddEventList(BCHECK_LOCAL_CHAT_COMMAND10, 10); else AddEventList(BCHECK_LOCAL_CHAT_COMMAND11, 10); m_showTimeStamp = !m_showTimeStamp; return TRUE; }else if (memcmp(cBuff, "/showgrid", 9)==0 || memcmp(cBuff, "/grid", 5)==0) { m_showGrid = !m_showGrid; return TRUE; }else if (memcmp(cBuff, "/showalldmg", 11)==0) { if(!m_showAllDmg) AddEventList(BCHECK_LOCAL_CHAT_COMMAND12, 10); else AddEventList(BCHECK_LOCAL_CHAT_COMMAND13, 10); m_showAllDmg = !m_showAllDmg; return TRUE; }else if (memcmp(cBuff, "/bigitems", 9)==0) { if(!m_bigItems) AddEventList(BCHECK_LOCAL_CHAT_COMMAND14, 10); else AddEventList(BCHECK_LOCAL_CHAT_COMMAND15, 10); m_bigItems = !m_bigItems; return TRUE; }else if (memcmp(cBuff, "/ekscreenshot", 13)==0) { if(!m_ekScreenshot) AddEventList(BCHECK_LOCAL_CHAT_COMMAND16, 10); else AddEventList(BCHECK_LOCAL_CHAT_COMMAND17, 10); m_ekScreenshot = !m_ekScreenshot; return TRUE; }else if (memcmp(cBuff, "/notifyme", 9)==0) { if(!m_tabbedNotification) AddEventList(BCHECK_LOCAL_CHAT_COMMAND18, 10); else AddEventList(BCHECK_LOCAL_CHAT_COMMAND19, 10); m_tabbedNotification = !m_tabbedNotification; return TRUE; }else if (memcmp(cBuff, "/manufill", 9)==0) { if(!m_manuAutoFill) AddEventList(BCHECK_LOCAL_CHAT_COMMAND20, 10); else AddEventList(BCHECK_LOCAL_CHAT_COMMAND21, 10); m_manuAutoFill = !m_manuAutoFill; return TRUE; }else if (memcmp(cBuff, "/enabletogglescreen", 19)==0) { m_bToggleScreen = TRUE; return TRUE; } else if (memcmp(cBuff, "/whon", 5) == 0) { m_bWhisper = TRUE; AddEventList(BCHECK_LOCAL_CHAT_COMMAND6, 10);// Enable to listen to whispers." return TRUE; }else if (memcmp(cBuff, "/whoff", 6) == 0) { m_bWhisper = FALSE; AddEventList(BCHECK_LOCAL_CHAT_COMMAND7, 10);// return TRUE; }else if (memcmp(cBuff, "/shon", 5) == 0) { m_bShout = TRUE; AddEventList(BCHECK_LOCAL_CHAT_COMMAND8, 10); //Enalbe to chat in public." return TRUE; }else if (memcmp(cBuff, "/shoff", 6) == 0) { m_bShout = FALSE; AddEventList(BCHECK_LOCAL_CHAT_COMMAND9, 10); //Unable to chat in public." return TRUE; } if (memcmp(cBuff, "/tooff", 6) == 0) { pStrTok = new class CStrTok(cBuff, seps); token = pStrTok->pGet(); token = pStrTok->pGet(); if (token != NULL) { if (strlen(token) <= 10) { strcpy(cName, token); if (memcmp(m_cPlayerName, cName, 10) == 0) { AddEventList(BCHECK_LOCAL_CHAT_COMMAND2, 10); if (pStrTok != NULL) delete pStrTok; return TRUE; } else if(m_MuteList.find(string(cName)) == m_MuteList.end()){ wsprintf(cTxt, BCHECK_LOCAL_CHAT_COMMAND3, token); AddEventList(cTxt, 10); m_MuteList.insert(string(cName)); SaveMuteList(); } } else AddEventList(BCHECK_LOCAL_CHAT_COMMAND5, 10); } if (pStrTok != NULL) delete pStrTok; return TRUE; }else if (memcmp(cBuff, "/toon", 5) == 0) { pStrTok = new class CStrTok(cBuff, seps); token = pStrTok->pGet(); token = pStrTok->pGet(); if (token != NULL) { if (strlen(token) <= 10) { if (m_MuteList.erase(string(token))) { wsprintf(cTxt, BCHECK_LOCAL_CHAT_COMMAND1, token); AddEventList(cTxt, 10); SaveMuteList(); } }else AddEventList(BCHECK_LOCAL_CHAT_COMMAND5, 10); } if (pStrTok != NULL) delete pStrTok; return TRUE; } if (pStrTok != NULL) delete pStrTok; return FALSE; } BOOL CGame::bCheckItemOperationEnabled(char cItemID) { if (m_pItemList[cItemID] == NULL) return FALSE; if (m_cCommand < 0) return FALSE; if (m_bIsTeleportRequested == TRUE) return FALSE; if (m_bIsItemDisabled[cItemID] == TRUE) return FALSE; if ((m_pItemList[cItemID]->m_sSpriteFrame == 155) && (m_bUsingSlate == TRUE)) { if ((m_cMapIndex==35)||(m_cMapIndex==36)||(m_cMapIndex==37)) { AddEventList(MSG_NOTIFY_SLATE_WRONG_MAP, 10); // "You cannot use it right here." return FALSE; } AddEventList(MSG_NOTIFY_SLATE_ALREADYUSING, 10); // Already Using Another Slate return FALSE; } if ( m_bIsDialogEnabled[17] == TRUE ) { AddEventList(BCHECK_ITEM_OPERATION_ENABLE1, 10); return FALSE; } if (m_bIsDialogEnabled[20] == TRUE) { AddEventList(BCHECK_ITEM_OPERATION_ENABLE1, 10); return FALSE; } if (m_bIsDialogEnabled[23] == TRUE) { AddEventList(BCHECK_ITEM_OPERATION_ENABLE1, 10); return FALSE; } if (m_bIsDialogEnabled[26] == TRUE) { AddEventList(BCHECK_ITEM_OPERATION_ENABLE1, 10); return FALSE; } if (m_bIsDialogEnabled[27] == TRUE) { AddEventList(BCHECK_ITEM_OPERATION_ENABLE1, 10); return FALSE; } if (m_bIsDialogEnabled[31] == TRUE) { AddEventList(BCHECK_ITEM_OPERATION_ENABLE1, 10); return FALSE; } if (m_bIsDialogEnabled[4] == TRUE) { AddEventList(BCHECK_ITEM_OPERATION_ENABLE1, 10); return FALSE; } return TRUE; } void CGame::ClearSkillUsingStatus() { if (m_bSkillUsingStatus == TRUE) { AddEventList(CLEAR_SKILL_USING_STATUS1, 10);//" DisableDialogBox(24); DisableDialogBox(26); if ((m_sPlayerType >= 1) && (m_sPlayerType <= 6)/* && ((m_sPlayerAppr2 & 0xF000) == 0)*/) { m_cCommand = OBJECTSTOP; m_sCommX = m_sPlayerX; m_sCommY = m_sPlayerY; } } m_bSkillUsingStatus = FALSE; } void CGame::NpcTalkHandler(char *pData) { char * cp, cRewardName[21], cTargetName[21], cTemp[21], cTxt[250]; short * sp, sType, sResponse; int iAmount, iIndex, iContribution, iX, iY, iRange; int iTargetType, iTargetCount, iQuestionType; cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sType = *sp; cp += 2; sp = (short *)cp; sResponse = *sp; cp += 2; sp = (short *)cp; iAmount = *sp; cp += 2; sp = (short *)cp; iContribution = *sp; cp += 2; sp = (short *)cp; iTargetType = *sp; cp += 2; sp = (short *)cp; iTargetCount = *sp; cp += 2; sp = (short *)cp; iX = *sp; cp += 2; sp = (short *)cp; iY = *sp; cp += 2; sp = (short *)cp; iRange = *sp; cp += 2; ZeroMemory(cRewardName, sizeof(cRewardName)); memcpy(cRewardName, cp, 20); cp += 20; ZeroMemory(cTargetName, sizeof(cTargetName)); memcpy(cTargetName, cp, 20); cp += 20; EnableDialogBox(21, sResponse, sType, 0); if ((sType >= 1) && (sType <= 100)) { iIndex = m_stDialogBoxInfo[21].sV1; m_pMsgTextList2[iIndex] = new class CMsg(NULL, " ", NULL); iIndex++; iQuestionType = NULL; switch (sType) { case 1: //Monster Hunt ZeroMemory(cTemp, sizeof(cTemp)); GetNpcName(iTargetType, cTemp); ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, NPC_TALK_HANDLER16, iTargetCount, cTemp); m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; ZeroMemory(cTxt, sizeof(cTxt)); if (memcmp(cTargetName, "NONE", 4) == 0) { strcpy(cTxt, NPC_TALK_HANDLER17);//" m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; } else { ZeroMemory(cTemp, sizeof(cTemp)); GetOfficialMapName(cTargetName, cTemp); wsprintf(cTxt, NPC_TALK_HANDLER18, cTemp);//"Map : %s" m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; if (iX != 0) { ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, NPC_TALK_HANDLER19, iX, iY, iRange);//"Position: %d,%d within %d blocks" m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; } ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, NPC_TALK_HANDLER20, iContribution);//" m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; } iQuestionType = 1; break; case 7: // ZeroMemory(cTxt, sizeof(cTxt)); m_pMsgTextList2[iIndex] = new class CMsg(NULL, NPC_TALK_HANDLER21, NULL); iIndex++; ZeroMemory(cTxt, sizeof(cTxt)); if (memcmp(cTargetName, "NONE", 4) == 0) { strcpy(cTxt, NPC_TALK_HANDLER22); m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; } else { ZeroMemory(cTemp, sizeof(cTemp)); GetOfficialMapName(cTargetName, cTemp); wsprintf(cTxt, NPC_TALK_HANDLER23, cTemp); m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; if (iX != 0) { ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, NPC_TALK_HANDLER24, iX, iY, iRange); m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; } ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, NPC_TALK_HANDLER25, iContribution); m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; } iQuestionType = 1; break; case 10: // Crusade ZeroMemory(cTxt, sizeof(cTxt)); m_pMsgTextList2[iIndex] = new class CMsg(NULL, NPC_TALK_HANDLER26, NULL); iIndex++; ZeroMemory(cTxt, sizeof(cTxt)); strcpy(cTxt, NPC_TALK_HANDLER27);//" m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; ZeroMemory(cTxt, sizeof(cTxt)); strcpy(cTxt, NPC_TALK_HANDLER28);//" m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; ZeroMemory(cTxt, sizeof(cTxt)); strcpy(cTxt, NPC_TALK_HANDLER29);//" m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; ZeroMemory(cTxt, sizeof(cTxt)); strcpy(cTxt, NPC_TALK_HANDLER30);//" m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; ZeroMemory(cTxt, sizeof(cTxt)); strcpy(cTxt, " "); m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; ZeroMemory(cTxt, sizeof(cTxt)); if (memcmp(cTargetName, "NONE", 4) == 0) { strcpy(cTxt, NPC_TALK_HANDLER31);//" m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; } else { ZeroMemory(cTemp, sizeof(cTemp)); GetOfficialMapName(cTargetName, cTemp); wsprintf(cTxt, NPC_TALK_HANDLER32, cTemp);//" m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; } iQuestionType = 2; break; } switch (iQuestionType) { case 1: m_pMsgTextList2[iIndex] = new class CMsg(NULL, " ", NULL); iIndex++; m_pMsgTextList2[iIndex] = new class CMsg(NULL, NPC_TALK_HANDLER33, NULL);//" iIndex++; m_pMsgTextList2[iIndex] = new class CMsg(NULL, NPC_TALK_HANDLER34, NULL);//" iIndex++; m_pMsgTextList2[iIndex] = new class CMsg(NULL, " ", NULL); iIndex++; break; case 2: m_pMsgTextList2[iIndex] = new class CMsg(NULL, " ", NULL); iIndex++; m_pMsgTextList2[iIndex] = new class CMsg(NULL, NPC_TALK_HANDLER35, NULL);//" iIndex++; m_pMsgTextList2[iIndex] = new class CMsg(NULL, " ", NULL); iIndex++; break; default: break; } } } void CGame::GetNpcName(short sType, char *pName) { switch (sType) { case 10: strcpy(pName, NPC_NAME_SLIME); break; case 11: strcpy(pName, NPC_NAME_SKELETON); break; case 12: strcpy(pName, NPC_NAME_STONEGOLEM); break; case 13: strcpy(pName, NPC_NAME_CYCLOPS); break; case 14: strcpy(pName, NPC_NAME_ORC); break; case 15: strcpy(pName, NPC_NAME_SHOP_KEEPER); break; case 16: strcpy(pName, NPC_NAME_GIANTANT); break; case 17: strcpy(pName, NPC_NAME_GIANTSCORPION); break; case 18: strcpy(pName, NPC_NAME_ZOMBIE); break; case 19: strcpy(pName, NPC_NAME_MAGICIAN); break; case 20: strcpy(pName, NPC_NAME_WAREHOUSE_KEEPER); break; case 21: strcpy(pName, NPC_NAME_GUARD); break; case 22: strcpy(pName, NPC_NAME_SNAKE); break; case 23: strcpy(pName, NPC_NAME_CLAYGOLEM); break; case 24: strcpy(pName, NPC_NAME_BLACKSMITH_KEEPER); break; case 25: strcpy(pName, NPC_NAME_CITYHALL_OFFICER); break; case 26: strcpy(pName, NPC_NAME_GUILDHALL_OFFICER); break; case 27: strcpy(pName, NPC_NAME_HELHOUND); break; case 28: strcpy(pName, NPC_NAME_TROLL); break; case 29: strcpy(pName, NPC_NAME_OGRE); break; case 30: strcpy(pName, NPC_NAME_LICHE); break; case 31: strcpy(pName, NPC_NAME_DEMON); break; case 32: strcpy(pName, NPC_NAME_UNICORN); break; case 33: strcpy(pName, NPC_NAME_WEREWOLF); break; case 34: strcpy(pName, NPC_NAME_DUMMY); break; case 35: strcpy(pName, NPC_NAME_ENERGYSPHERE); break; case 36: if (_tmp_sAppr2 != 0) strcpy(pName, NPC_NAME_ARROWGUARDTOWER_CK); else strcpy(pName, NPC_NAME_ARROWGUARDTOWER); break; case 37: if (_tmp_sAppr2 != 0) strcpy(pName, NPC_NAME_CANNONGUARDTOWER_CK); else strcpy(pName, NPC_NAME_CANNONGUARDTOWER); break; case 38: if (_tmp_sAppr2 != 0) strcpy(pName, NPC_NAME_MANACOLLECTOR_CK); else strcpy(pName, NPC_NAME_MANACOLLECTOR); break; case 39: if (_tmp_sAppr2 != 0) strcpy(pName, NPC_NAME_DETECTOR_CK); else strcpy(pName, NPC_NAME_DETECTOR); break; case 40: strcpy(pName, NPC_NAME_ENERGYSHIELD); break; case 41: strcpy(pName, NPC_NAME_GRANDMAGICGENERATOR); break; case 42: strcpy(pName, NPC_NAME_MANASTONE); break; case 43: strcpy(pName, NPC_NAME_LIGHTWARBEETLE); break; case 44: strcpy(pName, NPC_NAME_GODSHANDKNIGHT); break; case 45: strcpy(pName, NPC_NAME_GODSHANDKNIGHT_CK); break; case 46: strcpy(pName, NPC_NAME_TEMPLEKNIGHT); break; case 47: strcpy(pName, NPC_NAME_BATTLEGOLEM); break; case 48: strcpy(pName, NPC_NAME_STALKER); break; case 49: strcpy(pName, NPC_NAME_HELLCLAW); break; case 50: strcpy(pName, NPC_NAME_TIGERWORM); break; case 51: strcpy(pName, NPC_NAME_CATAPULT); break; case 52: strcpy(pName, NPC_NAME_GARGOYLE); break; case 53: strcpy(pName, NPC_NAME_BEHOLDER); break; case 54: strcpy(pName, NPC_NAME_DARKELF); break; case 55: strcpy(pName, NPC_NAME_RABBIT); break; case 56: strcpy(pName, NPC_NAME_CAT); break; case 57: strcpy(pName, NPC_NAME_FROG); break; case 58: strcpy(pName, NPC_NAME_MOUNTAIN_GIANT); break; case 59: strcpy(pName, NPC_NAME_ETTIN); break; case 60: strcpy(pName, NPC_NAME_CANNIBAL); break; case 61: strcpy(pName, NPC_NAME_RUDOLPH); break; case 62: strcpy(pName, NPC_NAME_DIREBOAR); break; case 63: strcpy(pName, NPC_NAME_FROST); break; case 64: { switch((_tmp_sAppr2 & 0xFF00)>>8) { case 1: strcpy(pName, NPC_NAME_WATERMELON); break; case 2: strcpy(pName, NPC_NAME_PUMPKIN); break; case 3: strcpy(pName, NPC_NAME_GARLIC); break; case 4: strcpy(pName, NPC_NAME_BARLEY); break; case 5: strcpy(pName, NPC_NAME_CARROT); break; case 6: strcpy(pName, NPC_NAME_RADISH); break; case 7: strcpy(pName, NPC_NAME_CORN); break; case 8: strcpy(pName, NPC_NAME_BFLOWER); break; case 9: strcpy(pName, NPC_NAME_MELON); break; case 10: strcpy(pName, NPC_NAME_TOMATO); break; case 11: strcpy(pName, NPC_NAME_GRAPPE); break; case 12: strcpy(pName, NPC_NAME_BLUEGRAPPE); break; case 13: strcpy(pName, NPC_NAME_MUSHROM); break; case 14: strcpy(pName, NPC_NAME_GINSENG); break; default: strcpy(pName, NPC_NAME_CROP); break; } } break; case 65: strcpy(pName, NPC_NAME_ICEGOLEM); break; case 66: strcpy(pName, NPC_NAME_WYVERN); break; case 67: strcpy(pName, NPC_NAME_MCGAFFIN); break; case 68: strcpy(pName, NPC_NAME_PERRY); break; case 69: strcpy(pName, NPC_NAME_DEVLIN); break; case 70: strcpy(pName, NPC_NAME_DRAGON); break; case 71: strcpy(pName, NPC_NAME_CENTAUR); break; case 72: strcpy(pName, NPC_NAME_CLAWTUR); break; case 73: strcpy(pName, NPC_NAME_FIREWYV); break; case 74: strcpy(pName, NPC_NAME_GICRAYF); break; case 75: strcpy(pName, NPC_NAME_GILIZAR); break; case 76: strcpy(pName, NPC_NAME_GITREE); break; case 77: strcpy(pName, NPC_NAME_MASTORC); break; case 78: strcpy(pName, NPC_NAME_MINAUS); break; case 79: strcpy(pName, NPC_NAME_NIZIE); break; case 80: strcpy(pName, NPC_NAME_TENTOCL); break; case 81: strcpy(pName, NPC_NAME_ABADDON); break; case 82: strcpy(pName, NPC_NAME_SORCERS); break; case 83: strcpy(pName, NPC_NAME_ATK); break; case 84: strcpy(pName, NPC_NAME_MASTELF); break; case 85: strcpy(pName, NPC_NAME_DSK); break; case 86: strcpy(pName, NPC_NAME_HBT); break; case 87: strcpy(pName, NPC_NAME_CT); break; case 88: strcpy(pName, NPC_NAME_BARBAR); break; case 89: strcpy(pName, NPC_NAME_AGC); break; case 90: strcpy(pName, NPC_NAME_GAIL); break; case 91: strcpy(pName, NPC_NAME_GATE); break; // CLEROTH - NEW MONSTERS case 102: switch(m_side) { case ARESDEN: strcpy(pName, "Aresden Princess"); break; case ELVINE: strcpy(pName, "Elvine Princess"); break; case ISTRIA: strcpy(pName, "Istria Princess"); break; } break; case 110: strcpy(pName, NPC_NAME_AIRLEMENTAL); break; } } void CGame::GetItemName(CItem *pItem, char *pStr1, char *pStr2, char *pStr3) {int i; char cTxt[256], cTxt2[256], cName[51]; DWORD dwType1, dwType2, dwValue1, dwValue2, dwValue3; m_bIsSpecial = FALSE; ZeroMemory(cName, sizeof(cName)); ZeroMemory(pStr1, sizeof(pStr1)); ZeroMemory(pStr2, sizeof(pStr2)); ZeroMemory(pStr3, sizeof(pStr3)); strcpy(cName, pItem->m_cName); for (i = 0; i < MAXITEMNAMES; i++) if ((m_pItemNameList[i] != NULL) && (strcmp(m_pItemNameList[i]->m_cOriginName, pItem->m_cName) == 0)) { strcpy(cName, m_pItemNameList[i]->m_cName); break; } /* if (0 == memcmp(pItem->m_cName,"AcientTablet", 12)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"NecklaceOf", 10)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"DarkElfBow", 10)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"DarkExecutor", 12)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"The_Devastator", 14)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"DemonSlayer", 10)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"LightingBlade", 12)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"RubyRing", 8)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"SapphireRing", 12)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"Ringof", 6)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"MagicNecklace", 13)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"MagicWand(M.Shield)", 19)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"MagicWand(MS30-LLF)", 19)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"Merien", 6)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"BerserkWand", 11)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"ResurWand", 9)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"Blood", 5)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"Swordof", 7)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"StoneOf", 7)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"ZemstoneofSacrifice", 19)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"StormBringer", 12)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"Aresden", 7)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"Elvine", 6)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"EmeraldRing", 11)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"Excaliber", 9)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"Xelima", 6)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"Kloness", 7)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"aHeroOf", 7)) m_bIsSpecial = TRUE; else if (0 == memcmp(pItem->m_cName,"eHeroOf", 7)) m_bIsSpecial = TRUE;*/ if ((pItem->m_dwAttribute & 0x00000001) != 0) { m_bIsSpecial = TRUE; strcpy(pStr1, cName); if (pItem->m_cItemType == ITEMTYPE_MATERIAL) wsprintf(pStr2, GET_ITEM_NAME1, pItem->m_sItemSpecEffectValue2); //"Purity: %d%%" else { // Crafting Magins completion fix if (pItem->m_cEquipPos == EQUIPPOS_LFINGER) { wsprintf(pStr2, GET_ITEM_NAME2, pItem->m_sItemSpecEffectValue2); //"Completion: }else { wsprintf(pStr2, GET_ITEM_NAME2, pItem->m_sItemSpecEffectValue2 +100); //"Completion: +100 } } }else{ if (pItem->m_dwCount == 1) wsprintf(G_cTxt, "%s", cName); else wsprintf(G_cTxt, DRAW_DIALOGBOX_SELLOR_REPAIR_ITEM1, pItem->m_dwCount, cName);//"%d %s" strcpy(pStr1, G_cTxt); } if (strcmp(pItem->m_cName,"RingofOgrepower") == 0){ wsprintf(pStr2, "+%i ", 2); strcat(pStr2, LNG_DAMAGE); }else if (strcmp(pItem->m_cName,"RingofDemonpower") == 0){ wsprintf(pStr2, "+%i ", 4); strcat(pStr2, LNG_DAMAGE); }else if (strcmp(pItem->m_cName,"RingofDragonpower") == 0){ wsprintf(pStr2, "+%i ", 5); strcat(pStr2, LNG_DAMAGE); }else if (strcmp(pItem->m_cName,"RingoftheXelima") == 0){ wsprintf(pStr2, "+%i ", 7); strcat(pStr2, LNG_DAMAGE); }else if (strcmp(pItem->m_cName,"RingoftheAbaddon") == 0){ wsprintf(pStr2, "+%i ", 10); strcat(pStr2, LNG_DAMAGE); }else if (strcmp(pItem->m_cName,"RingofWizard") == 0){ wsprintf(pStr2, "+%i ", 2); strcat(pStr2, LNG_MAGICDAMAGE); }else if (strcmp(pItem->m_cName,"RingofMage") == 0){ wsprintf(pStr2, "+%i ", 4); strcat(pStr2, LNG_MAGICDAMAGE); }else if (strcmp(pItem->m_cName,"RingofGrandMage") == 0){ wsprintf(pStr2, "+%i ", 5); strcat(pStr2, LNG_MAGICDAMAGE); }else if (strcmp(pItem->m_cName,"RingofArchmage") == 0){ wsprintf(pStr2, "+%i ", 7); strcat(pStr2, LNG_MAGICDAMAGE); }else if (strcmp(pItem->m_cName,"ZemstoneofSacrifice") == 0) { wsprintf(pStr2, GET_ITEM_NAME36, pItem->m_wCurLifeSpan); } if ((pItem->m_dwAttribute & 0x00F0F000) != 0) { m_bIsSpecial = TRUE; dwType1 = (pItem->m_dwAttribute & 0x00F00000) >> 20; dwValue1 = (pItem->m_dwAttribute & 0x000F0000) >> 16; dwType2 = (pItem->m_dwAttribute & 0x0000F000) >> 12; dwValue2 = (pItem->m_dwAttribute & 0x00000F00) >> 8; if (dwType1 != 0) { ZeroMemory(cTxt, sizeof(cTxt)); switch (dwType1) { case 1: strcpy(cTxt, GET_ITEM_NAME3); break; case 2: strcpy(cTxt, GET_ITEM_NAME4); break; // "Poisoning " case 3: strcpy(cTxt, GET_ITEM_NAME5); break; // "Righteous " case 4: break; case 5: strcpy(cTxt, GET_ITEM_NAME6); break; // "Agile " case 6: strcpy(cTxt, GET_ITEM_NAME7); break; case 7: strcpy(cTxt, GET_ITEM_NAME8); break; case 8: strcpy(cTxt, GET_ITEM_NAME9); break; case 9: strcpy(cTxt, GET_ITEM_NAME10); break; case 10: strcpy(cTxt, GET_ITEM_NAME11); break; case 11: strcpy(cTxt, GET_ITEM_NAME12); break; case 12: strcpy(cTxt, GET_ITEM_NAME13); break; } strcat(cTxt, pStr1); ZeroMemory(pStr1, sizeof(pStr1)); strcpy(pStr1, cTxt); ZeroMemory(cTxt, sizeof(cTxt)); switch (dwType1) { case 1: wsprintf(cTxt, GET_ITEM_NAME14, dwValue1); break; // "Critical Hit Damage+%d" case 2: wsprintf(cTxt, GET_ITEM_NAME15, dwValue1*5); break; // "Poison Damage+%d" case 3: break; case 4: break; case 5: strcpy(cTxt, GET_ITEM_NAME16); break; // "Attack Speed -1" case 6: wsprintf(cTxt, GET_ITEM_NAME17, dwValue1*4); break; case 7: strcpy(cTxt, GET_ITEM_NAME18); break; case 8: wsprintf(cTxt, GET_ITEM_NAME19, dwValue1*7); break; case 9: strcpy(cTxt, GET_ITEM_NAME20); break; case 10: wsprintf(cTxt, GET_ITEM_NAME21, dwValue1*3); break; case 11: wsprintf(cTxt, GET_ITEM_NAME22, dwValue1); break; case 12: wsprintf(cTxt, GET_ITEM_NAME23, dwValue1); break; } strcat(pStr2, cTxt); } if (dwType2 != 0) { ZeroMemory(cTxt, sizeof(cTxt)); switch (dwType2) { case 1: wsprintf(cTxt, GET_ITEM_NAME24, dwValue2*7); break;//PR case 2: wsprintf(cTxt, GET_ITEM_NAME25, dwValue2*7); break;//Hit Prob case 3: wsprintf(cTxt, GET_ITEM_NAME26, dwValue2*7); break;//DR case 4: wsprintf(cTxt, GET_ITEM_NAME27, dwValue2*7); break;//HP rec case 5: wsprintf(cTxt, GET_ITEM_NAME28, dwValue2*7); break;//SP rec case 6: wsprintf(cTxt, GET_ITEM_NAME29, dwValue2*7); break;//MP rec case 7: wsprintf(cTxt, GET_ITEM_NAME30, dwValue2*7); break;//MR case 8: wsprintf(cTxt, GET_ITEM_NAME31, dwValue2*3); break;//PA case 9: wsprintf(cTxt, GET_ITEM_NAME32, dwValue2*3); break;//MA case 10: wsprintf(cTxt, GET_ITEM_NAME33, dwValue2); break;//Rep case 11: wsprintf(cTxt, GET_ITEM_NAME34, dwValue2*10); break;//Exp case 12: wsprintf(cTxt, GET_ITEM_NAME35, dwValue2*10); break;//Gold +% } strcpy(pStr3, cTxt); } } dwValue3 = (pItem->m_dwAttribute & 0xF0000000) >> 28; if (dwValue3 > 0) { if (pStr1[strlen(pStr1)-2] == '+') { dwValue3 = atoi((char *)(pStr1 + strlen(pStr1)-1)) + dwValue3; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, pStr1, strlen(pStr1)-2); ZeroMemory(cTxt2, sizeof(cTxt2)); wsprintf(cTxt2, "%s+%d", cTxt, dwValue3); ZeroMemory(pStr1, sizeof(pStr1)); strcpy(pStr1, cTxt2); }else { ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, "+%d", dwValue3); strcat(pStr1, cTxt); } } } void CGame::GetItemName(char * cItemName, DWORD dwAttribute, char *pStr1, char *pStr2, char *pStr3) { int i; char cTxt[256], cTxt2[256], cName[51]; DWORD dwType1, dwType2, dwValue1, dwValue2, dwValue3; m_bIsSpecial = FALSE; ZeroMemory(cName, sizeof(cName)); ZeroMemory(pStr1, sizeof(pStr1)); ZeroMemory(pStr2, sizeof(pStr2)); ZeroMemory(pStr3, sizeof(pStr3)); strcpy(cName, cItemName); for (i = 0; i < MAXITEMNAMES; i++) if ((m_pItemNameList[i] != NULL) && (strcmp(m_pItemNameList[i]->m_cOriginName, cItemName) == 0)) { strcpy(cName, m_pItemNameList[i]->m_cName); break; } /* if (0 == memcmp(cItemName,"AcientTablet", 12)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"NecklaceOf", 10)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"DarkElfBow", 10)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"DarkExecutor", 12)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"The_Devastator", 14)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"DemonSlayer", 10)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"LightingBlade", 12)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"RubyRing", 8)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"SapphireRing", 12)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"Ringof", 6)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"MagicNecklace", 13)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"MagicWand(M.Shield)", 19)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"MagicWand(MS30-LLF)", 19)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"Merien", 6)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"BerserkWand", 11)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"ResurWand", 9)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"Blood", 5)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"Swordof", 7)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"StoneOf", 7)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"ZemstoneofSacrifice", 19)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"StormBringer", 12)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"Aresden", 7)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"Elvine", 6)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"EmeraldRing", 11)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"Excaliber", 9)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"Xelima", 6)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"Kloness", 7)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"aHeroOf", 7)) m_bIsSpecial = TRUE; else if (0 == memcmp(cItemName,"eHeroOf", 7)) m_bIsSpecial = TRUE;*/ strcpy(pStr1, cName); if ((dwAttribute & 0x00F0F000) != 0) { m_bIsSpecial = TRUE; dwType1 = (dwAttribute & 0x00F00000) >> 20; dwValue1 = (dwAttribute & 0x000F0000) >> 16; dwType2 = (dwAttribute & 0x0000F000) >> 12; dwValue2 = (dwAttribute & 0x00000F00) >> 8; if (dwType1 != 0) { ZeroMemory(cTxt, sizeof(cTxt)); switch (dwType1) { case 1: strcpy(cTxt, GET_ITEM_NAME3); break; case 2: strcpy(cTxt, GET_ITEM_NAME4); break; case 3: strcpy(cTxt, GET_ITEM_NAME5); break; case 4: break; case 5: strcpy(cTxt, GET_ITEM_NAME6); break; case 6: strcpy(cTxt, GET_ITEM_NAME7); break; case 7: strcpy(cTxt, GET_ITEM_NAME8); break; case 8: strcpy(cTxt, GET_ITEM_NAME9); break; case 9: strcpy(cTxt, GET_ITEM_NAME10); break; case 10: strcpy(cTxt, GET_ITEM_NAME11); break; case 11: strcpy(cTxt, GET_ITEM_NAME12); break; case 12: strcpy(cTxt, GET_ITEM_NAME13); break; } strcat(cTxt, pStr1); ZeroMemory(pStr1, sizeof(pStr1)); strcpy(pStr1, cTxt); ZeroMemory(cTxt, sizeof(cTxt)); switch (dwType1) { case 1: wsprintf(cTxt, GET_ITEM_NAME14, dwValue1); break; case 2: wsprintf(cTxt, GET_ITEM_NAME15, dwValue1*5); break; case 3: break; case 4: break; case 5: strcpy(cTxt, GET_ITEM_NAME16); break; case 6: wsprintf(cTxt, GET_ITEM_NAME17, dwValue1*4); break; case 7: strcpy(cTxt, GET_ITEM_NAME18); break; case 8: wsprintf(cTxt, GET_ITEM_NAME19, dwValue1*7); break; case 9: strcpy(cTxt, GET_ITEM_NAME20); break; case 10: wsprintf(cTxt, GET_ITEM_NAME21, dwValue1*3); break; case 11: wsprintf(cTxt, GET_ITEM_NAME22, dwValue1); break; case 12: wsprintf(cTxt, GET_ITEM_NAME23, dwValue1); break; } strcat(pStr2, cTxt); if (dwType2 != 0) { ZeroMemory(cTxt, sizeof(cTxt)); switch (dwType2) { case 1: wsprintf(cTxt, GET_ITEM_NAME24, dwValue2*7); break; case 2: wsprintf(cTxt, GET_ITEM_NAME25, dwValue2*7); break; case 3: wsprintf(cTxt, GET_ITEM_NAME26, dwValue2*7); break; case 4: wsprintf(cTxt, GET_ITEM_NAME27, dwValue2*7); break; case 5: wsprintf(cTxt, GET_ITEM_NAME28, dwValue2*7); break; case 6: wsprintf(cTxt, GET_ITEM_NAME29, dwValue2*7); break; case 7: wsprintf(cTxt, GET_ITEM_NAME30, dwValue2*7); break; case 8: wsprintf(cTxt, GET_ITEM_NAME31, dwValue2*3); break; case 9: wsprintf(cTxt, GET_ITEM_NAME32, dwValue2*3); break; case 10: wsprintf(cTxt, GET_ITEM_NAME33, dwValue2); break; case 11: wsprintf(cTxt, GET_ITEM_NAME34, dwValue2*10); break; case 12: wsprintf(cTxt, GET_ITEM_NAME35, dwValue2*10); break; } strcpy(pStr3, cTxt); } } } dwValue3 = (dwAttribute & 0xF0000000) >> 28; if (dwValue3 > 0) { if (pStr1[strlen(pStr1)-2] == '+') { dwValue3 = atoi((char *)(pStr1 + strlen(pStr1)-1)) + dwValue3; ZeroMemory(cTxt, sizeof(cTxt)); memcpy(cTxt, pStr1, strlen(pStr1)-2); ZeroMemory(cTxt2, sizeof(cTxt2)); wsprintf(cTxt2, "%s+%d", cTxt, dwValue3); ZeroMemory(pStr1, sizeof(pStr1)); strcpy(pStr1, cTxt2); }else { ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, "+%d", dwValue3); strcat(pStr1, cTxt); } } } void CGame::_CalcSocketClosed() { if (m_cGameMode == GAMEMODE_ONMAINGAME) { delete m_pGSock; m_pGSock = NULL; m_bEscPressed = FALSE; PlaySound('E', 14, 5); if (m_bSoundFlag) m_pESound[38]->bStop(); if ((m_bSoundFlag) && (m_bMusicStat == TRUE)) { if (m_pBGM != NULL) m_pBGM->bStop(); } ChangeGameMode(GAMEMODE_ONQUIT); } } void CGame::PointCommandHandler(int indexX, int indexY, char cItemID) { char cTemp[31]; if ((m_iPointCommandType >= 100) && (m_iPointCommandType < 200)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_MAGIC, NULL, indexX, indexY, m_iPointCommandType, NULL); } else if ((m_iPointCommandType >= 0) && (m_iPointCommandType < 50)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_USEITEM, NULL, m_iPointCommandType, indexX, indexY, cTemp, cItemID); if (m_pItemList[m_iPointCommandType]->m_cItemType == ITEMTYPE_USE_SKILL) m_bSkillUsingStatus = TRUE; else if (m_pItemList[m_iPointCommandType]->m_cItemType == ITEMTYPE_USE_DEPLETE_DEST && m_pItemList[m_iPointCommandType]->m_wCurLifeSpan > 1) // prevent exhausting by client m_pItemList[m_iPointCommandType]->m_wCurLifeSpan--; } else if (m_iPointCommandType == 200) { if ((strlen(m_cMCName) == 0) || (strcmp(m_cMCName, m_cPlayerName) == 0) || (m_cMCName[0] == '_')) { m_stDialogBoxInfo[32].cMode = 0; PlaySound('E', 14, 5); AddEventList(POINT_COMMAND_HANDLER1, 10); } else { m_stDialogBoxInfo[32].cMode = 3; PlaySound('E', 14, 5); ZeroMemory(m_stDialogBoxInfo[32].cStr, sizeof(m_stDialogBoxInfo[32].cStr)); strcpy(m_stDialogBoxInfo[32].cStr, m_cMCName); bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQUEST_JOINPARTY, NULL, 1, NULL, NULL, m_cMCName); return; } } else if (m_iPointCommandType == 250) { for(int i = 0; i < m_iTotalFriends; i++) //Can't add friend twice if(strcmp(friendsList[i].friendName, m_cMCName) == 0){ AddEventList("You cannot add the same player twice.",10); PlaySound('E', 24, 5); return; } if ((strlen(m_cMCName) == 0) || (strcmp(m_cMCName, m_cPlayerName) == 0) || (m_cMCName[0] == '_')) { PlaySound('E', 24, 5); }else { PlaySound('E', 14, 5); memcpy(friendsList[m_iTotalFriends].friendName,m_cMCName,10); m_iTotalFriends++; m_stDialogBoxInfo[43].sV1=0; SaveFriendList(); UpdateFriendsStatus(); } } } void CGame::UpdateScreen_OnGame() { short sVal, sDivX, sModX, sDivY, sModY, sPivotX, sPivotY, sVPXsave, sVPYsave; static int iUpdateRet = -1; short msX, msY, msZ, absX, absY, tX, tY; char cLB, cRB, cMB; char cItemColor; int i, iAmount; DWORD dwTime = timeGetTime(); static DWORD dwPrevChatTime = 0; static int imX = 0, imY = 0; if (m_cGameModeCount == 0) { m_DDraw.ClearBackB4(); m_dwFPStime = m_dwCheckConnTime = m_dwCheckSprTime = m_dwCheckChatTime = dwTime; m_iFrameCount = 0; if( m_bMusicStat ) StartBGM(); //if(m_iLevel < 40) AddEventList(UPDATE_SCREEN_ONGAME12, 10); } m_cGameModeCount++; if (m_cGameModeCount > 20) m_cGameModeCount = 20; // ---------------------------------------------------- cLB = cRB = cMB = 0; m_DInput.UpdateMouseState(&msX, &msY, &msZ, &cLB, &cRB, &cMB); m_dwCurTime = timeGetTime(); if (m_bEnterPressed == TRUE) { m_bEnterPressed = FALSE; if ((m_bIsDialogEnabled[7] == TRUE) && (m_stDialogBoxInfo[7].cMode == 1) && (iGetTopDialogBoxIndex() == 7)) { EndInputString(); m_bEnterPressed = FALSE; if (strlen(m_cGuildName) == 0) return; if (strcmp(m_cGuildName, "NONE") != 0) { bSendCommand(MSGID_REQUEST_CREATENEWGUILD, MSGTYPE_CONFIRM, NULL, NULL, NULL, NULL, NULL); m_stDialogBoxInfo[7].cMode = 2; // } } else if ((m_bIsDialogEnabled[17] == TRUE) && (m_stDialogBoxInfo[17].cMode == 1) && (iGetTopDialogBoxIndex() == 17)) { // Drop Item Query EndInputString(); if (m_bSkillUsingStatus == TRUE) { AddEventList(UPDATE_SCREEN_ONGAME1, 10); return; } if ( (m_bIsDialogEnabled[20] == TRUE) && ((m_stDialogBoxInfo[20].cMode == 1) || (m_stDialogBoxInfo[20].cMode == 2)) ) { AddEventList(UPDATE_SCREEN_ONGAME1, 10);//"You can not give or drop before the actual Item transaction." return; } if ( (m_bIsDialogEnabled[4] == TRUE) || (m_bIsDialogEnabled[23] == TRUE) || (m_bIsDialogEnabled[26] == TRUE)) { AddEventList(UPDATE_SCREEN_ONGAME1, 10); return; } if (strlen(m_cAmountString) == 0) return; iAmount = atoi(m_cAmountString); if ((int)(m_pItemList[m_stDialogBoxInfo[17].sView]->m_dwCount) < iAmount){ iAmount = m_pItemList[m_stDialogBoxInfo[17].sView]->m_dwCount ; } if (iAmount != 0) { if ((int)(m_pItemList[m_stDialogBoxInfo[17].sView]->m_dwCount) >= iAmount) { if (m_stDialogBoxInfo[17].sV1 != NULL) { absX = abs(m_stDialogBoxInfo[17].sV1 - m_sPlayerX); absY = abs(m_stDialogBoxInfo[17].sV2 - m_sPlayerY); if ((absX == 0) && (absY ==0)) AddEventList(UPDATE_SCREEN_ONGAME5, 10); else if ((absX <= 8) && (absY <= 8)) { switch (m_stDialogBoxInfo[17].sV3) { case 1: case 2: case 3: case 4: case 5: case 6: EnableDialogBox(20, 1, m_stDialogBoxInfo[17].sView, m_stDialogBoxInfo[17].sV3); m_stDialogBoxInfo[20].sV3 = iAmount; m_stDialogBoxInfo[20].sV4 = m_wCommObjectID; m_stDialogBoxInfo[20].sV5 = m_stDialogBoxInfo[17].sV1; m_stDialogBoxInfo[20].sV6 = m_stDialogBoxInfo[17].sV2; tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; ZeroMemory(m_stDialogBoxInfo[20].cStr, sizeof(m_stDialogBoxInfo[20].cStr)); strcpy(m_stDialogBoxInfo[20].cStr, m_stDialogBoxInfo[17].cStr); break; case 20: EnableDialogBox(20, 3, m_stDialogBoxInfo[17].sView, m_stDialogBoxInfo[17].sV3); m_stDialogBoxInfo[20].sV3 = iAmount; m_stDialogBoxInfo[20].sV4 = m_wCommObjectID; m_stDialogBoxInfo[20].sV5 = m_stDialogBoxInfo[17].sV1; m_stDialogBoxInfo[20].sV6 = m_stDialogBoxInfo[17].sV2; tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; ZeroMemory(m_stDialogBoxInfo[20].cStr, sizeof(m_stDialogBoxInfo[20].cStr)); GetNpcName(m_stDialogBoxInfo[17].sV3, m_stDialogBoxInfo[20].cStr); break; case 15: case 24: EnableDialogBox(20, 2, m_stDialogBoxInfo[17].sView, m_stDialogBoxInfo[17].sV3); m_stDialogBoxInfo[20].sV3 = iAmount; m_stDialogBoxInfo[20].sV4 = m_wCommObjectID; tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; ZeroMemory(m_stDialogBoxInfo[20].cStr, sizeof(m_stDialogBoxInfo[20].cStr)); GetNpcName(m_stDialogBoxInfo[17].sV3, m_stDialogBoxInfo[20].cStr); break; case 1000: // Trade stackable items // hum, déjà affiché? , j'attends le retour et je désactive! /*m_stDialogBoxInfo[27].sV1 = m_pItemList[m_stDialogBoxInfo[17].sV4]->m_sSprite; m_stDialogBoxInfo[27].sV2 = m_pItemList[m_stDialogBoxInfo[17].sV4]->m_sSpriteFrame; m_stDialogBoxInfo[27].sV3 = iAmount; m_stDialogBoxInfo[27].sV4 = m_pItemList[m_stDialogBoxInfo[17].sV4]->m_cItemColor;*/ if (m_stDialogBoxExchangeInfo[0].sV1 == -1) m_stDialogBoxExchangeInfo[0].sItemID = m_stDialogBoxInfo[17].sV4; else if (m_stDialogBoxExchangeInfo[1].sV1 == -1) m_stDialogBoxExchangeInfo[1].sItemID = m_stDialogBoxInfo[17].sV4; else if (m_stDialogBoxExchangeInfo[2].sV1 == -1) m_stDialogBoxExchangeInfo[2].sItemID = m_stDialogBoxInfo[17].sV4; else if (m_stDialogBoxExchangeInfo[3].sV1 == -1) m_stDialogBoxExchangeInfo[3].sItemID = m_stDialogBoxInfo[17].sV4; else return; // Impossible case, tested at function beginning bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_SETEXCHANGEITEM, NULL, m_stDialogBoxInfo[17].sV4, iAmount, NULL, NULL); break; case 1001: // Sell List for (i = 0; i < MAXSELLLIST; i++) if (m_stSellItemList[i].iIndex == -1) { m_stSellItemList[i].iIndex = m_stDialogBoxInfo[17].sV4; m_stSellItemList[i].iAmount = iAmount; m_bIsItemDisabled[m_stDialogBoxInfo[17].sV4] = TRUE; break; } if( i == MAXSELLLIST ) AddEventList(UPDATE_SCREEN_ONGAME6, 10); break; case 1002: if (_iGetBankItemCount() >= (MAXBANKITEMS-1)) AddEventList(DLGBOX_CLICK_NPCACTION_QUERY9, 10); else bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_GIVEITEMTOCHAR, m_stDialogBoxInfo[39].sV1, iAmount, m_stDialogBoxInfo[39].sV5, m_stDialogBoxInfo[39].sV6, m_pItemList[m_stDialogBoxInfo[39].sV1]->m_cName, m_stDialogBoxInfo[39].sV4); //v1.4 break; default: bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_GIVEITEMTOCHAR, (char)(m_stDialogBoxInfo[17].sView), iAmount, m_stDialogBoxInfo[17].sV1, m_stDialogBoxInfo[17].sV2, m_pItemList[m_stDialogBoxInfo[17].sView]->m_cName); break; } m_bIsItemDisabled[m_stDialogBoxInfo[17].sView] = TRUE; }else AddEventList(UPDATE_SCREEN_ONGAME7, 10); }else { if (iAmount <= 0) { AddEventList(UPDATE_SCREEN_ONGAME8, 10); }else { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_ITEMDROP, NULL, m_stDialogBoxInfo[17].sView, iAmount, NULL, m_pItemList[m_stDialogBoxInfo[17].sView]->m_cName); m_bIsItemDisabled[m_stDialogBoxInfo[17].sView] = TRUE; } } }else { AddEventList(UPDATE_SCREEN_ONGAME9, 10);//"You entered more quantity that you can carry." } } DisableDialogBox(17); }else { if (!m_bInputStatus) { switch( m_cBackupChatMsg[0] ){ case '!': case '@': case '#': case '$': case '^': ZeroMemory(m_cChatMsg, sizeof(m_cChatMsg)); m_cChatMsg[0] = m_cBackupChatMsg[0]; StartInputString(10, 414, sizeof(m_cChatMsg), m_cChatMsg); break; default: StartInputString(10, 414, sizeof(m_cChatMsg), m_cChatMsg); ClearInputString(); break; } }else { EndInputString(); ZeroMemory(G_cTxt, sizeof(G_cTxt)); ReceiveString((char *)G_cTxt); ZeroMemory(m_cBackupChatMsg, sizeof(m_cBackupChatMsg)); strcpy(m_cBackupChatMsg, G_cTxt); if ((m_dwCurTime - dwPrevChatTime) < 700) {}else { dwPrevChatTime = m_dwCurTime; m_curse.ConvertString( G_cTxt, strlen(G_cTxt) ); if ( strlen(G_cTxt) > 0 ) { if( (G_cTxt[0]=='!') || (G_cTxt[0]=='~')) { if( m_Misc.bCheckIMEString(G_cTxt) == FALSE ) return; } bSendCommand(MSGID_COMMAND_CHATMSG, NULL, NULL, NULL, NULL, NULL, G_cTxt); } } } } } sVPXsave = m_sViewPointX; sVPYsave = m_sViewPointY; if ((m_iCameraShakingDegree > 0) && (iUpdateRet != 0)) { m_sViewPointX += m_iCameraShakingDegree - (rand() % m_iCameraShakingDegree*2); m_sViewPointY += m_iCameraShakingDegree - (rand() % m_iCameraShakingDegree*2); m_iCameraShakingDegree--; if (m_iCameraShakingDegree <= 0) m_iCameraShakingDegree = 0; } sPivotX = m_pMapData->m_sPivotX; sPivotY = m_pMapData->m_sPivotY; sVal = m_sViewPointX - (sPivotX*32); sDivX = sVal / 32; sModX = sVal % 32; sVal = m_sViewPointY - (sPivotY*32); sDivY = sVal / 32; sModY = sVal % 32; if (iUpdateRet != 0) DrawBackground(sDivX, sModX, sDivY, sModY); if (iUpdateRet != 0) DrawEffectLights(); if (iUpdateRet != 0) DrawObjects(sPivotX, sPivotY, sDivX, sDivY, sModX, sModY, msX, msY); if (iUpdateRet != 0) { DrawEffects(); DrawWhetherEffects(); DrawChatMsgs(-100, 0, 800, 600); WhetherObjectFrameCounter(); } if (m_cMapIndex == 26) //Snoopy: Add Apocalypse map effect (fires in inferniaA) { m_pEffectSpr[89]->PutTransSprite(1296 - m_sViewPointX, 1283 - m_sViewPointY, _tmp_iEffectFrame %12, 0); m_pEffectSpr[89]->PutTransSprite(1520 - m_sViewPointX, 1123 - m_sViewPointY, _tmp_iEffectFrame %12, 0); m_pEffectSpr[89]->PutTransSprite(1488 - m_sViewPointX, 3971 - m_sViewPointY, _tmp_iEffectFrame %12, 0); m_pEffectSpr[93]->PutTransSprite(2574 - m_sViewPointX, 3677 - m_sViewPointY, _tmp_iEffectFrame %12, 0); m_pEffectSpr[93]->PutTransSprite(3018 - m_sViewPointX, 3973 - m_sViewPointY, _tmp_iEffectFrame %12, 0); }else if (m_cMapIndex == 27) //Add Apocalypse map effect (fires in inferniaB) { m_pEffectSpr[89]->PutTransSprite(1293 - m_sViewPointX, 3657 - m_sViewPointY, _tmp_iEffectFrame %12, 0); m_pEffectSpr[89]->PutTransSprite(944 - m_sViewPointX, 3881 - m_sViewPointY, _tmp_iEffectFrame %12, 0); m_pEffectSpr[89]->PutTransSprite(1325 - m_sViewPointX, 4137 - m_sViewPointY, _tmp_iEffectFrame %12, 0); m_pEffectSpr[89]->PutTransSprite(1648 - m_sViewPointX, 3913 - m_sViewPointY, _tmp_iEffectFrame %12, 0); } //Snoopy: Add Apocalypse Gate and apocalypse map effects (if no Gate, m_iGatePositX will be -1... if ( (m_iGatePositX >= m_sViewPointX/32) && (m_iGatePositX <= m_sViewPointX/32 + 20) && (m_iGatePositY >= m_sViewPointY/32) && (m_iGatePositY <= m_sViewPointY/32 + 15)) { m_pEffectSpr[101]->PutTransSprite(m_iGatePositX*32 - m_sViewPointX - 96, m_iGatePositY*32 - m_sViewPointY - 69, _tmp_iEffectFrame%30, dwTime); } if (iUpdateRet != 0) DrawDialogBoxs(msX, msY, msZ, cLB); if ((iUpdateRet != 0) && m_bInputStatus) { if (((m_bIsDialogEnabled[7] == TRUE) && (m_stDialogBoxInfo[7].cMode == 1)) || ((m_bIsDialogEnabled[17] == TRUE) && (m_stDialogBoxInfo[17].cMode == 1)) ) {}else m_DDraw.DrawShadowBox(0, 413, 639, 429); ShowReceivedString(); } if (iUpdateRet != 0) ShowEventList(m_dwCurTime); if ( (iUpdateRet != 0) && (m_stMCursor.cSelectedObjectType == SELECTEDOBJTYPE_ITEM) && (m_pItemList[m_stMCursor.sSelectedObjectID] != NULL) ) { cItemColor = m_pItemList[m_stMCursor.sSelectedObjectID]->m_cItemColor; if (cItemColor != 0) { if ((m_pItemList[m_stMCursor.sSelectedObjectID]->m_cEquipPos == EQUIPPOS_LHAND) || (m_pItemList[m_stMCursor.sSelectedObjectID]->m_cEquipPos == EQUIPPOS_RHAND) || (m_pItemList[m_stMCursor.sSelectedObjectID]->m_cEquipPos == EQUIPPOS_TWOHAND)) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stMCursor.sSelectedObjectID]->m_sSprite]->PutSpriteRGB(msX - m_stMCursor.sDistX, msY - m_stMCursor.sDistY, m_pItemList[m_stMCursor.sSelectedObjectID]->m_sSpriteFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], dwTime); }else { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stMCursor.sSelectedObjectID]->m_sSprite]->PutSpriteRGB(msX - m_stMCursor.sDistX, msY - m_stMCursor.sDistY, m_pItemList[m_stMCursor.sSelectedObjectID]->m_sSpriteFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], dwTime); } }else m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stMCursor.sSelectedObjectID]->m_sSprite]->PutSpriteFast(msX - m_stMCursor.sDistX, msY - m_stMCursor.sDistY, m_pItemList[m_stMCursor.sSelectedObjectID]->m_sSpriteFrame, dwTime); char cStr1[64], cStr2[64], cStr3[64]; int iLoc; GetItemName(m_pItemList[m_stMCursor.sSelectedObjectID], cStr1, cStr2, cStr3); iLoc = 0; if (strlen(cStr1) != 0) { if(m_bIsSpecial) PutString(msX, msY +25, cStr1, RGB(0, 255, 0), FALSE, 1); else PutString(msX, msY +25, cStr1, RGB(255,255,255), FALSE, 1); iLoc += 15; } if (strlen(cStr2) != 0) { PutString(msX, msY +25 +iLoc, cStr2, RGB(150,150,150), FALSE, 1); iLoc += 15; } if (strlen(cStr3) != 0) { PutString(msX, msY +25 +iLoc, cStr3, RGB(150,150,150), FALSE, 1); iLoc += 15; } if ( (m_pItemList[m_stMCursor.sSelectedObjectID]->m_sLevelLimit != 0) && ((m_pItemList[m_stMCursor.sSelectedObjectID]->m_dwAttribute & 0x00000001) == 0) ) { wsprintf(G_cTxt, "%s: %d", DRAW_DIALOGBOX_SHOP24, m_pItemList[m_stMCursor.sSelectedObjectID]->m_sLevelLimit); PutString(msX, msY +25 +iLoc, G_cTxt, RGB(150,150,150), FALSE, 1); iLoc += 15; } if( (m_pItemList[m_stMCursor.sSelectedObjectID]->m_cEquipPos != EQUIPPOS_NONE) && (m_pItemList[m_stMCursor.sSelectedObjectID]->m_wWeight>=1100) ) { int _wWeight = 0; if(m_pItemList[m_stMCursor.sSelectedObjectID]->m_wWeight%100) _wWeight = 1; wsprintf( G_cTxt, DRAW_DIALOGBOX_SHOP15, m_pItemList[m_stMCursor.sSelectedObjectID]->m_wWeight/100 + _wWeight); PutString(msX, msY +25 +iLoc, G_cTxt, RGB(150,150,150), FALSE, 1); iLoc += 15; } if (m_pItemList[m_stMCursor.sSelectedObjectID]->m_cEquipPos != EQUIPPOS_NONE || !strcmp(m_pItemList[m_stMCursor.sSelectedObjectID]->m_cName,"ZemstoneofSacrifice")) { wsprintf(G_cTxt, UPDATE_SCREEN_ONGAME10, m_pItemList[m_stMCursor.sSelectedObjectID]->m_wCurLifeSpan); PutString(msX, msY +25 +iLoc, G_cTxt, RGB(150,150,150), FALSE, 1); iLoc += 15; } else if (m_pItemList[m_stMCursor.sSelectedObjectID]->m_cItemType == ITEMTYPE_USE_DEPLETE_DEST) { wsprintf(G_cTxt, UPDATE_SCREEN_ONGAME15, m_pItemList[m_stMCursor.sSelectedObjectID]->m_wCurLifeSpan); PutString(msX, msY +25 +iLoc, G_cTxt, RGB(150,150,150), FALSE, 1); iLoc += 15; } if ( iLoc == 15 ) { iLoc = 0; for ( int iTmp = 0 ; iTmp < MAXITEMS ; iTmp++ ) { if( m_pItemList[iTmp] != NULL ) { if( strcmp(m_pItemList[iTmp]->m_cName, m_pItemList[m_stMCursor.sSelectedObjectID]->m_cName ) == 0 ) iLoc++; } } if( iLoc > 1 ) { wsprintf(G_cTxt, MSG_TOTAL_NUMBER, iLoc); PutString(msX, msY + 40, G_cTxt, RGB(150,150,150), FALSE, 1); } } } //Snoopy: Add Apocalypse map effect (druncncity bubbles) if(iUpdateRet && m_cMapIndex == 25) { bAddNewEffect(13, m_sViewPointX + rand() %640, m_sViewPointY + rand() %480, 0, 0, -1*(rand() %80), 1); DrawDruncncity(); } if(iUpdateRet) { if (m_bIsHeldenianMode && m_bIsHeldenianMap) DrawHeldenianStats(); DrawTopMsg(); if(m_bIsAstoriaMode && memcmp(m_cCurLocation, "astoria", 7) == 0) { DrawAstoriaStats(); } } //if(iUpdateRet && m_stQuest.sQuestType) { // DrawQuestHelper(); //} #ifdef _DEBUG if(iUpdateRet){ wsprintf(G_cTxt, "M(%d,%d) T(%d,%d)", msX, msY, (m_sViewPointX + msX)/32, (m_sViewPointY + msY)/32); PutString(msX, msY +30, G_cTxt, RGB(255,255,255)); } #endif // LogOut process if (m_cLogOutCount > 0) { if ((dwTime - m_dwLogOutCountTime) > 1000) { m_cLogOutCount--; m_dwLogOutCountTime = dwTime; wsprintf(G_cTxt, UPDATE_SCREEN_ONGAME13, m_cLogOutCount); AddEventList(G_cTxt, 10); } } // Logout if (m_cLogOutCount == 0) { delete m_pGSock; m_pGSock = NULL; m_bEscPressed = FALSE; PlaySound('E', 14, 5); if (m_bSoundFlag) m_pESound[38]->bStop(); if ((m_bSoundFlag) && (m_bMusicStat == TRUE)) { if (m_pBGM != NULL) m_pBGM->bStop(); } if (strlen(G_cCmdLineTokenA) != 0) ChangeGameMode(GAMEMODE_ONQUIT); else ChangeGameMode(GAMEMODE_ONMAINMENU); return; } // Restart Process if (m_cRestartCount > 0) { if ((dwTime - m_dwRestartCountTime) > 1000) { m_cRestartCount--; m_dwRestartCountTime = dwTime; wsprintf(G_cTxt, UPDATE_SCREEN_ONGAME14, m_cRestartCount); // "Restarting game...%d" AddEventList(G_cTxt, 10); } } // Restart if (m_cRestartCount == 0) { m_cRestartCount = -1; bSendCommand(MSGID_REQUEST_RESTART, NULL, NULL, NULL, NULL, NULL, NULL); return; } //Snoopy: Added diag "LEVEL UP" right down if(iUpdateRet && m_iLU_Point >0) PutString_SprFont(560, 390, "Level Up", 250, 250, 0); if (m_cGameModeCount < 6) m_DDraw.DrawShadowBox(0,0,639,479); if (m_cGameModeCount < 2) m_DDraw.DrawShadowBox(0,0,639,479); if(iUpdateRet) { if (m_bIsObserverMode == TRUE) { m_DDraw.PutPixel(msX, msY, 255,255,255); m_DDraw.PutPixel(msX+1, msY, 255,255,255); m_DDraw.PutPixel(msX-1, msY, 255,255,255); m_DDraw.PutPixel(msX, msY+1, 255,255,255); m_DDraw.PutPixel(msX, msY-1, 255,255,255); } else m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, m_stMCursor.sCursorFrame, dwTime); } //if( iUpdateRet == 0 ) m_iFrameCount++; //else m_iFrameCount+=256; if( dwTime - m_dwFPStime > 1000 ) { m_dwFPStime = dwTime; m_iFPS = m_iFrameCount; m_iFrameCount = 0; } if(iUpdateRet != 0 && (dwTime - lastFriendUpdate) < 6000 && (dwTime - lastFriendUpdate) > 4000) for(int f = 0; f < 13; f++) if (friendsList[f].updated == false) friendsList[f].online = false; if( iUpdateRet != 0 ) { if( m_bShowFPS ) { wsprintf( G_cTxt, "Real FPS: %d", m_iFPS ); PutString( 10, 100, G_cTxt, RGB(255,255,255) ); } if( m_DDraw.iFlip() == DDERR_SURFACELOST ) RestoreSprites(); } // m_iPlayerStatus 0x000F //if((dwTime - lastScreenUpdate) > 1) { iUpdateRet = m_pMapData->iObjectFrameCounter(m_cPlayerName, m_sViewPointX, m_sViewPointY); lastScreenUpdate = dwTime; } //else iUpdateRet = 0; if ((bEffectFrameCounter() == TRUE) && (iUpdateRet == 0)) iUpdateRet = -1; if (iUpdateRet == 2) { m_bCommandAvailable = TRUE; m_dwCommandTime = 0; } CommandProcessor( msX, msY, ((sDivX + sPivotX)*32 + sModX + msX - 17)/32 + 1, ((sDivY + sPivotY)*32 + sModY + msY - 17)/32 + 1, cLB, cRB, cMB); m_sViewPointX = sVPXsave; m_sViewPointY = sVPYsave; if (iUpdateRet > 0) CalcViewPoint(); if (m_bIsObserverMode) { if ((dwTime - m_dwObserverCamTime) > 25) { m_dwObserverCamTime = dwTime; CalcViewPoint(); iUpdateRet = -1; } } if (iUpdateRet > 0) { if (m_bDrawFlagDir == FALSE) { m_iDrawFlag++; if (m_iDrawFlag >= 25) { m_iDrawFlag = 25; m_bDrawFlagDir = TRUE; } }else { m_iDrawFlag--; if (m_iDrawFlag < 0) { m_iDrawFlag = 0; m_bDrawFlagDir = FALSE; } } } // iUpdateRet } void CGame::DrawHeldenianStats() { wsprintf( G_cTxt, "Towers Left | Flags | Kills | Deaths"); PutString_SprFont3(5, 135, G_cTxt, m_wR[14]*4, m_wG[14]*4, m_wB[14]*4, TRUE, 2); wsprintf( G_cTxt, "%10s | %2d | %2d | %3d | %3d", sideName[ARESDEN], m_iHeldenianAresdenLeftTower, m_iHeldenianAresdenFlags, m_iHeldenianAresdenKill, m_iHeldenianAresdenDead); PutString_SprFont3(10, 155, G_cTxt, m_wR[14]*4, m_wG[14]*4, m_wB[14]*4, TRUE, 2); wsprintf( G_cTxt, "%10s | %2d | %2d | %3d | %3d", sideName[ELVINE], m_iHeldenianElvineLeftTower, m_iHeldenianElvineFlags, m_iHeldenianElvineKill, m_iHeldenianElvineDead); PutString_SprFont3(13, 170, G_cTxt, m_wR[14]*4, m_wG[14]*4, m_wB[14]*4, TRUE, 2); } void CGame::NotifyMsg_Heldenian(char * pData) { WORD *wp; wp = (WORD *)(pData + INDEX2_MSGTYPE + 2); m_iHeldenianAresdenLeftTower = *wp; wp++; m_iHeldenianAresdenFlags = *wp; wp++; m_iHeldenianAresdenKill = *wp; wp++; m_iHeldenianAresdenDead = *wp; wp++; m_iHeldenianElvineLeftTower = *wp; wp++; m_iHeldenianElvineFlags = *wp; wp++; m_iHeldenianElvineKill = *wp; wp++; m_iHeldenianElvineDead = *wp; } void CGame::StartBGM() { if( m_bSoundFlag == FALSE ) { if (m_pBGM != NULL) { m_pBGM->bStop(); delete m_pBGM; m_pBGM = NULL; } return; } char cWavFileName[32]; ZeroMemory( cWavFileName, sizeof(cWavFileName) ); if ((m_bIsXmas == TRUE) && (m_cWhetherEffectType >= 4)) strcpy( cWavFileName, "music\\Carol.wav" ); else { if (memcmp(m_cCurLocation, "aresden", 7) == 0) strcpy( cWavFileName, "music\\aresden.wav" ); else if (memcmp(m_cCurLocation, "elvine", 6) == 0) strcpy( cWavFileName, "music\\elvine.wav" ); else if (memcmp(m_cCurLocation, "dglv", 4) == 0) strcpy( cWavFileName, "music\\dungeon.wav" ); else if (memcmp(m_cCurLocation, "middled1", 8) == 0) strcpy( cWavFileName, "music\\dungeon.wav" ); else if (memcmp(m_cCurLocation, "middleland", 10) == 0) strcpy( cWavFileName, "music\\middleland.wav" ); // Snoopy: new musics else if (memcmp(m_cCurLocation, "druncncity", 10) == 0) strcpy( cWavFileName, "music\\druncncity.wav" ); else if (memcmp(m_cCurLocation, "inferniaA", 9) == 0) strcpy( cWavFileName, "music\\middleland.wav" ); else if (memcmp(m_cCurLocation, "inferniaB", 9) == 0) strcpy( cWavFileName, "music\\middleland.wav" ); else if (memcmp(m_cCurLocation, "maze", 4) == 0) strcpy( cWavFileName, "music\\dungeon.wav" ); else if (memcmp(m_cCurLocation, "abaddon", 7) == 0) strcpy( cWavFileName, "music\\abaddon.wav" ); else if (strcmp(m_cCurLocation, "istria") == 0) strcpy( cWavFileName, "music\\istria.wav" ); else if (strcmp(m_cCurLocation, "astoria") == 0) strcpy( cWavFileName, "music\\astoria.wav" ); else strcpy( cWavFileName, "music\\MainTm.wav" ); } if (m_pBGM != NULL) { if( strcmp( m_pBGM->m_cWavFileName, cWavFileName ) == 0 ) return; m_pBGM->bStop(); delete m_pBGM; m_pBGM = NULL; } int iVolume = (m_cMusicVolume - 100)*20; if (iVolume > 0) iVolume = 0; if (iVolume < -10000) iVolume = -10000; //iVolume == Volume m_pBGM = new class CSoundBuffer(m_DSound.m_lpDS, m_DSound.m_DSCaps, cWavFileName, TRUE); m_pBGM->Play(TRUE, 0, iVolume); } void CGame::MotionResponseHandler(char * pData) { WORD * wp, wResponse; short * sp, sX, sY; char * cp, cDir; int * ip, iPreHP; // 0 3 4 5 6 7 8 9 10 11 // Confirm Code(4) | MsgSize(4) | MsgID(4) | OBJECTMOVE_CONFIRM(2) | Loc-X(2) | Loc-Y(2) | Dir(1) | MapData ... // Confirm Code(4) | MsgSize(4) | MsgID(4) | OBJECTMOVE_REJECT(2) | Loc-X(2) | Loc-Y(2) wp = (WORD *)(pData + INDEX2_MSGTYPE); wResponse = *wp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); switch (wResponse) { case OBJECTMOTION_CONFIRM: m_cCommandCount--; break; case OBJECTMOTION_ATTACK_CONFIRM: m_cCommandCount--; break; case OBJECTMOTION_REJECT: if (m_iHP <= 0) return; sp = (short *)cp; m_sPlayerX = *sp; cp += 2; sp = (short *)cp; m_sPlayerY = *sp; cp += 2; m_cCommand = OBJECTSTOP; m_sCommX = m_sPlayerX; m_sCommY = m_sPlayerY; m_pMapData->bSetOwner(m_sPlayerObjectID, m_sPlayerX, m_sPlayerY, m_sPlayerType, m_cPlayerDir, m_sPlayerAppr1, m_sPlayerAppr2, m_sPlayerAppr3, m_sPlayerAppr4, m_iPlayerApprColor, m_iPlayerStatus, m_cPlayerName, OBJECTSTOP, NULL, NULL, NULL, NULL, 5); m_cCommandCount = 0; m_bIsGetPointingMode = FALSE; m_sViewDstX = m_sViewPointX = (m_sPlayerX-10)*32; m_sViewDstY = m_sViewPointY = (m_sPlayerY-7)*32; m_bIsRedrawPDBGS = TRUE; break; case OBJECTMOVE_CONFIRM: sp = (short *)cp; sX = *sp; cp += 2; sp = (short *)cp; sY = *sp; cp += 2; cDir = *cp; cp++; m_iSP = m_iSP - *cp; cp++; if( m_iSP < 0 ) m_iSP = 0; iPreHP = m_iHP; ip = (int *)cp; m_iHP = *ip; cp += 4; if (m_iHP != iPreHP) { if (m_iHP < iPreHP) { wsprintf(G_cTxt, NOTIFYMSG_HP_DOWN, iPreHP - m_iHP); AddEventList(G_cTxt, 10); m_dwDamagedTime = timeGetTime(); if ((m_cLogOutCount>0) && (m_bForceDisconn==FALSE)) { m_cLogOutCount = -1; AddEventList(MOTION_RESPONSE_HANDLER2, 10); } }else { wsprintf(G_cTxt, NOTIFYMSG_HP_UP, m_iHP - iPreHP); AddEventList(G_cTxt, 10); } } m_pMapData->ShiftMapData(cDir); _ReadMapData(sX, sY, cp); m_bIsRedrawPDBGS = TRUE; m_cCommandCount--; break; case OBJECTMOVE_REJECT: if (m_iHP <= 0) return; wp = (WORD *)cp; if (m_sPlayerObjectID != *wp) return; cp += 2; sp = (short *)cp; m_sPlayerX = *sp; cp += 2; sp = (short *)cp; m_sPlayerY = *sp; cp += 2; sp = (short *)cp; m_sPlayerType = *sp; cp += 2; m_cPlayerDir = *cp; cp++; //memcpy(cName, cp, 10); cp += 10; sp = (short *)cp; m_sPlayerAppr1 = *sp; cp += 2; sp = (short *)cp; m_sPlayerAppr2 = *sp; cp += 2; sp = (short *)cp; m_sPlayerAppr3 = *sp; cp += 2; sp = (short *)cp; m_sPlayerAppr4 = *sp; cp += 2; ip = (int *)cp; m_iPlayerApprColor = *ip; cp += 4; ip = (int *)cp; m_iPlayerStatus = *ip; cp += 4; m_cCommand = OBJECTSTOP; m_sCommX = m_sPlayerX; m_sCommY = m_sPlayerY; m_pMapData->bSetOwner(m_sPlayerObjectID, m_sPlayerX, m_sPlayerY, m_sPlayerType, m_cPlayerDir, m_sPlayerAppr1, m_sPlayerAppr2, m_sPlayerAppr3, m_sPlayerAppr4, m_iPlayerApprColor, m_iPlayerStatus, m_cPlayerName, OBJECTSTOP, NULL, NULL, NULL, 0, 11); m_cCommandCount = 0; m_bIsGetPointingMode = FALSE; m_sViewDstX = m_sViewPointX = (m_sPlayerX-10)*32; m_sViewDstY = m_sViewPointY = (m_sPlayerY-7)*32; m_bIsPrevMoveBlocked = TRUE; switch (m_sPlayerType) { case 1: case 2: case 3: PlaySound('C', 12, 0); break; case 4: case 5: case 6: PlaySound('C', 13, 0); break; } //m_bCommandAvailable = TRUE; break; } } void CGame::CommandProcessor(short msX, short msY, short indexX, short indexY, char cLB, char cRB, char cMB) { char cDir, absX, absY, cName[12]; short sX, sY, sObjectType, tX, tY, dynObjectType; int iObjectStatus; int iRet; DWORD dwTime = timeGetTime(); WORD wType = 0; int i;//, iFOE; char cTxt[120]; char pDstName[21]; short sDstOwnerType; int iDstOwnerStatus; BOOL bGORet; // Fixed by Snoopy if ((m_bIsObserverCommanded == FALSE) && (m_bIsObserverMode == TRUE)) { if ((msX == 0) && (msY == 0) && (m_sViewDstX > 32*21) && (m_sViewDstY > 32*16)) bSendCommand(MSGID_REQUEST_PANNING, NULL, 8, NULL, NULL, NULL, NULL); else if ((msX == 639) && (msY == 0) && (m_sViewDstX < 32*m_pMapData->m_sMapSizeX - 32*21) && (m_sViewDstY > 32*16)) bSendCommand(MSGID_REQUEST_PANNING, NULL, 2, NULL, NULL, NULL, NULL); else if ((msX == 639) && (msY == 479) && (m_sViewDstX < 32*m_pMapData->m_sMapSizeX - 32*21) && (m_sViewDstY < 32*m_pMapData->m_sMapSizeY - 32*16)) bSendCommand(MSGID_REQUEST_PANNING, NULL, 4, NULL, NULL, NULL, NULL); else if ((msX == 0) && (msY == 479) && (m_sViewDstX > 32*21) && (m_sViewDstY < 32*m_pMapData->m_sMapSizeY - 32*16) ) bSendCommand(MSGID_REQUEST_PANNING, NULL, 6, NULL, NULL, NULL, NULL); else if ((msX == 0) && (m_sViewDstX > 32*21)) bSendCommand(MSGID_REQUEST_PANNING, NULL, 7, NULL, NULL, NULL, NULL); else if ((msX == 639) && (m_sViewDstX < 32*m_pMapData->m_sMapSizeX - 32*21)) bSendCommand(MSGID_REQUEST_PANNING, NULL, 3, NULL, NULL, NULL, NULL); else if ((msY == 0) && (m_sViewDstY > 32*16)) bSendCommand(MSGID_REQUEST_PANNING, NULL, 1, NULL, NULL, NULL, NULL); else if ((msY == 479) && (m_sViewDstY < 32*m_pMapData->m_sMapSizeY - 32*16)) bSendCommand(MSGID_REQUEST_PANNING, NULL, 5, NULL, NULL, NULL, NULL); else return; m_bIsObserverCommanded = TRUE; m_cArrowPressed = 0; return; } if (m_bIsObserverMode == TRUE) return; if (GetAsyncKeyState(VK_MENU)>>15) // [ALT] m_bSuperAttackMode = TRUE; else m_bSuperAttackMode = FALSE; switch (m_stMCursor.cPrevStatus) { case CURSORSTATUS_NULL: if (cLB != 0) { iRet = _iCheckDlgBoxFocus(msX, msY, 1); if (iRet == 1) { m_stMCursor.cPrevStatus = CURSORSTATUS_SELECTED; return; }else if (iRet == 0) { m_stMCursor.cPrevStatus = CURSORSTATUS_PRESSED; // Snoopy: Added Golden LevelUp if ( (msX >560) && (msX <620) && (msY>390) && (msY<405) && (m_iLU_Point >0)) { if (m_bIsDialogEnabled[12] != TRUE) { EnableDialogBox(12, NULL, NULL, NULL); PlaySound('E', 14, 5); } m_stMCursor.cPrevStatus = CURSORSTATUS_NULL; return; } }else if (iRet == -1) { return; } }else if (cRB != 0) { iRet = _iCheckDlgBoxFocus(msX, msY, 2); if (iRet == 1) return; } break; case CURSORSTATUS_PRESSED: if (cLB == 0) // Normal Click { m_stMCursor.cPrevStatus = CURSORSTATUS_NULL; } break; case CURSORSTATUS_SELECTED: if (cLB == 0) { if ( ((dwTime - m_stMCursor.dwSelectClickTime) < DOUBLECLICKTIME) // Double Click && abs(msX - m_stMCursor.sClickX) < 2 && abs(msY - m_stMCursor.sClickY) <2 )//(msX == m_stMCursor.sClickX) && (msY == m_stMCursor.sClickY) ) { m_stMCursor.dwSelectClickTime = m_stMCursor.dwSelectClickTime; _bCheckDlgBoxDoubleClick(msX, msY); } _bCheckDlgBoxClick(msX, msY); m_stMCursor.sClickX = msX; m_stMCursor.sClickY = msY; m_stMCursor.dwSelectClickTime = dwTime; m_stMCursor.cPrevStatus = CURSORSTATUS_NULL; if (m_stMCursor.cSelectedObjectType == SELECTEDOBJTYPE_ITEM) { _bCheckDraggingItemRelease(msX, msY); m_stMCursor.cSelectedObjectType = NULL; m_stMCursor.sSelectedObjectID = NULL; } return; } if (cLB != 0) { if ((m_pMapData->bIsTeleportLoc(m_sPlayerX, m_sPlayerY) == TRUE) && (m_cCommandCount == 0)) goto CP_SKIPMOUSEBUTTONSTATUS; if ((m_stMCursor.sPrevX != msX) || (m_stMCursor.sPrevY != msY)) { m_stMCursor.cPrevStatus = CURSORSTATUS_DRAGGING; m_stMCursor.sPrevX = msX; m_stMCursor.sPrevY = msY; if ( (m_stMCursor.cSelectedObjectType == SELECTEDOBJTYPE_DLGBOX) && ((m_stMCursor.sSelectedObjectID == 30) || (m_stMCursor.sSelectedObjectID == 29)) ) { m_stMCursor.cPrevStatus = CURSORSTATUS_NULL; } if ((m_stMCursor.cSelectedObjectType == SELECTEDOBJTYPE_DLGBOX) && (m_stMCursor.sSelectedObjectID == 7) && (m_stDialogBoxInfo[7].cMode == 1)) { EndInputString(); m_stDialogBoxInfo[7].cMode = 20; } // Query Drop Item Amount if ((m_stMCursor.cSelectedObjectType == SELECTEDOBJTYPE_DLGBOX) && (m_stMCursor.sSelectedObjectID == 17) && (m_stDialogBoxInfo[17].cMode == 1)) // Guild Menu { EndInputString(); m_stDialogBoxInfo[17].cMode = 20; } return; } if ((m_cCommand == OBJECTMOVE) || (m_cCommand == OBJECTRUN)) goto MOTION_COMMAND_PROCESS; return; } break; case CURSORSTATUS_DRAGGING: if (cLB != 0) { if ((m_pMapData->bIsTeleportLoc(m_sPlayerX, m_sPlayerY) == TRUE) && (m_cCommandCount == 0)) goto CP_SKIPMOUSEBUTTONSTATUS; if (m_stMCursor.cSelectedObjectType == SELECTEDOBJTYPE_DLGBOX) { m_stDialogBoxInfo[m_stMCursor.sSelectedObjectID].sX = msX - m_stMCursor.sDistX; m_stDialogBoxInfo[m_stMCursor.sSelectedObjectID].sY = msY - m_stMCursor.sDistY; } m_stMCursor.sPrevX = msX; m_stMCursor.sPrevY = msY; if ((m_cCommand == OBJECTMOVE) || (m_cCommand == OBJECTRUN)) goto MOTION_COMMAND_PROCESS; return; } if (cLB == 0) { switch (m_stMCursor.cSelectedObjectType) { case SELECTEDOBJTYPE_DLGBOX: if ((m_stMCursor.cSelectedObjectType == SELECTEDOBJTYPE_DLGBOX) && (m_stMCursor.sSelectedObjectID == 7) && (m_stDialogBoxInfo[7].cMode == 20)) { sX = m_stDialogBoxInfo[7].sX; sY = m_stDialogBoxInfo[7].sY; StartInputString(sX + 75, sY + 140, 21, m_cGuildName); m_stDialogBoxInfo[7].cMode = 1; } if ((m_stMCursor.cSelectedObjectType == SELECTEDOBJTYPE_DLGBOX) && (m_stMCursor.sSelectedObjectID == 17) && (m_stDialogBoxInfo[17].cMode == 20)) { // Query Drop Item Amount sX = m_stDialogBoxInfo[17].sX; sY = m_stDialogBoxInfo[17].sY; StartInputString(sX + 40, sY + 57, 11, m_cAmountString); m_stDialogBoxInfo[17].cMode = 1; } if ( m_stMCursor.sSelectedObjectID == 9 ) { if( msX < 320 ) m_stDialogBoxInfo[9].sX = 0; else m_stDialogBoxInfo[9].sX = 640 - m_stDialogBoxInfo[9].sSizeX; if( msY < 213 ) m_stDialogBoxInfo[9].sY = 0; else m_stDialogBoxInfo[9].sY = 427 - m_stDialogBoxInfo[9].sSizeY; } m_stMCursor.cPrevStatus = CURSORSTATUS_NULL; m_stMCursor.cSelectedObjectType = NULL; m_stMCursor.sSelectedObjectID = NULL; break; case SELECTEDOBJTYPE_ITEM: _bCheckDraggingItemRelease(msX, msY); m_stMCursor.cPrevStatus = CURSORSTATUS_NULL; m_stMCursor.cSelectedObjectType = NULL; m_stMCursor.sSelectedObjectID = NULL; break; default: m_stMCursor.cPrevStatus = CURSORSTATUS_NULL; m_stMCursor.cSelectedObjectType = NULL; m_stMCursor.sSelectedObjectID = NULL; break; } return; } break; } CP_SKIPMOUSEBUTTONSTATUS:; if (m_bCommandAvailable == FALSE) return; if ( (dwTime - m_dwCommandTime) < 300 ) { delete m_pGSock; m_pGSock = NULL; m_bEscPressed = FALSE; PlaySound('E', 14, 5); if (m_bSoundFlag) m_pESound[38]->bStop(); if ((m_bSoundFlag) && (m_bMusicStat == TRUE)) { if (m_pBGM != NULL) m_pBGM->bStop(); } if (strlen(G_cCmdLineTokenA) != 0) ChangeGameMode(GAMEMODE_ONQUIT); else ChangeGameMode(GAMEMODE_ONMAINMENU); return; } if (m_iHP <= 0) return; if (m_sDamageMove != 0) { m_cCommand = OBJECTDAMAGEMOVE; goto MOTION_COMMAND_PROCESS; } if (m_pMapData->bIsTeleportLoc(m_sPlayerX, m_sPlayerY) == TRUE && m_cCommandCount == 0) RequestTeleportAndWaitData(); // indexX, indexY if (cLB != 0) // Mouse Left button { if (m_bIsGetPointingMode == TRUE) { if ((m_sMCX != 0) || (m_sMCY != 0)) PointCommandHandler(m_sMCX, m_sMCY); else PointCommandHandler(indexX, indexY); m_bCommandAvailable = FALSE; m_dwCommandTime = timeGetTime(); m_bIsGetPointingMode = FALSE; return; } m_pMapData->bGetOwner(m_sMCX, m_sMCY-1, cName, &sObjectType, &iObjectStatus, &m_wCommObjectID); //m_pMapData->m_pData[dX][dY].m_sItemSprite if (memcmp(m_cMCName, m_cPlayerName, 10) == 0 && ( sObjectType <= 6 || m_pMapData->m_pData[m_sPlayerX-m_pMapData->m_sPivotX][m_sPlayerY-m_pMapData->m_sPivotY].m_sItemSprite != 0 )) {//if (memcmp(m_cMCName, m_cPlayerName, 10) == 0 && ( sObjectType <= 6 || m_pMapData->m_pData[15][15].m_sItemSprite != 0 )) { //if (memcmp(m_cMCName, m_cPlayerName, 10) == 0 && sObjectType <= 6){ if ((m_sPlayerType >= 1) && (m_sPlayerType <= 6)/* && ((m_sPlayerAppr2 & 0xF000) == 0)*/) { m_cCommand = OBJECTGETITEM; m_sCommX = m_sPlayerX; m_sCommY = m_sPlayerY; } }else { if( memcmp(m_cMCName, m_cPlayerName, 10) == 0 ) m_sMCY -= 1; if ((m_sMCX != 0) && (m_sMCY != 0)) // m_sMCX, m_sMCY { if (m_bCtrlPressed == TRUE) { m_pMapData->bGetOwner(m_sMCX, m_sMCY, cName, &sObjectType, &iObjectStatus, &m_wCommObjectID); if ( (iObjectStatus & 0x10) != 0) return; if ((sObjectType == 15) || (sObjectType == 20) || (sObjectType == 24)) return; m_stMCursor.sCursorFrame = 3; absX = abs(m_sPlayerX - m_sMCX); absY = abs(m_sPlayerY - m_sMCY); if ((absX <= 1) && (absY <= 1)) { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else if ( (absX <= 2) && (absY <= 2) // strike on Big mobs & gate from a range && ((sObjectType == 66)||(sObjectType == 73)||(sObjectType == 81)||(sObjectType == 91))) { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else // Pas au corp à corp { switch (_iGetWeaponSkillType()) { case 6: // Bow m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); break; case 5: // OpenHand case 7: // SS if (((absX == 2) && (absY == 2)) || ((absX == 0) && (absY == 2)) || ((absX == 2) && (absY == 0))) { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0)) { if (m_cSkillMastery[_iGetWeaponSkillType()] == 100) { m_cCommand = OBJECTATTACKMOVE; wType = _iGetAttackType(); }else { m_cCommand = OBJECTRUN; GetPlayerTurn(); } m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else { m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } }else { if ( (m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; // Staminar else m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } break; case 8: // LS if ( (absX <= 3) && (absY <= 3) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (_iGetAttackType() != 30)) // Crit without StormBlade { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else if ( (absX <= 5) && (absY <= 5) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (_iGetAttackType() == 30)) // Crit with StormBlade (by Snoopy) { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else if ( (absX <= 3) && (absY <= 3) && (_iGetAttackType() == 5)) // Normal hit with StormBlade (by Snoopy) { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else // Swing { if (((absX == 2) && (absY == 2)) || ((absX == 0) && (absY == 2)) || ((absX == 2) && (absY == 0)) && (_iGetAttackType() != 5)) // no Dash possible with StormBlade { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0)) { if (m_cSkillMastery[_iGetWeaponSkillType()] == 100) { m_cCommand = OBJECTATTACKMOVE; wType = _iGetAttackType(); }else { m_cCommand = OBJECTRUN; GetPlayerTurn(); } m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else { m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } }else { if ( (m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } } break; case 9: // Fencing if ((absX <= 4) && (absY <= 4) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } else { if (((absX == 2) && (absY == 2)) || ((absX == 0) && (absY == 2)) || ((absX == 2) && (absY == 0))) { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0)) { if (m_cSkillMastery[_iGetWeaponSkillType()] == 100) { m_cCommand = OBJECTATTACKMOVE; wType = _iGetAttackType(); } else { m_cCommand = OBJECTRUN; GetPlayerTurn(); } m_sCommX = m_sMCX; m_sCommY = m_sMCY; } else { m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } } else { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } } break; case 10: // Axe if ((absX <= 2) && (absY <= 2) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); }else { if (((absX == 2) && (absY == 2)) || ((absX == 0) && (absY == 2)) || ((absX == 2) && (absY == 0))) { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0)) { if (m_cSkillMastery[_iGetWeaponSkillType()] == 100) { m_cCommand = OBJECTATTACKMOVE; wType = _iGetAttackType(); }else { m_cCommand = OBJECTRUN; GetPlayerTurn(); } m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else { m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } }else { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } } break; case 14: // Hammer if ((absX <= 2) && (absY <= 2) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } else { if (((absX == 2) && (absY == 2)) || ((absX == 0) && (absY == 2)) || ((absX == 2) && (absY == 0))) { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0)) { if (m_cSkillMastery[_iGetWeaponSkillType()] == 100) { m_cCommand = OBJECTATTACKMOVE; wType = _iGetAttackType(); } else { m_cCommand = OBJECTRUN; GetPlayerTurn(); } m_sCommX = m_sMCX; m_sCommY = m_sMCY; } else { m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } } else { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } } break; case 21: // Wand if ((absX <= 2) && (absY <= 2) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } else { if (((absX == 2) && (absY == 2)) || ((absX == 0) && (absY == 2)) || ((absX == 2) && (absY == 0))) { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0)) { if (m_cSkillMastery[_iGetWeaponSkillType()] == 100) { m_cCommand = OBJECTATTACKMOVE; wType = _iGetAttackType(); } else { m_cCommand = OBJECTRUN; GetPlayerTurn(); } m_sCommX = m_sMCX; m_sCommY = m_sMCY; } else { m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } } else { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } } break; } } }else // CTRL not pressed { m_pMapData->bGetOwner(m_sMCX, m_sMCY, cName, &sObjectType, &iObjectStatus, &m_wCommObjectID, &dynObjectType); if (sObjectType >= 10 || ((sObjectType >= 1) && (sObjectType <= 6))) { switch (sObjectType) { // CLEROTH - NPC TALK case 15: // Jehovah - Changed so the shopkeeper reads case 8. EnableDialogBox(20, 8, 0, NULL); tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; m_stDialogBoxInfo[20].sV3 = 15; break; case 19: // Gandlf /*switch (cName[0]) { case '1':*/ EnableDialogBox(20, 0, 16, NULL); tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; m_stDialogBoxInfo[20].sV3 = 19; /* break; }*/ break; case 20: // Howard /*switch (cName[0]) { case '1':*/ EnableDialogBox(20, 0, 14, NULL); tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; m_stDialogBoxInfo[20].sV3 = 20; m_stDialogBoxInfo[39].sV3 = 20; m_stDialogBoxInfo[39].sV4 = m_wCommObjectID; m_stDialogBoxInfo[39].sV5 = m_sMCX; m_stDialogBoxInfo[39].sV6 = m_sMCY; /* break; }*/ break; case 24: // Jehovah - Changed so the blacksmith reads case 7. EnableDialogBox(20, 7, 0, NULL); tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; m_stDialogBoxInfo[20].sV3 = 24; m_stDialogBoxInfo[39].sV3 = 24; m_stDialogBoxInfo[39].sV4 = m_wCommObjectID; m_stDialogBoxInfo[39].sV5 = m_sMCX; m_stDialogBoxInfo[39].sV6 = m_sMCY; break; case 25: // Jehovah - Changed so the cityhall officer reads case 9. /*switch (cName[0]) { case '1':*/ EnableDialogBox(20, 9, 0, NULL); tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; m_stDialogBoxInfo[20].sV3 = 25; /* break; }*/ break; case 26: // Kennedy /*switch (cName[0]) { case '1':*/ EnableDialogBox(20, 0, 7, NULL); tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; m_stDialogBoxInfo[20].sV3 = 26; /* break; }*/ break; case 21: // Guard if ((_iGetFOE(iObjectStatus)>=0) && (!m_bIsCombatMode)) { EnableDialogBox(20, 4, NULL, NULL); tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; m_stDialogBoxInfo[20].sV3 = 21; } break; case 67: // McGaffin case 68: // Perry case 69: // Devlin if (!m_bIsCombatMode) { EnableDialogBox(20, 4, NULL, NULL); tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; m_stDialogBoxInfo[20].sV3 = sObjectType; } break; case 32: // Unicorn if (!m_bIsCombatMode) { EnableDialogBox(20, 4, NULL, NULL); tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; m_stDialogBoxInfo[20].sV3 = 32; } break; case 90: // Snoopy: Gail /*switch (cName[0]) { case '1':*/ EnableDialogBox(20, 6, 0, NULL); tX = msX - 117; tY = msY - 50; if (tX < 0) tX = 0; if ((tX + 235) > 639) tX = 639 - 235; if (tY < 0) tY = 0; if ((tY + 100) > 479) tY = 479 - 100; m_stDialogBoxInfo[20].sX = tX; m_stDialogBoxInfo[20].sY = tY; m_stDialogBoxInfo[20].sV3 = 90; /*break; }*/ break; default: // Other mobs if ( _iGetFOE(iObjectStatus) >= 0 ) break; if ( (sObjectType>=1) && (sObjectType<=6) && (m_bForceAttack==FALSE) ) break; absX = abs(m_sPlayerX - m_sMCX); absY = abs(m_sPlayerY - m_sMCY); if ((absX <= 1) && (absY <= 1)) { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else if ( (absX <= 2) && (absY <= 2) // strike on Big mobs & gate from a range && ((sObjectType == 66)||(sObjectType == 73)||(sObjectType == 81)||(sObjectType == 91))) { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else // Normal hit from a range. { switch (_iGetWeaponSkillType()) { case 6: // Bow m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); break; case 5: // Boxe case 7: // SS if ( (m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); break; case 8: // LS if ( (absX <= 3) && (absY <= 3) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (_iGetAttackType() != 30)) // Crit without StormBlade by Snoopy { if ((absX <= 1) && (absY <= 1) && (m_bShiftPressed || m_bRunningMode) && (m_iSP > 0)) m_cCommand = OBJECTATTACKMOVE; else m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); }else if ((absX <= 5) && (absY <= 5) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (_iGetAttackType() == 30)) // Crit with StormBlade by Snoopy { if ((absX <= 1) && (absY <= 1) && (m_bShiftPressed || m_bRunningMode) && (m_iSP > 0)) m_cCommand = OBJECTATTACKMOVE; else m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); }else if ((absX <= 3) && (absY <= 3) && (_iGetAttackType() == 5)) // Normal hit with StormBlade by Snoopy { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); }else { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } break; case 9: // Fencing if ((absX <= 4) && (absY <= 4) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { if ((absX <= 1) && (absY <= 1) && (m_bShiftPressed || m_bRunningMode) && (m_iSP > 0)) m_cCommand = OBJECTATTACKMOVE; else m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); }else { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } break; case 10: // if ((absX <= 2) && (absY <= 2) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { if ((absX <= 1) && (absY <= 1) && (m_bShiftPressed || m_bRunningMode) && (m_iSP > 0)) m_cCommand = OBJECTATTACKMOVE; else m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } else { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } break; case 14: // if ((absX <= 2) && (absY <= 2) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { if ((absX <= 1) && (absY <= 1) && (m_bShiftPressed || m_bRunningMode) && (m_iSP > 0)) m_cCommand = OBJECTATTACKMOVE; else m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } else { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } break; case 21: // if ((absX <= 2) && (absY <= 2) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { if ((absX <= 1) && (absY <= 1) && (m_bShiftPressed || m_bRunningMode) && (m_iSP > 0)) m_cCommand = OBJECTATTACKMOVE; else m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } else { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } break; } } break; } } else if ((dynObjectType == DYNAMICOBJECT_MINERAL1 || dynObjectType == DYNAMICOBJECT_MINERAL2) && ((m_sPlayerAppr2 & 0x0FF0) >> 4) == 25){ //Weapon = PickAxe if (abs(m_sPlayerX - m_sMCX) <= 1 && abs(m_sPlayerY - m_sMCY) <= 1) { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } else { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } } else { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; m_sCommX = m_sMCX; m_sCommY = m_sMCY; GetPlayerTurn(); } } }else { if ((m_bShiftPressed || m_bRunningMode) && (m_iSP > 0) && (m_sPlayerType >= 1) && (m_sPlayerType <= 6)) m_cCommand = OBJECTRUN; else m_cCommand = OBJECTMOVE; m_sCommX = indexX; m_sCommY = indexY; GetPlayerTurn(); } } }else if (cRB != 0) // Mouse Right button { m_cCommand = OBJECTSTOP; if (m_bIsGetPointingMode == TRUE) { m_bIsGetPointingMode = FALSE; AddEventList(COMMAND_PROCESSOR1, 10); } if (m_bCommandAvailable == FALSE) return; if (m_cCommandCount >= 6) return; if ((m_sMCX != 0) && (m_sMCY != 0)) { absX = abs(m_sPlayerX - m_sMCX); absY = abs(m_sPlayerY - m_sMCY); if( absX==0 && absY==0 ) return; if (m_bCtrlPressed == TRUE) { m_pMapData->bGetOwner(m_sMCX, m_sMCY, cName, &sObjectType, &iObjectStatus, &m_wCommObjectID); if ( (iObjectStatus & 0x10) != 0) return; if ((sObjectType == 15) || (sObjectType == 20) || (sObjectType == 24)) return; if ((absX <= 1) && (absY <= 1)) { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else if ( (absX <= 2) && (absY <= 2) // strike on Big mobs & gate from a range && ((sObjectType == 66)||(sObjectType == 73)||(sObjectType == 81)||(sObjectType == 91))) { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else { switch (_iGetWeaponSkillType()) { case 6: // Bow m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); break; case 5: // Boxe case 7: // SS break; case 8: // LS if ( (absX <= 3) && (absY <= 3) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (_iGetAttackType() != 30)) // without StormBlade by Snoopy { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else if ( (absX <= 5) && (absY <= 5) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (_iGetAttackType() == 30)) // with stormBlade crit by Snoopy { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else if ( (absX <= 3) && (absY <= 3) && (_iGetAttackType() == 5)) // with stormBlade no crit by Snoopy { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; } break; case 9: // Fencing if ((absX <= 4) && (absY <= 4) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } break; case 10: // if ((absX <= 2) && (absY <= 2) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } break; case 14: // if ((absX <= 2) && (absY <= 2) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } break; case 21: // if ((absX <= 2) && (absY <= 2) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } break; } } }else // CTRL not pressed { absX = abs(m_sPlayerX - m_sMCX); absY = abs(m_sPlayerY - m_sMCY); m_pMapData->bGetOwner(m_sMCX, m_sMCY, cName, &sObjectType, &iObjectStatus, &m_wCommObjectID, &dynObjectType); if (sObjectType >= 10 || ((sObjectType >= 1) && (sObjectType <= 6))) { switch (sObjectType) { case 15: case 19: case 20: case 24: case 25: case 26: // npcs case NPC_PRINCESS: break; default: // All "normal mobs" if ( _iGetFOE(iObjectStatus) >= 0 ) break; if ( (sObjectType>=1) && (sObjectType<=6) && (m_bForceAttack==FALSE) ) break; if ((absX <= 1) && (absY <= 1)) { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else if ( (absX <= 2) && (absY <= 2) // strike on Big mobs & gate from a range && ((sObjectType == 66)||(sObjectType == 73)||(sObjectType == 81)||(sObjectType == 91))) { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else // { switch (_iGetWeaponSkillType()) { case 6: // Bow m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); break; case 5: // Boxe case 7: // SS break; case 8: // LS if ( (absX <= 3) && (absY <= 3) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (_iGetAttackType() != 30)) // crit without StormBlade by Snoopy { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else if ( (absX <= 5) && (absY <= 5) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE) && (_iGetAttackType() == 30)) // with stormBlade crit by Snoopy { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; }else if ( (absX <= 3) && (absY <= 3) && (_iGetAttackType() == 5)) // with stormBlade no crit by Snoopy { wType = _iGetAttackType(); m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; } break; case 9: // fencing if ((absX <= 4) && (absY <= 4) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } break; case 10: // if ((absX <= 2) && (absY <= 2) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } break; case 14: // hammer if ((absX <= 2) && (absY <= 2) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } break; case 21: // wand if ((absX <= 2) && (absY <= 2) && (m_iSuperAttackLeft > 0) && (m_bSuperAttackMode == TRUE)) { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } break; } } break; } } else if ((dynObjectType == DYNAMICOBJECT_MINERAL1 || dynObjectType == DYNAMICOBJECT_MINERAL2) && ((m_sPlayerAppr2 & 0x0FF0) >> 4) == 25){ //Weapon = PickAxe if (absX <= 1 && absY <= 1) { m_cCommand = OBJECTATTACK; m_sCommX = m_sMCX; m_sCommY = m_sMCY; wType = _iGetAttackType(); } } } }else { cDir = m_Misc.cGetNextMoveDir(m_sPlayerX, m_sPlayerY, indexX, indexY); if (m_iHP <= 0) return; if (cDir == 0) return; if (m_cPlayerDir == cDir) return; ClearSkillUsingStatus(); m_cPlayerDir = cDir; bSendCommand(MSGID_COMMAND_MOTION, OBJECTSTOP, m_cPlayerDir, NULL, NULL, NULL, NULL); m_pMapData->bSetOwner(m_sPlayerObjectID, m_sPlayerX, m_sPlayerY, m_sPlayerType, m_cPlayerDir, m_sPlayerAppr1, m_sPlayerAppr2, m_sPlayerAppr3, m_sPlayerAppr4, m_iPlayerApprColor, m_iPlayerStatus, m_cPlayerName, m_cCommand, NULL, NULL, NULL, 0, 10); m_bCommandAvailable = FALSE; m_dwCommandTime = timeGetTime(); return; } } else if(cMB != 0){ } MOTION_COMMAND_PROCESS:; if (m_cCommand != OBJECTSTOP) { if (m_iHP <= 0) return; if (m_cCommandCount == 5) AddEventList(COMMAND_PROCESSOR2, 10, FALSE); if (m_bCommandAvailable == FALSE) return; if (m_cCommandCount >= 6) return; if (m_sPlayerType > 6) { switch (m_cCommand) { case OBJECTRUN: case OBJECTMAGIC: case OBJECTGETITEM: m_cCommand = OBJECTSTOP; break; } } ClearSkillUsingStatus(); if (m_sDamageMove != 0) { m_cCommand = OBJECTDAMAGEMOVE; m_sCommX = m_sPlayerX; m_sCommY = m_sPlayerY; switch (m_sDamageMove) { case 1: m_sCommY--; break; case 2: m_sCommX++; m_sCommY--; break; case 3: m_sCommX++; break; case 4: m_sCommX++; m_sCommY++; break; case 5: m_sCommY++; break; case 6: m_sCommX--; m_sCommY++; break; case 7: m_sCommX--; break; case 8: m_sCommX--; m_sCommY--; break; } for (i = 1; i < MAXCHATMSGS; i++) if (m_pChatMsgList[i] == NULL) { ZeroMemory(cTxt, sizeof(cTxt)); if (m_sDamageMoveAmount > 0) wsprintf(cTxt, "-%d", m_sDamageMoveAmount); //pts else strcpy(cTxt, COMMAND_PROCESSOR6); int iFontType; if ((m_sDamageMoveAmount >= 0) && (m_sDamageMoveAmount < 12)) iFontType = 21; else if ((m_sDamageMoveAmount >= 12) && (m_sDamageMoveAmount < 40)) iFontType = 22; else if ((m_sDamageMoveAmount >= 40) || (m_sDamageMoveAmount < 0)) iFontType = 23; m_pChatMsgList[i] = new class CMsg(iFontType, cTxt, m_dwCurTime); m_pChatMsgList[i]->m_iObjectID = m_sPlayerObjectID; if (m_pMapData->bSetChatMsgOwner(m_sPlayerObjectID, -10, -10, i) == FALSE) { delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } break; } m_sDamageMove = 0; } switch (m_cCommand) { case OBJECTRUN: case OBJECTMOVE: case OBJECTDAMAGEMOVE: if( m_bParalyze ) return; bGORet = m_pMapData->bGetOwner(m_sCommX, m_sCommY, pDstName, &sDstOwnerType, &iDstOwnerStatus, &m_wCommObjectID); if ((m_sPlayerX == m_sCommX) && (m_sPlayerY == m_sCommY)) m_cCommand = OBJECTSTOP; else if ( (abs(m_sPlayerX - m_sCommX) <= 1) && (abs(m_sPlayerY - m_sCommY) <= 1) && (bGORet == TRUE) && (sDstOwnerType != NULL) ) m_cCommand = OBJECTSTOP; else if((abs(m_sPlayerX - m_sCommX) <= 2) && (abs(m_sPlayerY - m_sCommY) <= 2) && (m_pMapData->m_tile[m_sCommX][m_sCommY].m_bIsMoveAllowed == FALSE)) m_cCommand = OBJECTSTOP; else { if( m_cCommand == OBJECTMOVE ) { if(m_bRunningMode || m_bShiftPressed) m_cCommand = OBJECTRUN; } if( m_cCommand == OBJECTRUN ) { if( (m_bRunningMode == FALSE) && (m_bShiftPressed == FALSE) ) m_cCommand = OBJECTMOVE; if( m_iSP < 1 ) m_cCommand = OBJECTMOVE; } cDir = cGetNextMoveDir(m_sPlayerX, m_sPlayerY, m_sCommX, m_sCommY, TRUE, m_bIllusionMVT); if (cDir != 0) { if(m_cLogOutCount > 0 && !m_bForceDisconn) { m_cLogOutCount = -1; AddEventList(COMMAND_PROCESSOR7, 10); } m_cPlayerDir = cDir; bSendCommand(MSGID_COMMAND_MOTION, m_cCommand, cDir, NULL, NULL, NULL, NULL); switch (cDir) { case 1: m_sPlayerY--; break; case 2: m_sPlayerY--; m_sPlayerX++; break; case 3: m_sPlayerX++; break; case 4: m_sPlayerX++; m_sPlayerY++; break; case 5: m_sPlayerY++; break; case 6: m_sPlayerX--; m_sPlayerY++; break; case 7: m_sPlayerX--; break; case 8: m_sPlayerX--; m_sPlayerY--; break; } #ifdef _DEBUG static int timez = timeGetTime(); wsprintf(G_cTxt, "Move: %i", timeGetTime() - timez); AddEventList(G_cTxt); timez = timeGetTime(); #endif m_pMapData->bSetOwner(m_sPlayerObjectID, m_sPlayerX, m_sPlayerY, m_sPlayerType, m_cPlayerDir, m_sPlayerAppr1, m_sPlayerAppr2, m_sPlayerAppr3, m_sPlayerAppr4, m_iPlayerApprColor, m_iPlayerStatus, m_cPlayerName, m_cCommand, NULL, NULL, NULL); m_bCommandAvailable = FALSE; m_dwCommandTime = timeGetTime(); m_iPrevMoveX = m_sPlayerX; m_iPrevMoveY = m_sPlayerY; } } if (m_cCommand == OBJECTDAMAGEMOVE) { m_bIsGetPointingMode = FALSE; m_iPointCommandType = -1; m_stMCursor.sCursorFrame = 0; ClearSkillUsingStatus(); m_cCommand = OBJECTSTOP; } break; case OBJECTATTACK: cDir = m_Misc.cGetNextMoveDir(m_sPlayerX, m_sPlayerY, m_sCommX, m_sCommY); // Snoopy: Illusion movement if (m_bIllusionMVT == TRUE) { cDir +=4; if (cDir >8) cDir -=8; } if (cDir != 0) { if ((wType == 2) || (wType == 25)) { if (_bCheckItemByType(ITEMTYPE_ARROW) == FALSE) wType = 0; } if (wType >= 20) { m_iSuperAttackLeft--; if (m_iSuperAttackLeft < 0) m_iSuperAttackLeft = 0; } m_cPlayerDir = cDir; bSendCommand(MSGID_COMMAND_MOTION, OBJECTATTACK, cDir, m_sCommX, m_sCommY, wType, NULL, m_wCommObjectID); m_pMapData->bSetOwner(m_sPlayerObjectID, m_sPlayerX, m_sPlayerY, m_sPlayerType, m_cPlayerDir, m_sPlayerAppr1, m_sPlayerAppr2, m_sPlayerAppr3, m_sPlayerAppr4, m_iPlayerApprColor, m_iPlayerStatus, m_cPlayerName, OBJECTATTACK, m_sCommX - m_sPlayerX, m_sCommY - m_sPlayerY, wType); m_bCommandAvailable = FALSE; m_dwCommandTime = timeGetTime(); } m_cCommand = OBJECTSTOP; break; case OBJECTATTACKMOVE: if( m_bParalyze ) return; bGORet = m_pMapData->bGetOwner(m_sCommX, m_sCommY, pDstName, &sDstOwnerType, &iDstOwnerStatus, &m_wCommObjectID); if ((m_sPlayerX == m_sCommX) && (m_sPlayerY == m_sCommY)) m_cCommand = OBJECTSTOP; else if ( (abs(m_sPlayerX - m_sCommX) <= 1) && (abs(m_sPlayerY - m_sCommY) <= 1) && (bGORet == TRUE) && (sDstOwnerType != NULL) ) m_cCommand = OBJECTSTOP; else { cDir = cGetNextMoveDir(m_sPlayerX, m_sPlayerY, m_sCommX, m_sCommY, TRUE, m_bIllusionMVT); if (cDir != 0) { m_cPlayerDir = cDir; bSendCommand(MSGID_COMMAND_MOTION, OBJECTATTACKMOVE, cDir, m_sCommX, m_sCommY, wType, NULL, m_wCommObjectID); switch (cDir) { case 1: m_sPlayerY--; break; case 2: m_sPlayerY--; m_sPlayerX++; break; case 3: m_sPlayerX++; break; case 4: m_sPlayerX++; m_sPlayerY++; break; case 5: m_sPlayerY++; break; case 6: m_sPlayerX--; m_sPlayerY++; break; case 7: m_sPlayerX--; break; case 8: m_sPlayerX--; m_sPlayerY--; break; } m_pMapData->bSetOwner(m_sPlayerObjectID, m_sPlayerX, m_sPlayerY, m_sPlayerType, m_cPlayerDir, m_sPlayerAppr1, m_sPlayerAppr2, m_sPlayerAppr3, m_sPlayerAppr4, m_iPlayerApprColor, m_iPlayerStatus, m_cPlayerName, m_cCommand, m_sCommX - m_sPlayerX, m_sCommY - m_sPlayerY, wType); m_bCommandAvailable = FALSE; m_dwCommandTime = timeGetTime(); m_iPrevMoveX = m_sPlayerX; m_iPrevMoveY = m_sPlayerY; } } m_cCommand = OBJECTSTOP; break; case OBJECTGETITEM: bSendCommand(MSGID_COMMAND_MOTION, OBJECTGETITEM, m_cPlayerDir, NULL, NULL, NULL, NULL); m_pMapData->bSetOwner(m_sPlayerObjectID, m_sPlayerX, m_sPlayerY, m_sPlayerType, m_cPlayerDir, m_sPlayerAppr1, m_sPlayerAppr2, m_sPlayerAppr3, m_sPlayerAppr4, m_iPlayerApprColor, m_iPlayerStatus, m_cPlayerName, OBJECTGETITEM, NULL, NULL, NULL); m_bCommandAvailable = FALSE; m_cCommand = OBJECTSTOP; break; case OBJECTMAGIC: bSendCommand(MSGID_COMMAND_MOTION, OBJECTMAGIC, m_cPlayerDir, m_iCastingMagicType, NULL, NULL, NULL); m_pMapData->bSetOwner(m_sPlayerObjectID, m_sPlayerX, m_sPlayerY, m_sPlayerType, m_cPlayerDir, m_sPlayerAppr1, m_sPlayerAppr2, m_sPlayerAppr3, m_sPlayerAppr4, m_iPlayerApprColor, m_iPlayerStatus, m_cPlayerName, OBJECTMAGIC, m_iCastingMagicType, NULL, NULL); m_bCommandAvailable = FALSE; m_dwCommandTime = timeGetTime(); m_bIsGetPointingMode = TRUE; m_cCommand = OBJECTSTOP; _RemoveChatMsgListByObjectID(m_sPlayerObjectID); for (i = 1; i < MAXCHATMSGS; i++) if (m_pChatMsgList[i] == NULL) { ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, "%s!", m_pMagicCfgList[m_iCastingMagicType]->m_cName); m_pChatMsgList[i] = new class CMsg(41, cTxt, timeGetTime()); m_pChatMsgList[i]->m_iObjectID = m_sPlayerObjectID; m_pMapData->bSetChatMsgOwner(m_sPlayerObjectID, -10, -10, i); return; } break; default: break; } } } void CGame::DrawDialogBox_Bank(short msX, short msY, short msZ, char cLB) { short sX, sY, szX; int i, iTotalLines, iPointerLoc, iLoc; double d1, d2, d3; char cItemColor, cStr1[64], cStr2[64], cStr3[64]; BOOL bFlag = FALSE; sX = m_stDialogBoxInfo[14].sX; sY = m_stDialogBoxInfo[14].sY; szX = m_stDialogBoxInfo[14].sSizeX - 5; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 21); ZeroMemory( cStr1, sizeof(cStr1) ); ZeroMemory( cStr2, sizeof(cStr2) ); ZeroMemory( cStr3, sizeof(cStr3) ); iLoc = 45; switch (m_stDialogBoxInfo[14].cMode) { case -1: PutString(sX + 30 + 15, sY + 70, DRAW_DIALOGBOX_BANK1, RGB(0,0,0));//" PutString(sX + 30 + 15, sY + 85, DRAW_DIALOGBOX_BANK2, RGB(0,0,0));//" break; case 0: for (i = 0; i < m_stDialogBoxInfo[14].sV1; i++) if ((m_pBankList[i + m_stDialogBoxInfo[14].sView] != NULL) && ((i + m_stDialogBoxInfo[14].sView) < MAXBANKITEMS)) { GetItemName(m_pBankList[i + m_stDialogBoxInfo[14].sView], cStr1, cStr2, cStr3); if ((msX > sX + 30) && (msX < sX + 210) && (msY >= sY + 110 + i*15) && (msY <= sY + 124 + i*15)) { bFlag = TRUE; PutAlignedString(sX, sX+szX, sY + 110 + i*15, cStr1, 255, 255, 255 ); if(m_bIsSpecial) PutAlignedString(sX + 70, sX + szX, sY + iLoc, cStr1, 0, 255, 0); else PutAlignedString(sX + 70, sX + szX, sY + iLoc, cStr1, 0, 0, 0); if( strlen(cStr2) > 0 ) { iLoc += 15; PutAlignedString(sX + 70, sX + szX, sY + iLoc, cStr2, 0, 255, 0); } if( strlen(cStr3) > 0 ) { iLoc += 15; PutAlignedString(sX + 70, sX + szX, sY + iLoc, cStr3, 0, 255, 0); } if( m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_sLevelLimit != 0 && m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_dwAttribute & 0x00000001 ) { iLoc += 15; wsprintf( G_cTxt, "%s: %d", DRAW_DIALOGBOX_SHOP24, m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_sLevelLimit ); PutAlignedString(sX + 70, sX + szX, sY + iLoc, G_cTxt, 0, 255, 0); } if( (m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_cEquipPos != EQUIPPOS_NONE) && (m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_wWeight>=1100) ) { iLoc += 15; int _wWeight = 0; if(m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_wWeight%100) _wWeight = 1; wsprintf( G_cTxt, DRAW_DIALOGBOX_SHOP15, m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_wWeight/100 + _wWeight); PutAlignedString(sX + 70, sX + szX, sY + iLoc, G_cTxt, 255, 255, 255); } cItemColor = m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_cItemColor; if( cItemColor == 0 ) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_sSprite]->PutSpriteFast(sX+60, sY+68, m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_sSpriteFrame, m_dwCurTime); }else { if ( (m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_cEquipPos == EQUIPPOS_LHAND) || (m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_cEquipPos == EQUIPPOS_RHAND) || (m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_cEquipPos == EQUIPPOS_TWOHAND)) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_sSprite]->PutSpriteRGB(sX+60, sY+68, m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_sSpriteFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], m_dwCurTime); }else m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_sSprite]->PutSpriteRGB(sX+60, sY+68, m_pBankList[i + m_stDialogBoxInfo[14].sView]->m_sSpriteFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } }else { if (m_bIsSpecial) PutAlignedString(sX, sX+szX, sY + 110 + i*15, cStr1, 0, 255, 0); else PutAlignedString(sX, sX+szX, sY + 110 + i*15, cStr1, 0, 0, 0); } } iTotalLines = 0; for (i = 0; i < MAXBANKITEMS; i++) if (m_pBankList[i] != NULL) iTotalLines++; if (iTotalLines > m_stDialogBoxInfo[14].sV1) { d1 = (double)m_stDialogBoxInfo[14].sView; d2 = (double)(iTotalLines-m_stDialogBoxInfo[14].sV1); d3 = (274.0f * d1)/d2; iPointerLoc = (int)d3; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 3); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX+242, sY + iPointerLoc + 35, 7); } else iPointerLoc = 0; if (cLB != 0 && (iGetTopDialogBoxIndex() == 14) && iTotalLines > m_stDialogBoxInfo[14].sV1) { if ((msX >= sX + 230) && (msX <= sX + 260) && (msY >= sY + 40) && (msY <= sY + 320)) { d1 = (double)(msY -(sY+35)); d2 = (double)(iTotalLines-m_stDialogBoxInfo[14].sV1); d3 = (d1 * d2)/274.0f; m_stDialogBoxInfo[14].sView = (int)(d3+0.5); } else if ((msX >= sX + 230) && (msX <= sX + 260) && (msY > sY + 10) && (msY < sY + 40)) m_stDialogBoxInfo[14].sView = 0; } else m_stDialogBoxInfo[14].bIsScrollSelected = FALSE; if( iGetTopDialogBoxIndex() == 14 && msZ != 0 ) { if( iTotalLines > 50 ) m_stDialogBoxInfo[14].sView = m_stDialogBoxInfo[14].sView - msZ/30; else {// if( msZ > 0 ) m_stDialogBoxInfo[14].sView--; if( msZ < 0 ) m_stDialogBoxInfo[14].sView++; } m_DInput.m_sZ = 0; } if( iTotalLines > m_stDialogBoxInfo[14].sV1 && m_stDialogBoxInfo[14].sView > iTotalLines-m_stDialogBoxInfo[14].sV1 ) m_stDialogBoxInfo[14].sView = iTotalLines-m_stDialogBoxInfo[14].sV1; if( iTotalLines <= m_stDialogBoxInfo[14].sV1 ) m_stDialogBoxInfo[14].sView = 0; if( m_stDialogBoxInfo[14].sView < 0 ) m_stDialogBoxInfo[14].sView = 0; if( bFlag == FALSE ) { PutAlignedString(sX, sX+szX, sY + 35, DRAW_DIALOGBOX_BANK3); PutAlignedString(sX, sX+szX, sY + 50, DRAW_DIALOGBOX_BANK4); PutAlignedString(sX, sX+szX, sY + 65, DRAW_DIALOGBOX_BANK5); wsprintf(G_cTxt, DRAW_DIALOGBOX_BANK6, iTotalLines, MAXBANKITEMS-1); PutAlignedString(sX, sX+szX, sY + 85, G_cTxt, 255, 255, 255); } break; } } void CGame::DrawDialogBox_FeedBackCard(short msX, short msY) {} void CGame::DrawDialogBox_Character(short msX, short msY) {short sX, sY, sSprH, sFrame; int i, iR, iG, iB, iSkirtDraw = 0; char cTxt2[120], cEquipPoiStatus[MAXITEMEQUIPPOS]; char cItemColor, cCollison; sX = m_stDialogBoxInfo[1].sX; sY = m_stDialogBoxInfo[1].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 0, FALSE, m_bDialogTrans); ZeroMemory(G_cTxt, sizeof(G_cTxt)); strcpy(G_cTxt, m_cPlayerName); strcat(G_cTxt, " : "); if (m_iPKCount > 0) { ZeroMemory(cTxt2, sizeof(cTxt2)); wsprintf(cTxt2, DRAW_DIALOGBOX_CHARACTER1, m_iPKCount); strcat(G_cTxt, cTxt2); } ZeroMemory(cTxt2, sizeof(cTxt2)); wsprintf(cTxt2, DRAW_DIALOGBOX_CHARACTER2, m_iContribution); strcat(G_cTxt, cTxt2); PutAlignedString(sX +24, sX +252, sY+52, G_cTxt, 45,20,20); ZeroMemory(G_cTxt, sizeof(G_cTxt)); strcpy(G_cTxt, sideName[m_side]); if(m_side != NEUTRAL) { strcat(G_cTxt, MSG_COMBATANT); if( m_iGuildRank >= 0 ) { strcat( G_cTxt, "(" ); strcat( G_cTxt, m_cGuildName ); if( m_iGuildRank == 0 ) strcat( G_cTxt, MSG_GUILDMASTER1 ); else strcat( G_cTxt, MSG_GUILDSMAN1 ); // " Guildsman)" } } PutAlignedString(sX, sX+275, sY+69, G_cTxt, 45,25,25); int iTemp; // Level wsprintf(G_cTxt, "%d", m_iLevel); PutAlignedString(sX+180, sX+250, sY + 106, G_cTxt, 45,25,25); // Exp wsprintf(G_cTxt, "%d", m_iExp); PutAlignedString(sX+180, sX+250, sY + 125, G_cTxt, 45,25,25); // Next.Exp wsprintf(G_cTxt, "%d", m_levelExpTable[m_iLevel+1]); PutAlignedString(sX+180, sX+250, sY + 142, G_cTxt, 45,25,25); // Hp iTemp = m_iHP; wsprintf(G_cTxt, "%d/%d", iTemp, m_stat[STAT_VIT]*3 + m_iLevel*2 + m_stat[STAT_STR] /2); PutAlignedString(sX+180, sX+250, sY + 173, G_cTxt, 45,25,25); // Mp iTemp = m_iMP; wsprintf(G_cTxt, "%d/%d", iTemp, m_stat[STAT_MAG]*2 + m_iLevel*2 + m_stat[STAT_INT] /2); PutAlignedString(sX+180, sX+250, sY + 191, G_cTxt, 45,25,25); // Sp iTemp = m_iSP; wsprintf(G_cTxt, "%d/%d", iTemp, m_iLevel*2 + m_stat[STAT_STR]*2); PutAlignedString(sX+180, sX+250, sY + 208, G_cTxt, 45,25,25); // Max.Load wsprintf(G_cTxt, "%d/%d", (_iCalcTotalWeight()/100), (m_stat[STAT_STR]*5 + m_iLevel*5)); PutAlignedString(sX+180, sX+250, sY + 240, G_cTxt, 45,25,25); // Enemy Kills wsprintf(G_cTxt, "%d", m_iEnemyKillCount); PutAlignedString(sX+180, sX+250, sY + 257, G_cTxt, 45,25,25); // Str wsprintf(G_cTxt, "%d", m_stat[STAT_STR]); if (m_angelStat[STAT_STR] == 0) PutAlignedString(sX+48, sX+82, sY + 285, G_cTxt, 45,25,25); else PutAlignedString(sX+48, sX+82, sY + 285, G_cTxt, 0,0,192); wsprintf(G_cTxt, "%d", m_stat[STAT_VIT]); PutAlignedString(sX+218, sX+251, sY + 285, G_cTxt, 45,25,25); // Dex wsprintf(G_cTxt, "%d", m_stat[STAT_DEX]); if (m_angelStat[STAT_DEX] == 0) { PutAlignedString(sX+48, sX+82, sY +302, G_cTxt, 45,25,25); }else { PutAlignedString(sX+48, sX+82, sY +302, G_cTxt, 0,0,192); } // Int wsprintf(G_cTxt, "%d", m_stat[STAT_INT]); if (m_angelStat[STAT_INT] == 0) { PutAlignedString(sX+135, sX+167, sY +285, G_cTxt, 45,25,25); }else { PutAlignedString(sX+135, sX+167, sY +285, G_cTxt, 0,0,192); } // Mag wsprintf(G_cTxt, "%d", m_stat[STAT_MAG]); if (m_angelStat[STAT_MAG] == 0) { PutAlignedString(sX+135, sX+167, sY +302, G_cTxt, 45,25,25); }else { PutAlignedString(sX+135, sX+167, sY +302, G_cTxt, 0,0,192); } // Chr wsprintf(G_cTxt, "%d", m_stat[STAT_CHR]); PutAlignedString(sX+218, sX+251, sY +302, G_cTxt, 45,25,25); for (i = 0; i < MAXITEMEQUIPPOS; i++) cEquipPoiStatus[i] = -1; for (i = 0; i < MAXITEMS; i++) { if ((m_pItemList[i] != NULL) && (m_bIsItemEquipped[i] == TRUE)) cEquipPoiStatus[ m_pItemList[i]->m_cEquipPos ] = i; } if ((m_sPlayerType >= 1) && (m_sPlayerType <= 3)) { cCollison = -1; m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 0]->PutSpriteFast(sX + 171, sY + 290, m_sPlayerType-1, m_dwCurTime); if (cEquipPoiStatus[EQUIPPOS_HEAD] == -1) { _GetHairColorRGB(((m_sPlayerAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 18]->PutSpriteRGB(sX + 171, sY + 290, (m_sPlayerAppr1 & 0x0F00) >> 8, iR, iG, iB, m_dwCurTime); } m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 19]->PutSpriteFast(sX + 171, sY + 290, (m_sPlayerAppr1 & 0x000F), m_dwCurTime); if (cEquipPoiStatus[EQUIPPOS_BACK] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BACK]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BACK]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_BACK]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_BACK] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteFast(sX + 41, sY + 137, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteRGB(sX + 41, sY + 137, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite2(sX + 41, sY + 137, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSpriteRGB(sX + 41, sY + 137, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison( sX + 41, sY + 137, sFrame, msX, msY ) ) cCollison = EQUIPPOS_BACK; } if (cEquipPoiStatus[EQUIPPOS_PANTS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_PANTS] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteFast(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite2(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cCollison = EQUIPPOS_PANTS; } if (cEquipPoiStatus[EQUIPPOS_ARMS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_ARMS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_ARMS]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_ARMS]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_ARMS] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteFast(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite2(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cCollison = EQUIPPOS_ARMS; } if (cEquipPoiStatus[EQUIPPOS_BOOTS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_BOOTS] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteFast(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite2(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cCollison = EQUIPPOS_BOOTS; } if (cEquipPoiStatus[EQUIPPOS_BODY] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BODY]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BODY]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_BODY]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_BODY] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteFast(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite2(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cCollison = EQUIPPOS_BODY; } if (cEquipPoiStatus[EQUIPPOS_FULLBODY] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_FULLBODY]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_FULLBODY]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_FULLBODY]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_FULLBODY] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteFast(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite2(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cCollison = EQUIPPOS_FULLBODY; } if (cEquipPoiStatus[EQUIPPOS_LHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_LHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_LHAND]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_LHAND]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_LHAND] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteFast(sX + 90, sY + 170, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteRGB(sX + 90, sY + 170, sFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite2(sX + 90, sY + 170, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSpriteRGB(sX + 90, sY + 170, sFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 90, sY + 170, sFrame, msX, msY ) ) cCollison = EQUIPPOS_LHAND; } if (cEquipPoiStatus[EQUIPPOS_RHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_RHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_RHAND]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_RHAND]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_RHAND] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteFast(sX + 57, sY + 186, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteRGB(sX + 57, sY + 186, sFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite2(sX + 57, sY + 186, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSpriteRGB(sX + 57, sY + 186, sFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 57, sY + 186, sFrame, msX, msY ) ) cCollison = EQUIPPOS_RHAND; } if (cEquipPoiStatus[EQUIPPOS_TWOHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_TWOHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_TWOHAND]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_TWOHAND]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_TWOHAND] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteFast(sX + 57, sY + 186, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteRGB(sX + 57, sY + 186, sFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite2(sX + 57, sY + 186, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSpriteRGB(sX + 57, sY + 186, sFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 57, sY + 186, sFrame, msX, msY ) ) cCollison = EQUIPPOS_TWOHAND; } if (cEquipPoiStatus[EQUIPPOS_NECK] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_NECK]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_NECK]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_NECK]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_NECK] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteFast(sX + 35, sY + 120, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteRGB(sX + 35, sY + 120, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite2(sX + 35, sY + 120, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSpriteRGB(sX + 35, sY + 120, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 35, sY + 120, sFrame, msX, msY ) ) cCollison = EQUIPPOS_NECK; } if (cEquipPoiStatus[EQUIPPOS_RFINGER] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_RFINGER]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_RFINGER]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_RFINGER]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_RFINGER] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteFast(sX + 32, sY + 193, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteRGB(sX + 32, sY + 193, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite2(sX + 32, sY + 193, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSpriteRGB(sX + 32, sY + 193, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 32, sY + 193, sFrame, msX, msY ) ) cCollison = EQUIPPOS_RFINGER; } if (cEquipPoiStatus[EQUIPPOS_LFINGER] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_LFINGER]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_LFINGER]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_LFINGER]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_LFINGER] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteFast(sX + 100, sY + 185, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteRGB(sX + 100, sY + 185, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite2(sX + 100, sY + 185, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSpriteRGB(sX + 100, sY + 185, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 100, sY + 185, sFrame, msX, msY ) ) cCollison = EQUIPPOS_LFINGER; } if (cEquipPoiStatus[EQUIPPOS_HEAD] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_HEAD]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_HEAD]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_HEAD]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_HEAD] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteFast(sX + 72, sY + 135, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutSpriteRGB(sX + 72, sY + 135, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite2(sX + 72, sY + 135, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSpriteRGB(sX + 72, sY + 135, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->_bCheckCollison(sX + 72, sY + 135, sFrame, msX, msY ) ) cCollison = EQUIPPOS_HEAD; } if( cCollison != -1 ) { sSprH = m_pItemList[cEquipPoiStatus[cCollison]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[cCollison]]->m_sSpriteFrame; if( cCollison == EQUIPPOS_HEAD ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite(sX + 72, sY + 135, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_RFINGER ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite(sX + 32, sY + 193, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_LFINGER ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite(sX + 100, sY + 185, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_NECK ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite(sX + 35, sY + 120, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_TWOHAND ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite(sX + 57, sY + 186, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_RHAND ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite(sX + 57, sY + 186, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_LHAND ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite(sX + 90, sY + 170, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_BODY ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite(sX + 171, sY + 290, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_FULLBODY ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite(sX + 171, sY + 290, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_BOOTS ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite(sX + 171, sY + 290, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_ARMS ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite(sX + 171, sY + 290, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_PANTS ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite(sX + 171, sY + 290, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_BACK ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH]->PutTransSprite(sX + 41, sY + 137, sFrame, m_dwCurTime); } }else if ((m_sPlayerType >= 4) && (m_sPlayerType <= 6)) { cCollison = -1; m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 40]->PutSpriteFast(sX + 171, sY + 290, m_sPlayerType-4, m_dwCurTime); if (cEquipPoiStatus[EQUIPPOS_HEAD] == -1) { _GetHairColorRGB(((m_sPlayerAppr1 & 0x00F0) >> 4), &iR, &iG, &iB); m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 18 +40]->PutSpriteRGB(sX + 171, sY + 290, (m_sPlayerAppr1 & 0x0F00) >> 8, iR, iG, iB, m_dwCurTime); } m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + 19 +40]->PutSpriteFast(sX + 171, sY + 290, (m_sPlayerAppr1 & 0x000F), m_dwCurTime); if (cEquipPoiStatus[EQUIPPOS_PANTS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_sSpriteFrame; if ((sSprH == 12) && (sFrame == 0)) iSkirtDraw = 1; } if (cEquipPoiStatus[EQUIPPOS_BACK] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BACK]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BACK]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_BACK]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_BACK] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteFast(sX + 45, sY + 143, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteRGB(sX + 45, sY + 143, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite2(sX + 45, sY + 143, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSpriteRGB(sX + 45, sY + 143, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 45, sY + 143, sFrame, msX, msY ) ) cCollison = EQUIPPOS_BACK; } if ((cEquipPoiStatus[EQUIPPOS_BOOTS] != -1) && (iSkirtDraw == 1)) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_BOOTS] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteFast(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite2(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cCollison = EQUIPPOS_BOOTS; } if (cEquipPoiStatus[EQUIPPOS_PANTS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_PANTS]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_PANTS] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteFast(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite2(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cCollison = EQUIPPOS_PANTS; } if (cEquipPoiStatus[EQUIPPOS_ARMS] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_ARMS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_ARMS]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_ARMS]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_ARMS] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteFast(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite2(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cCollison = EQUIPPOS_ARMS; } if ((cEquipPoiStatus[EQUIPPOS_BOOTS] != -1) && (iSkirtDraw == 0)) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_BOOTS]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_BOOTS] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteFast(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite2(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cCollison = EQUIPPOS_BOOTS; } if (cEquipPoiStatus[EQUIPPOS_BODY] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_BODY]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_BODY]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_BODY]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_BODY] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteFast(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite2(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cCollison = EQUIPPOS_BODY; } if (cEquipPoiStatus[EQUIPPOS_FULLBODY] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_FULLBODY]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_FULLBODY]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_FULLBODY]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_FULLBODY] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteFast(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite2(sX + 171, sY + 290, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSpriteRGB(sX + 171, sY + 290, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 171, sY + 290, sFrame, msX, msY ) ) cCollison = EQUIPPOS_FULLBODY; } if (cEquipPoiStatus[EQUIPPOS_LHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_LHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_LHAND]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_LHAND]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_LHAND] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteFast(sX + 84, sY + 175, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteRGB(sX + 84, sY + 175, sFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite2(sX + 84, sY + 175, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSpriteRGB(sX + 84, sY + 175, sFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 84, sY + 175, sFrame, msX, msY ) ) cCollison = EQUIPPOS_LHAND; } if (cEquipPoiStatus[EQUIPPOS_RHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_RHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_RHAND]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_RHAND]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_RHAND] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteFast(sX + 60, sY + 191, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteRGB(sX + 60, sY + 191, sFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite2(sX + 60, sY + 191, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSpriteRGB(sX + 60, sY + 191, sFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 60, sY + 191, sFrame, msX, msY ) ) cCollison = EQUIPPOS_RHAND; } if (cEquipPoiStatus[EQUIPPOS_TWOHAND] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_TWOHAND]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_TWOHAND]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_TWOHAND]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_TWOHAND] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteFast(sX + 60, sY + 191, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteRGB(sX + 60, sY + 191, sFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite2(sX + 60, sY + 191, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSpriteRGB(sX + 60, sY + 191, sFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 60, sY + 191, sFrame, msX, msY ) ) cCollison = EQUIPPOS_TWOHAND; } if (cEquipPoiStatus[EQUIPPOS_NECK] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_NECK]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_NECK]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_NECK]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_NECK] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteFast(sX + 35, sY + 120, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteRGB(sX + 35, sY + 120, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite2(sX + 35, sY + 120, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSpriteRGB(sX + 35, sY + 120, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 35, sY + 120, sFrame, msX, msY ) ) cCollison = EQUIPPOS_NECK; } if (cEquipPoiStatus[EQUIPPOS_RFINGER] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_RFINGER]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_RFINGER]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_RFINGER]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_RFINGER] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteFast(sX + 32, sY + 193, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteRGB(sX + 32, sY + 193, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite2(sX + 32, sY + 193, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSpriteRGB(sX + 32, sY + 193, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 32, sY + 193, sFrame, msX, msY ) ) cCollison = EQUIPPOS_RFINGER; } if (cEquipPoiStatus[EQUIPPOS_LFINGER] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_LFINGER]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_LFINGER]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_LFINGER]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_LFINGER] ] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteFast(sX + 100, sY + 185, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteRGB(sX + 100, sY + 185, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite2(sX + 100, sY + 185, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSpriteRGB(sX + 100, sY + 185, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 100, sY + 185, sFrame, msX, msY ) ) cCollison = EQUIPPOS_LFINGER; } if (cEquipPoiStatus[EQUIPPOS_HEAD] != -1) { sSprH = m_pItemList[cEquipPoiStatus[EQUIPPOS_HEAD]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[EQUIPPOS_HEAD]]->m_sSpriteFrame; cItemColor = m_pItemList[cEquipPoiStatus[EQUIPPOS_HEAD]]->m_cItemColor; if (m_bIsItemDisabled[ cEquipPoiStatus[EQUIPPOS_HEAD]] == FALSE) { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteFast(sX + 72, sY +139, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutSpriteRGB(sX + 72, sY +139, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); }else { if (cItemColor == 0) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite2(sX + 72, sY +139, sFrame, m_dwCurTime); else m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSpriteRGB(sX + 72, sY +139, sFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], m_dwCurTime); } if( m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->_bCheckCollison(sX + 72, sY + 139, sFrame, msX, msY ) ) cCollison = EQUIPPOS_HEAD; } if( cCollison != -1 ) { sSprH = m_pItemList[cEquipPoiStatus[cCollison]]->m_sSprite; sFrame = m_pItemList[cEquipPoiStatus[cCollison]]->m_sSpriteFrame; if( cCollison == EQUIPPOS_HEAD ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite(sX + 72, sY + 139, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_RFINGER ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite(sX + 32, sY + 193, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_LFINGER ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite(sX + 100, sY + 185, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_NECK ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite(sX + 35, sY + 120, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_TWOHAND ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite(sX + 60, sY + 191, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_RHAND ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite(sX + 60, sY + 191, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_LHAND ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite(sX + 84, sY + 175, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_BODY ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite(sX + 171, sY + 290, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_FULLBODY ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite(sX + 171, sY + 290, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_BOOTS ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite(sX + 171, sY + 290, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_ARMS ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite(sX + 171, sY + 290, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_PANTS ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite(sX + 171, sY + 290, sFrame, m_dwCurTime); else if( cCollison == EQUIPPOS_BACK ) m_pSprite[SPRID_ITEMEQUIP_PIVOTPOINT + sSprH +40]->PutTransSprite(sX + 45, sY + 143, sFrame, m_dwCurTime); } } if ((msX >= sX + 15) && (msX <= sX + 15 + BTNSZX) && (msY >= sY + 340) && (msY <= sY + 340 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 15, sY +340, 5, FALSE, m_bDialogTrans); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 15, sY +340, 4, FALSE, m_bDialogTrans); if ((msX >= sX + 98) && (msX <= sX + 98 + BTNSZX) && (msY >= sY + 340) && (msY <= sY + 340 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 98, sY +340, 45, FALSE, m_bDialogTrans); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 98, sY +340, 44, FALSE, m_bDialogTrans); if ((msX >= sX + 180) && (msX <= sX + 180 + BTNSZX) && (msY >= sY + 340) && (msY <= sY + 340 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 180, sY +340, 11, FALSE, m_bDialogTrans); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 180, sY +340, 10, FALSE, m_bDialogTrans); } // 3.51 Level Up Dialog - Diuuude void CGame::DrawDialogBox_LevelUpSetting(short msX, short msY) { short sX, sY, szX; DWORD dwTime = m_dwCurTime; char cTxt[120]; int iStats; #ifdef _DEBUG wsprintf( G_cTxt, "m_stat[STAT_STR]: %d m_angelStat[STAT_STR]: %d", m_stat[STAT_STR], m_angelStat[STAT_STR] ); PutString( 10, 10, G_cTxt, RGB(255,255,255) ); #endif sX = m_stDialogBoxInfo[12].sX; sY = m_stDialogBoxInfo[12].sY; szX = m_stDialogBoxInfo[12].sSizeX; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 0); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 2); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, sX+16, sY+100, 4); PutAlignedString(sX, sX + szX, sY + 50, DRAW_DIALOGBOX_LEVELUP_SETTING1); PutAlignedString(sX, sX + szX, sY + 65, DRAW_DIALOGBOX_LEVELUP_SETTING2); // Points Left - Display in green if > 0 PutString(sX + 20, sY + 85, DRAW_DIALOGBOX_LEVELUP_SETTING3, RGB(0,0,0)); wsprintf(cTxt, "%d", m_iLU_Point); if (m_iLU_Point > 0) { PutString(sX + 73, sY + 102, cTxt, RGB(0,255,0)); }else { PutString(sX + 73, sY + 102, cTxt, RGB(0,0,0)); } // Strength PutString(sX + 24, sY + 125, DRAW_DIALOGBOX_LEVELUP_SETTING4, RGB(5,5,5)); wsprintf(cTxt, "%d", m_stat[STAT_STR] - m_angelStat[STAT_STR]); PutString(sX + 109, sY + 125, cTxt, RGB(25,35,25)); iStats = m_stat[STAT_STR] + m_luStat[STAT_STR] - m_angelStat[STAT_STR]; wsprintf(cTxt, "%d", iStats); if (iStats != m_stat[STAT_STR] - m_angelStat[STAT_STR]) { PutString(sX + 162, sY + 125, cTxt, RGB(255,0,0)); }else { PutString(sX + 162, sY + 125, cTxt, RGB(25,35,25)); } if ((msX >= sX + 195) && (msX <= sX + 205) && (msY >= sY + 127) && (msY <= sY + 133) && (m_stat[STAT_STR] < 200)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 195, sY + 127, 5, dwTime); if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 127) && (msY <= sY + 133) && (m_luStat[STAT_STR] > 0)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 210, sY + 127, 6, dwTime); PutString(sX + 24, sY + 144, DRAW_DIALOGBOX_LEVELUP_SETTING5, RGB(5,5,5)); wsprintf(cTxt, "%d", m_stat[STAT_VIT]); PutString(sX + 109, sY + 144, cTxt, RGB(25,35,25)); iStats = m_stat[STAT_VIT] + m_luStat[STAT_VIT]; wsprintf(cTxt, "%d", iStats); if (iStats != m_stat[STAT_VIT]) { PutString(sX + 162, sY + 144, cTxt, RGB(255,0,0)); }else { PutString(sX + 162, sY + 144, cTxt, RGB(25,35,25)); } if ((msX >= sX + 195) && (msX <= sX + 205) && (msY >= sY + 146) && (msY <= sY + 152) && (m_stat[STAT_VIT] < 200)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 195, sY + 146, 5, dwTime); if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 146) && (msY <= sY + 152) && (m_luStat[STAT_VIT] > 0)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 210, sY + 146, 6, dwTime); // Dexterity PutString(sX + 24, sY + 163, DRAW_DIALOGBOX_LEVELUP_SETTING6, RGB(5,5,5)); wsprintf(cTxt, "%d", m_stat[STAT_DEX] - m_angelStat[STAT_DEX]); PutString(sX + 109, sY + 163, cTxt, RGB(25,35,25)); iStats = m_stat[STAT_DEX] + m_luStat[STAT_DEX] - m_angelStat[STAT_DEX]; wsprintf(cTxt, "%d", iStats); if (iStats != m_stat[STAT_DEX] - m_angelStat[STAT_DEX]) { PutString(sX + 162, sY + 163, cTxt, RGB(255,0,0)); }else { PutString(sX + 162, sY + 163, cTxt, RGB(25,35,25)); } if ((msX >= sX + 195) && (msX <= sX + 205) && (msY >= sY + 165) && (msY <= sY + 171) && (m_stat[STAT_DEX] < 200)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 195, sY + 165, 5, dwTime); if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 165) && (msY <= sY + 171) && (m_luStat[STAT_DEX] > 0)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 210, sY + 165, 6, dwTime); // Intelligence PutString(sX + 24, sY + 182, DRAW_DIALOGBOX_LEVELUP_SETTING7, RGB(5,5,5)); wsprintf(cTxt, "%d", m_stat[STAT_INT] - m_angelStat[STAT_INT]); PutString(sX + 109, sY + 182, cTxt, RGB(25,35,25)); iStats = m_stat[STAT_INT] + m_luStat[STAT_INT] - m_angelStat[STAT_INT]; wsprintf(cTxt, "%d", iStats); if (iStats != m_stat[STAT_INT] - m_angelStat[STAT_INT]) { PutString(sX + 162, sY + 182, cTxt, RGB(255,0,0)); }else { PutString(sX + 162, sY + 182, cTxt, RGB(25,35,25)); } if ((msX >= sX + 195) && (msX <= sX + 205) && (msY >= sY + 184) && (msY <= sY + 190) && (m_stat[STAT_INT] < 200)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 195, sY + 184, 5, dwTime); if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 184) && (msY <= sY + 190) && (m_luStat[STAT_INT] > 0)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 210, sY + 184, 6, dwTime); // Magic PutString(sX + 24, sY + 201, DRAW_DIALOGBOX_LEVELUP_SETTING8, RGB(5,5,5)); wsprintf(cTxt, "%d", m_stat[STAT_MAG] - m_angelStat[STAT_MAG]); PutString(sX + 109, sY + 201, cTxt, RGB(25,35,25)); iStats = m_stat[STAT_MAG] + m_luStat[STAT_MAG] - m_angelStat[STAT_MAG]; wsprintf(cTxt, "%d", iStats); if (iStats != m_stat[STAT_MAG] - m_angelStat[STAT_MAG]) { PutString(sX + 162, sY + 201, cTxt, RGB(255,0,0)); }else { PutString(sX + 162, sY + 201, cTxt, RGB(25,35,25)); } if ((msX >= sX + 195) && (msX <= sX + 205) && (msY >= sY + 203) && (msY <= sY + 209) && (m_stat[STAT_MAG] < 200)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 195, sY + 203, 5, dwTime); if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 203) && (msY <= sY + 209) && (m_luStat[STAT_MAG] > 0)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 210, sY + 203, 6, dwTime); // Charisma PutString(sX + 24, sY + 220, DRAW_DIALOGBOX_LEVELUP_SETTING9, RGB(5,5,5)); wsprintf(cTxt, "%d", m_stat[STAT_CHR]); PutString(sX + 109, sY + 220, cTxt, RGB(25,35,25)); iStats = m_stat[STAT_CHR] + m_luStat[STAT_CHR]; wsprintf(cTxt, "%d", iStats); if (iStats != m_stat[STAT_CHR]) { PutString(sX + 162, sY + 220, cTxt, RGB(255,0,0)); }else { PutString(sX + 162, sY + 220, cTxt, RGB(25,35,25)); } if ((msX >= sX + 195) && (msX <= sX + 205) && (msY >= sY + 222) && (msY <= sY + 228) && (m_stat[STAT_CHR] < 200)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 195, sY + 222, 5, dwTime); if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 222) && (msY <= sY + 228) && (m_luStat[STAT_CHR] > 0)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 210, sY + 222, 6, dwTime); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); if ((m_luStat[STAT_STR] == 0)&&(m_luStat[STAT_VIT] == 0)&&(m_luStat[STAT_DEX] == 0)&&(m_luStat[STAT_INT] == 0)&&(m_luStat[STAT_MAG] == 0)&&(m_luStat[STAT_CHR] == 0)) { if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { if (m_iLU_Point <= 0) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 21); }else { if (m_iLU_Point <= 0) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 20); } } } void CGame::DrawDialogBox_CityHallMenu(short msX, short msY, short msZ, char cLB) { static const enum modes{ LEGIONPTSSERVICES = 9, TELEPORTLIST = 10 }; short sX, sY, szX; int iPointerLoc; double d1, d2, d3; char cTxt[120]; int i; sX = m_stDialogBoxInfo[13].sX; sY = m_stDialogBoxInfo[13].sY; szX = m_stDialogBoxInfo[13].sSizeX; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 18);//CityHall Menu Text switch (m_stDialogBoxInfo[13].cMode) { case 0: // citizenship req if (m_side == NEUTRAL) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 70) && (msY < sY + 95)) PutAlignedString(sX, sX + szX, sY + 70, DRAW_DIALOGBOX_CITYHALL_MENU1, 255,255,255); //" else PutAlignedString(sX, sX + szX, sY + 70, DRAW_DIALOGBOX_CITYHALL_MENU1, 4,0,50); //" }else PutAlignedString(sX, sX + szX, sY + 70, DRAW_DIALOGBOX_CITYHALL_MENU1, 65,65,65); //" if (m_iRewardGold > 0) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 95) && (msY < sY + 120)) PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_CITYHALL_MENU4, 255,255,255); //" else PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_CITYHALL_MENU4, 4,0,50); //" }else PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_CITYHALL_MENU4, 65,65,65); //" // 3.51 Cityhall Menu - Request Hero's Items - Diuuude if ((m_iEnemyKillCount >= 100) && (m_iContribution >= 10)) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 120) && (msY < sY + 145)) PutAlignedString(sX, sX + szX, sY + 120, DRAW_DIALOGBOX_CITYHALL_MENU8, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 120, DRAW_DIALOGBOX_CITYHALL_MENU8, 4,0,50); }else PutAlignedString(sX, sX + szX, sY + 120, DRAW_DIALOGBOX_CITYHALL_MENU8, 65,65,65); // Cancel quest if (m_stQuest.sQuestType != NULL) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 145) && (msY < sY + 170)) PutAlignedString(sX, sX + szX, sY + 145, DRAW_DIALOGBOX_CITYHALL_MENU11, 255,255,255);//" else PutAlignedString(sX, sX + szX, sY + 145, DRAW_DIALOGBOX_CITYHALL_MENU11, 4,0,50);//" }else PutAlignedString(sX, sX + szX, sY + 145, DRAW_DIALOGBOX_CITYHALL_MENU11, 65,65,65);//" // Legion point services if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 170) && (msY < sY + 195)) PutAlignedString(sX, sX + szX, sY + 170, "Legion points' services", 255,255,255); else PutAlignedString(sX, sX + szX, sY + 170, "Legion points' services", 4,0,50); // Teleport list if ( (m_bIsCrusadeMode==FALSE)) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 195) && (msY < sY + 220)) PutAlignedString(sX, sX + szX, sY + 195, "Teleport List", 255,255,255); else PutAlignedString(sX, sX + szX, sY + 195, "Teleport List", 4,0,50); }else PutAlignedString(sX, sX + szX, sY + 195, "Teleport List", 65,65,65); //Change crusade role if ( m_bIsCrusadeMode && m_side != NEUTRAL ) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 220) && (msY < sY + 220)) PutAlignedString(sX, sX + szX, sY + 220, DRAW_DIALOGBOX_CITYHALL_MENU14, 255,255,255);//"Change the crusade assignment." else PutAlignedString(sX, sX + szX, sY + 220, DRAW_DIALOGBOX_CITYHALL_MENU14, 4,0,50);//" }else PutAlignedString(sX, sX + szX, sY + 220, DRAW_DIALOGBOX_CITYHALL_MENU14, 65,65,65);//" PutAlignedString(sX, sX + szX, sY + 270, DRAW_DIALOGBOX_CITYHALL_MENU17);//"Select an Item you want." break; case 1: // become citizen warning PutAlignedString(sX, sX + szX, sY + 80, DRAW_DIALOGBOX_CITYHALL_MENU18, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_CITYHALL_MENU19, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 110, DRAW_DIALOGBOX_CITYHALL_MENU20, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_CITYHALL_MENU21, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 140,DRAW_DIALOGBOX_CITYHALL_MENU22, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 155,DRAW_DIALOGBOX_CITYHALL_MENU23, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 170,DRAW_DIALOGBOX_CITYHALL_MENU24, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 200,DRAW_DIALOGBOX_CITYHALL_MENU25, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 215,DRAW_DIALOGBOX_CITYHALL_MENU26, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 230,DRAW_DIALOGBOX_CITYHALL_MENU27, 55,25,25);//" if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 18); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 2); break; case 2: // Offering Citizenship. PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_CITYHALL_MENU28, 55,25,25);//" break; case 3: //Congratulations!! You acquired Citizenship" PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_CITYHALL_MENU29, 55,25,25);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 4: //Failed on acquiring citizenship!" PutAlignedString(sX, sX + szX, sY + 80, DRAW_DIALOGBOX_CITYHALL_MENU30, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 100, DRAW_DIALOGBOX_CITYHALL_MENU31, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 115, DRAW_DIALOGBOX_CITYHALL_MENU32, 55,25,25);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 5: //The prize gold for your" PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_CITYHALL_MENU33, 55,25,25);//" wsprintf(cTxt, DRAW_DIALOGBOX_CITYHALL_MENU34, m_iRewardGold);//" PutAlignedString(sX, sX + szX, sY + 140, cTxt, 55,25,25); PutAlignedString(sX, sX + szX, sY + 155, DRAW_DIALOGBOX_CITYHALL_MENU35, 55,25,25);//" if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 18); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 2); break; case 7:// 3.51 Cityhall Menu - Request Hero's Items - Diuuude PutAlignedString(sX, sX + szX, sY + 60, DRAW_DIALOGBOX_CITYHALL_MENU46, 255,255,255);// Here are the Hero's Item aivable : // Hero's Cape (EK 300) if (m_iEnemyKillCount >= 300) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 95) && (msY < sY + 110)) PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_CITYHALL_MENU47, 255,255,255);// On mouse over Mode else PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_CITYHALL_MENU47, 4,0,50);// Normal Mode } else PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_CITYHALL_MENU47, 65,65,65);// Disabled Mode // Hero's Helm (EK 150 - Contrib 20) if ((m_iEnemyKillCount >= 150) && (m_iContribution >= 20)) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 125) && (msY < sY + 140)) PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_CITYHALL_MENU48, 255,255,255);// On mouse over Mode else PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_CITYHALL_MENU48, 4,0,50);// Normal Mode } else PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_CITYHALL_MENU48, 65,65,65);// Disabled Mode // Hero's Cap (EK 100 - Contrib 20) if ((m_iEnemyKillCount >= 100) && (m_iContribution >= 20)) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 155) && (msY < sY + 170)) PutAlignedString(sX, sX + szX, sY + 155, DRAW_DIALOGBOX_CITYHALL_MENU49, 255,255,255);// On mouse over Mode else PutAlignedString(sX, sX + szX, sY + 155, DRAW_DIALOGBOX_CITYHALL_MENU49, 4,0,50);// Normal Mode } else PutAlignedString(sX, sX + szX, sY + 155, DRAW_DIALOGBOX_CITYHALL_MENU49, 65,65,65);// Disabled Mode // Hero's Armor (EK 300 - Contrib 30) if ((m_iEnemyKillCount >= 300) && (m_iContribution >= 30)) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 185) && (msY < sY + 200)) PutAlignedString(sX, sX + szX, sY + 185, DRAW_DIALOGBOX_CITYHALL_MENU50, 255,255,255);// On mouse over Mode else PutAlignedString(sX, sX + szX, sY + 185, DRAW_DIALOGBOX_CITYHALL_MENU50, 4,0,50);// Normal Mode } else PutAlignedString(sX, sX + szX, sY + 185, DRAW_DIALOGBOX_CITYHALL_MENU50, 65,65,65);// Disabled Mode // Hero's Robe (EK 200 - Contrib 20) if ((m_iEnemyKillCount >= 200) && (m_iContribution >= 20)) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 215) && (msY < sY + 230)) PutAlignedString(sX, sX + szX, sY + 215, DRAW_DIALOGBOX_CITYHALL_MENU51, 255,255,255);// On mouse over Mode else PutAlignedString(sX, sX + szX, sY + 215, DRAW_DIALOGBOX_CITYHALL_MENU51, 4,0,50);// Normal Mode } else PutAlignedString(sX, sX + szX, sY + 215, DRAW_DIALOGBOX_CITYHALL_MENU51, 65,65,65);// Disabled Mode // Hero's Hauberk (EK 100 - Contrib 10) if ((m_iEnemyKillCount >= 100) && (m_iContribution >= 10)) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 245) && (msY < sY + 260)) PutAlignedString(sX, sX + szX, sY + 245, DRAW_DIALOGBOX_CITYHALL_MENU52, 255,255,255);// On mouse over Mode else PutAlignedString(sX, sX + szX, sY + 245, DRAW_DIALOGBOX_CITYHALL_MENU52, 4,0,50);// Normal Mode } else PutAlignedString(sX, sX + szX, sY + 245, DRAW_DIALOGBOX_CITYHALL_MENU52, 65,65,65);// Disabled Mode // Hero's Leggings (EK 150 - Contrib 15) if ((m_iEnemyKillCount >= 150) && (m_iContribution >= 15)) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 275) && (msY < sY + 290)) PutAlignedString(sX, sX + szX, sY + 275, DRAW_DIALOGBOX_CITYHALL_MENU53, 255,255,255);// On mouse over Mode else PutAlignedString(sX, sX + szX, sY + 275, DRAW_DIALOGBOX_CITYHALL_MENU53, 4,0,50);// Normal Mode } else PutAlignedString(sX, sX + szX, sY + 275, DRAW_DIALOGBOX_CITYHALL_MENU53, 65,65,65);// Disabled Mode break; case 8: // cancel current quest? PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_CITYHALL_MENU54, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_CITYHALL_MENU55, 55,25,25);//" if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 18); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 2); break; case LEGIONPTSSERVICES: wsprintf(cTxt, "Legion points: %u", m_cash); PutAlignedString(sX, sX + szX, sY + 35, cTxt, 55,25,25); if ((msX > sX + 160) && (msX < sX + szX) && (msY > sY + 35) && (msY < sY + 50)) PutAlignedString(sX + 160, sX + szX, sY + 35, "Update" , 255,255,255); else PutAlignedString(sX + 160, sX + szX, sY + 35, "Update" , 4,0,50); PutAlignedString(sX - 20, sX + szX, sY + 55, "Name", 55,25,25); PutAlignedString(sX + 180, sX + szX, sY + 55, "Price" , 55,25,25); d1 = (double)m_stDialogBoxInfo[13].sView; d2 = (double)(CMD_LGNSVC_MAX-16); d3 = (274.0f * d1)/d2; iPointerLoc = (int)(d3); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 3); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX+242, sY + iPointerLoc + 35, 7); if(cLB != 0) { if ((iGetTopDialogBoxIndex() == 13)) { if ((msX >= sX + 235) && (msX <= sX + 260) && (msY >= sY + 10) && (msY <= sY + 330)) { d1 = (double)(msY -(sY+35)); d2 = (double)(CMD_LGNSVC_MAX-16); d3 = (d1 * d2)/274.0f; m_stDialogBoxInfo[13].sView = (int)(d3+0.5); } } }else m_stDialogBoxInfo[13].bIsScrollSelected = FALSE; if( iGetTopDialogBoxIndex() == 13 && msZ != 0 ) { m_stDialogBoxInfo[13].sView = m_stDialogBoxInfo[13].sView - msZ/60; m_DInput.m_sZ = 0; } if( m_stDialogBoxInfo[13].sView > CMD_LGNSVC_MAX-16 ) m_stDialogBoxInfo[13].sView = CMD_LGNSVC_MAX-16; if( m_stDialogBoxInfo[13].sView < 0 ) m_stDialogBoxInfo[13].sView = 0; for (i = 0; i < 16; i++) { if(i+ m_stDialogBoxInfo[13].sView < CMD_LGNSVC_MAX) { if ((msX > sX-8) && (msX < sX + szX - 20) && (msY > sY + 73 + 15*i) && (msY < sY + 87 + 15*i)) { PutAlignedString(sX-30, sX + szX, sY + 75 + 15*i, lgnPtsSvcs[i + m_stDialogBoxInfo[13].sView].desc, 255,255,255); wsprintf(cTxt, "%u", lgnPtsSvcs[i + m_stDialogBoxInfo[13].sView].price); PutAlignedString(sX + 190, sX + szX, sY + 75 + 15*i, cTxt, 255,255,255); } else { PutAlignedString(sX-30, sX + szX, sY + 75 + 15*i, lgnPtsSvcs[i + m_stDialogBoxInfo[13].sView].desc, 4,0,50); wsprintf(cTxt, "%u", lgnPtsSvcs[i + m_stDialogBoxInfo[13].sView].price); PutAlignedString(sX + 190, sX + szX, sY + 75 + 15*i, cTxt, 4,0,50); } } } break; case TELEPORTLIST:// Teleport List if( m_iTeleportMapCount > 0 ) { //PutAlignedString(sX, sX + szX, sY + 50, DRAW_DIALOGBOX_CITYHALL_MENU69, 55,25,25); // "Teleporting to dungeon level 2." //PutAlignedString(sX, sX + szX, sY + 80, DRAW_DIALOGBOX_CITYHALL_MENU70, 55,25,25); // "5000Gold is required" //PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_CITYHALL_MENU71, 55,25,25); // //PutAlignedString(sX, sX + szX, sY + 110, DRAW_DIALOGBOX_CITYHALL_MENU72, 55,25,25);// //PutString2(sX + 35, sY + 250, DRAW_DIALOGBOX_CITYHALL_MENU72_1, 55,25,25);//"Civilians cannot go some area." for( int i=0 ; i<m_iTeleportMapCount ; i++ ) { ZeroMemory( cTxt, sizeof(cTxt) ); GetOfficialMapName( m_stTeleportList[i].mapname, cTxt ); wsprintf( G_cTxt, DRAW_DIALOGBOX_CITYHALL_MENU77, cTxt, m_stTeleportList[i].iCost ); if( (msX >= sX + LBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + 130 + i*15) && (msY <= sY + 144 + i*15) ) PutAlignedString(sX, sX + szX, sY + 130 + i*15, G_cTxt, 255, 255, 255); else PutAlignedString(sX, sX + szX, sY + 130 + i*15, G_cTxt, 250, 250, 0); } }else if( m_iTeleportMapCount == -1 ) { PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_CITYHALL_MENU73, 55,25,25); PutAlignedString(sX, sX + szX, sY + 150, DRAW_DIALOGBOX_CITYHALL_MENU74, 55,25,25); }else { PutAlignedString(sX, sX + szX, sY + 150, DRAW_DIALOGBOX_CITYHALL_MENU76, 55,25,25);//"There is no area that you can teleport." } break; case 11: //drajwer - ask for tooking hero mantle PutAlignedString(sX,sX+szX-1,sY+125,m_cTakeHeroItemName, 55,25,25); PutAlignedString(sX+1,sX+szX,sY+125,m_cTakeHeroItemName, 55,25,25); PutAlignedString(sX,sX+szX,sY+260,DRAW_DIALOGBOX_CITYHALL_MENU46A, 55,25,25); // would you like.. if ( (msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 18); if ( (msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 2); break; case 12: // Bleeding Island Teleport PutAlignedString(sX,sX+szX-1,sY+125,"Bleeding Island", 55,25,25); PutAlignedString(sX+1,sX+szX,sY+125,"Bleeding Island", 55,25,25); PutAlignedString(sX,sX+szX-1,sY+140,"(100) Gold Required", 55,25,25); PutAlignedString(sX+1,sX+szX,sY+140,"(100) Gold Required", 55,25,25); PutAlignedString(sX,sX+szX,sY+260,"Would you like to teleport here?", 55,25,25); // would you like.. if ( (msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 18); if ( (msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 2); break; case 13: // Players Arena Teleport PutAlignedString(sX,sX+szX-1,sY+125,"Players Arena", 55,25,25); PutAlignedString(sX+1,sX+szX,sY+125,"Players Arena", 55,25,25); PutAlignedString(sX,sX+szX-1,sY+140,"(250) Gold Required", 55,25,25); PutAlignedString(sX+1,sX+szX,sY+140,"(250) Gold Required", 55,25,25); PutAlignedString(sX,sX+szX,sY+260,"Would you like to teleport here?", 55,25,25); // would you like.. if ( (msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 18); if ( (msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 2); break; case 14: // Dungeon Level 2 Teleport PutAlignedString(sX,sX+szX-1,sY+125,"Dungeon Level 2", 55,25,25); PutAlignedString(sX+1,sX+szX,sY+125,"Dungeon Level 2", 55,25,25); PutAlignedString(sX,sX+szX-1,sY+140,"(2500) Gold Required", 55,25,25); PutAlignedString(sX+1,sX+szX,sY+140,"(2500) Gold Required", 55,25,25); PutAlignedString(sX,sX+szX,sY+260,"Would you like to teleport here?", 55,25,25); // would you like.. if ( (msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 18); if ( (msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 2); break; } } /********************************************************************************************************************* ** void CGame::DrawDialogBox_ConfirmExchange(short msX, short msY) (snoopy) ** ** description :: paints the trade windows Added confirmation window in v3.51 ** **********************************************************************************************************************/ void CGame::DrawDialogBox_ConfirmExchange(short msX, short msY) {short sX, sY; sX = m_stDialogBoxInfo[41].sX; sY = m_stDialogBoxInfo[41].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME1, sX, sY, 2); switch (m_stDialogBoxInfo[41].cMode) { case 1: // Question PutString(sX + 35, sY + 30, "Do you really want to exchange?", RGB(4,0,50)); PutString(sX + 36, sY + 30, "Do you really want to exchange?", RGB(4,0,50)); if ((msX >= sX + 30) && (msX <= sX + 30 + BTNSZX) && (msY >= sY + 55) && (msY <= sY + 55 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 30, sY + 55 , 19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 30, sY + 55 , 18); if ((msX >= sX + 170 ) && (msX <= sX + 170 + BTNSZX ) && (msY >= sY + 55 ) && (msY <= sY + 55 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 170, sY + 55 , 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 170, sY + 55 , 2); break; case 2: // Waiting for response PutString(sX + 45, sY + 36, "Waiting for response...", RGB(4,0,50)); PutString(sX + 46, sY + 36, "Waiting for response...", RGB(4,0,50)); break; } } /********************************************************************************************************************* ** void CGame::DrawDialogBox_Exchange(short msX, short msY) (snoopy) ** ** description :: paints the trade windows ** **********************************************************************************************************************/ void CGame::DrawDialogBox_Exchange(short msX, short msY) { short sX, sY, szX, sXadd; DWORD dwTime = m_dwCurTime; char cItemColor, cTxt[120], cTxt2[128]; char cNameStr[120], cSubStr1[120], cSubStr2[120]; int iLoc, i; sX = m_stDialogBoxInfo[27].sX; sY = m_stDialogBoxInfo[27].sY ; szX = m_stDialogBoxInfo[27].sSizeX; DrawNewDialogBox(SPRID_INTERFACE_ND_NEWEXCHANGE, sX, sY, 0); switch (m_stDialogBoxInfo[27].cMode) { case 1: // Not yet confirmed exchange PutAlignedString(sX + 80, sX + 180, sY + 38, m_cPlayerName, 35,55,35); // my name if (m_stDialogBoxExchangeInfo[4].sV1 != -1) // Other name if applicable PutAlignedString(sX + 250, sX + 540, sY + 38, m_stDialogBoxExchangeInfo[4].cStr2, 35,55,35); for (i=0; i<8; i++) // draw items { sXadd = (58 * i) + 48; if (i>3) sXadd += 20; if ( m_stDialogBoxExchangeInfo[i].sV1 != -1) { cItemColor = m_stDialogBoxExchangeInfo[i].sV4; if (cItemColor == 0) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_stDialogBoxExchangeInfo[i].sV1]->PutSpriteFast(sX + sXadd, sY + 130, m_stDialogBoxExchangeInfo[i].sV2, dwTime); }else { switch (m_stDialogBoxExchangeInfo[i].sV1) {//sV1 : Sprite case 1: // Swds case 2: // Bows case 3: // Shields case 15: // Axes hammers case 17: // Wands m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_stDialogBoxExchangeInfo[i].sV1]->PutSpriteRGB(sX + sXadd, sY + 130 , m_stDialogBoxExchangeInfo[i].sV2, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], dwTime); break; default: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_stDialogBoxExchangeInfo[i].sV1]->PutSpriteRGB(sX + sXadd, sY + 130 , m_stDialogBoxExchangeInfo[i].sV2, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], dwTime); break; } } GetItemName(m_stDialogBoxExchangeInfo[i].cStr1, m_stDialogBoxExchangeInfo[i].dwV1, cNameStr, cSubStr1, cSubStr2); // If pointer over item then show this item data if ( (msX >= sX + sXadd - 6) && (msX <= sX + sXadd + 42) && (msY >= sY + 61) && (msY <= sY + 200) ) { wsprintf(cTxt, "%s", cNameStr); if (m_bIsSpecial) { PutAlignedString(sX + 15, sX + 155, sY + 215, cTxt, 0, 255, 0); PutAlignedString(sX + 16, sX + 156, sY + 215, cTxt, 0, 255, 0); }else { PutAlignedString(sX + 15, sX + 155, sY + 215, cTxt, 35,35,35); PutAlignedString(sX + 16, sX + 156, sY + 215, cTxt, 35,35,35); } iLoc = 0; if (strlen(cSubStr1) != 0) { PutAlignedString(sX + 16, sX + 155, sY + 235 +iLoc, cSubStr1, 0,0,0); iLoc += 15; } if (strlen(cSubStr2) != 0) { PutAlignedString(sX + 16, sX + 155, sY + 235 +iLoc, cSubStr2, 0,0,0); iLoc += 15; } if (m_stDialogBoxExchangeInfo[i].sV3 != 1) // Item avec Quantity { if(m_stDialogBoxExchangeInfo[i].sV3 > 1) { DisplayCommaNumber_G_cTxt(m_stDialogBoxExchangeInfo[i].sV3); strcpy(cTxt2, G_cTxt); }else wsprintf(cTxt2, DRAW_DIALOGBOX_EXCHANGE2, m_stDialogBoxExchangeInfo[i].sV3); PutAlignedString(sX + 16, sX + 155, sY +235 +iLoc, cTxt2, 35,35,35); iLoc += 15; } if (m_stDialogBoxExchangeInfo[i].sV5 != -1) // completion { // Crafting Magins completion fix if (m_stDialogBoxExchangeInfo[i].sV1 == 22) { if ( (m_stDialogBoxExchangeInfo[i].sV2 > 5) && (m_stDialogBoxExchangeInfo[i].sV2 < 10)) { wsprintf(cTxt, GET_ITEM_NAME2, (m_stDialogBoxExchangeInfo[i].sV7 - 100)); //Completion - 100 } }else if (m_stDialogBoxExchangeInfo[i].sV1 == 6) { wsprintf(cTxt, GET_ITEM_NAME1, (m_stDialogBoxExchangeInfo[i].sV7 - 100)); //Purity }else { wsprintf(cTxt, GET_ITEM_NAME2, m_stDialogBoxExchangeInfo[i].sV7); //Completion } PutAlignedString(sX + 16, sX + 155, sY + 235 +iLoc, cTxt, 35,35,35); iLoc += 15; } if (iLoc < 45) // Endurance { wsprintf(cTxt, DRAW_DIALOGBOX_EXCHANGE3, m_stDialogBoxExchangeInfo[i].sV5, m_stDialogBoxExchangeInfo[i].sV6); PutAlignedString(sX + 16, sX + 155, sY + 235 +iLoc, cTxt, 35,35,35); iLoc += 15; } } } } if ((m_stDialogBoxExchangeInfo[0].sV1 != -1) && (m_stDialogBoxExchangeInfo[4].sV1 == -1)) { PutAlignedString(sX, sX + szX, sY + 235 +10, DRAW_DIALOGBOX_EXCHANGE9, 55,25,25); // Please wait until other player decides PutAlignedString(sX, sX + szX, sY + 250 +10, DRAW_DIALOGBOX_EXCHANGE10, 55,25,25);// to exchange. If you want to cancel the PutAlignedString(sX, sX + szX, sY + 265 +10, DRAW_DIALOGBOX_EXCHANGE11, 55,25,25);// exchange press the CANCEL button now. PutString_SprFont(sX + 220, sY + 310, "Exchange", 15,15,15); }else if ((m_stDialogBoxExchangeInfo[0].sV1 == -1) && (m_stDialogBoxExchangeInfo[4].sV1 != -1)) { PutAlignedString(sX, sX + szX, sY + 205 +10, DRAW_DIALOGBOX_EXCHANGE12, 55,25,25);// Other player offered an item exchange PutAlignedString(sX, sX + szX, sY + 220 +10, DRAW_DIALOGBOX_EXCHANGE13, 55,25,25);// Select an item which you want to exc- PutAlignedString(sX, sX + szX, sY + 235 +10, DRAW_DIALOGBOX_EXCHANGE14, 55,25,25);// hange with above item, drag it to the PutAlignedString(sX, sX + szX, sY + 250 +10, DRAW_DIALOGBOX_EXCHANGE15, 55,25,25);// blank and press the EXCHANGE button. PutAlignedString(sX, sX + szX, sY + 265 +10, DRAW_DIALOGBOX_EXCHANGE16, 55,25,25);// And you can also reject an offer by PutAlignedString(sX, sX + szX, sY + 280 +10, DRAW_DIALOGBOX_EXCHANGE17, 55,25,25);// pressing the CANCEL button. PutString_SprFont(sX + 220, sY + 310, "Exchange", 15,15,15); }else if ((m_stDialogBoxExchangeInfo[0].sV1 != -1) && (m_stDialogBoxExchangeInfo[4].sV1 != -1)) { PutAlignedString(sX, sX + szX, sY + 205 +10, DRAW_DIALOGBOX_EXCHANGE18, 55,25,25);// The preparation for item exchange PutAlignedString(sX, sX + szX, sY + 220 +10, DRAW_DIALOGBOX_EXCHANGE19, 55,25,25);// has been finished. Press the EXCHANGE PutAlignedString(sX, sX + szX, sY + 235 +10, DRAW_DIALOGBOX_EXCHANGE20, 55,25,25);// button to exchange as above. Press the PutAlignedString(sX, sX + szX, sY + 250 +10, DRAW_DIALOGBOX_EXCHANGE21, 55,25,25);// CANCEL button to cancel. Occasionally PutAlignedString(sX, sX + szX, sY + 265 +10, DRAW_DIALOGBOX_EXCHANGE22, 55,25,25);// when you press the EXCHANGE button, you PutAlignedString(sX, sX + szX, sY + 280 +10, DRAW_DIALOGBOX_EXCHANGE23, 55,25,25);// will not be able to cancel the exchange. if ( (msX >= sX + 200) && (msX <= sX + 200 + BTNSZX) && (msY >= sY + 310) && (msY <= sY + 310 + BTNSZY) ) PutString_SprFont(sX + 220, sY + 310, "Exchange", 6,6,20); else PutString_SprFont(sX + 220, sY + 310, "Exchange", 0,0,7); } if ( (msX >= sX + 450) && (msX <= sX + 450 + BTNSZX) && (msY >= sY + 310) && (msY <= sY + 310 + BTNSZY) && (m_bIsDialogEnabled[41] == FALSE)) PutString_SprFont(sX + 450, sY + 310, "Cancel", 6,6,20); else PutString_SprFont(sX + 450, sY + 310, "Cancel", 0,0,7); break; case 2: // You have confirmed the exchange PutAlignedString(sX + 80, sX + 180, sY + 38, m_cPlayerName, 35,55,35); // my name if (m_stDialogBoxExchangeInfo[4].sV1 != -1) // Other name if applicable PutAlignedString(sX + 250, sX + 540, sY + 38, m_stDialogBoxExchangeInfo[4].cStr2, 35,55,35); for (i=0; i<8; i++) // draw items { sXadd = (58 * i) + 48; if (i>3) sXadd += 20; if ( m_stDialogBoxExchangeInfo[i].sV1 != -1) { cItemColor = m_stDialogBoxExchangeInfo[i].sV4; if (cItemColor == 0) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_stDialogBoxExchangeInfo[i].sV1]->PutSpriteFast(sX + sXadd, sY + 130, m_stDialogBoxExchangeInfo[i].sV2, dwTime); }else { switch (m_stDialogBoxExchangeInfo[i].sV1) { case 1: // Swds case 2: // Bows case 3: // Shields case 15: // Axes hammers case 17: // Wands m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_stDialogBoxExchangeInfo[i].sV1]->PutSpriteRGB(sX + sXadd, sY + 130 , m_stDialogBoxExchangeInfo[i].sV2, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], dwTime); break; default: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_stDialogBoxExchangeInfo[i].sV1]->PutSpriteRGB(sX + sXadd, sY + 130 , m_stDialogBoxExchangeInfo[i].sV2, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], dwTime); break; } } GetItemName(m_stDialogBoxExchangeInfo[i].cStr1, m_stDialogBoxExchangeInfo[i].dwV1, cNameStr, cSubStr1, cSubStr2); // If pointer over item then show this item data if ( (msX >= sX + sXadd - 6) && (msX <= sX + sXadd + 42) && (msY >= sY + 61) && (msY <= sY + 200) ) { wsprintf(cTxt, "%s", cNameStr); if (m_bIsSpecial) { PutAlignedString(sX + 15, sX + 155, sY + 215, cTxt, 0, 255, 0); PutAlignedString(sX + 16, sX + 156, sY + 215, cTxt, 0, 255, 0); }else { PutAlignedString(sX + 15, sX + 155, sY + 215, cTxt, 35,35,35); PutAlignedString(sX + 16, sX + 156, sY + 215, cTxt, 35,35,35); } iLoc = 0; if (strlen(cSubStr1) != 0) { PutAlignedString(sX + 16, sX + 155, sY + 235 +iLoc, cSubStr1, 0,0,0); iLoc += 15; } if (strlen(cSubStr2) != 0) { PutAlignedString(sX + 16, sX + 155, sY + 235 +iLoc, cSubStr2, 0,0,0); iLoc += 15; } if (m_stDialogBoxExchangeInfo[i].sV3 != 1) // Item avec Quantity { if(m_stDialogBoxExchangeInfo[i].sV3 > 1) { DisplayCommaNumber_G_cTxt(m_stDialogBoxExchangeInfo[i].sV3); strcpy(cTxt2, G_cTxt); }else wsprintf(cTxt2, DRAW_DIALOGBOX_EXCHANGE2, m_stDialogBoxExchangeInfo[i].sV3); PutAlignedString(sX + 16, sX + 155, sY +235 +iLoc, cTxt2, 35,35,35); iLoc += 15; } if (m_stDialogBoxExchangeInfo[i].sV5 != -1) // completion { // Crafting Magins completion fix if (m_stDialogBoxExchangeInfo[i].sV1 == 22) { if ( (m_stDialogBoxExchangeInfo[i].sV2 > 5) && (m_stDialogBoxExchangeInfo[i].sV2 < 10)) { wsprintf(cTxt, GET_ITEM_NAME2, (m_stDialogBoxExchangeInfo[i].sV7 - 100)); //Completion - 100 } }else if (m_stDialogBoxExchangeInfo[i].sV1 == 6) { wsprintf(cTxt, GET_ITEM_NAME1, (m_stDialogBoxExchangeInfo[i].sV7 - 100)); //Purity }else { wsprintf(cTxt, GET_ITEM_NAME2, m_stDialogBoxExchangeInfo[i].sV7); //Completion } PutAlignedString(sX + 16, sX + 155, sY + 235 +iLoc, cTxt, 35,35,35); iLoc += 15; } if (iLoc < 45) // Endurance { wsprintf(cTxt, DRAW_DIALOGBOX_EXCHANGE3, m_stDialogBoxExchangeInfo[i].sV5, m_stDialogBoxExchangeInfo[i].sV6); PutAlignedString(sX + 16, sX + 155, sY + 235 +iLoc, cTxt, 35,35,35); iLoc += 15; } } } } wsprintf(cTxt, DRAW_DIALOGBOX_EXCHANGE33, m_stDialogBoxExchangeInfo[4].cStr2); PutAlignedString(sX, sX + szX, sY + 205 +10, cTxt, 55,25,25); // Please wait until %s agrees to PutAlignedString(sX, sX + szX, sY + 220 +10, DRAW_DIALOGBOX_EXCHANGE34, 55,25,25);// exchange. The exchange can't be achieved PutAlignedString(sX, sX + szX, sY + 235 +10, DRAW_DIALOGBOX_EXCHANGE35, 55,25,25);// unless both people agree. PutAlignedString(sX, sX + szX, sY + 250 +10, DRAW_DIALOGBOX_EXCHANGE36, 55,25,25);// If other player does not decide to exchange PutAlignedString(sX, sX + szX, sY + 265 +10, DRAW_DIALOGBOX_EXCHANGE37, 55,25,25);// you can cancel the exchange by pressing the PutAlignedString(sX, sX + szX, sY + 280 +10, DRAW_DIALOGBOX_EXCHANGE38, 55,25,25);// CANCEL button. But if other player already PutAlignedString(sX, sX + szX, sY + 295 +10, DRAW_DIALOGBOX_EXCHANGE39, 55,25,25);// decided to exchange, you can't cancel anymore /* if ( (msX >= sX + 450) && (msX <= sX + 450 + BTNSZX) && (msY >= sY + 310) && (msY <= sY + 310 + BTNSZY) ) PutString_SprFont(sX + 450, sY + 310, "Cancel", 6,6,20); else PutString_SprFont(sX + 450, sY + 310, "Cancel", 0,0,7);*/ break; } } void CGame::DrawDialogBox_Fishing(short msX, short msY) { short sX, sY; DWORD dwTime = m_dwCurTime; char cTxt[120]; sX = m_stDialogBoxInfo[24].sX; sY = m_stDialogBoxInfo[24].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME1, sX, sY, 2); char cStr1[64], cStr2[64], cStr3[64]; GetItemName(m_stDialogBoxInfo[24].cStr, NULL, cStr1, cStr2, cStr3); switch (m_stDialogBoxInfo[24].cMode) { case 0: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_stDialogBoxInfo[24].sV3]->PutSpriteFast(sX + 18 + 35, sY + 18 + 17, m_stDialogBoxInfo[24].sV4, dwTime); wsprintf(cTxt, "%s", cStr1); PutString(sX + 98, sY + 14, cTxt, RGB(255,255,255)); wsprintf(cTxt, DRAW_DIALOGBOX_FISHING1, m_stDialogBoxInfo[24].sV2); PutString(sX + 98, sY + 28, cTxt, RGB(0,0,0)); PutString(sX + 97, sY + 43, DRAW_DIALOGBOX_FISHING2, RGB(0,0,0)); wsprintf(cTxt, "%d %%", m_stDialogBoxInfo[24].sV1); PutString_SprFont(sX + 157, sY + 40, cTxt, 10,0,0); if ((msX >= sX + 160) && (msX <= sX + 253) && (msY >= sY + 70) && (msY <= sY + 90)) PutString_SprFont(sX + 160, sY + 70, "Try Now!", 6,6,20); else PutString_SprFont(sX + 160, sY + 70, "Try Now!", 0, 0, 7); break; } } void CGame::DrawDialogBox_GuildMenu(short msX, short msY) { short sX, sY, szX; int iAdjX, iAdjY ; sX = m_stDialogBoxInfo[7].sX; sY = m_stDialogBoxInfo[7].sY; szX = m_stDialogBoxInfo[7].sSizeX; iAdjX = - 13 ; iAdjY = 30 ; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 19); switch (m_stDialogBoxInfo[7].cMode) { case 0: if ( (m_iGuildRank == -1) && (m_stat[STAT_CHR] >= 20) && (m_iLevel >= 20) ) { if ((msX > sX + iAdjX +80) && (msX < sX + iAdjX +210) && (msY > sY + iAdjY + 63) && (msY < sY + iAdjY + 78)) PutAlignedString(sX, sX + szX, sY + iAdjY + 65, DRAW_DIALOGBOX_GUILDMENU1, 255,255,255);//" else PutAlignedString(sX, sX + szX, sY + iAdjY + 65, DRAW_DIALOGBOX_GUILDMENU1, 4,0,50);//" } else PutAlignedString(sX, sX + szX, sY + iAdjY + 65, DRAW_DIALOGBOX_GUILDMENU1, 45,45,45);//" if (m_iGuildRank == 0) { if ((msX > sX + iAdjX +72) && (msX < sX + iAdjX +222) && (msY > sY + iAdjY + 82) && (msY < sY + iAdjY + 99)) PutAlignedString(sX, sX + szX, sY + iAdjY + 85, DRAW_DIALOGBOX_GUILDMENU4, 255,255,255);//" else PutAlignedString(sX, sX + szX, sY + iAdjY + 85, DRAW_DIALOGBOX_GUILDMENU4, 4,0,50);//" } else PutAlignedString(sX, sX + szX, sY + iAdjY + 85, DRAW_DIALOGBOX_GUILDMENU4, 65,65,65);//" if ((msX > sX + iAdjX +61) && (msX < sX + iAdjX +226) && (msY > sY + iAdjY + 103) && (msY < sY + iAdjY + 120)) PutAlignedString(sX, sX + szX, sY + iAdjY + 105, DRAW_DIALOGBOX_GUILDMENU7, 255,255,255);//" else PutAlignedString(sX, sX + szX, sY + iAdjY + 105, DRAW_DIALOGBOX_GUILDMENU7, 4,0,50);//" if ((msX > sX + iAdjX +60) && (msX < sX + iAdjX +227) && (msY > sY + iAdjY + 123) && (msY < sY + iAdjY + 139)) PutAlignedString(sX, sX + szX, sY + iAdjY + 125, DRAW_DIALOGBOX_GUILDMENU9, 255,255,255);//" else PutAlignedString(sX, sX + szX, sY + iAdjY + 125, DRAW_DIALOGBOX_GUILDMENU9, 4,0,50);//" if (m_iGuildRank == 0 && m_iFightzoneNumber == 0) { if ((msX > sX + iAdjX +72) && (msX < sX + iAdjX +228) && (msY > sY + iAdjY + 143) && (msY < sY + iAdjY + 169)) PutAlignedString(sX, sX + szX, sY + iAdjY + 145, DRAW_DIALOGBOX_GUILDMENU11, 255,255,255);//" else PutAlignedString(sX, sX + szX, sY + iAdjY + 145, DRAW_DIALOGBOX_GUILDMENU11, 4,0,50);//" } else if (m_iGuildRank == 0 && m_iFightzoneNumber > 0) { if ((msX > sX + iAdjX +72) && (msX < sX + iAdjX +216) && (msY > sY + iAdjY + 143) && (msY < sY + iAdjY + 169)) PutAlignedString(sX, sX + szX, sY + iAdjY + 145, DRAW_DIALOGBOX_GUILDMENU13, 255,255,255);//" else PutAlignedString(sX, sX + szX, sY + iAdjY + 145, DRAW_DIALOGBOX_GUILDMENU13, 4,0,50);//" } else if (m_iFightzoneNumber < 0) { PutAlignedString(sX, sX + szX, sY + iAdjY + 145, DRAW_DIALOGBOX_GUILDMENU13, 65,65,65);//" } else PutAlignedString(sX, sX + szX, sY + iAdjY + 145, DRAW_DIALOGBOX_GUILDMENU11, 65,65,65);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 205, DRAW_DIALOGBOX_GUILDMENU17);//" break; case 1: PutAlignedString(sX + 24, sX + 239, sY + 125, DRAW_DIALOGBOX_GUILDMENU18, 55,25,25);//" PutString(sX + 75, sY + 144, "____________________", RGB(25,35,25)); if (iGetTopDialogBoxIndex() != 7) PutString(sX + 75, sY + 140, m_cGuildName, RGB(255,255,255), 16, FALSE, 2); if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { if ((strcmp(m_cGuildName, "NONE") == 0) || (strlen(m_cGuildName) == 0)) { DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 24);//Create Gray Button } else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 25);//Create Highlight Button } else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 24);//Create Gray Button if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 17);//Red Cancel Button else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 16);//Gray Cancel Button break; case 2: PutAlignedString(sX, sX + szX, sY +140, DRAW_DIALOGBOX_GUILDMENU19, 55,25,25);//" break; case 3: PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_GUILDMENU20, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 140, m_cGuildName, 55,25,25); PutAlignedString(sX, sX + szX, sY + 144, "____________________", 25,35,25); PutAlignedString(sX, sX + szX, sY + 160, DRAW_DIALOGBOX_GUILDMENU21, 55,25,25);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 4: PutAlignedString(sX, sX + szX, sY + 135, DRAW_DIALOGBOX_GUILDMENU22, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 150, DRAW_DIALOGBOX_GUILDMENU23, 55,25,25);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 5: PutAlignedString(sX, sX + szX, sY + 90, DRAW_DIALOGBOX_GUILDMENU24); PutAlignedString(sX, sX + szX, sY + 105, m_cGuildName, 35,35,35); PutAlignedString(sX, sX + szX, sY + 109, "____________________", 0,0,0); PutAlignedString(sX, sX + szX, sY + 130, DRAW_DIALOGBOX_GUILDMENU25);//" PutAlignedString(sX, sX + szX, sY + 145,DRAW_DIALOGBOX_GUILDMENU26);//" PutAlignedString(sX, sX + szX, sY + 160,DRAW_DIALOGBOX_GUILDMENU27);//" PutAlignedString(sX, sX + szX, sY + 185, DRAW_DIALOGBOX_GUILDMENU28, 55,25,25);//" if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 18); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 2); break; case 6: PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_GUILDMENU29, 55,25,25);//" break; case 7: PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_GUILDMENU30, 55,25,25);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 8: PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_GUILDMENU31, 55,25,25);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 9: PutAlignedString(sX, sX + szX, sY + iAdjY + 60, DRAW_DIALOGBOX_GUILDMENU32);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 75, DRAW_DIALOGBOX_GUILDMENU33);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 90, DRAW_DIALOGBOX_GUILDMENU34);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 105, DRAW_DIALOGBOX_GUILDMENU35);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 130, DRAW_DIALOGBOX_GUILDMENU36);//" if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 31); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 30); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 17); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 16); break; case 10: PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_GUILDMENU37, 55,25,25);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 11: PutAlignedString(sX, sX + szX, sY + iAdjY + 60, DRAW_DIALOGBOX_GUILDMENU38);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 75, DRAW_DIALOGBOX_GUILDMENU39);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 90, DRAW_DIALOGBOX_GUILDMENU40);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 105, DRAW_DIALOGBOX_GUILDMENU41);// PutAlignedString(sX, sX + szX, sY + iAdjY + 130, DRAW_DIALOGBOX_GUILDMENU42);//" if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 31); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 30); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 17); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 16); break; case 12: PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_GUILDMENU43, 55,25,25);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 13: PutAlignedString(sX, sX + szX, sY + iAdjY + 40, DRAW_DIALOGBOX_GUILDMENU44);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 55, DRAW_DIALOGBOX_GUILDMENU45);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 70, DRAW_DIALOGBOX_GUILDMENU46);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 85, DRAW_DIALOGBOX_GUILDMENU47);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 100, DRAW_DIALOGBOX_GUILDMENU48);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 115, DRAW_DIALOGBOX_GUILDMENU49);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 130, DRAW_DIALOGBOX_GUILDMENU50);//" if ((msX > sX + iAdjX +65) && (msX < sX + iAdjX +137) && (msY > sY + iAdjY + 168) && (msY < sY + iAdjY + 185)) PutString(sX + iAdjX +65 + 25 -23, sY + iAdjY + 170, DRAW_DIALOGBOX_GUILDMENU51, RGB(255,255,255)); else PutString(sX + iAdjX +65 + 25 -23, sY + iAdjY + 170, DRAW_DIALOGBOX_GUILDMENU51, RGB(4,0,50)); if ((msX > sX + iAdjX +150) && (msX < sX + iAdjX +222) && (msY > sY + iAdjY + 168) && (msY < sY + iAdjY + 185)) PutString(sX + iAdjX +150 + 25 -23, sY + iAdjY + 170, DRAW_DIALOGBOX_GUILDMENU53, RGB(255,255,255)); else PutString(sX + iAdjX +150 + 25 -23, sY + iAdjY + 170, DRAW_DIALOGBOX_GUILDMENU53, RGB(4,0,50)); if ((msX > sX + iAdjX +65) && (msX < sX + iAdjX +137) && (msY > sY + iAdjY + 188) && (msY < sY + iAdjY + 205)) PutString(sX + iAdjX +65 + 25 -23, sY + iAdjY + 190, DRAW_DIALOGBOX_GUILDMENU55, RGB(255,255,255)); else PutString(sX + iAdjX +65 + 25 -23, sY + iAdjY + 190, DRAW_DIALOGBOX_GUILDMENU55, RGB(4,0,50)); if ((msX > sX + iAdjX +150) && (msX < sX + iAdjX +222) && (msY > sY + iAdjY + 188) && (msY < sY + iAdjY + 205)) PutString(sX + iAdjX +150 + 25 -23, sY + iAdjY + 190, DRAW_DIALOGBOX_GUILDMENU57, RGB(255,255,255)); else PutString(sX + iAdjX +150 + 25 -23, sY + iAdjY + 190, DRAW_DIALOGBOX_GUILDMENU57, RGB(4,0,50)); if ((msX > sX + iAdjX +65) && (msX < sX + iAdjX +137) && (msY > sY + iAdjY + 208) && (msY < sY + iAdjY + 225)) PutString(sX + iAdjX +65 + 25 -23, sY + iAdjY + 210, DRAW_DIALOGBOX_GUILDMENU59, RGB(255,255,255)); else PutString(sX + iAdjX +65 + 25 -23, sY + iAdjY + 210, DRAW_DIALOGBOX_GUILDMENU59, RGB(4,0,50)); if ((msX > sX + iAdjX +150) && (msX < sX + iAdjX +222) && (msY > sY + iAdjY + 208) && (msY < sY + iAdjY + 225)) PutString(sX + iAdjX +150 + 25 -23, sY + iAdjY + 210, DRAW_DIALOGBOX_GUILDMENU61, RGB(255,255,255)); else PutString(sX + iAdjX +150 + 25 -23, sY + iAdjY + 210, DRAW_DIALOGBOX_GUILDMENU61, RGB(4,0,50)); if ((msX > sX + iAdjX +65) && (msX < sX + iAdjX +137) && (msY > sY + iAdjY + 228) && (msY < sY + iAdjY + 245)) PutString(sX + iAdjX +65 + 25 -23, sY + iAdjY + 230, DRAW_DIALOGBOX_GUILDMENU63, RGB(255,255,255)); else PutString(sX + iAdjX +65 + 25 -23, sY + iAdjY + 230, DRAW_DIALOGBOX_GUILDMENU63, RGB(4,0,50)); if ((msX > sX + iAdjX +150) && (msX < sX + iAdjX +222) && (msY > sY + iAdjY + 228) && (msY < sY + iAdjY + 245)) PutString(sX + iAdjX +150 + 25 -23, sY + iAdjY + 230, DRAW_DIALOGBOX_GUILDMENU65, RGB(255,255,255)); else PutString(sX + iAdjX +150 + 25 -23, sY + iAdjY + 230, DRAW_DIALOGBOX_GUILDMENU65, RGB(4,0,50)); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 17); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 16); break; case 14: PutAlignedString(sX, sX + szX, sY + 130, DRAW_DIALOGBOX_GUILDMENU66, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 145, DRAW_DIALOGBOX_GUILDMENU67, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 160, DRAW_DIALOGBOX_GUILDMENU68, 55,25,25);// if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 15: PutAlignedString(sX, sX + szX, sY + 135, DRAW_DIALOGBOX_GUILDMENU69, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 150, DRAW_DIALOGBOX_GUILDMENU70, 55,25,25);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 16: PutAlignedString(sX, sX + szX, sY + 135, DRAW_DIALOGBOX_GUILDMENU71, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + 150, DRAW_DIALOGBOX_GUILDMENU72, 55,25,25);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 17: PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_GUILDMENU73, 55,25,25);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 18: PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_GUILDMENU74, 55,25,25);//" break; case 19: if( m_iFightzoneNumber >0 ) bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_GETOCCUPYFIGHTZONETICKET, NULL, NULL, NULL, NULL, NULL); m_stDialogBoxInfo[7].cMode = 0; break; case 20: PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_GUILDMENU75, 55,25,25);//" PutString(sX + 75, sY + 144, "____________________", RGB(25,35,25)); PutString(sX + 75, sY + 140, m_cGuildName, RGB(255,255,255), FALSE, 2); if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 25); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 24); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 17); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 16); break; case 21: PutAlignedString(sX, sX + szX, sY + iAdjY + 95, DRAW_DIALOGBOX_GUILDMENU76, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 110, DRAW_DIALOGBOX_GUILDMENU77, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 135, DRAW_DIALOGBOX_GUILDMENU78, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 150, DRAW_DIALOGBOX_GUILDMENU79, 55,25,25);//" PutAlignedString(sX, sX + szX, sY + iAdjY + 165, DRAW_DIALOGBOX_GUILDMENU80, 55,25,25);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 22: PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_GUILDMENU81, 55,25,25);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; } } void CGame::DrawDialogBox_GuildOperation(short msX, short msY) { short sX, sY; sX = m_stDialogBoxInfo[8].sX; sY = m_stDialogBoxInfo[8].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 0); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 19); switch (m_stGuildOpList[0].cOpMode) { case 1: PutAlignedString(sX + 24, sX + 248, sY + 50, DRAW_DIALOGBOX_GUILD_OPERATION1); PutAlignedString(sX + 24, sX + 248, sY + 65, m_stGuildOpList[0].cName, 35,35,35); PutAlignedString(sX + 24, sX + 248, sY + 69, "____________________", 0,0,0); PutAlignedString(sX + 24, sX + 248, sY + 90, DRAW_DIALOGBOX_GUILD_OPERATION2); PutAlignedString(sX + 24, sX + 248, sY + 105,DRAW_DIALOGBOX_GUILD_OPERATION3); PutAlignedString(sX + 24, sX + 248, sY + 120,DRAW_DIALOGBOX_GUILD_OPERATION4); PutAlignedString(sX + 24, sX + 248, sY + 160, DRAW_DIALOGBOX_GUILD_OPERATION5, 55,25,25); if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 33); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 32); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 35); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 34); break; case 2: PutAlignedString(sX + 24, sX + 248, sY + 50, DRAW_DIALOGBOX_GUILD_OPERATION6); PutAlignedString(sX + 24, sX + 248, sY + 65, m_stGuildOpList[0].cName, 35,35,35); PutAlignedString(sX + 24, sX + 248, sY + 69, "____________________", 0,0,0); PutAlignedString(sX + 24, sX + 248, sY + 90, DRAW_DIALOGBOX_GUILD_OPERATION7); PutAlignedString(sX + 24, sX + 248, sY + 105,DRAW_DIALOGBOX_GUILD_OPERATION8); PutAlignedString(sX + 24, sX + 248, sY + 120,DRAW_DIALOGBOX_GUILD_OPERATION9); PutAlignedString(sX + 24, sX + 248, sY + 160, DRAW_DIALOGBOX_GUILD_OPERATION10, 55,25,25); if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 33); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 32); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 35); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 34); break; case 3: PutAlignedString(sX + 24, sX + 248, sY + 50, DRAW_DIALOGBOX_GUILD_OPERATION11); PutAlignedString(sX + 24, sX + 248, sY + 65, m_stGuildOpList[0].cName, 35,35,35); PutAlignedString(sX + 24, sX + 248, sY + 69, "____________________", 0,0,0); PutAlignedString(sX + 24, sX + 248, sY + 90, DRAW_DIALOGBOX_GUILD_OPERATION12); PutAlignedString(sX + 24, sX + 248, sY + 105, DRAW_DIALOGBOX_GUILD_OPERATION13); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 4: PutAlignedString(sX + 24, sX + 248, sY + 50, DRAW_DIALOGBOX_GUILD_OPERATION14); PutAlignedString(sX + 24, sX + 248, sY + 65, m_stGuildOpList[0].cName, 35,35,35); PutAlignedString(sX + 24, sX + 248, sY + 69, "____________________", 0,0,0); PutAlignedString(sX + 24, sX + 248, sY + 90, DRAW_DIALOGBOX_GUILD_OPERATION15); PutAlignedString(sX + 24, sX + 248, sY + 105, DRAW_DIALOGBOX_GUILD_OPERATION16); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 5: PutAlignedString(sX + 24, sX + 248, sY + 50, DRAW_DIALOGBOX_GUILD_OPERATION17); PutAlignedString(sX + 24, sX + 248, sY + 65, m_stGuildOpList[0].cName, 35,35,35); PutAlignedString(sX + 24, sX + 248, sY + 69, "____________________", 0,0,0); PutAlignedString(sX + 24, sX + 248, sY + 90, DRAW_DIALOGBOX_GUILD_OPERATION18); PutAlignedString(sX + 24, sX + 248, sY + 105, DRAW_DIALOGBOX_GUILD_OPERATION19); PutAlignedString(sX + 24, sX + 248, sY + 120, DRAW_DIALOGBOX_GUILD_OPERATION20); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 6: PutAlignedString(sX + 24, sX + 248, sY + 50, DRAW_DIALOGBOX_GUILD_OPERATION21); PutAlignedString(sX + 24, sX + 248, sY + 65, m_stGuildOpList[0].cName, 35,35,35); PutAlignedString(sX + 24, sX + 248, sY + 69, "____________________", 0,0,0); PutAlignedString(sX + 24, sX + 248, sY + 90, DRAW_DIALOGBOX_GUILD_OPERATION22); PutAlignedString(sX + 24, sX + 248, sY + 105, DRAW_DIALOGBOX_GUILD_OPERATION23); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 7: PutAlignedString(sX + 24, sX + 248, sY + 50, DRAW_DIALOGBOX_GUILD_OPERATION24); //PutString(sX + 60, sY + 65, m_stGuildOpList[0].cName, RGB(35,35,35)); //PutString(sX + 60, sY + 69, "____________________", RGB(0,0,0)); PutAlignedString(sX + 24, sX + 248, sY + 90, DRAW_DIALOGBOX_GUILD_OPERATION25); PutAlignedString(sX + 24, sX + 248, sY + 105, DRAW_DIALOGBOX_GUILD_OPERATION26); PutAlignedString(sX + 24, sX + 248, sY + 120, DRAW_DIALOGBOX_GUILD_OPERATION27); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; } } int _tmp_iMCProb[] = {0, 300, 250, 200, 150, 100, 80, 70, 60, 50, 40}; int _tmp_iMLevelPenalty[] = {0, 5, 5, 8, 8, 10, 14, 28, 32, 36, 40}; void CGame::DrawDialogBox_Magic(short msX, short msY, short msZ) { short sX, sY, sMagicCircle, sLevelMagic; int iCPivot, i, iYloc, iResult, iManaCost; char cTxt[120], cMana[10]; DWORD dwTime = m_dwCurTime; double dV1, dV2, dV3, dV4; sX = m_stDialogBoxInfo[3].sX; sY = m_stDialogBoxInfo[3].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME1, sX, sY, 1, FALSE, m_bDialogTrans); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 7, FALSE, m_bDialogTrans); if( iGetTopDialogBoxIndex() == 3 && msZ != 0 ) { if( msZ > 0 ) m_stDialogBoxInfo[3].sView--; if( msZ < 0 ) m_stDialogBoxInfo[3].sView++; m_DInput.m_sZ = 0; } if( m_stDialogBoxInfo[3].sView < 0 ) m_stDialogBoxInfo[3].sView = 9; if( m_stDialogBoxInfo[3].sView > 9 ) m_stDialogBoxInfo[3].sView = 0; //Circle ZeroMemory(cTxt, sizeof(cTxt)); switch (m_stDialogBoxInfo[3].sView) { case 0: strcpy(cTxt, DRAW_DIALOGBOX_MAGIC1); break;//"Circle One" case 1: strcpy(cTxt, DRAW_DIALOGBOX_MAGIC2); break;//"Circle Two" case 2: strcpy(cTxt, DRAW_DIALOGBOX_MAGIC3); break;//"Circle Three" case 3: strcpy(cTxt, DRAW_DIALOGBOX_MAGIC4); break;//"Circle Four" case 4: strcpy(cTxt, DRAW_DIALOGBOX_MAGIC5); break;//"Circle Five" case 5: strcpy(cTxt, DRAW_DIALOGBOX_MAGIC6); break;//"Circle Six" case 6: strcpy(cTxt, DRAW_DIALOGBOX_MAGIC7); break;//"Circle Seven" case 7: strcpy(cTxt, DRAW_DIALOGBOX_MAGIC8); break;//"Circle Eight" case 8: strcpy(cTxt, DRAW_DIALOGBOX_MAGIC9); break;//"Circle Nine" case 9: strcpy(cTxt, DRAW_DIALOGBOX_MAGIC10); break;//"Circle Ten" } PutAlignedString(sX + 3, sX + 256, sY + 50, cTxt); PutAlignedString(sX + 4, sX + 257, sY + 50, cTxt); iCPivot = m_stDialogBoxInfo[3].sView*10; iYloc = 0; for (i = 0; i < 9; i++) { if ((m_cMagicMastery[iCPivot + i] != NULL) && (m_pMagicCfgList[iCPivot + i] != NULL)) { wsprintf(cTxt, "%s", m_pMagicCfgList[iCPivot + i]->m_cName); m_Misc.ReplaceString(cTxt, '-', ' '); iManaCost = iGetManaCost(iCPivot+i); if (iManaCost > m_iMP) { if( m_Misc.bCheckIMEString( cTxt ) == FALSE ) { PutString(sX + 30, sY + 73 + iYloc, cTxt, RGB(41, 16, 41)); PutString(sX + 31, sY + 73 + iYloc, cTxt, RGB(41, 16, 41)); } else PutString_SprFont(sX + 30, sY + 70 + iYloc, cTxt, 5, 5, 5); wsprintf(cMana, "%3d", iManaCost); PutString_SprFont(sX + 206, sY + 70 + iYloc, cMana, 5, 5, 5); } else if ((msX >= sX + 30) && (msX <= sX + 240) && (msY >= sY + 70 + iYloc) && (msY <= sY + 70 + 14 + iYloc)) { if( m_Misc.bCheckIMEString( cTxt ) == FALSE ) { PutString(sX + 30, sY + 73 + iYloc, cTxt, RGB(255,255,255)); PutString(sX + 31, sY + 73 + iYloc, cTxt, RGB(255,255,255)); } else PutString_SprFont(sX + 30, sY + 70 + iYloc, cTxt, 250, 250, 250); wsprintf(cMana, "%3d", iManaCost); PutString_SprFont(sX + 206, sY + 70 + iYloc, cMana, 250, 250, 250); } else { if( m_Misc.bCheckIMEString( cTxt ) == FALSE ) { PutString(sX + 30, sY + 73 + iYloc, cTxt, RGB(8,0,66)); PutString(sX + 31, sY + 73 + iYloc, cTxt, RGB(8,0,66)); } else PutString_SprFont(sX + 30, sY + 70 + iYloc, cTxt, 1, 1, 8); wsprintf(cMana, "%3d", iManaCost); PutString_SprFont(sX + 206, sY + 70 + iYloc, cMana, 1, 1, 8); } iYloc += 18; } } if (iYloc == 0) { PutAlignedString(sX + 3, sX +256, sY + 100, DRAW_DIALOGBOX_MAGIC11);//" PutAlignedString(sX + 3, sX +256, sY + 115, DRAW_DIALOGBOX_MAGIC12);//" PutAlignedString(sX + 3, sX +256, sY + 130, DRAW_DIALOGBOX_MAGIC13);//" PutAlignedString(sX + 3, sX +256, sY + 145, DRAW_DIALOGBOX_MAGIC14);//" PutAlignedString(sX + 3, sX +256, sY + 160, DRAW_DIALOGBOX_MAGIC15);//" } m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX + 30, sY + 250, 19, dwTime); switch (m_stDialogBoxInfo[3].sView) { case 0: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX + 30, sY + 250, 20, dwTime); break; case 1: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX + 43, sY + 250, 21, dwTime); break; case 2: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX + 61, sY + 250, 22, dwTime); break; case 3: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX + 86, sY + 250, 23, dwTime); break; case 4: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX + 106, sY + 250, 24, dwTime); break; case 5: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX + 121, sY + 250, 25, dwTime); break; case 6: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX + 142, sY + 250, 26, dwTime); break; case 7: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX + 169, sY + 250, 27, dwTime); break; case 8: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX + 202, sY + 250, 28, dwTime); break; case 9: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX + 222, sY + 250, 29, dwTime); break; } sMagicCircle = m_stDialogBoxInfo[3].sView + 1; if (m_cSkillMastery[SKILL_MAGIC] == 0) dV1 = 1.0f; else dV1 = (double)m_cSkillMastery[SKILL_MAGIC]; dV2 = (double)(dV1 / 100.0f); dV3 = (double)_tmp_iMCProb[sMagicCircle]; dV1 = dV2 * dV3; iResult = (int)dV1; if (m_stat[STAT_INT] > 50) iResult += (m_stat[STAT_INT] - 50)/2; sLevelMagic = (m_iLevel / 10); if (sMagicCircle != sLevelMagic) { if (sMagicCircle > sLevelMagic) { dV1 = (double)(m_iLevel - sLevelMagic*10); dV2 = (double)abs(sMagicCircle - sLevelMagic)*_tmp_iMLevelPenalty[sMagicCircle]; dV3 = (double)abs(sMagicCircle - sLevelMagic)*10; dV4 = (dV1 / dV3)*dV2; iResult -= abs(abs(sMagicCircle - sLevelMagic)*_tmp_iMLevelPenalty[sMagicCircle] - (int)dV4); }else { iResult += 5*abs(sMagicCircle - sLevelMagic); } } switch (m_cWhetherStatus) { case 0: break; case 1: iResult = iResult - (iResult / 24); break; case 2: iResult = iResult - (iResult / 12); break; case 3: iResult = iResult - (iResult / 5); break; } for( i=0; i<MAXITEMS ; i++ ) { if( m_pItemList[i] == NULL ) continue; if( m_bIsItemEquipped[i] == TRUE ) { if( ((m_pItemList[i]->m_dwAttribute & 0x00F00000) >> 20) == 10 ) { dV1 = (double)iResult; dV2 = (double)(( (m_pItemList[i]->m_dwAttribute & 0x000F0000) >> 16) * 3 ); dV3 = dV1 + dV2; iResult = (int)dV3; break; } } } if (iResult > 100) iResult = 100; if (m_iSP < 1) iResult = iResult*9/10; if (iResult < 1 ) iResult = 1; ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, DRAW_DIALOGBOX_MAGIC16, iResult);//" PutAlignedString(sX, sX + 256, sY + 267, cTxt); PutAlignedString(sX+1, sX + 257, sY + 267, cTxt); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + 285) && (msY <= sY + 285 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + 285, 49, FALSE, m_bDialogTrans); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + 285, 48, FALSE, m_bDialogTrans); } void CGame::DrawDialogBox_MagicShop(short msX, short msY, short msZ) { short sX, sY; DWORD dwTime = m_dwCurTime; int i; int iCPivot, iYloc; char cTxt[120], cMana[10]; sX = m_stDialogBoxInfo[16].sX; sY = m_stDialogBoxInfo[16].sY; switch (m_stDialogBoxInfo[16].cMode) { case 1: DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, sX, sY, 1); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 14); PutString_SprFont(sX + 45, sY + 40, DRAW_MANASAVEINFO, 5, 5, 5); PutString(sX + 50, sY + 55, DRAW_MANASAVEINFO1, RGB(45,25,25)); PutString(sX + 51, sY + 55, DRAW_MANASAVEINFO1, RGB(45,25,25)); PutString(sX + 50, sY + 70, DRAW_MANASAVEINFO2, RGB(255, 255, 255)); PutString(sX + 50, sY + 80, DRAW_MANASAVEINFO3, RGB(255, 255, 255)); PutString(sX + 50, sY + 90, DRAW_MANASAVEINFO4, RGB(255, 255, 255)); PutString(sX + 50, sY + 105, DRAW_MANASAVEINFO5, RGB(45,25,25)); PutString(sX + 51, sY + 105, DRAW_MANASAVEINFO5, RGB(45,25,25)); PutString(sX + 50, sY + 120, DRAW_MANASAVEINFO6, RGB(255, 255, 255)); PutString(sX + 50, sY + 130, DRAW_MANASAVEINFO7, RGB(255, 255, 255)); PutString(sX + 50, sY + 140, DRAW_MANASAVEINFO8, RGB(255, 255, 255)); PutString(sX + 50, sY + 155, DRAW_MANASAVEINFO9, RGB(45,25,25)); PutString(sX + 51, sY + 155, DRAW_MANASAVEINFO9, RGB(45,25,25)); PutString(sX + 50, sY + 170, DRAW_MANASAVEINFO10, RGB(255, 255, 255)); PutString(sX + 50, sY + 185, DRAW_MANASAVEINFO11, RGB(45,25,25)); PutString(sX + 51, sY + 185, DRAW_MANASAVEINFO11, RGB(45,25,25)); PutString(sX + 50, sY + 200, DRAW_MANASAVEINFO12, RGB(255, 255, 255)); PutString(sX + 50, sY + 210, DRAW_MANASAVEINFO13, RGB(255, 255, 255)); PutString(sX + 50, sY + 220, DRAW_MANASAVEINFO14, RGB(255, 255, 255)); PutString(sX + 50, sY + 230, DRAW_MANASAVEINFO15, RGB(255, 255, 255)); PutString(sX + 50, sY + 245, DRAW_MANASAVEINFO16, RGB(45,25,25)); PutString(sX + 51, sY + 245, DRAW_MANASAVEINFO16, RGB(45,25,25)); PutString(sX + 50, sY + 260, DRAW_MANASAVEINFO17, RGB(255, 255, 255)); PutString(sX + 50, sY + 270, DRAW_MANASAVEINFO18, RGB(255, 255, 255)); PutString(sX + 50, sY + 280, DRAW_MANASAVEINFO19, RGB(255, 255, 255)); break; default: DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, sX, sY, 1); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 14); if( iGetTopDialogBoxIndex() == 16 && msZ != 0 ) { if( msZ > 0 ) m_stDialogBoxInfo[16].sView--; if( msZ < 0 ) m_stDialogBoxInfo[16].sView++; m_DInput.m_sZ = 0; } if( m_stDialogBoxInfo[16].sView < 0 ) m_stDialogBoxInfo[16].sView = 9; if( m_stDialogBoxInfo[16].sView > 9 ) m_stDialogBoxInfo[16].sView = 0; PutString(sX + 20, sY - 35 + 90, DRAW_DIALOGBOX_MAGICSHOP11, RGB(45,25,25)); PutString(sX + 21, sY - 35 + 90, DRAW_DIALOGBOX_MAGICSHOP11, RGB(45,25,25)); PutString(sX + 155, sY - 35 + 90, DRAW_DIALOGBOX_MAGICSHOP16, RGB(45,25,25)); PutString(sX + 156, sY - 35 + 90, DRAW_DIALOGBOX_MAGICSHOP16, RGB(45,25,25)); PutString(sX + 225, sY - 35 + 90, DRAW_DIALOGBOX_MAGICSHOP12, RGB(45,25,25)); PutString(sX + 226, sY - 35 + 90, DRAW_DIALOGBOX_MAGICSHOP12, RGB(45,25,25)); PutString(sX + 255, sY - 35 + 90, DRAW_DIALOGBOX_MAGICSHOP13, RGB(45,25,25)); PutString(sX + 256, sY - 35 + 90, DRAW_DIALOGBOX_MAGICSHOP13, RGB(45,25,25)); iCPivot = m_stDialogBoxInfo[16].sView*10; iYloc = 0; for (i = 0; i < 9; i++) { if ((m_pMagicCfgList[iCPivot + i] != NULL) && (m_pMagicCfgList[iCPivot + i]->m_bIsVisible)) { wsprintf(cTxt, "%s", m_pMagicCfgList[iCPivot + i]->m_cName); m_Misc.ReplaceString(cTxt, '-', ' '); if (m_cMagicMastery[iCPivot + i] != 0) { if( m_Misc.bCheckIMEString( cTxt ) == FALSE ) { PutString(sX + 20, sY + 73 + iYloc, cTxt, RGB(41,16,41)); PutString(sX + 21, sY + 73 + iYloc, cTxt, RGB(41,16,41)); } else PutString_SprFont(sX + 20, sY + 70 + iYloc, cTxt, 5, 5, 5); wsprintf(cMana, "%3d", m_pMagicCfgList[iCPivot + i]->m_sValue1); PutString_SprFont(sX + 190, sY + 70 + iYloc, cMana, 5, 5, 5); wsprintf(cMana, "%3d", m_pMagicCfgList[iCPivot + i]->m_sValue2); PutString_SprFont(sX + 220, sY + 70 + iYloc, cMana, 5, 5, 5); wsprintf(cMana, "%3d", m_pMagicCfgList[iCPivot + i]->m_sValue3); PutString_SprFont(sX + 250, sY + 70 + iYloc, cMana, 5, 5, 5); } else if ((msX >= sX + 24) && (msX <= sX + 24 + 135) && (msY >= sY + 70 + iYloc) && (msY <= sY + 70 + 14 + iYloc)) { if( m_Misc.bCheckIMEString( cTxt ) == FALSE ) { PutString(sX + 20, sY + 73 + iYloc, cTxt, RGB(255,255,255)); PutString(sX + 21, sY + 73 + iYloc, cTxt, RGB(255,255,255)); } else PutString_SprFont(sX + 20, sY + 70 + iYloc, cTxt, 250, 250, 250); wsprintf(cMana, "%3d", m_pMagicCfgList[iCPivot + i]->m_sValue1); PutString_SprFont(sX + 190, sY + 70 + iYloc, cMana, 250, 250, 250); wsprintf(cMana, "%3d", m_pMagicCfgList[iCPivot + i]->m_sValue2); PutString_SprFont(sX + 220, sY + 70 + iYloc, cMana, 250, 250, 250); wsprintf(cMana, "%3d", m_pMagicCfgList[iCPivot + i]->m_sValue3); PutString_SprFont(sX + 250, sY + 70 + iYloc, cMana, 250, 250, 250); } else { if( m_Misc.bCheckIMEString( cTxt ) == FALSE ) { PutString(sX + 20, sY + 73 + iYloc, cTxt, RGB(8,0,66)); PutString(sX + 21, sY + 73 + iYloc, cTxt, RGB(8,0,66)); } else PutString_SprFont(sX + 20, sY + 70 + iYloc, cTxt, 1, 1, 8); wsprintf(cMana, "%3d", m_pMagicCfgList[iCPivot + i]->m_sValue1); PutString_SprFont(sX + 190, sY + 70 + iYloc, cMana, 1, 1, 8); wsprintf(cMana, "%3d", m_pMagicCfgList[iCPivot + i]->m_sValue2); PutString_SprFont(sX + 220, sY + 70 + iYloc, cMana, 1, 1, 8); wsprintf(cMana, "%3d", m_pMagicCfgList[iCPivot + i]->m_sValue3); PutString_SprFont(sX + 250, sY + 70 + iYloc, cMana, 1, 1, 8); } iYloc += 18; } } m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX + 55, sY + 250, 19, dwTime); switch (m_stDialogBoxInfo[16].sView) { case 0: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX -20 + 44 +31, sY + 250, 20, dwTime); break; case 1: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX -20 + 57 +31, sY + 250, 21, dwTime); break; case 2: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX -20 + 75 +31, sY + 250, 22, dwTime); break; case 3: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX -20 + 100 +31, sY + 250, 23, dwTime); break; case 4: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX -20 + 120 +31, sY + 250, 24, dwTime); break; case 5: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX -20 + 135 +31, sY + 250, 25, dwTime); break; case 6: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX -20 + 156 +31, sY + 250, 26, dwTime); break; case 7: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX -20 + 183 +31, sY + 250, 27, dwTime); break; case 8: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX -20 + 216 +31, sY + 250, 28, dwTime); break; case 9: m_pSprite[SPRID_INTERFACE_SPRFONTS]->PutSpriteFast(sX -20 + 236 +31, sY + 250, 29, dwTime); break; } PutString(sX + 90, sY + 260, DRAW_DIALOGBOX_MAGICSHOP17, RGB(45,25,25)); PutString(sX + 91, sY + 260, DRAW_DIALOGBOX_MAGICSHOP17, RGB(45,25,25)); PutAlignedString(sX, sX+m_stDialogBoxInfo[16].sSizeX, sY + 275, DRAW_DIALOGBOX_MAGICSHOP14, 45,25,25); PutAlignedString(sX, sX+m_stDialogBoxInfo[16].sSizeX+1, sY + 275, DRAW_DIALOGBOX_MAGICSHOP14, 45,25,25); break; } } void CGame::DrawDialogBox_ShutDownMsg(short msX, short msY) { short sX, sY, szX; sX = m_stDialogBoxInfo[25].sX; sY = m_stDialogBoxInfo[25].sY; szX = m_stDialogBoxInfo[25].sSizeX; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, sX, sY,2); switch (m_stDialogBoxInfo[25].cMode) { case 1: ZeroMemory(G_cTxt, sizeof(G_cTxt)); if (m_stDialogBoxInfo[25].sV1 != 0) wsprintf(G_cTxt, DRAW_DIALOGBOX_NOTICEMSG1, m_stDialogBoxInfo[25].sV1); else strcpy(G_cTxt, DRAW_DIALOGBOX_NOTICEMSG2); PutAlignedString(sX, sX + szX, sY + 31, G_cTxt, 100,10,10); PutAlignedString(sX, sX + szX, sY + 48, DRAW_DIALOGBOX_NOTICEMSG3); PutAlignedString(sX, sX + szX, sY + 65, DRAW_DIALOGBOX_NOTICEMSG4); PutAlignedString(sX, sX + szX, sY + 82, DRAW_DIALOGBOX_NOTICEMSG5); PutAlignedString(sX, sX + szX, sY + 99, DRAW_DIALOGBOX_NOTICEMSG6); if ((msX >= sX + 210) && (msX <= sX + 210 + BTNSZX) && (msY > sY + 127) && (msY < sY + 127 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 210, sY + 127, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 210, sY + 127, 0); break; case 2: PutAlignedString(sX, sX + szX, sY + 31, DRAW_DIALOGBOX_NOTICEMSG7, 100,10,10); PutAlignedString(sX, sX + szX, sY + 48, DRAW_DIALOGBOX_NOTICEMSG8); PutAlignedString(sX, sX + szX, sY + 65, DRAW_DIALOGBOX_NOTICEMSG9); PutAlignedString(sX, sX + szX, sY + 82, DRAW_DIALOGBOX_NOTICEMSG10); PutAlignedString(sX, sX + szX, sY + 99, DRAW_DIALOGBOX_NOTICEMSG11); if ((msX >= sX + 210) && (msX <= sX + 210 + BTNSZX) && (msY > sY + 127) && (msY < sY + 127 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 210, sY + 127, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 210, sY + 127, 0); break; } } void CGame::DrawDialogBox_NpcActionQuery(short msX, short msY) { short sX, sY, szX; char cTxt[120], cTxt2[120], cStr1[64], cStr2[64], cStr3[64]; ZeroMemory(cStr1, sizeof(cStr1)); ZeroMemory(cStr2, sizeof(cStr2)); ZeroMemory(cStr3, sizeof(cStr3)); sX = m_stDialogBoxInfo[20].sX; sY = m_stDialogBoxInfo[20].sY; szX = m_stDialogBoxInfo[20].sSizeX; //DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 5); //5 //DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 6); //6 switch (m_stDialogBoxInfo[20].cMode) { case 0: // npc DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 5); switch (m_stDialogBoxInfo[20].sV3) { case 15: PutString(sX +33, sY +23, NPC_NAME_SHOP_KEEPER, RGB(45,25,25)); PutString(sX +33 -1, sY +23 -1, NPC_NAME_SHOP_KEEPER, RGB(255,255,255)); break; case 19: PutString(sX +33, sY +23, NPC_NAME_MAGICIAN, RGB(45,25,25)); PutString(sX +33 -1, sY +23 -1, NPC_NAME_MAGICIAN, RGB(255,255,255)); break; case 20: PutString(sX +33, sY +23, NPC_NAME_WAREHOUSE_KEEPER, RGB(45,25,25)); PutString(sX +33 -1, sY +23 -1, NPC_NAME_WAREHOUSE_KEEPER, RGB(255,255,255)); break; case 24: PutString(sX +33, sY +23, NPC_NAME_BLACKSMITH_KEEPER, RGB(45,25,25)); PutString(sX +33 -1, sY +23 -1, NPC_NAME_BLACKSMITH_KEEPER, RGB(255,255,255)); break; case 25: PutString(sX +33, sY +23, NPC_NAME_CITYHALL_OFFICER, RGB(45,25,25)); PutString(sX +33 -1, sY +23 -1, NPC_NAME_CITYHALL_OFFICER, RGB(255,255,255)); break; case 26: // "Guildhall Officer" PutString(sX +33, sY +23, NPC_NAME_GUILDHALL_OFFICER, RGB(45,25,25)); PutString(sX +33 -1, sY +23 -1, NPC_NAME_GUILDHALL_OFFICER, RGB(255,255,255)); break; case 90: //Gail PutString(sX +33, sY +23, NPC_NAME_CMDHALL_OFFICER, RGB(45,25,25)); PutString(sX +33 -1, sY +23 -1, NPC_NAME_CMDHALL_OFFICER, RGB(255,255,255)); break; } if ( m_stDialogBoxInfo[20].sV3 == 25 ) { // OFFER if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY13, RGB(255,255,255)); // "Offer" PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY13, RGB(255,255,255)); } else { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY13, RGB(4,0,50)); PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY13, RGB(4,0,50)); } }else if ( m_stDialogBoxInfo[20].sV3 == 20 ) { // WITHDRAW if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY17, RGB(255,255,255)); // "Withdraw" PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY17, RGB(255,255,255)); } else { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY17, RGB(4,0,50)); PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY17, RGB(4,0,50)); } }else if ( m_stDialogBoxInfo[20].sV3 == 19 ) // CLEROTH: MAGICIAN { // LEARN if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY19, RGB(255,255,255)); // "Learn" PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY19, RGB(255,255,255)); } else { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY19, RGB(4,0,50)); PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY19, RGB(4,0,50)); } }else { // TRADE if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY21, RGB(255,255,255)); // "Trade" PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY21, RGB(255,255,255)); } else { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY21, RGB(4,0,50)); PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY21, RGB(4,0,50)); } } if (m_bIsDialogEnabled[21] == FALSE) { if ((msX > sX + 125) && (msX < sX + 180) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 125, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY25, RGB(255,255,255)); // "Talk" PutString(sX + 126, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY25, RGB(255,255,255)); } else { PutString(sX + 125, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY25, RGB(4,0,50)); PutString(sX + 126, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY25, RGB(4,0,50)); } } break; case 1: // Other char DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 6); GetItemName(m_pItemList[m_stDialogBoxInfo[20].sV1]->m_cName, m_pItemList[m_stDialogBoxInfo[20].sV1]->m_dwAttribute, cStr1, cStr2, cStr3); wsprintf(cTxt, DRAW_DIALOGBOX_NPCACTION_QUERY29, m_stDialogBoxInfo[20].sV3, cStr1); //"%d %s to" wsprintf(cTxt2, DRAW_DIALOGBOX_NPCACTION_QUERY29_1, m_stDialogBoxInfo[20].cStr); // "%s" PutString(sX+24, sY+25, cTxt, RGB(45,25,25)); PutString(sX+24, sY+40, cTxt2, RGB(45,25,25)); if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY30, RGB(255,255,255));//"Give" PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY30, RGB(255,255,255)); } else { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY30, RGB(4,0,50)); PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY30, RGB(4,0,50)); } if ((msX > sX + 155) && (msX < sX + 210) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 155, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY34, RGB(255,255,255));//"Exchange" PutString(sX + 156, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY34, RGB(255,255,255)); } else { PutString(sX + 155, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY34, RGB(4,0,50)); PutString(sX + 156, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY34, RGB(4,0,50)); } break; case 2: // Shop / BS DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 5); GetItemName(m_pItemList[ m_stDialogBoxInfo[20].sV1 ]->m_cName, m_pItemList[ m_stDialogBoxInfo[20].sV1 ]->m_dwAttribute, cStr1, cStr2, cStr3); wsprintf(cTxt, DRAW_DIALOGBOX_NPCACTION_QUERY29, m_stDialogBoxInfo[20].sV3, cStr1);//"%d %s to" wsprintf(cTxt2, DRAW_DIALOGBOX_NPCACTION_QUERY29_1, m_stDialogBoxInfo[20].cStr);//"%s" PutString(sX+24, sY+20, cTxt, RGB(45,25,25)); PutString(sX+24, sY+35, cTxt2, RGB(45,25,25)); if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY39, RGB(255,255,255));//"Sell" PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY39, RGB(255,255,255)); }else { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY39, RGB(4,0,50)); PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY39, RGB(4,0,50)); } if ((m_pItemList[m_stDialogBoxInfo[20].sV1]->m_cItemType == ITEMTYPE_CONSUME) || (m_pItemList[m_stDialogBoxInfo[20].sV1]->m_cItemType == ITEMTYPE_ARROW)) {}else { if ((msX > sX + 125) && (msX < sX + 180) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 125, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY43, RGB(255,255,255));//"Repair" PutString(sX + 126, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY43, RGB(255,255,255)); }else { PutString(sX + 125, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY43, RGB(4,0,50)); PutString(sX + 126, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY43, RGB(4,0,50)); } } break; case 3: // WH DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 6); GetItemName(m_pItemList[m_stDialogBoxInfo[20].sV1]->m_cName, m_pItemList[m_stDialogBoxInfo[20].sV1]->m_dwAttribute, cStr1, cStr2, cStr3); wsprintf(cTxt, DRAW_DIALOGBOX_NPCACTION_QUERY29, m_stDialogBoxInfo[20].sV3, cStr1);//"%d %s to" wsprintf(cTxt2, DRAW_DIALOGBOX_NPCACTION_QUERY29_1, m_stDialogBoxInfo[20].cStr);//"%s" PutAlignedString(sX, sX+240, sY+20, cTxt, 45,25,25); PutAlignedString(sX, sX+240, sY+35, cTxt2, 45,25,25); if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY48, RGB(255,255,255));//"Deposit" PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY48, RGB(255,255,255)); }else { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY48, RGB(4,0,50)); PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY48, RGB(4,0,50)); } break; case 4: // talk to npc or unicorn DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 5); switch (m_stDialogBoxInfo[20].sV3) { case 21: PutString(sX +35, sY + 25, NPC_NAME_GUARD, RGB(45,25,25));// PutString(sX +35 -1, sY + 25 -1, NPC_NAME_GUARD, RGB(255,255,255)); break; case 32: PutString(sX +35, sY + 25, NPC_NAME_UNICORN, RGB(45,25,25));//" PutString(sX +35 -1, sY + 25 -1, NPC_NAME_UNICORN, RGB(255,255,255));//" break; case 67: PutString(sX +35, sY + 25, NPC_NAME_MCGAFFIN, RGB(45,25,25)); PutString(sX +35 -1, sY + 25 -1, NPC_NAME_MCGAFFIN, RGB(255,255,255)); break; case 68: PutString(sX +35, sY + 25, NPC_NAME_PERRY, RGB(45,25,25)); PutString(sX +35 -1, sY + 25 -1, NPC_NAME_PERRY, RGB(255,255,255)); break; case 69: PutString(sX +35, sY + 25, NPC_NAME_DEVLIN, RGB(45,25,25)); PutString(sX +35 -1, sY + 25 -1, NPC_NAME_DEVLIN, RGB(255,255,255)); break; } if (m_bIsDialogEnabled[21] == FALSE) { if ((msX > sX + 125) && (msX < sX + 180) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 125, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY25, RGB(255,255,255)); PutString(sX + 126, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY25, RGB(255,255,255)); } else { PutString(sX + 125, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY25, RGB(4,0,50)); PutString(sX + 126, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY25, RGB(4,0,50)); } } break; case 5: // Shop / BS DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 6); switch (m_stDialogBoxInfo[20].sV3) { case 15: PutString(sX +33, sY +23, NPC_NAME_SHOP_KEEPER, RGB(45,25,25));//Shop Keeper" PutString(sX +33 -1, sY +23 -1, NPC_NAME_SHOP_KEEPER, RGB(255,255,255)); break; case 24: PutString(sX +33, sY +23, NPC_NAME_BLACKSMITH_KEEPER, RGB(45,25,25));//"BlackSmith Keeper" PutString(sX +33 -1, sY +23 -1, NPC_NAME_BLACKSMITH_KEEPER, RGB(255,255,255));//" break; } if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY21, RGB(255,255,255));//"Trade" PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY21, RGB(255,255,255)); }else { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY21, RGB(4,0,50)); PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY21, RGB(4,0,50)); } if ((msX > sX + 25 +79) && (msX < sX + 80 +75) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 28 +75, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY39, RGB(255,255,255));//"Sell" PutString(sX + 29 +75, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY39, RGB(255,255,255)); }else { PutString(sX + 28 +75, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY39, RGB(4,0,50)); PutString(sX + 29 +75, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY39, RGB(4,0,50)); } if (m_bIsDialogEnabled[21] == FALSE) { if ((msX > sX + 155) && (msX < sX + 210) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 155, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY25, RGB(255,255,255));//"Talk" PutString(sX + 156, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY25, RGB(255,255,255)); }else { PutString(sX + 155, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY25, RGB(4,0,50)); PutString(sX + 156, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY25, RGB(4,0,50)); } } break; case 6: //Gail DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 5); if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 55) && (msY < sY + 70)) { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY21, RGB(255,255,255)); // "Trade" PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY21, RGB(255,255,255)); }else { PutString(sX + 28, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY21, RGB(4,0,50)); PutString(sX + 29, sY + 55, DRAW_DIALOGBOX_NPCACTION_QUERY21, RGB(4,0,50)); } PutString(sX +33, sY +23, DRAW_DIALOGBOX_NPCACTION_QUERY49, RGB(45,25,25)); PutString(sX +33 -1, sY +23 -1, DRAW_DIALOGBOX_NPCACTION_QUERY49, RGB(255,255,255)); break; case 7: // Jehovah - New Blacksmith Function DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 5); if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 30) && (msY < sY + 45)) { PutString(sX + 25, sY + 30, DRAW_BLACKSMITH1, RGB(255,255,255)); // "Buy Weapons" PutString(sX + 26, sY + 30, DRAW_BLACKSMITH1, RGB(255,255,255)); }else { PutString(sX + 25, sY + 30, DRAW_BLACKSMITH1, RGB(4,0,50)); PutString(sX + 26, sY + 30, DRAW_BLACKSMITH1, RGB(4,0,50)); } if ((msX > sX + 125) && (msX < sX + 175) && (msY > sY + 30) && (msY < sY + 45)) { PutString(sX + 125, sY + 30, DRAW_BLACKSMITH2, RGB(255,255,255)); // "Buy (M) Armor" PutString(sX + 126, sY + 30, DRAW_BLACKSMITH2, RGB(255,255,255)); }else { PutString(sX + 125, sY + 30, DRAW_BLACKSMITH2, RGB(4,0,50)); PutString(sX + 126, sY + 30, DRAW_BLACKSMITH2, RGB(4,0,50)); } if ((msX > sX + 125) && (msX < sX + 175) && (msY > sY + 50) && (msY < sY + 65)) { PutString(sX + 125, sY + 50, DRAW_BLACKSMITH3, RGB(255,255,255)); // "Buy (W) Armor" PutString(sX + 126, sY + 50, DRAW_BLACKSMITH3, RGB(255,255,255)); }else { PutString(sX + 125, sY + 50, DRAW_BLACKSMITH3, RGB(4,0,50)); PutString(sX + 126, sY + 50, DRAW_BLACKSMITH3, RGB(4,0,50)); } if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 50) && (msY < sY + 65)) { PutString(sX + 25, sY + 50, DRAW_BLACKSMITH4, RGB(255,255,255)); // "Sell" PutString(sX + 26, sY + 50, DRAW_BLACKSMITH4, RGB(255,255,255)); }else { PutString(sX + 25, sY + 50, DRAW_BLACKSMITH4, RGB(4,0,50)); PutString(sX + 26, sY + 50, DRAW_BLACKSMITH4, RGB(4,0,50)); } PutString(sX +65, sY +5, DRAW_BLACKSMITH, RGB(0,0,0)); PutString(sX +65 -1, sY +5 -1, DRAW_BLACKSMITH, RGB(255,255,255)); PutString(sX +61, sY +5, "________________", RGB(0,0,0)); break; case 8: // Jehovah - New Shopkeeper Function DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 5); if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 30) && (msY < sY + 45)) { PutString(sX + 25, sY + 30, DRAW_SHOP1, RGB(255,255,255)); // "Buy Potions" PutString(sX + 26, sY + 30, DRAW_SHOP1, RGB(255,255,255)); }else { PutString(sX + 25, sY + 30, DRAW_SHOP1, RGB(4,0,50)); PutString(sX + 26, sY + 30, DRAW_SHOP1, RGB(4,0,50)); } if ((msX > sX + 125) && (msX < sX + 175) && (msY > sY + 30) && (msY < sY + 45)) { PutString(sX + 125, sY + 30, DRAW_SHOP2, RGB(255,255,255)); // "Buy Misc." PutString(sX + 126, sY + 30, DRAW_SHOP2, RGB(255,255,255)); }else { PutString(sX + 125, sY + 30, DRAW_SHOP2, RGB(4,0,50)); PutString(sX + 126, sY + 30, DRAW_SHOP2, RGB(4,0,50)); } if ((msX > sX + 125) && (msX < sX + 175) && (msY > sY + 50) && (msY < sY + 65)) { PutString(sX + 125, sY + 50, DRAW_SHOP3, RGB(255,255,255)); // "Buy Outfits" PutString(sX + 126, sY + 50, DRAW_SHOP3, RGB(255,255,255)); }else { PutString(sX + 125, sY + 50, DRAW_SHOP3, RGB(4,0,50)); PutString(sX + 126, sY + 50, DRAW_SHOP3, RGB(4,0,50)); } if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 50) && (msY < sY + 65)) { PutString(sX + 25, sY + 50, DRAW_SHOP4, RGB(255,255,255)); // "Sell Items" PutString(sX + 26, sY + 50, DRAW_SHOP4, RGB(255,255,255)); }else { PutString(sX + 25, sY + 50, DRAW_SHOP4, RGB(4,0,50)); PutString(sX + 26, sY + 50, DRAW_SHOP4, RGB(4,0,50)); } PutString(sX +70, sY +5, DRAW_SHOP, RGB(0,0,0)); PutString(sX +70 -1, sY +5 -1, DRAW_SHOP, RGB(255,255,255)); PutString(sX +66, sY +5, "____________", RGB(0,0,0)); break; case 9: // Jehovah - New Cityhall Officer Function DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 5); if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 30) && (msY < sY + 45)) { PutString(sX + 25, sY + 30, DRAW_CITYHALL1, RGB(255,255,255)); // "Offer" PutString(sX + 26, sY + 30, DRAW_CITYHALL1, RGB(255,255,255)); }else { PutString(sX + 25, sY + 30, DRAW_CITYHALL1, RGB(4,0,50)); PutString(sX + 26, sY + 30, DRAW_CITYHALL1, RGB(4,0,50)); } //if ((msX > sX + 125) && (msX < sX + 175) && (msY > sY + 30) && (msY < sY + 45)) //{ PutString(sX + 125, sY + 30, DRAW_CITYHALL2, RGB(255,255,255)); // "Buy Armor" // PutString(sX + 126, sY + 30, DRAW_CITYHALL2, RGB(255,255,255)); //}else //{ PutString(sX + 125, sY + 30, DRAW_CITYHALL2, RGB(4,0,50)); // PutString(sX + 126, sY + 30, DRAW_CITYHALL2, RGB(4,0,50)); //} if ((msX > sX + 125) && (msX < sX + 175) && (msY > sY + 50) && (msY < sY + 65)) { PutString(sX + 125, sY + 50, DRAW_CITYHALL2, RGB(255,255,255)); // "Buy Weapons" PutString(sX + 126, sY + 50, DRAW_CITYHALL2, RGB(255,255,255)); }else { PutString(sX + 125, sY + 50, DRAW_CITYHALL2, RGB(4,0,50)); PutString(sX + 126, sY + 50, DRAW_CITYHALL2, RGB(4,0,50)); } if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 50) && (msY < sY + 65)) { PutString(sX + 25, sY + 50, DRAW_CITYHALL3, RGB(255,255,255)); // "Talk" PutString(sX + 26, sY + 50, DRAW_CITYHALL3, RGB(255,255,255)); }else { PutString(sX + 25, sY + 50, DRAW_CITYHALL3, RGB(4,0,50)); PutString(sX + 26, sY + 50, DRAW_CITYHALL3, RGB(4,0,50)); } PutString(sX +70, sY +5, DRAW_CITYHALL, RGB(0,0,0)); PutString(sX +70 -1, sY +5 -1, DRAW_CITYHALL, RGB(255,255,255)); PutString(sX +66, sY +5, "____________", RGB(0,0,0)); break; } } void CGame::DrawDialogBox_Party(short msX, short msY, short msZ, char cLB) { short sX, sY, szX; int i, iTotalLines, iPointerLoc; double d1, d2, d3; sX = m_stDialogBoxInfo[32].sX; sY = m_stDialogBoxInfo[32].sY; szX = m_stDialogBoxInfo[32].sSizeX; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 0); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 3); switch (m_stDialogBoxInfo[32].cMode) { case 0: if (m_iPartyStatus == 0) { if ((msX > sX + 80) && (msX < sX + 195) && (msY > sY + 80) && (msY < sY + 100)) PutAlignedString(sX, sX + szX, sY + 85, DRAW_DIALOGBOX_PARTY1, 255,255,255);//" else PutAlignedString(sX, sX + szX, sY + 85, DRAW_DIALOGBOX_PARTY1, 4,0,50);//" } else PutAlignedString(sX, sX + szX, sY + 85, DRAW_DIALOGBOX_PARTY1, 65,65,65);//" if (m_iPartyStatus != 0) { if ((msX > sX + 80) && (msX < sX + 195) && (msY > sY + 100) && (msY < sY + 120)) PutAlignedString(sX, sX + szX, sY + 105, DRAW_DIALOGBOX_PARTY4, 255,255,255);//" else PutAlignedString(sX, sX + szX, sY + 105, DRAW_DIALOGBOX_PARTY4, 4,0,50);//" } else PutAlignedString(sX, sX + szX, sY + 105, DRAW_DIALOGBOX_PARTY4, 65,65,65);//" if (m_iPartyStatus != 0) { if ((msX > sX + 80) && (msX < sX + 195) && (msY > sY + 120) && (msY < sY + 140)) PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_PARTY7, 255,255,255);//" else PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_PARTY7, 4,0,50);//" } else PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_PARTY7, 65,65,65);//" if (m_partyAutoAccept) { if ((msX > sX + 80) && (msX < sX + 195) && (msY > sY + 140) && (msY < sY + 160)) PutAlignedString(sX, sX + szX, sY + 145, DRAW_DIALOGBOX_PARTY57, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 145, DRAW_DIALOGBOX_PARTY57, 4,0,50);//" } else { if ((msX > sX + 80) && (msX < sX + 195) && (msY > sY + 140) && (msY < sY + 160)) PutAlignedString(sX, sX + szX, sY + 145, DRAW_DIALOGBOX_PARTY56, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 145, DRAW_DIALOGBOX_PARTY56, 4,0,50); } switch (m_iPartyStatus) { case 0: PutAlignedString(sX, sX + szX, sY + 175, DRAW_DIALOGBOX_PARTY10);//" PutAlignedString(sX, sX + szX, sY + 190, DRAW_DIALOGBOX_PARTY11);//" PutAlignedString(sX, sX + szX, sY + 205, DRAW_DIALOGBOX_PARTY12);//" break; case 1: case 2: PutAlignedString(sX, sX + szX, sY + 175, DRAW_DIALOGBOX_PARTY13);//" PutAlignedString(sX, sX + szX, sY + 190, DRAW_DIALOGBOX_PARTY14);//" PutAlignedString(sX, sX + szX, sY + 205, DRAW_DIALOGBOX_PARTY15);//" break; } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; break; case 1: // wsprintf(G_cTxt, DRAW_DIALOGBOX_PARTY16, m_stDialogBoxInfo[32].cStr); PutAlignedString(sX, sX + szX, sY + 95, G_cTxt); PutAlignedString(sX, sX + szX, sY + 110, DRAW_DIALOGBOX_PARTY17);//"join the party. You can" PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_PARTY18);//"share the experience by" PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_PARTY19);//"the ratio of level if" PutAlignedString(sX, sX + szX, sY + 155, DRAW_DIALOGBOX_PARTY20);//"you join the party." PutAlignedString(sX, sX + szX, sY + 175, DRAW_DIALOGBOX_PARTY21);//"Would you like to join party?" if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 18); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 2); break; case 2: PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_PARTY22);//"Click the character which" PutAlignedString(sX, sX + szX, sY + 110, DRAW_DIALOGBOX_PARTY23);//" PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_PARTY24);//" PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_PARTY25);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 17); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 16); break; case 3: wsprintf(G_cTxt, DRAW_DIALOGBOX_PARTY26, m_stDialogBoxInfo[32].cStr);//" PutAlignedString(sX, sX + szX, sY + 95, G_cTxt); PutAlignedString(sX, sX + szX, sY + 110, DRAW_DIALOGBOX_PARTY27);//" PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_PARTY28);//" PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_PARTY29);//" PutAlignedString(sX, sX + szX, sY + 155, DRAW_DIALOGBOX_PARTY30);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 17); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 16); break; case 4: PutAlignedString(sX, sX + szX, sY + 50, DRAW_DIALOGBOX_PARTY31);//" PutAlignedString(sX, sX + szX, sY + 65, DRAW_DIALOGBOX_PARTY32);//" iTotalLines = m_stPartyMember.size(); if (iTotalLines > 12) { d1 = (double)m_stDialogBoxInfo[32].sView; d2 = (double)(iTotalLines-12); d3 = (274.0f * d1)/d2; iPointerLoc = (int)(d3); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 3); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX+242, sY + iPointerLoc + 35, 7); } if (cLB != 0 && iTotalLines > 12) { if ((iGetTopDialogBoxIndex() == 32)) { if ((msX >= sX + 235) && (msX <= sX + 260) && (msY >= sY + 10) && (msY <= sY + 330)) { d1 = (double)(msY -(sY+35)); d2 = (double)(iTotalLines-12); d3 = (d1 * d2)/274.0f; m_stDialogBoxInfo[32].sView = (int)(d3+0.5); } } }else m_stDialogBoxInfo[32].bIsScrollSelected = FALSE; if( iGetTopDialogBoxIndex() == 32 && msZ != 0 ) { m_stDialogBoxInfo[11].sView = m_stDialogBoxInfo[11].sView - msZ/60; m_DInput.m_sZ = 0; } if( iTotalLines > 12 && m_stDialogBoxInfo[32].sView > iTotalLines-12 ) m_stDialogBoxInfo[32].sView = iTotalLines-12; if( m_stDialogBoxInfo[32].sView < 0 || iTotalLines < 12 ) m_stDialogBoxInfo[32].sView = 0; for (i = 0; i < 12; i++) if ((i+ m_stDialogBoxInfo[32].sView) < m_stPartyMember.size()) { PutAlignedString(sX +10, sX +260, sY + 95 +15*(i), (char*)m_stPartyMember[i + m_stDialogBoxInfo[32].sView]->cName.c_str()); } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 5: PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_PARTY33);//" PutAlignedString(sX, sX + szX, sY + 110, DRAW_DIALOGBOX_PARTY34);//" break; case 6: PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_PARTY35);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 7: PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_PARTY36);//" PutAlignedString(sX, sX + szX, sY + 110, DRAW_DIALOGBOX_PARTY37);//" PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_PARTY38);//" PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_PARTY39);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 8: PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_PARTY40);//" PutAlignedString(sX, sX + szX, sY + 110, DRAW_DIALOGBOX_PARTY41);//" PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_PARTY42);//" PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_PARTY43);//" PutAlignedString(sX, sX + szX, sY + 155, DRAW_DIALOGBOX_PARTY44);//" PutAlignedString(sX, sX + szX, sY + 170, DRAW_DIALOGBOX_PARTY45);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 9: PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_PARTY46);//" PutAlignedString(sX, sX + szX, sY + 110, DRAW_DIALOGBOX_PARTY47);//" PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_PARTY48);//" PutAlignedString(sX, sX + szX, sY + 140, DRAW_DIALOGBOX_PARTY49);//" PutAlignedString(sX, sX + szX, sY + 155, DRAW_DIALOGBOX_PARTY50);//" PutAlignedString(sX, sX + szX, sY + 170, DRAW_DIALOGBOX_PARTY51);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 10: PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_PARTY52);//" PutAlignedString(sX, sX + szX, sY + 110, DRAW_DIALOGBOX_PARTY53);//" PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_PARTY54);//" if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 11: // PutAlignedString(sX, sX + szX, sY + 95, DRAW_DIALOGBOX_PARTY55);//" if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 18); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 2); break; } } void CGame::DrawDialogBox_QueryDropItemAmount() { short sX, sY; char cTxt[120], cStr1[64], cStr2[64], cStr3[64]; sX = m_stDialogBoxInfo[17].sX; sY = m_stDialogBoxInfo[17].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 5); switch (m_stDialogBoxInfo[17].cMode) { case 1: GetItemName( m_pItemList[m_stDialogBoxInfo[17].sView]->m_cName, m_pItemList[m_stDialogBoxInfo[17].sView]->m_dwAttribute, cStr1, cStr2, cStr3 ); if (strlen(m_stDialogBoxInfo[17].cStr) == 0) wsprintf(cTxt, DRAW_DIALOGBOX_QUERY_DROP_ITEM_AMOUNT1, cStr1); else wsprintf(cTxt, DRAW_DIALOGBOX_QUERY_DROP_ITEM_AMOUNT2, cStr1, m_stDialogBoxInfo[17].cStr);//"%s: if (m_stDialogBoxInfo[17].sV3 < 1000) PutString(sX + 30, sY + 20, cTxt, RGB(55,25,25)); PutString(sX + 30, sY + 35, DRAW_DIALOGBOX_QUERY_DROP_ITEM_AMOUNT3, RGB(55,25,25));//" if (iGetTopDialogBoxIndex() != 17) PutString(sX + 40, sY + 57, m_cAmountString, RGB(255,255,255), FALSE, 2); wsprintf(cTxt, "__________ (0 ~ %d)", m_pItemList[m_stDialogBoxInfo[17].sView]->m_dwCount); PutString(sX + 38, sY + 62, cTxt, RGB(25,35,25)); break; case 20: GetItemName( m_pItemList[m_stDialogBoxInfo[17].sView]->m_cName, m_pItemList[m_stDialogBoxInfo[17].sView]->m_dwAttribute, cStr1, cStr2, cStr3 ); if (strlen(m_stDialogBoxInfo[17].cStr) == 0) wsprintf(cTxt, DRAW_DIALOGBOX_QUERY_DROP_ITEM_AMOUNT1, cStr1);//"%s: else wsprintf(cTxt, DRAW_DIALOGBOX_QUERY_DROP_ITEM_AMOUNT2, cStr1, m_stDialogBoxInfo[17].cStr);//"%s: if (m_stDialogBoxInfo[17].sV3 < 1000) PutString(sX + 30, sY + 20, cTxt, RGB(55,25,25)); PutString(sX + 30, sY + 35, DRAW_DIALOGBOX_QUERY_DROP_ITEM_AMOUNT3, RGB(55,25,25));//" PutString(sX + 40, sY + 57, m_cAmountString, RGB(255,255,255), FALSE, 2); wsprintf(cTxt, "__________ (0 ~ %d)", m_pItemList[m_stDialogBoxInfo[17].sView]->m_dwCount); PutString(sX + 38, sY + 62, cTxt, RGB(25,35,25)); break; } } void CGame::DrawDialogBox_Quest(int msX, int msY) { short sX, sY, szX; char cTxt[120], cTemp[21]; sX = m_stDialogBoxInfo[28].sX; sY = m_stDialogBoxInfo[28].sY; szX = m_stDialogBoxInfo[28].sSizeX; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT , sX, sY, 4); switch (m_stDialogBoxInfo[28].cMode) { case 1: switch (m_stQuest.sQuestType) { case NULL: PutAlignedString(sX, sX + szX, sY + 50 +115 -30, DRAW_DIALOGBOX_QUEST1, 55,25,25); // " You are not on a quest." break; case 1: // Hunt if (m_stQuest.bIsQuestCompleted == FALSE) PutAlignedString(sX, sX + szX, sY + 50, DRAW_DIALOGBOX_QUEST2, 55,25,25); // "You are on a monster conquering quest." else PutAlignedString(sX, sX + szX, sY + 50, DRAW_DIALOGBOX_QUEST3, 55,25,25); // "You accomplished the monster conquering quest." ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, "Rest Monster : %d", m_stQuest.sCurrentCount); // Snoopy: "Rest Monster : %s" PutAlignedString(sX, sX + szX, sY + 50 +20, cTxt, 55,25,25); // m_stQuest.sCurrentCount ZeroMemory(cTemp, sizeof(cTemp)); switch (m_stQuest.sWho) { case 1: case 2: case 3: break; case 4: strcpy(cTemp, NPC_NAME_CITYHALL_OFFICER); break; case 5: case 6: case 7: break; } ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, DRAW_DIALOGBOX_QUEST5, cTemp); // "Client: %s" PutAlignedString(sX, sX + szX, sY + 50 +45, cTxt, 55,25,25); ZeroMemory(cTemp, sizeof(cTemp)); GetNpcName(m_stQuest.sTargetType, cTemp); ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, NPC_TALK_HANDLER16, m_stQuest.sTargetCount, cTemp); PutAlignedString(sX, sX + szX, sY + 50 +60, cTxt, 55,25,25); ZeroMemory(cTxt, sizeof(cTxt)); if (memcmp(m_stQuest.cTargetName, "NONE", 4) == 0) { strcpy(cTxt, DRAW_DIALOGBOX_QUEST31); // "Location : Anywhere" PutAlignedString(sX, sX + szX, sY + 50 +75, cTxt, 55,25,25); }else { ZeroMemory(cTemp, sizeof(cTemp)); GetOfficialMapName(m_stQuest.cTargetName, cTemp); wsprintf(cTxt, DRAW_DIALOGBOX_QUEST32, cTemp); // "Map : %s" PutAlignedString(sX, sX + szX, sY + 50 +75, cTxt, 55,25,25); if (m_stQuest.sX != 0) { ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, DRAW_DIALOGBOX_QUEST33, m_stQuest.sX, m_stQuest.sY, m_stQuest.sRange); // "Position: %d, %d Range: %d block" PutAlignedString(sX, sX + szX, sY + 50 +90, cTxt, 55,25,25); } } ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, DRAW_DIALOGBOX_QUEST34, m_stQuest.sContribution); // "Contribution: %d" PutAlignedString(sX, sX + szX, sY + 50 +105, cTxt, 55,25,25); break; case 7: // if (m_stQuest.bIsQuestCompleted == FALSE) PutAlignedString(sX, sX + szX, sY + 50, DRAW_DIALOGBOX_QUEST26, 55,25,25); else PutAlignedString(sX, sX + szX, sY + 50, DRAW_DIALOGBOX_QUEST27, 55,25,25); ZeroMemory(cTemp, sizeof(cTemp)); switch (m_stQuest.sWho) { case 1: case 2: case 3: break; case 4: strcpy(cTemp, NPC_NAME_CITYHALL_OFFICER); break; case 5: case 6: case 7: break; } ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, DRAW_DIALOGBOX_QUEST29, cTemp); PutAlignedString(sX, sX + szX, sY + 50 +45, cTxt, 55,25,25); PutAlignedString(sX, sX + szX, sY + 50 +60, DRAW_DIALOGBOX_QUEST30, 55,25,25); ZeroMemory(cTxt, sizeof(cTxt)); if (memcmp(m_stQuest.cTargetName, "NONE", 4) == 0) { strcpy(cTxt, DRAW_DIALOGBOX_QUEST31); PutAlignedString(sX, sX + szX, sY + 50 +75, cTxt, 55,25,25); } else { ZeroMemory(cTemp, sizeof(cTemp)); GetOfficialMapName(m_stQuest.cTargetName, cTemp); wsprintf(cTxt, DRAW_DIALOGBOX_QUEST32, cTemp); PutAlignedString(sX, sX + szX, sY + 50 +75, cTxt, 55,25,25); if (m_stQuest.sX != 0) { ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, DRAW_DIALOGBOX_QUEST33, m_stQuest.sX, m_stQuest.sY, m_stQuest.sRange); PutAlignedString(sX, sX + szX, sY + 50 +90, cTxt, 55,25,25); } } ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, DRAW_DIALOGBOX_QUEST34, m_stQuest.sContribution);//" %dPoint" PutAlignedString(sX, sX + szX, sY + 50 +105, cTxt, 55,25,25); break; } break; case 2: PutAlignedString(sX, sX + szX, sY + 50 +115 -30, DRAW_DIALOGBOX_QUEST35, 55,25,25); break; } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); } void CGame::DrawDialogBox_SellList(short msX, short msY) { short sX, sY, szX; int i, iItem; char cTemp[255], cStr1[64], cStr2[64], cStr3[64]; sX = m_stDialogBoxInfo[31].sX; sY = m_stDialogBoxInfo[31].sY; szX = m_stDialogBoxInfo[31].sSizeX; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 11); iItem = 0; for (i = 0; i < MAXSELLLIST; i++) if (m_stSellItemList[i].iIndex != -1) { ZeroMemory(cTemp, sizeof(cTemp)); GetItemName(m_pItemList[m_stSellItemList[i].iIndex]->m_cName, m_pItemList[m_stSellItemList[i].iIndex]->m_dwAttribute, cStr1, cStr2, cStr3); if (m_stSellItemList[i].iAmount > 1 ) { wsprintf(cTemp, DRAW_DIALOGBOX_SELL_LIST1, m_stSellItemList[i].iAmount, cStr1); if ((msX > sX + 25) && (msX < sX + 250) && (msY >= sY + 55 + i*15) && (msY <= sY + 55 + 14 + i*15)) PutAlignedString(sX, sX+szX, sY + 55 + i*15, cTemp, 255,255,255); else { if(m_bIsSpecial) PutAlignedString(sX, sX+szX, sY + 55 + i*15, cTemp, 0, 255, 0); else PutAlignedString(sX, sX+szX, sY + 55 + i*15, cTemp, 45,25,25); } } else { if ((msX > sX + 25) && (msX < sX + 250) && (msY >= sY + 55 + i*15) && (msY <= sY + 55 + 14 + i*15)) { if( (strlen(cStr2)==0) && (strlen(cStr3)==0) ) PutAlignedString(sX, sX+szX, sY + 55 + i*15, cStr1, 255,255,255); else { ZeroMemory( G_cTxt, sizeof(G_cTxt) ); if( (strlen(cStr1)+strlen(cStr2)+strlen(cStr3)) < 36 ) { if( (strlen(cStr2)>0) && (strlen(cStr3)>0) ) wsprintf( G_cTxt, "%s(%s, %s)", cStr1, cStr2, cStr3 ); else wsprintf( G_cTxt, "%s(%s%s)", cStr1, cStr2, cStr3 ); PutAlignedString(sX, sX+szX, sY + 55 + i*15, G_cTxt, 255,255,255); } else { if( (strlen(cStr2)>0) && (strlen(cStr3)>0) ) wsprintf( G_cTxt, "(%s, %s)", cStr2, cStr3 ); else wsprintf( G_cTxt, "(%s%s)", cStr2, cStr3 ); PutAlignedString(sX, sX+szX, sY + 55 + i*15, cStr1, 255,255,255); PutAlignedString(sX, sX+szX, sY + 55 + i*15 + 15, G_cTxt, 200,200,200); i++; } } }else { if( (strlen(cStr2)==0) && (strlen(cStr3)==0) ) { if(m_bIsSpecial) PutAlignedString(sX, sX+szX, sY + 55 + i*15, cStr1, 0, 255, 0); else PutAlignedString(sX, sX+szX, sY + 55 + i*15, cStr1, 45,25,25); }else { ZeroMemory( G_cTxt, sizeof(G_cTxt) ); if( (strlen(cStr1)+strlen(cStr2)+strlen(cStr3)) < 36 ) { if( (strlen(cStr2)>0) && (strlen(cStr3)>0) ) wsprintf( G_cTxt, "%s(%s, %s)", cStr1, cStr2, cStr3 ); else wsprintf( G_cTxt, "%s(%s%s)", cStr1, cStr2, cStr3 ); if(m_bIsSpecial) PutAlignedString(sX, sX+szX, sY + 55 + i*15, G_cTxt, 0, 255, 0); else PutAlignedString(sX, sX+szX, sY + 55 + i*15, G_cTxt, 45,25,25); } else { if(m_bIsSpecial) PutAlignedString(sX, sX+szX, sY + 55 + i*15, cStr1, 0, 255, 0); else PutAlignedString(sX, sX+szX, sY + 55 + i*15, cStr1, 45,25,25); } } } } } else iItem++; if (iItem == MAXSELLLIST) { PutAlignedString(sX, sX+szX, sY + 55 + 30 + 282 -117 -170, DRAW_DIALOGBOX_SELL_LIST2);//" PutAlignedString(sX, sX+szX, sY + 55 + 45 + 282 -117 -170, DRAW_DIALOGBOX_SELL_LIST3);//" PutAlignedString(sX, sX+szX, sY + 55 + 60 + 282 -117 -170, DRAW_DIALOGBOX_SELL_LIST4);//" PutAlignedString(sX, sX+szX, sY + 55 + 75 + 282 -117 -170, DRAW_DIALOGBOX_SELL_LIST5);//" PutAlignedString(sX, sX+szX, sY + 55 + 95 + 282 -117 -170, DRAW_DIALOGBOX_SELL_LIST6);//" PutAlignedString(sX, sX+szX, sY + 55 + 110 + 282 -117 -170,DRAW_DIALOGBOX_SELL_LIST7);//" PutAlignedString(sX, sX+szX, sY + 55 + 125 + 282 -117 -170,DRAW_DIALOGBOX_SELL_LIST8);//" PutAlignedString(sX, sX+szX, sY + 55 + 155 + 282 -117 -170,DRAW_DIALOGBOX_SELL_LIST9);//" } if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY) && (iItem < MAXSELLLIST) ) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 39); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 38); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 17); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 16); } void CGame::DrawDialogBox_SellorRepairItem(short msX, short msY) { short sX, sY; DWORD dwTime = m_dwCurTime; char cItemID, cItemColor, cTxt[120], cTemp[120], cStr2[120], cStr3[120]; sX = m_stDialogBoxInfo[23].sX; sY = m_stDialogBoxInfo[23].sY; switch (m_stDialogBoxInfo[23].cMode) { case 1: DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 11); cItemID = m_stDialogBoxInfo[23].sV1; cItemColor = m_pItemList[cItemID]->m_cItemColor; if (cItemColor == 0) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->PutSpriteFast(sX + 62 + 15, sY + 84 + 30, m_pItemList[cItemID]->m_sSpriteFrame, dwTime); else { switch (m_pItemList[cItemID]->m_sSprite) { case 1: // Swds case 2: // Bows case 3: // Shields case 15: // Axes hammers m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->PutSpriteRGB(sX + 62 + 15, sY + 84 + 30 , m_pItemList[cItemID]->m_sSpriteFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], dwTime); break; default: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->PutSpriteRGB(sX + 62 + 15, sY + 84 + 30 , m_pItemList[cItemID]->m_sSpriteFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], dwTime); break; } } ZeroMemory(cTemp, sizeof(cTemp)); ZeroMemory(cStr2, sizeof(cStr2)); ZeroMemory(cStr3, sizeof(cStr3)); GetItemName(m_pItemList[cItemID]->m_cName, m_pItemList[cItemID]->m_dwAttribute, cTemp, cStr2, cStr3); if( m_stDialogBoxInfo[23].sV4 == 1 ) strcpy( cTxt, cTemp ); else wsprintf(cTxt, DRAW_DIALOGBOX_SELLOR_REPAIR_ITEM1, m_stDialogBoxInfo[23].sV4, cTemp); if(m_bIsSpecial) { PutAlignedString(sX + 25, sX + 240, sY + 60, cTxt, 0, 255, 0); PutAlignedString(sX + 25 +1, sX + 240 +1, sY + 60, cTxt, 0, 255, 0); } else { PutAlignedString(sX + 25, sX + 240, sY + 60, cTxt, 45,25,25); PutAlignedString(sX + 25 +1, sX + 240 +1, sY + 60, cTxt, 45,25,25); } wsprintf(cTxt, DRAW_DIALOGBOX_SELLOR_REPAIR_ITEM2, m_stDialogBoxInfo[23].sV2); PutString(sX + 95 + 15, sY + 53 + 60, cTxt, RGB(45,25,25)); wsprintf(cTxt, DRAW_DIALOGBOX_SELLOR_REPAIR_ITEM3, m_stDialogBoxInfo[23].sV3); PutString(sX + 95 + 15, sY + 53 + 75, cTxt, RGB(45,25,25)); PutString(sX + 55, sY + 190, DRAW_DIALOGBOX_SELLOR_REPAIR_ITEM4, RGB(45,25,25)); if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX +LBTNPOSX, sY + BTNPOSY, 39); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX +LBTNPOSX, sY + BTNPOSY, 38); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX +RBTNPOSX, sY + BTNPOSY, 17); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX +RBTNPOSX, sY + BTNPOSY, 16); break; case 2: DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 10); cItemID = m_stDialogBoxInfo[23].sV1; cItemColor = m_pItemList[cItemID]->m_cItemColor; if (cItemColor == 0) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->PutSpriteFast(sX + 62 + 15, sY + 84 + 30, m_pItemList[cItemID]->m_sSpriteFrame, dwTime); else { switch (m_pItemList[cItemID]->m_sSprite) { case 1: // Swds case 2: // Bows case 3: // Shields case 15: // Axes hammers m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->PutSpriteRGB(sX + 62 + 15, sY + 84 + 30 , m_pItemList[cItemID]->m_sSpriteFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], dwTime); break; default: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[cItemID]->m_sSprite]->PutSpriteRGB(sX + 62 + 15, sY + 84 + 30 , m_pItemList[cItemID]->m_sSpriteFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], dwTime); break; } } ZeroMemory(cTemp, sizeof(cTemp)); ZeroMemory(cStr2, sizeof(cStr2)); ZeroMemory(cStr3, sizeof(cStr3)); GetItemName(m_pItemList[cItemID], cTemp, cStr2, cStr3); wsprintf(cTxt, "%s", cTemp); // PutAlignedString(sX + 25, sX + 240, sY + 60, cTxt, 45,25,25); // PutAlignedString(sX + 25 +1, sX + 240 +1, sY + 60, cTxt, 45,25,25); if(m_bIsSpecial) { PutAlignedString(sX + 25, sX + 240, sY + 60, cTxt, 0, 255, 0); PutAlignedString(sX + 25 +1, sX + 240 +1, sY + 60, cTxt, 0, 255, 0); }else { PutAlignedString(sX + 25, sX + 240, sY + 60, cTxt, 45,25,25); PutAlignedString(sX + 25 +1, sX + 240 +1, sY + 60, cTxt, 45,25,25); } wsprintf(cTxt, DRAW_DIALOGBOX_SELLOR_REPAIR_ITEM2, m_stDialogBoxInfo[23].sV2); PutString(sX + 95 + 15, sY + 53 + 60, cTxt, RGB(45,25,25)); wsprintf(cTxt, DRAW_DIALOGBOX_SELLOR_REPAIR_ITEM6, m_stDialogBoxInfo[23].sV3); PutString(sX + 95 + 15, sY + 53 + 75, cTxt, RGB(45,25,25)); PutString(sX + 55, sY + 190, DRAW_DIALOGBOX_SELLOR_REPAIR_ITEM7, RGB(45,25,25)); if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 43); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 42); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 17); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 16); break; case 3: DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 11); PutString(sX + 55, sY + 100, DRAW_DIALOGBOX_SELLOR_REPAIR_ITEM8, RGB(45,25,25));//" PutString(sX + 55, sY + 120, DRAW_DIALOGBOX_SELLOR_REPAIR_ITEM9, RGB(45,25,25));//" PutString(sX + 55, sY + 135, DRAW_DIALOGBOX_SELLOR_REPAIR_ITEM10, RGB(45,25,25));//" break; case 4: DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 10); PutString(sX + 55, sY + 100, DRAW_DIALOGBOX_SELLOR_REPAIR_ITEM11, RGB(45,25,25));//" PutString(sX + 55, sY + 120, DRAW_DIALOGBOX_SELLOR_REPAIR_ITEM9, RGB(45,25,25));//" PutString(sX + 55, sY + 135, DRAW_DIALOGBOX_SELLOR_REPAIR_ITEM10, RGB(45,25,25));//" break; } } void CGame::DrawDialogBox_Skill(short msX, short msY, short msZ, char cLB) { short sX, sY; int iTotalLines, iPointerLoc; char cTemp[255], cTemp2[255]; double d1,d2,d3; sX = m_stDialogBoxInfo[15].sX; sY = m_stDialogBoxInfo[15].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 0); // Normal Dialog DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 1); // Skill Dialog Title Bar switch (m_stDialogBoxInfo[15].cMode) { case 0: for (int line=0, skillIndex=0; line < 17;skillIndex++) if (line < MAXSKILLTYPE && m_pSkillCfgList[skillIndex+m_stDialogBoxInfo[15].sView]) { ZeroMemory(cTemp, sizeof(cTemp)); wsprintf(cTemp, "%s", m_pSkillCfgList[skillIndex + m_stDialogBoxInfo[15].sView]->m_cName); m_Misc.ReplaceString(cTemp, '-', ' '); ZeroMemory(cTemp2, sizeof(cTemp2)); wsprintf(cTemp2, "%3d%%", m_pSkillCfgList[skillIndex + m_stDialogBoxInfo[15].sView]->m_iLevel); COLORREF colour = RGB(5,5,5); if ((msX >= sX + 25) && (msX <= sX + 166) && (msY >= sY + 45 + line*15) && (msY <= sY + 59 + line*15)) if(m_pSkillCfgList[ skillIndex+m_stDialogBoxInfo[15].sView ]->m_bIsUseable && m_pSkillCfgList[ skillIndex+m_stDialogBoxInfo[15].sView ]->m_iLevel != 0) { colour = RGB(255,255,255); } else if(m_pSkillCfgList[ skillIndex+m_stDialogBoxInfo[15].sView ]->m_bIsUseable && m_pSkillCfgList[ skillIndex+m_stDialogBoxInfo[15].sView ]->m_iLevel != 0) { colour = RGB(34,30,120); } PutString(sX + 30, sY + 45 + line*15, cTemp, colour); PutString(sX + 183, sY + 45 + line*15, cTemp2, colour); if (m_iDownSkillIndex == (skillIndex + m_stDialogBoxInfo[15].sView)) m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutTransSpriteRGB(sX + 215, sY + 47 + line*15, 21, 50,50,50, m_dwTime); else m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX + 215, sY + 47 + line*15, 20, m_dwTime); line++; } iTotalLines = 0; for (int i = 0; i < MAXSKILLTYPE; i++) if (m_pSkillCfgList[i] != NULL) iTotalLines++; if (iTotalLines > 17) { d1 = (double)m_stDialogBoxInfo[15].sView; d2 = (double)(iTotalLines-17); d3 = (274.0f * d1)/d2; iPointerLoc = (int)d3; } else iPointerLoc = 0; if( iTotalLines > 17 ) { DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 1); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX+242, sY+iPointerLoc + 35, 7); } if (cLB != 0 && iTotalLines > 17) { if ((iGetTopDialogBoxIndex() == 15)) { if ((msX >= sX + 240) && (msX <= sX + 260) && (msY >= sY + 30) && (msY <= sY + 320)) { d1 = (double)(msY -(sY+35)); d2 = (double)(iTotalLines-17); d3 = (d1 * d2)/274.0f; iPointerLoc = (int)(d3+0.5); if (iPointerLoc > iTotalLines - 17) iPointerLoc = iTotalLines -17; m_stDialogBoxInfo[15].sView = iPointerLoc; } } }else m_stDialogBoxInfo[15].bIsScrollSelected = FALSE; if( iGetTopDialogBoxIndex() == 15 && msZ != 0 ) { if( msZ > 0 ) m_stDialogBoxInfo[15].sView--; if( msZ < 0 ) m_stDialogBoxInfo[15].sView++; m_DInput.m_sZ = 0; } if( m_stDialogBoxInfo[15].sView < 0 ) m_stDialogBoxInfo[15].sView = 0; if( iTotalLines > 17 && m_stDialogBoxInfo[15].sView > iTotalLines-17 ) m_stDialogBoxInfo[15].sView = iTotalLines-17; break; } } void CGame::DrawDialogBox_SkillDlg(short msX, short msY, short msZ, char cLB) { int i, iLoc ,iAdjX, iAdjY; char cTemp[120], cTemp2[120]; short sX, sY, szX; char cStr1[64], cStr2[64], cStr3[64]; DWORD dwTime = m_dwCurTime; iAdjX = 5 ; iAdjY = 8 ; switch (m_stDialogBoxInfo[26].cMode) { case 1: // Alchemy waiting incredients if (m_stDialogBoxInfo[26].cStr[0] != 0) { sX = m_stDialogBoxInfo[26].sX + iAdjX + (m_stDialogBoxInfo[26].cStr[0] - (rand() % (m_stDialogBoxInfo[26].cStr[0]*2))); sY = m_stDialogBoxInfo[26].sY + iAdjY + (m_stDialogBoxInfo[26].cStr[0] - (rand() % (m_stDialogBoxInfo[26].cStr[0]*2))); }else { sX = m_stDialogBoxInfo[26].sX; sY = m_stDialogBoxInfo[26].sY; } m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX, sY, 1, dwTime); if (m_stDialogBoxInfo[26].sV1 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSprite]->PutTransSprite50(sX + iAdjX + 55 +(1-(rand()%3)), sY + iAdjY + 55 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV2 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV2]->m_sSprite]->PutTransSprite50(sX + iAdjX + 55 +45*1 +(1-(rand()%3)), sY + iAdjY + 55 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV2]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV3 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV3]->m_sSprite]->PutTransSprite50(sX + iAdjX + 55 +45*2 +(1-(rand()%3)), sY + iAdjY + 55 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV3]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV4 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV4]->m_sSprite]->PutTransSprite50(sX + iAdjX + 55 +(1-(rand()%3)), sY + iAdjY + 100 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV4]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV5 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV5]->m_sSprite]->PutTransSprite50(sX + iAdjX + 55+45*1 +(1-(rand()%3)), sY + iAdjY + 100 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV5]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV6 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV6]->m_sSprite]->PutTransSprite50(sX + iAdjX + 55+45*2 +(1-(rand()%3)), sY + iAdjY + 100 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV6]->m_sSpriteFrame, dwTime); if ((msX >= sX + iAdjX + 60) && (msX <= sX + iAdjX + 153) && (msY >= sY + iAdjY + 175) && (msY <= sY + iAdjY + 195)) PutString_SprFont(sX + iAdjX + 60, sY + iAdjY + 175, "Try Now!", 16,16,30); else PutString_SprFont(sX + iAdjX + 60, sY + iAdjY + 175, "Try Now!", 6, 6, 20); break; case 2: // Alchemy, creating a potion if (m_stDialogBoxInfo[26].cStr[0] != 0) { sX = m_stDialogBoxInfo[26].sX + iAdjX + (m_stDialogBoxInfo[26].cStr[0] - (rand() % (m_stDialogBoxInfo[26].cStr[0]*2))); sY = m_stDialogBoxInfo[26].sY + iAdjY + (m_stDialogBoxInfo[26].cStr[0] - (rand() % (m_stDialogBoxInfo[26].cStr[0]*2))); }else { sX = m_stDialogBoxInfo[26].sX; sY = m_stDialogBoxInfo[26].sY; } m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX, sY, 1, dwTime); if (m_stDialogBoxInfo[26].sV1 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSprite]->PutTransSprite50(sX + iAdjX + 55 +(1-(rand()%3)), sY + iAdjY + 55 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV2 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV2]->m_sSprite]->PutTransSprite50(sX + iAdjX + 55 +45*1 +(1-(rand()%3)), sY + iAdjY + 55 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV2]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV3 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV3]->m_sSprite]->PutTransSprite50(sX + iAdjX + 55 +45*2 +(1-(rand()%3)), sY + iAdjY + 55 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV3]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV4 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV4]->m_sSprite]->PutTransSprite50(sX + iAdjX + 55 +(1-(rand()%3)), sY + iAdjY + 100 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV4]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV5 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV5]->m_sSprite]->PutTransSprite50(sX + iAdjX + 55+45*1 +(1-(rand()%3)), sY + iAdjY + 100 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV5]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV6 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV6]->m_sSprite]->PutTransSprite50(sX + iAdjX + 55+45*2 +(1-(rand()%3)), sY + iAdjY + 100 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV6]->m_sSpriteFrame, dwTime); PutString_SprFont(sX + iAdjX + 60, sY + iAdjY + 175, "Creating...", 20,6,6); if ((dwTime - m_stDialogBoxInfo[26].dwT1) > 1000) { m_stDialogBoxInfo[26].dwT1 = dwTime; m_stDialogBoxInfo[26].cStr[0]++; } if (m_stDialogBoxInfo[26].cStr[0] >= 4) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_CREATEPOTION, NULL, NULL, NULL, NULL, NULL); DisableDialogBox(26); PlaySound('E', 42, 0); } break; case 3: // Manuf: Choose what you want to create sX = m_stDialogBoxInfo[26].sX; sY = m_stDialogBoxInfo[26].sY; szX = m_stDialogBoxInfo[26].sSizeX; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME3, sX, sY, 0); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 8); PutString(sX + iAdjX + 44, sY + iAdjY + 38, "Name", RGB(0,0,0)); PutString(sX + iAdjX +171, sY + iAdjY + 38, "Max.Skill", RGB(0,0,0)); iLoc = 0; for (i = 0; i < 13; i++) if (m_pDispBuildItemList[i + m_stDialogBoxInfo[26].sView] != NULL) { ZeroMemory(cTemp, sizeof(cTemp)); GetItemName( m_pDispBuildItemList[i + m_stDialogBoxInfo[26].sView]->m_cName, NULL, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); ZeroMemory(cTemp2, sizeof(cTemp2)); wsprintf(cTemp2, "%d%%", m_pDispBuildItemList[i + m_stDialogBoxInfo[26].sView]->m_iMaxSkill); if ((msX >= sX + 30) && (msX <= sX + 180) && (msY >= sY + iAdjY + 55 + iLoc*15) && (msY <= sY + iAdjY + 69 + iLoc*15)) { PutString(sX + 30, sY + iAdjY + 55 + iLoc*15, cTemp, RGB(255,255,255)); PutString(sX + 190, sY + iAdjY + 55 + iLoc*15, cTemp2, RGB(255,255,255)); }else { if (m_pDispBuildItemList[i + m_stDialogBoxInfo[26].sView]->m_bBuildEnabled == TRUE) { PutString(sX + 30, sY + iAdjY + 55 + iLoc*15, cTemp, RGB(34,30,120)); PutString(sX + 190, sY + iAdjY + 55 + iLoc*15, cTemp2, RGB(34,30,120)); }else { PutString(sX + 30, sY + iAdjY + 55 + iLoc*15, cTemp, RGB(45,25,25)); PutString(sX + 190, sY + iAdjY + 55 + iLoc*15, cTemp2, RGB(45,25,25)); } } iLoc++; } if ((m_stDialogBoxInfo[26].sView >= 1) && (m_pDispBuildItemList[m_stDialogBoxInfo[26].sView - 1] != NULL)) m_pSprite[SPRID_INTERFACE_ND_GAME2]->PutSpriteFast(sX + iAdjX + 225, sY + iAdjY + 210, 23, dwTime); else m_pSprite[SPRID_INTERFACE_ND_GAME2]->PutTransSpriteRGB(sX + iAdjX + 225, sY + iAdjY + 210, 23, 5,5,5, dwTime); if (m_pDispBuildItemList[m_stDialogBoxInfo[26].sView+13] != NULL) m_pSprite[SPRID_INTERFACE_ND_GAME2]->PutSpriteFast(sX + iAdjX + 225, sY + iAdjY + 230, 24, dwTime); else m_pSprite[SPRID_INTERFACE_ND_GAME2]->PutTransSpriteRGB(sX + iAdjX + 225, sY + iAdjY + 230, 24, 5,5,5, dwTime); if ((cLB != 0) && (iGetTopDialogBoxIndex() == 26)) { if ((msX >= sX + iAdjX + 225) && (msX <= sX + iAdjX + 245) && (msY >= sY + iAdjY + 210) && (msY <= sY + iAdjY + 230)) { m_stDialogBoxInfo[26].sView--; } if ((msX >= sX + iAdjX + 225) && (msX <= sX + iAdjX + 245) && (msY >= sY + iAdjY + 230) && (msY <= sY + iAdjY + 250)) { if (m_pDispBuildItemList[m_stDialogBoxInfo[26].sView + 13] != NULL) m_stDialogBoxInfo[26].sView++; } } if (( msZ != 0) && (iGetTopDialogBoxIndex() == 26)) { m_stDialogBoxInfo[26].sView = m_stDialogBoxInfo[26].sView - msZ/60; m_DInput.m_sZ = 0; } if (m_pDispBuildItemList[m_stDialogBoxInfo[26].sView + 12] == NULL) { while(1) { m_stDialogBoxInfo[26].sView --; if( m_stDialogBoxInfo[26].sView < 1 ) break; if( m_pDispBuildItemList[m_stDialogBoxInfo[26].sView+12] != NULL ) break; } } if (m_stDialogBoxInfo[26].sView < 0) m_stDialogBoxInfo[26].sView = 0; PutAlignedString(sX, sX+m_stDialogBoxInfo[26].sSizeX, sY + 265, DRAW_DIALOGBOX_SKILLDLG2, 55,25,25);//" List of items which you can make with" PutAlignedString(sX, sX+m_stDialogBoxInfo[26].sSizeX, sY + 280, DRAW_DIALOGBOX_SKILLDLG3, 55,25,25);//"your current skill. The items you can" PutAlignedString(sX, sX+m_stDialogBoxInfo[26].sSizeX, sY + 295, DRAW_DIALOGBOX_SKILLDLG4, 55,25,25);//"make now with your current stuff will" PutAlignedString(sX, sX+m_stDialogBoxInfo[26].sSizeX, sY + 310, DRAW_DIALOGBOX_SKILLDLG5, 55,25,25);//"be displayed in blue. " PutAlignedString(sX, sX+m_stDialogBoxInfo[26].sSizeX, sY + 340, DRAW_DIALOGBOX_SKILLDLG6, 55,25,25);//"Select an item you want to manufacture." break; case 4: // Manuf: Waiting for incredients sX = m_stDialogBoxInfo[26].sX; sY = m_stDialogBoxInfo[26].sY; szX = m_stDialogBoxInfo[26].sSizeX; iAdjX = -1; iAdjY = -7; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME3, sX, sY, 0); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 8); m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iSprH]->PutSpriteFast(sX + iAdjX + 62 + 5, sY + iAdjY + 84 + 17, m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iSprFrame, dwTime); ZeroMemory(cTemp, sizeof(cTemp)); GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cName, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); PutString(sX + iAdjX + 44 +10 +60, sY + iAdjY + 55, cTemp, RGB(255,255,255)); wsprintf(cTemp, DRAW_DIALOGBOX_SKILLDLG7 // "Skill level: %d/%d" , m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iSkillLimit , m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iMaxSkill); PutString(sX + iAdjX + 44 +10 +60, sY + iAdjY + 55 +2*15, cTemp, RGB(45,25,25)); PutString(sX + iAdjX + 44 +10 +60, sY + iAdjY + 55 +3*15 +5, DRAW_DIALOGBOX_SKILLDLG8, RGB(45,25,25));//"Ingredients Needed:" iLoc = 4; if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iElementCount[1] != 0) { GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cElementName1, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_bElementFlag[1] == TRUE) PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(45,25,25)); else PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(150,150,150)); iLoc++; } if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iElementCount[2] != 0) { GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cElementName2, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_bElementFlag[2] == TRUE) PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(45,25,25)); else PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(150,150,150)); iLoc++; } if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iElementCount[3] != 0) { GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cElementName3, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_bElementFlag[3] == TRUE) PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(45,25,25)); else PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(150,150,150)); iLoc++; } if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iElementCount[4] != 0) { GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cElementName4, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_bElementFlag[4] == TRUE) PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(45,25,25)); else PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(150,150,150)); iLoc++; } if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iElementCount[5] != 0) { GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cElementName5, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_bElementFlag[5] == TRUE) PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(45,25,25)); else PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(150,150,150)); iLoc++; } if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iElementCount[6] != 0) { GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cElementName6, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_bElementFlag[6] == TRUE) PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(45,25,25)); else PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(150,150,150)); iLoc++; } if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_bBuildEnabled == TRUE) { m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX + iAdjX +55 +30 +13, sY + iAdjY +55 +180 , 2, dwTime); m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX + iAdjX +55 +30 +45*1 +13, sY + iAdjY +55 +180, 2, dwTime); m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX + iAdjX +55 +30 +45*2 +13, sY + iAdjY +55 +180, 2, dwTime); m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX + iAdjX +55 +30 +13, sY + iAdjY +100 +180, 2, dwTime); m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX + iAdjX +55 +30 +45*1 +13, sY + iAdjY +100 +180, 2, dwTime); m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX + iAdjX +55 +30 +45*2 +13, sY + iAdjY +100 +180, 2, dwTime); if (m_stDialogBoxInfo[26].sV1 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55 +30 +13, sY + iAdjY + 55 +180, m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV2 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV2]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55 +45*1 +30 +13, sY + iAdjY + 55 +180, m_pItemList[m_stDialogBoxInfo[26].sV2]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV3 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV3]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55 +45*2 +30 +13, sY + iAdjY + 55 +180, m_pItemList[m_stDialogBoxInfo[26].sV3]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV4 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV4]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55 +30 +13, sY + iAdjY + 100 +180, m_pItemList[m_stDialogBoxInfo[26].sV4]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV5 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV5]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55+45*1 +30 +13, sY + iAdjY + 100 +180, m_pItemList[m_stDialogBoxInfo[26].sV5]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV6 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV6]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55+45*2 +30 +13, sY + iAdjY + 100 +180, m_pItemList[m_stDialogBoxInfo[26].sV6]->m_sSpriteFrame, dwTime); PutAlignedString(sX, sX + szX, sY + iAdjY + 230 +75, DRAW_DIALOGBOX_SKILLDLG15, 55,25,25);//" Click MANUFACTURE button after" PutAlignedString(sX, sX + szX, sY + iAdjY + 245 +75, DRAW_DIALOGBOX_SKILLDLG16, 55,25,25);//"dragging ingredients in the blanks" PutAlignedString(sX, sX + szX, sY + iAdjY + 260 +75, DRAW_DIALOGBOX_SKILLDLG17, 55,25,25);//"to manufacture above item." if ((msX >= sX + iAdjX + 32) && (msX <= sX + iAdjX + 95) && (msY >= sY + iAdjY + 353) && (msY <= sY + iAdjY + 372)) PutString_SprFont(sX + iAdjX + 25, sY + iAdjY + 330 +23, "Back", 6,6,20); else PutString_SprFont(sX + iAdjX + 25, sY + iAdjY + 330 +23, "Back", 0,0,7); if ((msX >= sX + iAdjX + 160) && (msX <= sX + iAdjX + 255) && (msY >= sY + iAdjY + 353) && (msY <= sY + iAdjY + 372)) { if (m_stDialogBoxInfo[26].cStr[4] == 1) PutString_SprFont(sX + iAdjX + 153, sY + iAdjY + 330 +23, "Manufacture", 6,6,20); else PutString_SprFont(sX + iAdjX + 153, sY + iAdjY + 330 +23, "Manufacture", 10,10,10); } else { if (m_stDialogBoxInfo[26].cStr[4] == 1) PutString_SprFont(sX + iAdjX + 153, sY + iAdjY + 330 +23, "Manufacture", 0, 0, 7); else PutString_SprFont(sX + iAdjX + 153, sY + iAdjY + 330 +23, "Manufacture", 10,10,10); } } else { PutAlignedString(sX, sX + szX, sY + iAdjY + 200 +75, DRAW_DIALOGBOX_SKILLDLG18, 55,25,25);//"There are not enough ingredients to" PutAlignedString(sX, sX + szX, sY + iAdjY + 215 +75, DRAW_DIALOGBOX_SKILLDLG19, 55,25,25);//"manufacture. Needed materials are" PutAlignedString(sX, sX + szX, sY + iAdjY + 230 +75, DRAW_DIALOGBOX_SKILLDLG20, 55,25,25);//"displayed in grey." if ((msX >= sX + iAdjX + 32) && (msX <= sX + iAdjX + 95) && (msY >= sY + iAdjY + 353) && (msY <= sY + iAdjY + 372)) PutString_SprFont(sX + iAdjX + 25, sY + iAdjY + 330 +23, "Back", 6,6,20); else PutString_SprFont(sX + iAdjX + 25, sY + iAdjY + 330 +23, "Back", 0,0,7); } break; case 5: // Manuf: in progress sX = m_stDialogBoxInfo[26].sX; sY = m_stDialogBoxInfo[26].sY; iAdjX = -1; iAdjY = -7; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME3, sX, sY, 0); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 8); m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iSprH]->PutSpriteFast(sX + iAdjX + 62 + 5, sY + iAdjY + 84 + 17, m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iSprFrame, dwTime); ZeroMemory(cTemp, sizeof(cTemp)); GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cName, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); PutString(sX + iAdjX + 44 +10 +60, sY + iAdjY + 55, cTemp, RGB(255,255,255)); wsprintf(cTemp, DRAW_DIALOGBOX_SKILLDLG7 // "Skill level: %d/%d" , m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iSkillLimit, m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iMaxSkill); PutString(sX + iAdjX + 44 +10 +60, sY + iAdjY + 55 +2*15, cTemp, RGB(45,25,25)); PutString(sX + iAdjX + 44 +10 +60, sY + iAdjY + 55 +3*15 +5, DRAW_DIALOGBOX_SKILLDLG8, RGB(45,25,25));//"Ingredients Needed:" iLoc = 4; if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iElementCount[1] != 0) { GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cElementName1, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_bElementFlag[1] == TRUE) PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(45,25,25)); else PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(120,120,120)); iLoc++; } if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iElementCount[2] != 0) { GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cElementName2, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_bElementFlag[2] == TRUE) PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(45,25,25)); else PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(120,120,120)); iLoc++; } if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iElementCount[3] != 0) { GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cElementName3, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_bElementFlag[3] == TRUE) PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(45,25,25)); else PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(120,120,120)); iLoc++; } if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iElementCount[4] != 0) { GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cElementName4, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_bElementFlag[4] == TRUE) PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(45,25,25)); else PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(120,120,120)); iLoc++; } if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iElementCount[5] != 0) { GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cElementName5, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_bElementFlag[5] == TRUE) PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(45,25,25)); else PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(120,120,120)); iLoc++; } if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iElementCount[6] != 0) { GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cElementName6, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_bElementFlag[6] == TRUE) PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(45,25,25)); else PutString(sX + iAdjX + 44 +20 +60, sY + iAdjY + 55 +iLoc*15 +5, cTemp, RGB(120,120,120)); iLoc++; } m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX + iAdjX +55 +30 +13, sY + iAdjY +55 +180 , 2, dwTime); m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX + iAdjX +55 +30 +45*1 +13, sY + iAdjY +55 +180, 2, dwTime); m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX + iAdjX +55 +30 +45*2 +13, sY + iAdjY +55 +180, 2, dwTime); m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX + iAdjX +55 +30 +13, sY + iAdjY +100 +180, 2, dwTime); m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX + iAdjX +55 +30 +45*1 +13, sY + iAdjY +100 +180, 2, dwTime); m_pSprite[SPRID_INTERFACE_ADDINTERFACE]->PutSpriteFast(sX + iAdjX +55 +30 +45*2 +13, sY + iAdjY +100 +180, 2, dwTime); if (m_stDialogBoxInfo[26].sV1 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55 +30 +13, sY + iAdjY + 55 +180, m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV2 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV2]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55 +45*1 +30 +13, sY + iAdjY + 55 +180, m_pItemList[m_stDialogBoxInfo[26].sV2]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV3 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV3]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55 +45*2 +30 +13, sY + iAdjY + 55 +180, m_pItemList[m_stDialogBoxInfo[26].sV3]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV4 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV4]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55 +30 +13, sY + iAdjY + 100 +180, m_pItemList[m_stDialogBoxInfo[26].sV4]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV5 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV5]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55+45*1 +30 +13, sY + iAdjY + 100 +180, m_pItemList[m_stDialogBoxInfo[26].sV5]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV6 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV6]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55+45*2 +30 +13, sY + iAdjY + 100 +180, m_pItemList[m_stDialogBoxInfo[26].sV6]->m_sSpriteFrame, dwTime); PutString(sX + iAdjX + 33, sY + iAdjY + 230 +75, DRAW_DIALOGBOX_SKILLDLG29, RGB(55,25,25));//" Manufacturing the items...." PutString(sX + iAdjX + 33, sY + iAdjY + 245 +75, DRAW_DIALOGBOX_SKILLDLG30, RGB(55,25,25));//"Please wait until manufacture finishes." if ((dwTime - m_stDialogBoxInfo[26].dwT1) > 400) //if ((dwTime - m_stDialogBoxInfo[26].dwT1) > 1000) { m_stDialogBoxInfo[26].dwT1 = dwTime; m_stDialogBoxInfo[26].cStr[1]++; if (m_stDialogBoxInfo[26].cStr[1] >= 7) m_stDialogBoxInfo[26].cStr[1] = 7; } if (m_stDialogBoxInfo[26].cStr[1] == 4) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_BUILDITEM, NULL, NULL, NULL, NULL, m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cName); m_stDialogBoxInfo[26].cStr[1]++; } break; case 6: // Manuf: Done sX = m_stDialogBoxInfo[26].sX; sY = m_stDialogBoxInfo[26].sY; iAdjX = -1; iAdjY = -7; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME3, sX, sY, 0); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 8); m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iSprH]->PutSpriteFast(sX + iAdjX + 62 + 5, sY + iAdjY + 84 + 17, m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_iSprFrame, dwTime); ZeroMemory(cTemp, sizeof(cTemp)); GetItemName( m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_cName, 0, cStr1, cStr2, cStr3 ); wsprintf(cTemp, "%s", cStr1); PutString(sX + iAdjX + 44 +10 +60, sY + iAdjY + 55, cTemp, RGB(255,255,255)); if (m_stDialogBoxInfo[26].cStr[2] == 1) { PutString(sX + iAdjX + 33 +11, sY + iAdjY + 200 -45, DRAW_DIALOGBOX_SKILLDLG31, RGB(55,25,25));//" Success in manufacture!" if (m_stDialogBoxInfo[26].sV1 == ITEMTYPE_MATERIAL) { wsprintf(G_cTxt, DRAW_DIALOGBOX_SKILLDLG32, m_stDialogBoxInfo[26].cStr[3]);//"The purity of product is %d%%." PutString(sX + iAdjX + 33 +11, sY + iAdjY + 215 -45, G_cTxt, RGB(55,25,25)); } else { wsprintf(G_cTxt, DRAW_DIALOGBOX_SKILLDLG33, (int)m_stDialogBoxInfo[26].cStr[3] +100);//"The completion of product is %d%%." PutString(sX + iAdjX + 33, sY + iAdjY + 215 -45, G_cTxt, RGB(55,25,25)); } } else { PutString(sX + iAdjX + 33+11, sY + iAdjY + 200, DRAW_DIALOGBOX_SKILLDLG34, RGB(55,25,25));//"Failed on manufacture." } if ((msX >= sX + iAdjX + 32) && (msX <= sX + iAdjX + 95) && (msY >= sY + iAdjY + 353) && (msY <= sY + iAdjY + 372)) PutString_SprFont(sX + iAdjX + 35, sY + iAdjY + 330 +23, "Back", 6,6,20); else PutString_SprFont(sX + iAdjX + 35, sY + iAdjY + 330 +23, "Back", 0,0,7); break; case 7: // Crafting, wait for incredients if (m_stDialogBoxInfo[26].cStr[0] != 0) { sX = m_stDialogBoxInfo[26].sX + iAdjX + (m_stDialogBoxInfo[26].cStr[0] - (rand() % (m_stDialogBoxInfo[26].cStr[0]*2))); sY = m_stDialogBoxInfo[26].sY + iAdjY + (m_stDialogBoxInfo[26].cStr[0] - (rand() % (m_stDialogBoxInfo[26].cStr[0]*2))); }else { sX = m_stDialogBoxInfo[26].sX; sY = m_stDialogBoxInfo[26].sY; } m_pSprite[SPRID_INTERFACE_CRAFTING]->PutSpriteFast(sX, sY, 0, dwTime); if (m_stDialogBoxInfo[26].sV1 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55 +(1-(rand()%3)), sY + iAdjY + 55 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV2 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV2]->m_sSprite]->PutSpriteFast(sX + iAdjX + 65 +45*1 +(1-(rand()%3)), sY + iAdjY + 40 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV2]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV3 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV3]->m_sSprite]->PutSpriteFast(sX + iAdjX + 65 +45*2 +(1-(rand()%3)), sY + iAdjY + 55 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV3]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV4 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV4]->m_sSprite]->PutSpriteFast(sX + iAdjX + 65 +(1-(rand()%3)), sY + iAdjY + 100 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV4]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV5 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV5]->m_sSprite]->PutSpriteFast(sX + iAdjX + 65+45*1 +(1-(rand()%3)), sY + iAdjY + 115 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV5]->m_sSpriteFrame, dwTime); if (m_stDialogBoxInfo[26].sV6 != -1) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV6]->m_sSprite]->PutSpriteFast(sX + iAdjX + 75+45*2 +(1-(rand()%3)), sY + iAdjY + 100 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV6]->m_sSpriteFrame, dwTime); if ((msX >= sX + iAdjX + 60) && (msX <= sX + iAdjX + 153) && (msY >= sY + iAdjY + 175) && (msY <= sY + iAdjY + 195)) PutString_SprFont(sX + iAdjX + 60, sY + iAdjY + 175, "Try Now!", 16,16,30); else PutString_SprFont(sX + iAdjX + 60, sY + iAdjY + 175, "Try Now!", 6, 6, 20); break; case 8: // Crafting in progress if (m_stDialogBoxInfo[26].cStr[0] != 0) { sX = m_stDialogBoxInfo[26].sX + iAdjX + (m_stDialogBoxInfo[26].cStr[0] - (rand() % (m_stDialogBoxInfo[26].cStr[0]*2))); sY = m_stDialogBoxInfo[26].sY + iAdjY + (m_stDialogBoxInfo[26].cStr[0] - (rand() % (m_stDialogBoxInfo[26].cStr[0]*2))); }else { sX = m_stDialogBoxInfo[26].sX; sY = m_stDialogBoxInfo[26].sY; } m_pSprite[SPRID_INTERFACE_CRAFTING]->PutSpriteFast(sX, sY, 0, dwTime); if (m_stDialogBoxInfo[26].sV1 != -1) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSprite]->PutSpriteFast(sX + iAdjX + 55 +(1-(rand()%3)) +(1-(rand()%3)), sY + iAdjY + 55 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV1]->m_sSpriteFrame, dwTime); if ( (m_pItemList[m_stDialogBoxInfo[26].sV1]->m_cItemType == ITEMTYPE_EQUIP) && (m_pItemList[m_stDialogBoxInfo[26].sV1]->m_cEquipPos == EQUIPPOS_NECK)) m_iContributionPrice = 10; } if (m_stDialogBoxInfo[26].sV2 != -1) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV2]->m_sSprite]->PutSpriteFast(sX + iAdjX + 65 +45*1 +(1-(rand()%3)), sY + iAdjY + 40 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV2]->m_sSpriteFrame, dwTime); if ( (m_pItemList[m_stDialogBoxInfo[26].sV2]->m_cItemType == ITEMTYPE_EQUIP) && (m_pItemList[m_stDialogBoxInfo[26].sV2]->m_cEquipPos == EQUIPPOS_NECK)) m_iContributionPrice = 10; } if (m_stDialogBoxInfo[26].sV3 != -1) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV3]->m_sSprite]->PutSpriteFast(sX + iAdjX + 65 +45*2 +(1-(rand()%3)), sY + iAdjY + 55 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV3]->m_sSpriteFrame, dwTime); if ( (m_pItemList[m_stDialogBoxInfo[26].sV3]->m_cItemType == ITEMTYPE_EQUIP) && (m_pItemList[m_stDialogBoxInfo[26].sV3]->m_cEquipPos == EQUIPPOS_NECK)) m_iContributionPrice = 10; } if (m_stDialogBoxInfo[26].sV4 != -1) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV4]->m_sSprite]->PutSpriteFast(sX + iAdjX + 65 +(1-(rand()%3)), sY + iAdjY + 100 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV4]->m_sSpriteFrame, dwTime); if ( (m_pItemList[m_stDialogBoxInfo[26].sV4]->m_cItemType == ITEMTYPE_EQUIP) && (m_pItemList[m_stDialogBoxInfo[26].sV4]->m_cEquipPos == EQUIPPOS_NECK)) m_iContributionPrice = 10; } if (m_stDialogBoxInfo[26].sV5 != -1) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV5]->m_sSprite]->PutSpriteFast(sX + iAdjX + 65+45*1 +(1-(rand()%3)), sY + iAdjY + 115 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV5]->m_sSpriteFrame, dwTime); if ( (m_pItemList[m_stDialogBoxInfo[26].sV5]->m_cItemType == ITEMTYPE_EQUIP) && (m_pItemList[m_stDialogBoxInfo[26].sV5]->m_cEquipPos == EQUIPPOS_NECK)) m_iContributionPrice = 10; } if (m_stDialogBoxInfo[26].sV6 != -1) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[26].sV6]->m_sSprite]->PutSpriteFast(sX + iAdjX + 75+45*2 +(1-(rand()%3)), sY + iAdjY + 100 +(1-(rand()%3)), m_pItemList[m_stDialogBoxInfo[26].sV6]->m_sSpriteFrame, dwTime); if ( (m_pItemList[m_stDialogBoxInfo[26].sV6]->m_cItemType == ITEMTYPE_EQUIP) && (m_pItemList[m_stDialogBoxInfo[26].sV6]->m_cEquipPos == EQUIPPOS_NECK)) m_iContributionPrice = 10; } PutString_SprFont(sX + iAdjX + 60, sY + iAdjY + 175, "Creating...", 20,6,6); if ((dwTime - m_stDialogBoxInfo[26].dwT1) > 1000) { m_stDialogBoxInfo[26].dwT1 = dwTime; m_stDialogBoxInfo[26].cStr[1]++; } if (m_stDialogBoxInfo[26].cStr[1] >= 5)//m_pDispCraftItemList { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_CRAFTITEM, NULL, NULL, NULL, NULL, NULL); DisableDialogBox(26); PlaySound('E', 42, 0); } break; } } void CGame::DrawDialogBox_SysMenu(short msX, short msY, char cLB) {short sX, sY; sX = m_stDialogBoxInfo[19].sX; sY = m_stDialogBoxInfo[19].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME1, sX, sY, 0); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 6); PutString(sX + 23, sY + 63, DRAW_DIALOGBOX_SYSMENU_DETAILLEVEL, RGB(45,25,25)); PutString(sX + 24, sY + 63, DRAW_DIALOGBOX_SYSMENU_DETAILLEVEL, RGB(45,25,25)); if (m_cDetailLevel == 0) PutString(sX + 121, sY + 63, DRAW_DIALOGBOX_SYSMENU_LOW, RGB(255,255,255)); else PutString(sX + 121, sY + 63, DRAW_DIALOGBOX_SYSMENU_LOW, RGB(45,25,25)); if (m_cDetailLevel == 1) PutString(sX + 153, sY + 63, DRAW_DIALOGBOX_SYSMENU_NORMAL, RGB(255,255,255)); else PutString(sX + 153, sY + 63, DRAW_DIALOGBOX_SYSMENU_NORMAL, RGB(45,25,25)); if (m_cDetailLevel == 2) PutString(sX + 205, sY + 63, DRAW_DIALOGBOX_SYSMENU_HIGH, RGB(255,255,255)); else PutString(sX + 205, sY + 63, DRAW_DIALOGBOX_SYSMENU_HIGH, RGB(45,25,25)); PutString(sX + 23, sY + 84, DRAW_DIALOGBOX_SYSMENU_SOUND, RGB(45,25,25)); PutString(sX + 24, sY + 84, DRAW_DIALOGBOX_SYSMENU_SOUND, RGB(45,25,25)); if (m_bSoundFlag) { if (m_bSoundStat) PutString(sX + 85, sY + 85, DRAW_DIALOGBOX_SYSMENU_ON, RGB(255,255,255)); else PutString(sX + 83, sY + 85, DRAW_DIALOGBOX_SYSMENU_OFF, RGB(200,200,200)); } else PutString(sX + 68, sY + 85, DRAW_DIALOGBOX_SYSMENU_DISABLED, RGB(100,100,100)); PutString(sX + 123, sY + 84, DRAW_DIALOGBOX_SYSMENU_MUSIC, RGB(45,25,25)); PutString(sX + 124, sY + 84, DRAW_DIALOGBOX_SYSMENU_MUSIC, RGB(45,25,25)); if (m_bSoundFlag) { if (m_bMusicStat) PutString(sX + 180, sY + 85, DRAW_DIALOGBOX_SYSMENU_ON, RGB(255,255,255)); else PutString(sX + 178, sY + 85, DRAW_DIALOGBOX_SYSMENU_OFF, RGB(200,200,200)); } else PutString(sX + 163, sY + 85, DRAW_DIALOGBOX_SYSMENU_DISABLED, RGB(100,100,100)); PutString(sX + 23, sY + 106, DRAW_DIALOGBOX_SYSMENU_WHISPER, RGB(45,25,25)); PutString(sX + 24, sY + 106, DRAW_DIALOGBOX_SYSMENU_WHISPER, RGB(45,25,25)); if (m_bWhisper) PutString(sX + 85, sY + 106, DRAW_DIALOGBOX_SYSMENU_ON, RGB(255,255,255)); else PutString(sX + 82, sY + 106, DRAW_DIALOGBOX_SYSMENU_OFF, RGB(200,200,200)); PutString(sX + 123, sY + 106, DRAW_DIALOGBOX_SYSMENU_SHOUT, RGB(45,25,25)); PutString(sX + 124, sY + 106, DRAW_DIALOGBOX_SYSMENU_SHOUT, RGB(45,25,25)); if (m_bShout) PutString(sX + 180, sY + 106, DRAW_DIALOGBOX_SYSMENU_ON, RGB(255,255,255)); else PutString(sX + 177, sY + 106, DRAW_DIALOGBOX_SYSMENU_OFF, RGB(200,200,200)); PutString(sX + 23, sY + 124, DRAW_DIALOGBOX_SYSMENU_SOUNDVOLUME, RGB(45,25,25)); PutString(sX + 24, sY + 124, DRAW_DIALOGBOX_SYSMENU_SOUNDVOLUME, RGB(45,25,25)); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX + 130 + m_cSoundVolume, sY + 129, 8); PutString(sX + 23, sY + 141, DRAW_DIALOGBOX_SYSMENU_MUSICVOLUME, RGB(45,25,25)); PutString(sX + 24, sY + 141, DRAW_DIALOGBOX_SYSMENU_MUSICVOLUME, RGB(45,25,25)); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX + 130 + m_cMusicVolume, sY + 145, 8); PutString(sX + 23, sY + 158, DRAW_DIALOGBOX_SYSMENU_TRANSPARENCY, RGB(45,25,25)); PutString(sX + 24, sY + 158, DRAW_DIALOGBOX_SYSMENU_TRANSPARENCY, RGB(45,25,25)); if (m_bDialogTrans) PutString(sX + 208, sY + 158, DRAW_DIALOGBOX_SYSMENU_ON, RGB(255,255,255)); else PutString(sX + 207, sY + 158, DRAW_DIALOGBOX_SYSMENU_OFF, RGB(200,200,200)); PutString(sX + 23, sY + 180, DRAW_DIALOGBOX_SYSMENU_GUIDEMAP, RGB(45,25,25)); PutString(sX + 24, sY + 180, DRAW_DIALOGBOX_SYSMENU_GUIDEMAP, RGB(45,25,25)); if (m_bIsDialogEnabled[9]) PutString(sX + 99, sY + 180, DRAW_DIALOGBOX_SYSMENU_ON, RGB(255,255,255)); else PutString(sX + 98, sY + 180, DRAW_DIALOGBOX_SYSMENU_OFF, RGB(200,200,200)); SYSTEMTIME SysTime; GetLocalTime(&SysTime); ZeroMemory(G_cTxt, sizeof(G_cTxt)); wsprintf(G_cTxt, "%d:%d:%d:%d:%d", SysTime.wMonth, SysTime.wDay, SysTime.wHour, SysTime.wMinute, SysTime.wSecond); PutString(sX + 23, sY + 204, G_cTxt, RGB(45,25,25)); PutString(sX + 24, sY + 204, G_cTxt, RGB(45,25,25)); //v2.172 #ifdef _DEBUG PutString(sX + 23, sY + 41, UPDATE_SCREEN_ON_SELECT_CHARACTER36, RGB(45,25,25)); // "Test server" PutString(sX + 24, sY + 41, UPDATE_SCREEN_ON_SELECT_CHARACTER36, RGB(45,25,25)); // "Test server" #else if (strcmp(m_cWorldServerName, NAME_WORLDNAME1) == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME1, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME1, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, NAME_WORLDNAME2) == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME2, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME2, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, "WS3") == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME3, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME3, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, "WS4") == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME4, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME4, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, "WS5") == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME5, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME5, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, "WS6") == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME6, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME6, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, "WS7") == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME7, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME7, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, "WS8") == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME8, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME8, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, "WS9") == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME9, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME9, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, "WS10") == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME10, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME10, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, "WS11") == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME11, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME11, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, "WS12") == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME12, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME12, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, "WS13") == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME13, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME13, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, "WS14") == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME14, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME14, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, "WS15") == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME15, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME15, RGB(45,25,25)); } else if (strcmp(m_cWorldServerName, "WS16") == 0) { PutString(sX + 23, sY + 41, MSG_WORLDNAME16, RGB(45,25,25)); PutString(sX + 24, sY + 41, MSG_WORLDNAME16, RGB(45,25,25)); } #endif if ( (cLB != 0) && (iGetTopDialogBoxIndex() == 19) ) // (msX >= sX + 120) && (msX <= sX + 242) && (msY >= sY +122) && (msY <= sY +138) { if ((msX >= sX + 127) && (msX <= sX + 238) && (msY >= sY +122) && (msY <= sY +138)) { m_cSoundVolume = msX - (sX + 127); if( m_cSoundVolume > 100 ) m_cSoundVolume = 100; if( m_cSoundVolume < 0 ) m_cSoundVolume = 0; } if ((msX >= sX + 127) && (msX <= sX + 238) && (msY >= sY +139) && (msY <= sY +155)) { m_cMusicVolume = msX - (sX + 127); if( m_cMusicVolume > 100 ) m_cMusicVolume = 100; if( m_cMusicVolume < 0 ) m_cMusicVolume = 0; if (m_bSoundFlag) { int iVol; iVol = (m_cMusicVolume - 100)*20; if (iVol > 0) iVol = 0; if (iVol < -10000) iVol = -10000; if (m_pBGM != NULL) { m_pBGM->bStop(TRUE); m_pBGM->Play(FALSE, 0, iVol); } } } } else m_stDialogBoxInfo[19].bIsScrollSelected = FALSE; // Log-Out if (m_cLogOutCount == -1) { if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + 225) && (msY <= sY + 225 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY +225, 9); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY +225, 8); } else { //Continue if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + 225) && (msY <= sY + 225 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY +225, 7); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY +225, 6); } // Restart if ((m_iHP <= 0) && (m_cRestartCount == -1)) { if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + 225) && (msY <= sY + 225 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY +225, 37); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY +225, 36); }else if (m_cRestartCount == -1) { PutString(sX + 115, sY + 227, "www.helbreathlegion.net", RGB(10,0,0)); PutString(sX + 114, sY + 226, "www.helbreathlegion.net", RGB(45,25,25)); } } //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ void CGame::bItemDrop_Character() { ItemEquipHandler((char)m_stMCursor.sSelectedObjectID); } void CGame::bItemDrop_Inventory(short msX, short msY) { short sX, sY, dX, dY; char cTxt[120]; if (m_cCommand < 0) return; if (m_pItemList[m_stMCursor.sSelectedObjectID] == NULL) return; if ((m_bSkillUsingStatus == TRUE) && (m_bIsItemEquipped[m_stMCursor.sSelectedObjectID] == TRUE)) { AddEventList(BITEMDROP_INVENTORY1, 10); return; } if (m_bIsItemDisabled[m_stMCursor.sSelectedObjectID] == TRUE) return; sY = m_stDialogBoxInfo[2].sY; sX = m_stDialogBoxInfo[2].sX; dX = msX - sX - 32 - m_stMCursor.sDistX; dY = msY - sY - 44 - m_stMCursor.sDistY; if (dY < -10) dY = -10; if (dX < 0) dX = 0; if (dX > 170) dX = 170; if (dY > 95) dY = 95; m_pItemList[m_stMCursor.sSelectedObjectID]->m_sX = dX; m_pItemList[m_stMCursor.sSelectedObjectID]->m_sY = dY; short sTmpSpr, sTmpSprFrm; sTmpSpr = m_pItemList[m_stMCursor.sSelectedObjectID]->m_sSprite; sTmpSprFrm = m_pItemList[m_stMCursor.sSelectedObjectID]->m_sSpriteFrame; char cItemID; if (m_bShiftPressed) { for (int i = 0; i < MAXITEMS; i++) { if (m_cItemOrder[MAXITEMS - 1 - i] != -1) { cItemID = m_cItemOrder[MAXITEMS - 1 - i]; if (m_pItemList[cItemID] != NULL && memcmp(m_pItemList[cItemID]->m_cName, m_pItemList[m_stMCursor.sSelectedObjectID]->m_cName, 20) == 0 ) { m_pItemList[cItemID]->m_sX = dX; m_pItemList[cItemID]->m_sY = dY; bSendCommand(MSGID_REQUEST_SETITEMPOS, NULL, cItemID, dX, dY, NULL, NULL); } } } }else bSendCommand(MSGID_REQUEST_SETITEMPOS, NULL, (char)(m_stMCursor.sSelectedObjectID), dX, dY, NULL, NULL); if (m_bIsItemEquipped[m_stMCursor.sSelectedObjectID] == TRUE) { char cStr1[64], cStr2[64], cStr3[64]; GetItemName(m_pItemList[m_stMCursor.sSelectedObjectID], cStr1, cStr2, cStr3); wsprintf(cTxt, ITEM_EQUIPMENT_RELEASED, cStr1); AddEventList(cTxt, 10); if(memcmp(m_pItemList[m_stMCursor.sSelectedObjectID]->m_cName, "AngelicPendant", 14) == 0) PlaySound('E', 53, 0); else PlaySound('E', 29, 0); // Remove Angelic Stats if ( (m_pItemList[m_stMCursor.sSelectedObjectID]->m_cEquipPos >= 11) && (m_pItemList[m_stMCursor.sSelectedObjectID]->m_cItemType == 1)) { char cItemID = m_stMCursor.sSelectedObjectID; if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(STR)", 19) == 0) { m_angelStat[STAT_STR] = 0; }else if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(DEX)", 19) == 0) { m_angelStat[STAT_DEX] = 0; }else if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(INT)", 19) == 0) { m_angelStat[STAT_INT] = 0; }else if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(MAG)", 19) == 0) { m_angelStat[STAT_MAG] = 0; } } bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_RELEASEITEM, NULL, m_stMCursor.sSelectedObjectID, NULL, NULL, NULL); m_bIsItemEquipped[m_stMCursor.sSelectedObjectID] = FALSE; m_sItemEquipmentStatus[ m_pItemList[m_stMCursor.sSelectedObjectID]->m_cEquipPos ] = -1; } } void CGame::bItemDrop_SellList(short msX, short msY) { int i; char cItemID; cItemID = (char)m_stMCursor.sSelectedObjectID; if (m_pItemList[cItemID] == NULL) return; if (m_bIsItemDisabled[cItemID] == TRUE) return; if (m_cCommand < 0) return; for (i = 0; i < MAXSELLLIST; i++) if (m_stSellItemList[i].iIndex == cItemID) { AddEventList(BITEMDROP_SELLLIST1, 10); return; } if (strcmp(m_pItemList[cItemID]->m_cName, "Gold") == 0) { AddEventList(BITEMDROP_SELLLIST2, 10); return; } if (m_pItemList[cItemID]->m_wCurLifeSpan == 0) { ZeroMemory( G_cTxt, sizeof(G_cTxt) ); char cStr1[64], cStr2[64], cStr3[64]; GetItemName(m_pItemList[cItemID], cStr1, cStr2, cStr3); wsprintf( G_cTxt, NOTIFYMSG_CANNOT_SELL_ITEM2, cStr1 ); AddEventList( G_cTxt, 10 ); return; } if ( ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_ARROW)) && (m_pItemList[cItemID]->m_dwCount > 1) ) { m_stDialogBoxInfo[17].sX = msX - 140; m_stDialogBoxInfo[17].sY = msY - 70; if (m_stDialogBoxInfo[17].sY < 0) m_stDialogBoxInfo[17].sY = 0; m_stDialogBoxInfo[17].sV1 = m_sPlayerX+1; m_stDialogBoxInfo[17].sV2 = m_sPlayerY+1; m_stDialogBoxInfo[17].sV3 = 1001; m_stDialogBoxInfo[17].sV4 = cItemID; ZeroMemory(m_stDialogBoxInfo[17].cStr, sizeof(m_stDialogBoxInfo[17].cStr)); EnableDialogBox(17, cItemID, m_pItemList[cItemID]->m_dwCount, NULL); m_bIsItemDisabled[cItemID] = TRUE; }else { for (i = 0; i < MAXSELLLIST; i++) if (m_stSellItemList[i].iIndex == -1) { m_stSellItemList[i].iIndex = cItemID; m_stSellItemList[i].iAmount = 1; m_bIsItemDisabled[cItemID] = TRUE; return; } AddEventList(BITEMDROP_SELLLIST3, 10); } } void CGame::bItemDrop_ItemUpgrade() { char cItemID; cItemID = (char)m_stMCursor.sSelectedObjectID; if (m_bIsItemDisabled[cItemID] == TRUE) return; if (m_cCommand < 0) return; if (m_pItemList[cItemID]->m_cEquipPos == EQUIPPOS_NONE) return; switch (m_stDialogBoxInfo[34].cMode) { case 1: m_bIsItemDisabled[m_stDialogBoxInfo[34].sV1] = FALSE; m_stDialogBoxInfo[34].sV1 = cItemID; m_bIsItemDisabled[cItemID] = TRUE; PlaySound('E', 29, 0); break; case 6: m_bIsItemDisabled[m_stDialogBoxInfo[34].sV1] = FALSE; m_stDialogBoxInfo[34].sV1 = cItemID; m_bIsItemDisabled[cItemID] = TRUE; PlaySound('E', 29, 0); break; } } void CGame::bItemDrop_Bank(short msX, short msY) { m_stDialogBoxInfo[39].sV1 = m_stMCursor.sSelectedObjectID; if (m_cCommand < 0) return; if (m_pItemList[m_stDialogBoxInfo[39].sV1] == NULL) return; if (m_bIsItemDisabled[m_stDialogBoxInfo[39].sV1] == TRUE) return; if ( m_bIsDialogEnabled[17] == TRUE ) { AddEventList(BITEMDROP_SKILLDIALOG1, 10); return; } if ( (m_bIsDialogEnabled[20] == TRUE) && ((m_stDialogBoxInfo[20].cMode == 1) || (m_stDialogBoxInfo[20].cMode == 2)) ) { AddEventList(BITEMDROP_SKILLDIALOG1, 10); return; } if (m_bIsDialogEnabled[23] == TRUE) { AddEventList(BITEMDROP_SKILLDIALOG1, 10); return; } if (m_bIsDialogEnabled[4] == TRUE) { AddEventList(BITEMDROP_SKILLDIALOG1, 10); return; } if ( ((m_pItemList[m_stDialogBoxInfo[39].sV1]->m_cItemType == ITEMTYPE_CONSUME) || (m_pItemList[m_stDialogBoxInfo[39].sV1]->m_cItemType == ITEMTYPE_ARROW)) && (m_pItemList[m_stDialogBoxInfo[39].sV1]->m_dwCount > 1) ) { m_stDialogBoxInfo[17].sX = msX - 140; m_stDialogBoxInfo[17].sY = msY - 70; if (m_stDialogBoxInfo[17].sY < 0) m_stDialogBoxInfo[17].sY = 0; m_stDialogBoxInfo[17].sV1 = m_sPlayerX+1; m_stDialogBoxInfo[17].sV2 = m_sPlayerY+1; m_stDialogBoxInfo[17].sV3 = 1002;// NPC m_stDialogBoxInfo[17].sV4 = m_stDialogBoxInfo[39].sV1; ZeroMemory(m_stDialogBoxInfo[17].cStr, sizeof(m_stDialogBoxInfo[17].cStr)); EnableDialogBox(17, m_stDialogBoxInfo[39].sV1, m_pItemList[m_stDialogBoxInfo[39].sV1]->m_dwCount, NULL); }else { if (_iGetBankItemCount() >= (MAXBANKITEMS-1)) AddEventList(DLGBOX_CLICK_NPCACTION_QUERY9, 10); else bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_GIVEITEMTOCHAR, m_stDialogBoxInfo[39].sV1, 1, m_stDialogBoxInfo[39].sV5, m_stDialogBoxInfo[39].sV6, m_pItemList[m_stDialogBoxInfo[39].sV1]->m_cName, m_stDialogBoxInfo[39].sV4); //v1.4 } } void CGame::bItemDrop_SkillDialog() { int iConsumeNum; char cItemID; if (m_cCommand < 0) return; cItemID = (char)m_stMCursor.sSelectedObjectID; if (m_pItemList[cItemID] == NULL) return; if (m_bIsItemDisabled[cItemID] == TRUE) return; if ( m_bIsDialogEnabled[17] == TRUE ) { AddEventList(BITEMDROP_SKILLDIALOG1, 10); return; } if ( (m_bIsDialogEnabled[20] == TRUE) && ((m_stDialogBoxInfo[20].cMode == 1) || (m_stDialogBoxInfo[20].cMode == 2)) ) { AddEventList(BITEMDROP_SKILLDIALOG1, 10); return; } if (m_bIsDialogEnabled[23] == TRUE) { AddEventList(BITEMDROP_SKILLDIALOG1, 10); return; } switch (m_stDialogBoxInfo[26].cMode) { case 1: if (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) { iConsumeNum = 0; if (m_stDialogBoxInfo[26].sV1 == cItemID) iConsumeNum++; if (m_stDialogBoxInfo[26].sV2 == cItemID) iConsumeNum++; if (m_stDialogBoxInfo[26].sV3 == cItemID) iConsumeNum++; if (m_stDialogBoxInfo[26].sV4 == cItemID) iConsumeNum++; if (m_stDialogBoxInfo[26].sV5 == cItemID) iConsumeNum++; if (m_stDialogBoxInfo[26].sV6 == cItemID) iConsumeNum++; if (iConsumeNum >= (int)(m_pItemList[cItemID]->m_dwCount)) return; } if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_EAT) || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_NONE)) {}else return; if (m_stDialogBoxInfo[26].sV1 == -1) { m_stDialogBoxInfo[26].sV1 = cItemID; if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV2 == -1) { m_stDialogBoxInfo[26].sV2 = cItemID; if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV3 == -1) { m_stDialogBoxInfo[26].sV3 = cItemID; if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV4 == -1) { m_stDialogBoxInfo[26].sV4 = cItemID; if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV5 == -1) { m_stDialogBoxInfo[26].sV5 = cItemID; if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV6 == -1) { m_stDialogBoxInfo[26].sV6 = cItemID; if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; } AddEventList(BITEMDROP_SKILLDIALOG4, 10); break; case 4: if (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) { iConsumeNum = 0; if (m_stDialogBoxInfo[26].sV1 == cItemID) iConsumeNum++; if (m_stDialogBoxInfo[26].sV2 == cItemID) iConsumeNum++; if (m_stDialogBoxInfo[26].sV3 == cItemID) iConsumeNum++; if (m_stDialogBoxInfo[26].sV4 == cItemID) iConsumeNum++; if (m_stDialogBoxInfo[26].sV5 == cItemID) iConsumeNum++; if (m_stDialogBoxInfo[26].sV6 == cItemID) iConsumeNum++; if (iConsumeNum >= (int)(m_pItemList[cItemID]->m_dwCount)) return; } if (m_stDialogBoxInfo[26].sV1 == -1) { m_stDialogBoxInfo[26].sV1 = cItemID; m_stDialogBoxInfo[26].cStr[4] = (char)_bCheckCurrentBuildItemStatus(); if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV2 == -1) { m_stDialogBoxInfo[26].sV2 = cItemID; m_stDialogBoxInfo[26].cStr[4] = (char)_bCheckCurrentBuildItemStatus(); if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV3 == -1) { m_stDialogBoxInfo[26].sV3 = cItemID; m_stDialogBoxInfo[26].cStr[4] = (char)_bCheckCurrentBuildItemStatus(); if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV4 == -1) { m_stDialogBoxInfo[26].sV4 = cItemID; m_stDialogBoxInfo[26].cStr[4] = (char)_bCheckCurrentBuildItemStatus(); if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV5 == -1) { m_stDialogBoxInfo[26].sV5 = cItemID; m_stDialogBoxInfo[26].cStr[4] = (char)_bCheckCurrentBuildItemStatus(); if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV6 == -1) { m_stDialogBoxInfo[26].sV6 = cItemID; m_stDialogBoxInfo[26].cStr[4] = (char)_bCheckCurrentBuildItemStatus(); if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; } AddEventList(BITEMDROP_SKILLDIALOG4, 10); // "There is no more space for ingredients." break; // Crafting case 7: if ( (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_NONE) // Merien Stone || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_EQUIP) // Necks XXXMagins || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) // stones || (m_pItemList[cItemID]->m_cItemType == ITEMTYPE_MATERIAL)) // XXXwares {}else return; if (m_stDialogBoxInfo[26].sV1 == -1) { m_stDialogBoxInfo[26].sV1 = cItemID; if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV2 == -1) { m_stDialogBoxInfo[26].sV2 = cItemID; if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV3 == -1) { m_stDialogBoxInfo[26].sV3 = cItemID; if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV4 == -1) { m_stDialogBoxInfo[26].sV4 = cItemID; if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV5 == -1) { m_stDialogBoxInfo[26].sV5 = cItemID; if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; }else if (m_stDialogBoxInfo[26].sV6 == -1) { m_stDialogBoxInfo[26].sV6 = cItemID; if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_CONSUME) && (m_pItemList[cItemID]->m_dwCount > 1)) {}else m_bIsItemDisabled[cItemID] = TRUE; return; } AddEventList(BITEMDROP_SKILLDIALOG4, 10); // "There is no more space for ingredients." break; default: break; } } // Slates Item Drag&Drop - Diuuude void CGame::bItemDrop_Slates() { char cItemID; if (m_cCommand < 0) return; cItemID = (char)m_stMCursor.sSelectedObjectID; if (m_pItemList[cItemID] == NULL) return; if (m_bIsItemDisabled[cItemID] == TRUE) return; if ( m_bIsDialogEnabled[17] == TRUE ) { AddEventList(BITEMDROP_SKILLDIALOG1, 10); return; } if ( (m_bIsDialogEnabled[20] == TRUE) && ((m_stDialogBoxInfo[20].cMode == 1) || (m_stDialogBoxInfo[20].cMode == 2)) ) { AddEventList(BITEMDROP_SKILLDIALOG1, 10); return; } if (m_bIsDialogEnabled[23] == TRUE) { AddEventList(BITEMDROP_SKILLDIALOG1, 10); return; } switch (m_stDialogBoxInfo[40].cMode) { case 1: if ((m_pItemList[cItemID]->m_cItemType == ITEMTYPE_USE_SKILL_ENABLEDIALOGBOX) && (m_pItemList[cItemID]->m_sSpriteFrame >= 151) && (m_pItemList[cItemID]->m_sSpriteFrame <= 154)) { char cItemIDText[20]; switch(m_pItemList[cItemID]->m_sSpriteFrame){ case 151: if (m_stDialogBoxInfo[40].sV1 == -1){ m_bIsItemDisabled[cItemID] = TRUE; m_stDialogBoxInfo[40].sV1 = cItemID; wsprintf(cItemIDText, "Item ID : %d", cItemID); AddEventList(cItemIDText, 10); } break; case 152: if (m_stDialogBoxInfo[40].sV2 == -1){ m_bIsItemDisabled[cItemID] = TRUE; m_stDialogBoxInfo[40].sV2 = cItemID; wsprintf(cItemIDText, "Item ID : %d", cItemID); AddEventList(cItemIDText, 10); } break; case 153: if (m_stDialogBoxInfo[40].sV3 == -1){ m_bIsItemDisabled[cItemID] = TRUE; m_stDialogBoxInfo[40].sV3 = cItemID; wsprintf(cItemIDText, "Item ID : %d", cItemID); AddEventList(cItemIDText, 10); } break; case 154: if (m_stDialogBoxInfo[40].sV4 == -1){ m_bIsItemDisabled[cItemID] = TRUE; m_stDialogBoxInfo[40].sV4 = cItemID; wsprintf(cItemIDText, "Item ID : %d", cItemID); AddEventList(cItemIDText, 10); } break; } } break; default: break; } } void CGame::DlgBoxClick_Bank(short msX, short msY) { int i; short sX, sY; sX = m_stDialogBoxInfo[14].sX; sY = m_stDialogBoxInfo[14].sY; switch ( m_stDialogBoxInfo[14].cMode ) { case -1: break; case 0: for (i = 0; i < m_stDialogBoxInfo[14].sV1; i++) if ((msX > sX + 30) && (msX < sX + 210) && (msY >= sY + 110 + i*15) && (msY <= sY + 124 + i*15)) { if ((m_pBankList[m_stDialogBoxInfo[14].sView + i] != NULL) && ((m_stDialogBoxInfo[14].sView + i) < MAXBANKITEMS)) { if (_iGetTotalItemNum() >= 50) { AddEventList(DLGBOX_CLICK_BANK1, 10); return; } bSendCommand(MSGID_REQUEST_RETRIEVEITEM, NULL, NULL, (m_stDialogBoxInfo[14].sView + i), NULL, NULL, NULL); m_stDialogBoxInfo[14].cMode = -1; PlaySound('E', 14, 5); } return; } break; } } void CGame::DlgBoxClick_Fish(short msX, short msY) { short sX, sY; sX = m_stDialogBoxInfo[24].sX; sY = m_stDialogBoxInfo[24].sY; switch (m_stDialogBoxInfo[24].cMode) { case 0: if ((msX >= sX + 160) && (msX <= sX + 253) && (msY >= sY + 70) && (msY <= sY + 90)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_GETFISHTHISTIME, NULL, NULL, NULL, NULL, NULL); AddEventList(DLGBOX_CLICK_FISH1, 10); DisableDialogBox(24); PlaySound('E', 14, 5); } break; } } void CGame::DlgBoxClick_Magic(short msX, short msY) { int i, iCPivot, iYloc; short sX, sY; sX = m_stDialogBoxInfo[3].sX; sY = m_stDialogBoxInfo[3].sY; iCPivot = m_stDialogBoxInfo[3].sView*10; iYloc = 0; for (i = 0; i < 9; i++) { if ((m_cMagicMastery[iCPivot + i] != NULL) && (m_pMagicCfgList[iCPivot + i] != NULL)) { if ((msX >= sX + 30) && (msX <= sX + 240) && (msY >= sY + 70 + iYloc) && (msY <= sY + 70 + 18 + iYloc)) { UseMagic(iCPivot + i); PlaySound('E', 14, 5); return; } iYloc += 18; } } if ((msX >= sX + 16) && (msX <= sX + 38) && (msY >= sY + 240) && (msY <= sY + 268)) m_stDialogBoxInfo[3].sView = 0; if ((msX >= sX + 39) && (msX <= sX + 56) && (msY >= sY + 240) && (msY <= sY + 268)) m_stDialogBoxInfo[3].sView = 1; if ((msX >= sX + 57) && (msX <= sX + 81) && (msY >= sY + 240) && (msY <= sY + 268)) m_stDialogBoxInfo[3].sView = 2; if ((msX >= sX + 82) && (msX <= sX + 101) && (msY >= sY + 240) && (msY <= sY + 268)) m_stDialogBoxInfo[3].sView = 3; if ((msX >= sX + 102) && (msX <= sX + 116) && (msY >= sY + 240) && (msY <= sY + 268)) m_stDialogBoxInfo[3].sView = 4; if ((msX >= sX + 117) && (msX <= sX + 137) && (msY >= sY + 240) && (msY <= sY + 268)) m_stDialogBoxInfo[3].sView = 5; if ((msX >= sX + 138) && (msX <= sX + 165) && (msY >= sY + 240) && (msY <= sY + 268)) m_stDialogBoxInfo[3].sView = 6; if ((msX >= sX + 166) && (msX <= sX + 197) && (msY >= sY + 240) && (msY <= sY + 268)) m_stDialogBoxInfo[3].sView = 7; if ((msX >= sX + 198) && (msX <= sX + 217) && (msY >= sY + 240) && (msY <= sY + 268)) m_stDialogBoxInfo[3].sView = 8; if ((msX >= sX + 218) && (msX <= sX + 239) && (msY >= sY + 240) && (msY <= sY + 268)) m_stDialogBoxInfo[3].sView = 9; if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + 285) && (msY <= sY + 285 + BTNSZY)) { if (m_cSkillMastery[SKILL_ALCHEMY] == 0) AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY16, 10); else { for (i = 0; i < MAXITEMS; i++) if ((m_pItemList[i] != NULL) && (m_pItemList[i]->m_cItemType == ITEMTYPE_USE_SKILL_ENABLEDIALOGBOX) && (m_pItemList[i]->m_sSpriteFrame == 55)) { EnableDialogBox(26, 1, NULL, NULL, NULL); AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY10, 10); PlaySound('E', 14, 5); return; } AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY15, 10); } PlaySound('E', 14, 5); } } void CGame::DlgBoxClick_NpcActionQuery(short msX, short msY) {short sX, sY; int absX, absY; if (m_bIsDialogEnabled[27] == TRUE) { AddEventList(BITEMDROP_SKILLDIALOG1, 10); return; } sX = m_stDialogBoxInfo[20].sX; sY = m_stDialogBoxInfo[20].sY; switch (m_stDialogBoxInfo[20].cMode) { case 0: // Talk to npc if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 55) && (msY < sY + 70)) { EnableDialogBox(m_stDialogBoxInfo[20].sV1, m_stDialogBoxInfo[20].sV2, NULL, NULL); DisableDialogBox(20); } if ((m_bIsDialogEnabled[21] == FALSE) && (msX > sX + 125) && (msX < sX + 180) && (msY > sY + 55) && (msY < sY + 70)) { switch (m_stDialogBoxInfo[20].sV1) { case 7: // Guild bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 1, NULL, NULL, NULL); AddEventList(TALKING_TO_GUILDHALL_OFFICER, 10); break; case 11: // BS or Shop switch (m_stDialogBoxInfo[20].sV2) { case 1: bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 2, NULL, NULL, NULL); AddEventList(TALKING_TO_SHOP_KEEPER, 10); break; case 2: bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 3, NULL, NULL, NULL); AddEventList(TALKING_TO_BLACKSMITH_KEEPER, 10); break; } break; case 13: // CityHall officer bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 4, NULL, NULL, NULL); AddEventList(TALKING_TO_CITYHALL_OFFICER, 10); break; case 14: // WH keeper bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 5, NULL, NULL, NULL); AddEventList(TALKING_TO_WAREHOUSE_KEEPER, 10); break; case 16: // Magicmerchant bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 6, NULL, NULL, NULL); AddEventList(TALKING_TO_MAGICIAN, 10); break; } DisableDialogBox(20); } break; case 1: // On other player if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 55) && (msY < sY + 70)) { absX = abs(m_stDialogBoxInfo[20].sV5 - m_sPlayerX); absY = abs(m_stDialogBoxInfo[20].sV6 - m_sPlayerY); if ((absX <= 4) && (absY <= 4)) bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_GIVEITEMTOCHAR, m_stDialogBoxInfo[20].sV1, m_stDialogBoxInfo[20].sV3, m_stDialogBoxInfo[20].sV5, m_stDialogBoxInfo[20].sV6, m_pItemList[m_stDialogBoxInfo[20].sV1]->m_cName, m_stDialogBoxInfo[20].sV4); //v1.4 else AddEventList(DLGBOX_CLICK_NPCACTION_QUERY7, 10); //"Too far to give the item." DisableDialogBox(20); }else if ((msX > sX + 155) && (msX < sX + 210) && (msY > sY + 55) && (msY < sY + 70)) { absX = abs(m_stDialogBoxInfo[20].sV5 - m_sPlayerX); absY = abs(m_stDialogBoxInfo[20].sV6 - m_sPlayerY); if ((absX <= 4) && (absY <= 4)) bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_EXCHANGEITEMTOCHAR, m_stDialogBoxInfo[20].sV1, m_stDialogBoxInfo[20].sV3, m_stDialogBoxInfo[20].sV5, m_stDialogBoxInfo[20].sV6, m_pItemList[m_stDialogBoxInfo[20].sV1]->m_cName, m_stDialogBoxInfo[20].sV4); //v1.4 else AddEventList(DLGBOX_CLICK_NPCACTION_QUERY8, 10); //"Too far to exchange item." DisableDialogBox(20); } break; case 2: // Item on Shop/BS if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 55) && (msY < sY + 70)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_SELLITEM, NULL, m_stDialogBoxInfo[20].sV1, m_stDialogBoxInfo[20].sV2, m_stDialogBoxInfo[20].sV3, m_pItemList[m_stDialogBoxInfo[20].sV1]->m_cName, m_stDialogBoxInfo[20].sV4); DisableDialogBox(20); }else if ((msX > sX + 125) && (msX < sX + 180) && (msY > sY + 55) && (msY < sY + 70)) { if (m_stDialogBoxInfo[20].sV3 == 1) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_REPAIRITEM, NULL, m_stDialogBoxInfo[20].sV1, m_stDialogBoxInfo[20].sV2, NULL, m_pItemList[m_stDialogBoxInfo[20].sV1]->m_cName, m_stDialogBoxInfo[20].sV4); DisableDialogBox(20); } } break; case 3: // Put item in the WH if ((msX > sX + 25) && (msX < sX + 105) && (msY > sY + 55) && (msY < sY + 70)) { absX = abs(m_stDialogBoxInfo[20].sV5 - m_sPlayerX); absY = abs(m_stDialogBoxInfo[20].sV6 - m_sPlayerY); if ((absX <= 8) && (absY <= 8)) { if (_iGetBankItemCount() >= (MAXBANKITEMS-1)) { AddEventList(DLGBOX_CLICK_NPCACTION_QUERY9, 10);//"here is no empty space left in warehouse." }else bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_GIVEITEMTOCHAR, m_stDialogBoxInfo[20].sV1, m_stDialogBoxInfo[20].sV3, m_stDialogBoxInfo[20].sV5, m_stDialogBoxInfo[20].sV6, m_pItemList[m_stDialogBoxInfo[20].sV1]->m_cName, m_stDialogBoxInfo[20].sV4); //v1.4 }else AddEventList(DLGBOX_CLICK_NPCACTION_QUERY7, 10);//"Too far to give the item." DisableDialogBox(20); } break; case 4: // talk to npc or Unicorn if ((m_bIsDialogEnabled[21] == FALSE) && (msX > sX + 125) && (msX < sX + 180) && (msY > sY + 55) && (msY < sY + 70)) { switch (m_stDialogBoxInfo[20].sV3) { case 21: // Guard bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 21, NULL, NULL, NULL); AddEventList(TALKING_TO_GUARD, 10);//"Talking to Guard..." break; case 32: // Unicorn bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 32, NULL, NULL, NULL); AddEventList(TALKING_TO_UNICORN, 10);//"Talking to Unicorn..." break; case 67: bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 67, NULL, NULL, NULL); AddEventList(TALKING_TO_MCGAFFIN, 10);//"Talking to a town man..." break; case 68: bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 68, NULL, NULL, NULL); AddEventList(TALKING_TO_PERRY, 10);//"Talking to a town maiden..." break; case 69: bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 69, NULL, NULL, NULL); AddEventList(TALKING_TO_DEVLIN, 10);//"Talking to a town magician..." break; } } DisableDialogBox(20); break; case 5: // Talk slit shop if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 55) && (msY < sY + 70)) { if((m_stDialogBoxInfo[20].sV2 == 1)&&(m_stDialogBoxInfo[20].sV1 == 11)) { EnableDialogBox(52, NULL, NULL, NULL); DisableDialogBox(20); } if((m_stDialogBoxInfo[20].sV2 == 2) && (m_stDialogBoxInfo[20].sV1 == 11)) { EnableDialogBox(53, NULL, NULL, NULL); DisableDialogBox(20); } if((m_stDialogBoxInfo[20].sV2 != 2) && (m_stDialogBoxInfo[20].sV2 != 1) && (m_stDialogBoxInfo[20].sV1 != 11)) { EnableDialogBox(m_stDialogBoxInfo[20].sV1, m_stDialogBoxInfo[20].sV2, NULL, NULL); DisableDialogBox(20); } } if ((msX > sX + 25 +75) && (msX < sX + 80 +75) && (msY > sY + 55) && (msY < sY + 70)) { EnableDialogBox(31, NULL, NULL, NULL); DisableDialogBox(20); } if ((m_bIsDialogEnabled[21] == FALSE) && (msX > sX + 155) && (msX < sX + 210) && (msY > sY + 55) && (msY < sY + 70)) { switch (m_stDialogBoxInfo[20].sV1) { case 7: // Guild bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 1, NULL, NULL, NULL); AddEventList(TALKING_TO_GUILDHALL_OFFICER, 10);//"Talking to Guildhall Officer..." break; case 11: // switch (m_stDialogBoxInfo[20].sV2) { case 1: bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 2, NULL, NULL, NULL); AddEventList(TALKING_TO_SHOP_KEEPER, 10);//"Talking to Shop Keeper..." break; case 2: bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 3, NULL, NULL, NULL); AddEventList(TALKING_TO_BLACKSMITH_KEEPER, 10);//" break; } break; case 13: // bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 4, NULL, NULL, NULL); AddEventList(TALKING_TO_CITYHALL_OFFICER, 10);//" break; case 14: // bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 5, NULL, NULL, NULL); AddEventList(TALKING_TO_WAREHOUSE_KEEPER, 10);// break; case 16: // bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 6, NULL, NULL, NULL); AddEventList(TALKING_TO_MAGICIAN, 10);//" break; } DisableDialogBox(20); } break; case 6: // Snoopy: Added Gail if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 55) && (msY < sY + 70)) { EnableDialogBox(51, 0, NULL, NULL); DisableDialogBox(20); } break; case 7: // Jehovah - New Blacksmith Function if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 30) && (msY < sY + 45)) // Buy Weapons { EnableDialogBox(11, 4, NULL, NULL); DisableDialogBox(20); } if ((msX > sX + 125) && (msX < sX + 175) && (msY > sY + 30) && (msY < sY + 45)) // Buy (M) Armor { EnableDialogBox(11, 5, NULL, NULL); DisableDialogBox(20); } if ((msX > sX + 125) && (msX < sX + 175) && (msY > sY + 50) && (msY < sY + 65)) // Buy (W) Armor { EnableDialogBox(11, 6, NULL, NULL); DisableDialogBox(20); } if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 50) && (msY < sY + 65)) // Sell items { EnableDialogBox(31, NULL, NULL, NULL); DisableDialogBox(20); } break; case 8: // Jehovah - New Shopkeeper Function if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 30) && (msY < sY + 45)) // Buy Potions { EnableDialogBox(11, 1, NULL, NULL); DisableDialogBox(20); } if ((msX > sX + 125) && (msX < sX + 175) && (msY > sY + 30) && (msY < sY + 45)) // Buy Misc. { EnableDialogBox(11, 2, NULL, NULL); DisableDialogBox(20); } if ((msX > sX + 125) && (msX < sX + 175) && (msY > sY + 50) && (msY < sY + 65)) // Buy Outfits { EnableDialogBox(11, 3, NULL, NULL); DisableDialogBox(20); } if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 50) && (msY < sY + 65)) // Sell items { EnableDialogBox(31, NULL, NULL, NULL); DisableDialogBox(20); } break; case 9: // Jehovah - New Cityhall Officer Function if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 30) && (msY < sY + 45)) // Offer { EnableDialogBox(13, 0, NULL, NULL); DisableDialogBox(20); } //if ((msX > sX + 125) && (msX < sX + 175) && (msY > sY + 30) && (msY < sY + 45)) // Buy Armor //{ EnableDialogBox(52, 0, NULL, NULL); // DisableDialogBox(20); //} if ((msX > sX + 125) && (msX < sX + 175) && (msY > sY + 50) && (msY < sY + 65)) // Buy Weapons { EnableDialogBox(53, 0, NULL, NULL); DisableDialogBox(20); } if ((msX > sX + 25) && (msX < sX + 100) && (msY > sY + 50) && (msY < sY + 65)) // Talk { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TALKTONPC, NULL, 4, NULL, NULL, NULL); AddEventList(TALKING_TO_CITYHALL_OFFICER, 10);//" } break; } } void CGame::DlgBoxClick_Shop(short msX, short msY) { int i; short sX, sY; char cTemp[21]; sX = m_stDialogBoxInfo[11].sX; sY = m_stDialogBoxInfo[11].sY; switch ( m_stDialogBoxInfo[11].cMode ) { case 0: for (i = 0; i < 13; i++) if ((msX >= sX + 20) && (msX <= sX + 220) && (msY >= sY + i*18 + 65) && (msY <= sY + i*18 + 79)) { if (_iGetTotalItemNum() >= 50) { AddEventList(DLGBOX_CLICK_SHOP1, 10);//"You cannot buy anything because your bag is full." return; } PlaySound('E', 14, 5); if (m_pItemForSaleList[m_stDialogBoxInfo[11].sView + i] != NULL) m_stDialogBoxInfo[11].cMode = m_stDialogBoxInfo[11].sView + i + 1; return; } break; default: if ((msX >= sX + 145) && (msX <= sX + 162) && (msY >= sY + 209) && (msY <= sY + 230)) { m_stDialogBoxInfo[11].sV3 += 10; if (m_stDialogBoxInfo[11].sV3 >= (50 - _iGetTotalItemNum())) m_stDialogBoxInfo[11].sV3 = (50 - _iGetTotalItemNum()); } if ((msX >= sX + 145) && (msX <= sX + 162) && (msY >= sY + 234) && (msY <= sY + 251)) { m_stDialogBoxInfo[11].sV3 -= 10; if (m_stDialogBoxInfo[11].sV3 <= 1) m_stDialogBoxInfo[11].sV3 = 1; } if ((msX >= sX + 163) && (msX <= sX + 180) && (msY >= sY + 209) && (msY <= sY + 230)) { m_stDialogBoxInfo[11].sV3++; if (m_stDialogBoxInfo[11].sV3 >= (50 - _iGetTotalItemNum())) m_stDialogBoxInfo[11].sV3 = (50 - _iGetTotalItemNum()); } if ((msX >= sX + 163) && (msX <= sX + 180) && (msY >= sY + 234) && (msY <= sY + 251)) { m_stDialogBoxInfo[11].sV3--; if (m_stDialogBoxInfo[11].sV3 <= 1) m_stDialogBoxInfo[11].sV3 = 1; } if ((msX >= sX + 30) && (msX <= sX + 30 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Purchase Click if ((50 - _iGetTotalItemNum()) < m_stDialogBoxInfo[11].sV3) { AddEventList(DLGBOX_CLICK_SHOP1, 10);//"ou cannot buy anything because your bag is full." }else { ZeroMemory(cTemp, sizeof(cTemp)); strcpy(cTemp, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_cName); bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_PURCHASEITEM, NULL, m_stDialogBoxInfo[11].sV3, NULL, NULL, cTemp); } m_stDialogBoxInfo[11].cMode = 0; m_stDialogBoxInfo[11].sV3 = 1; PlaySound('E', 14, 5); } if ((msX >= sX + 154) && (msX <= sX + 154 + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) { // Cancel Click m_stDialogBoxInfo[11].cMode = 0; m_stDialogBoxInfo[11].sV3 = 1; PlaySound('E', 14, 5); } break; } } void CGame::DlgBoxClick_Skill(short msX, short msY) { short sX = m_stDialogBoxInfo[15].sX; short sY = m_stDialogBoxInfo[15].sY; if(m_stDialogBoxInfo[15].cMode == 0) { for(int line=0, skillIndex=0; line < 17; skillIndex++) { if ((line < MAXSKILLTYPE) && (m_pSkillCfgList[skillIndex + m_stDialogBoxInfo[15].sView] != NULL)) { if ((msX >= sX + 30) && (msX <= sX + 135 + 44) && (msY >= sY + 45 + line*15) && (msY <= sY + 59 + line*15)) { if (m_pSkillCfgList[ skillIndex+m_stDialogBoxInfo[15].sView ]->m_bIsUseable && m_pSkillCfgList[ skillIndex+m_stDialogBoxInfo[15].sView ]->m_iLevel != 0) { if (m_bSkillUsingStatus) { AddEventList(DLGBOX_CLICK_SKILL1, 10); // "You are already using other skill." return; } if ((m_bCommandAvailable == FALSE) || (m_iHP <= 0)) { AddEventList(DLGBOX_CLICK_SKILL2, 10); // "You can't use a skill while you are moving." return; } if (m_bIsGetPointingMode) return; switch (m_pSkillCfgList[skillIndex + m_stDialogBoxInfo[15].sView]->m_cUseMethod) { case 0: case 2: bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_USESKILL, NULL, (skillIndex + m_stDialogBoxInfo[15].sView), NULL, NULL, NULL); m_bSkillUsingStatus = TRUE; DisableDialogBox(15); PlaySound('E', 14, 5); break; } } }else if ((msX >= sX + 215) && (msX <= sX + 240) && (msY >= sY + 45 + line*15) && (msY <= sY + 59 + line*15)) { if (m_stDialogBoxInfo[15].bFlag == FALSE) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_SETDOWNSKILLINDEX, NULL, skillIndex + m_stDialogBoxInfo[15].sView, NULL, NULL, NULL); PlaySound('E', 14, 5); m_stDialogBoxInfo[15].bFlag = TRUE; } } line++; } } } } void CGame::DlgBoxClick_SkillDlg(short msX, short msY) { int i, iAdjX, iAdjY, buildItem; short sX, sY; sX = m_stDialogBoxInfo[26].sX; sY = m_stDialogBoxInfo[26].sY; iAdjX = 5 ; iAdjY = 8 ; switch (m_stDialogBoxInfo[26].cMode) { case 1: if ((msX >= sX + iAdjX + 60) && (msX <= sX + iAdjX + 153) && (msY >= sY + iAdjY + 175) && (msY <= sY + iAdjY + 195)) { m_stDialogBoxInfo[26].cMode = 2; m_stDialogBoxInfo[26].cStr[0] = 1; m_stDialogBoxInfo[26].dwT1 = m_dwCurTime; PlaySound('E', 14, 5); AddEventList(DLGBOX_CLICK_SKILLDLG1, 10); // "Mixing a potion..." PlaySound('E', 41, 0); } break; // Crafting case 7: if ((msX >= sX + iAdjX + 60) && (msX <= sX + iAdjX + 153) && (msY >= sY + iAdjY + 175) && (msY <= sY + iAdjY + 195)) { DebugLog("Tag1 DlgBoxClick_SkillDlg"); if (m_stDialogBoxInfo[26].sV1 == -1) { AddEventList(DLGBOX_CLICK_SKILLDLG2, 10); // "There is not enough crafting materials. Please put in more materials." PlaySound('E', 14, 5); }else { m_stDialogBoxInfo[26].cMode = 8; m_stDialogBoxInfo[26].dwT1 = m_dwCurTime; m_stDialogBoxInfo[26].cStr[1] = 1; PlaySound('E', 14, 5); AddEventList(DLGBOX_CLICK_SKILLDLG3, 10); // "Crafting the item in progress" PlaySound('E', 51, 0); } } break; case 3: for (i = 0; i < 13; i++) if (m_pDispBuildItemList[i + m_stDialogBoxInfo[26].sView] != NULL) { if ((msX >= sX + iAdjX + 44) && (msX <= sX + iAdjX + 135 + 44) && (msY >= sY + iAdjY + 55 + i*15) && (msY <= sY + iAdjY + 55 + 14 + i*15)) { m_stDialogBoxInfo[26].cMode = 4; m_stDialogBoxInfo[26].cStr[0] = buildItem = i + m_stDialogBoxInfo[26].sView; PlaySound('E', 14, 5); if(m_manuAutoFill){ for(i = 0; i < MAXITEMS; i++) { if (m_pItemList[i] == NULL) continue; int usedCount = 0; if(m_stDialogBoxInfo[26].sV1 == -1 && m_pDispBuildItemList[buildItem]->m_iElementCount[1] && !strcmp(m_pDispBuildItemList[buildItem]->m_cElementName1, m_pItemList[i]->m_cName)) { m_stDialogBoxInfo[26].sV1 = i; usedCount++; if (m_pItemList[i]->m_dwCount == usedCount) continue; } if(m_stDialogBoxInfo[26].sV2 == -1 && m_pDispBuildItemList[buildItem]->m_iElementCount[2] && !strcmp(m_pDispBuildItemList[buildItem]->m_cElementName2, m_pItemList[i]->m_cName)) { m_stDialogBoxInfo[26].sV2 = i; usedCount++; if (m_pItemList[i]->m_dwCount == usedCount) continue; } if(m_stDialogBoxInfo[26].sV3 == -1 && m_pDispBuildItemList[buildItem]->m_iElementCount[3] && !strcmp(m_pDispBuildItemList[buildItem]->m_cElementName3, m_pItemList[i]->m_cName)) { m_stDialogBoxInfo[26].sV3 = i; usedCount++; if (m_pItemList[i]->m_dwCount == usedCount) continue; } if(m_stDialogBoxInfo[26].sV4 == -1 && m_pDispBuildItemList[buildItem]->m_iElementCount[4] && !strcmp(m_pDispBuildItemList[buildItem]->m_cElementName4, m_pItemList[i]->m_cName)) { m_stDialogBoxInfo[26].sV4 = i; usedCount++; if (m_pItemList[i]->m_dwCount == usedCount) continue; } if(m_stDialogBoxInfo[26].sV5 == -1 && m_pDispBuildItemList[buildItem]->m_iElementCount[5] && !strcmp(m_pDispBuildItemList[buildItem]->m_cElementName5, m_pItemList[i]->m_cName)) { m_stDialogBoxInfo[26].sV5 = i; usedCount++; if (m_pItemList[i]->m_dwCount == usedCount) continue; } if(m_stDialogBoxInfo[26].sV6 == -1 && m_pDispBuildItemList[buildItem]->m_iElementCount[6] && !strcmp(m_pDispBuildItemList[buildItem]->m_cElementName6, m_pItemList[i]->m_cName)) { m_stDialogBoxInfo[26].sV6 = i; } } } m_stDialogBoxInfo[26].cStr[4] = (char)_bCheckCurrentBuildItemStatus(); break; } } break; case 4: iAdjX = -1 ; iAdjY = -7 ; if (m_pDispBuildItemList[m_stDialogBoxInfo[26].cStr[0]]->m_bBuildEnabled == TRUE) { if ((msX >= sX + iAdjX + 32) && (msX <= sX + iAdjX + 95) && (msY >= sY + iAdjY + 353) && (msY <= sY + iAdjY + 372)) { // Back m_stDialogBoxInfo[26].cMode = 3; PlaySound('E', 14, 5); if ((m_stDialogBoxInfo[26].sV1 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV1] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV1] = FALSE; if ((m_stDialogBoxInfo[26].sV2 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV2] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV2] = FALSE; if ((m_stDialogBoxInfo[26].sV3 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV3] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV3] = FALSE; if ((m_stDialogBoxInfo[26].sV4 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV4] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV4] = FALSE; if ((m_stDialogBoxInfo[26].sV5 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV5] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV5] = FALSE; if ((m_stDialogBoxInfo[26].sV6 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV6] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV6] = FALSE; m_stDialogBoxInfo[26].sV1 = -1; m_stDialogBoxInfo[26].sV2 = -1; m_stDialogBoxInfo[26].sV3 = -1; m_stDialogBoxInfo[26].sV4 = -1; m_stDialogBoxInfo[26].sV5 = -1; m_stDialogBoxInfo[26].sV6 = -1; m_stDialogBoxInfo[26].cStr[0] = 0; m_stDialogBoxInfo[26].cStr[1] = 0; m_stDialogBoxInfo[26].cStr[4] = 0; } //if ((msX >= sX + iAdjX + 160) && (msX <= sX + iAdjX + 255) && (msY >= sY + iAdjY + 353) && (msY <= sY + iAdjY + 372)) //{ // Manufacture if (m_stDialogBoxInfo[26].cStr[4] == 1) { m_stDialogBoxInfo[26].cMode = 5; m_stDialogBoxInfo[26].cStr[1] = 0; m_stDialogBoxInfo[26].dwT1 = m_dwCurTime; PlaySound('E', 14, 5); PlaySound('E', 44, 0); } //} }else { if ((msX >= sX + iAdjX + 32) && (msX <= sX + iAdjX + 95) && (msY >= sY + iAdjY + 353) && (msY <= sY + iAdjY + 372)) // Back { m_stDialogBoxInfo[26].cMode = 3; PlaySound('E', 14, 5); if ((m_stDialogBoxInfo[26].sV1 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV1] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV1] = FALSE; if ((m_stDialogBoxInfo[26].sV2 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV2] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV2] = FALSE; if ((m_stDialogBoxInfo[26].sV3 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV3] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV3] = FALSE; if ((m_stDialogBoxInfo[26].sV4 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV4] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV4] = FALSE; if ((m_stDialogBoxInfo[26].sV5 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV5] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV5] = FALSE; if ((m_stDialogBoxInfo[26].sV6 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV6] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV6] = FALSE; m_stDialogBoxInfo[26].sV1 = -1; m_stDialogBoxInfo[26].sV2 = -1; m_stDialogBoxInfo[26].sV3 = -1; m_stDialogBoxInfo[26].sV4 = -1; m_stDialogBoxInfo[26].sV5 = -1; m_stDialogBoxInfo[26].sV6 = -1; m_stDialogBoxInfo[26].cStr[0] = 0; m_stDialogBoxInfo[26].cStr[1] = 0; m_stDialogBoxInfo[26].cStr[4] = 0; } } break; case 6: iAdjX = -1; iAdjY = -7; //if ((msX >= sX + iAdjX + 32) && (msX <= sX + iAdjX + 95) && (msY >= sY + iAdjY + 353) && (msY <= sY + iAdjY + 372)) { // Back m_stDialogBoxInfo[26].cMode = 3; PlaySound('E', 14, 5); if ((m_stDialogBoxInfo[26].sV1 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV1] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV1] = FALSE; if ((m_stDialogBoxInfo[26].sV2 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV2] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV2] = FALSE; if ((m_stDialogBoxInfo[26].sV3 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV3] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV3] = FALSE; if ((m_stDialogBoxInfo[26].sV4 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV4] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV4] = FALSE; if ((m_stDialogBoxInfo[26].sV5 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV5] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV5] = FALSE; if ((m_stDialogBoxInfo[26].sV6 != -1) && (m_pItemList[m_stDialogBoxInfo[26].sV6] != NULL)) m_bIsItemDisabled[m_stDialogBoxInfo[26].sV6] = FALSE; m_stDialogBoxInfo[26].sV1 = -1; m_stDialogBoxInfo[26].sV2 = -1; m_stDialogBoxInfo[26].sV3 = -1; m_stDialogBoxInfo[26].sV4 = -1; m_stDialogBoxInfo[26].sV5 = -1; m_stDialogBoxInfo[26].sV6 = -1; m_stDialogBoxInfo[26].cStr[0] = 0; m_stDialogBoxInfo[26].cStr[1] = 0; m_stDialogBoxInfo[26].cStr[4] = 0; //} break; } } void CGame::ResponseTeleportList(char *pData) { char *cp; int *ip, i; #ifdef _DEBUG AddEventList("Teleport ???", 10); #endif cp = pData + 6; ip = (int*) cp; m_iTeleportMapCount = *ip; cp += 4; for ( i = 0 ; i < m_iTeleportMapCount ; i++) { ip = (int*)cp; m_stTeleportList[i].iIndex = *ip; cp += 4; ZeroMemory(m_stTeleportList[i].mapname, sizeof(m_stTeleportList[i].mapname) ); memcpy(m_stTeleportList[i].mapname, cp, 10); cp += 10; ip = (int*)cp; m_stTeleportList[i].iX = *ip; cp += 4; ip = (int*)cp; m_stTeleportList[i].iY = *ip; cp += 4; ip = (int*)cp; m_stTeleportList[i].iCost = *ip; cp += 4; } } void CGame::ResponseChargedTeleport(char *pData) { short *sp; char *cp; short sRejectReason = 0; cp = (char*)pData + INDEX2_MSGTYPE + 2; sp = (short*)cp; sRejectReason = *sp; #ifdef _DEBUG AddEventList( "charged teleport ?", 10 ); #endif switch( sRejectReason ) { case 1: AddEventList( RESPONSE_CHARGED_TELEPORT1, 10 ); break; case 2: AddEventList( RESPONSE_CHARGED_TELEPORT2, 10 ); break; case 3: AddEventList( RESPONSE_CHARGED_TELEPORT3, 10 ); break; case 4: AddEventList( RESPONSE_CHARGED_TELEPORT4, 10 ); break; case 5: AddEventList( RESPONSE_CHARGED_TELEPORT5, 10 ); break; case 6: AddEventList( RESPONSE_CHARGED_TELEPORT6, 10 ); break; default: AddEventList( RESPONSE_CHARGED_TELEPORT7, 10 ); } } void CGame::NotifyMsg_CannotGiveItem(char *pData) { char * cp, cName[21], cTxt[256]; WORD * wp, wItemIndex; int * ip, iAmount; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; wItemIndex = *wp; cp += 2; ip = (int *)cp; iAmount = *ip; cp += 4; ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 20); cp += 20; char cStr1[64], cStr2[64], cStr3[64]; GetItemName(m_pItemList[wItemIndex], cStr1, cStr2, cStr3); if( iAmount == 1 ) wsprintf(cTxt, NOTIFYMSG_CANNOT_GIVE_ITEM2, cStr1, cName); else wsprintf( cTxt, NOTIFYMSG_CANNOT_GIVE_ITEM1, iAmount, cStr1, cName); AddEventList(cTxt, 10); } void CGame::NotifyMsg_DropItemFin_CountChanged(char *pData) { char * cp, cTxt[256]; WORD * wp, wItemIndex; int * ip, iAmount; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; wItemIndex = *wp; cp += 2; ip = (int *)cp; iAmount = *ip; cp += 4; char cStr1[64], cStr2[64], cStr3[64]; GetItemName(m_pItemList[wItemIndex]->m_cName, m_pItemList[wItemIndex]->m_dwAttribute, cStr1, cStr2, cStr3); wsprintf(cTxt, NOTIFYMSG_THROW_ITEM1, iAmount, cStr1); AddEventList(cTxt, 10); } void CGame::NotifyMsg_CannotJoinMoreGuildsMan(char * pData) { char * cp, cName[12], cTxt[120]; cp = (char *)(pData + INDEX2_MSGTYPE + 2); ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 10); wsprintf(cTxt, NOTIFYMSG_CANNOT_JOIN_MOREGUILDMAN1, cName); AddEventList(cTxt, 10); AddEventList(NOTIFYMSG_CANNOT_JOIN_MOREGUILDMAN2, 10); } void CGame::NotifyMsg_DismissGuildsMan(char * pData) { char * cp, cName[12], cTxt[120]; cp = (char *)(pData + INDEX2_MSGTYPE + 2); ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 10); if( memcmp( m_cPlayerName, cName, 10 ) != 0 ) { wsprintf(cTxt, NOTIFYMSG_DISMISS_GUILDMAN1, cName); AddEventList(cTxt, 10); } ClearGuildNameList(); } void CGame::NotifyMsg_CannotRating(char * pData) { char * cp, cTxt[120]; WORD * wp, wTime; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; wTime = *wp; cp += 2; if (wTime == 0) wsprintf(cTxt, NOTIFYMSG_CANNOT_RATING1, wTime*3); else wsprintf(cTxt, NOTIFYMSG_CANNOT_RATING2, wTime*3); AddEventList(cTxt, 10); } void CGame::NotifyMsg_CannotRepairItem(char * pData) { char * cp, cTxt[120], cStr1[64], cStr2[64], cStr3[64]; WORD * wp, wV1, wV2; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; wV1 = *wp; cp += 2; wp = (WORD *)cp; wV2 = *wp; cp += 2; ZeroMemory( cStr1, sizeof(cStr1) ); ZeroMemory( cStr2, sizeof(cStr2) ); ZeroMemory( cStr3, sizeof(cStr3) ); GetItemName( m_pItemList[wV1], cStr1, cStr2, cStr3 ); switch (wV2) { case 1: wsprintf(cTxt, NOTIFYMSG_CANNOT_REPAIR_ITEM1, cStr1 ); AddEventList(cTxt, 10); break; case 2: wsprintf(cTxt, NOTIFYMSG_CANNOT_REPAIR_ITEM2, cStr1 ); AddEventList(cTxt, 10); break; } m_bIsItemDisabled[wV1] = FALSE; } void CGame::NotifyMsg_CannotSellItem(char * pData) { char * cp, cTxt[120], cStr1[64], cStr2[64], cStr3[64]; WORD * wp, wV1, wV2; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; wV1 = *wp; cp += 2; wp = (WORD *)cp; wV2 = *wp; cp += 2; ZeroMemory( cStr1, sizeof(cStr1) ); ZeroMemory( cStr2, sizeof(cStr2) ); ZeroMemory( cStr3, sizeof(cStr3) ); GetItemName( m_pItemList[wV1], cStr1, cStr2, cStr3 ); switch (wV2) { case 1: wsprintf(cTxt, NOTIFYMSG_CANNOT_SELL_ITEM1, cStr1);//" AddEventList(cTxt, 10); break; case 2: wsprintf(cTxt, NOTIFYMSG_CANNOT_SELL_ITEM2, cStr1);//" AddEventList(cTxt, 10); break; case 3: wsprintf(cTxt, NOTIFYMSG_CANNOT_SELL_ITEM3, cStr1);//" AddEventList(cTxt, 10); AddEventList(NOTIFYMSG_CANNOT_SELL_ITEM4, 10);//" break; case 4: AddEventList(NOTIFYMSG_CANNOT_SELL_ITEM5, 10); // " AddEventList(NOTIFYMSG_CANNOT_SELL_ITEM6, 10); // " break; } m_bIsItemDisabled[wV1] = FALSE; } void CGame::NotifyMsg_Charisma(char * pData) { DWORD * dwp; int iPrevChar; char cTxt[120]; iPrevChar = m_stat[STAT_CHR]; dwp = (DWORD *)(pData + INDEX2_MSGTYPE + 2); m_stat[STAT_CHR] = (int)*dwp; if (m_stat[STAT_CHR] > iPrevChar) { wsprintf(cTxt, NOTIFYMSG_CHARISMA_UP, m_stat[STAT_CHR] - iPrevChar);//" AddEventList(cTxt, 10); PlaySound('E', 21, 0); }else { wsprintf(cTxt, NOTIFYMSG_CHARISMA_DOWN, iPrevChar - m_stat[STAT_CHR]);//" AddEventList(cTxt, 10); } } void CGame::NotifyMsg_DropItemFin_EraseItem(char *pData) { char * cp; WORD * wp; int * ip, iAmount; short sItemIndex; char cTxt[120]; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; sItemIndex = *wp; cp += 2; ip = (int *)cp; iAmount = *ip; cp += 4; char cStr1[64], cStr2[64], cStr3[64]; GetItemName(m_pItemList[sItemIndex], cStr1, cStr2, cStr3); ZeroMemory(cTxt, sizeof(cTxt)); if (m_bIsItemEquipped[sItemIndex] == TRUE) { wsprintf(cTxt, ITEM_EQUIPMENT_RELEASED, cStr1); AddEventList(cTxt, 10); m_sItemEquipmentStatus[ m_pItemList[sItemIndex]->m_cEquipPos ] = -1; m_bIsItemEquipped[sItemIndex] = FALSE; } if (m_iHP > 0) { wsprintf(cTxt, NOTIFYMSG_THROW_ITEM2, cStr1); }else { if (iAmount < 2) wsprintf(cTxt, NOTIFYMSG_DROPITEMFIN_ERASEITEM3, cStr1); // "You dropped a %s." else // Snoopy fix { wsprintf(cTxt, NOTIFYMSG_DROPITEMFIN_ERASEITEM5, cStr1); // "You dropped %s." } } AddEventList(cTxt, 10); EraseItem((char)sItemIndex); _bCheckBuildItemStatus(); } void CGame::NotifyMsg_EnemyKillReward(char *pData) { DWORD * dwp; short * sp, sGuildRank; char * cp, cName[12], cGuildName[24], cTxt[120]; int iExp, iEnemyKillCount, iWarContribution; ZeroMemory(cName, sizeof(cName)); ZeroMemory(cGuildName, sizeof(cGuildName)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); dwp = (DWORD *)cp; iExp = *dwp; cp += 4; dwp = (DWORD *)cp; iEnemyKillCount = *dwp; cp += 4; memcpy(cName, cp, 10); cp += 10; memcpy(cGuildName, cp, 20); cp += 20; sp = (short *)cp; sGuildRank = *sp; cp += 2; sp = (short *)cp; iWarContribution = *sp; cp += 2; if (iWarContribution > m_iWarContribution) { wsprintf(G_cTxt, "%s +%d!", CRUSADE_MESSAGE21, iWarContribution - m_iWarContribution); SetTopMsg(G_cTxt, 5); }else if (iWarContribution < m_iWarContribution) {} m_iWarContribution = iWarContribution; if (sGuildRank == -1) { wsprintf(cTxt, NOTIFYMSG_ENEMYKILL_REWARD1, cName); AddEventList(cTxt, 10); }else { wsprintf(cTxt, NOTIFYMSG_ENEMYKILL_REWARD2, cName, cGuildName); // Fixed by Snoopy AddEventList(cTxt, 10); } /* if( m_iExp != iExp ) // removed by snoopy because too much msg hide victim's name { if (m_iExp > iExp) wsprintf(cTxt, EXP_DECREASED,m_iExp - iExp); else wsprintf(cTxt, EXP_INCREASED,iExp - m_iExp); AddEventList(cTxt, 10); }*/ if (m_iEnemyKillCount != iEnemyKillCount) { if (m_iEnemyKillCount > iEnemyKillCount) { wsprintf(cTxt, NOTIFYMSG_ENEMYKILL_REWARD5,m_iEnemyKillCount - iEnemyKillCount); AddEventList(cTxt, 10); }else { wsprintf(cTxt, NOTIFYMSG_ENEMYKILL_REWARD6, iEnemyKillCount - m_iEnemyKillCount); AddEventList(cTxt, 10); } } if( iExp >= 0 ) m_iExp = iExp; if( iEnemyKillCount >= 0 ) m_iEnemyKillCount = iEnemyKillCount; PlaySound('E', 23, 0); if(m_ekScreenshot) m_ekSSTime = timeGetTime() + 650; } void CGame::NotifyMsg_EventFishMode(char * pData) { short sSprite, sSpriteFrame; char * cp, cName[21]; WORD * wp, wPrice; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; wPrice = *wp; cp += 2; wp = (WORD *)cp; sSprite = (short)*wp; cp += 2; wp = (WORD *)cp; sSpriteFrame = (short)*wp; cp += 2; ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 20); cp += 20; EnableDialogBox(24, 0, NULL, wPrice, cName); m_stDialogBoxInfo[24].sV3 = sSprite; m_stDialogBoxInfo[24].sV4 = sSpriteFrame; AddEventList(NOTIFYMSG_EVENTFISHMODE1, 10); } void CGame::NotifyMsg_Exp(char * pData) { DWORD * dwp; int iPrevExp, * ip; char * cp, cTxt[120]; iPrevExp = m_iExp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); dwp = (DWORD *)cp; m_iExp = (int)*dwp; cp += 4; ip = (int *)cp; // m_iRating = *ip; cp += 4; if (m_iExp > iPrevExp) { wsprintf(cTxt, EXP_INCREASED, m_iExp - iPrevExp); AddEventList(cTxt, 10); }else if (m_iExp < iPrevExp) { wsprintf(cTxt, EXP_DECREASED, iPrevExp - m_iExp); AddEventList(cTxt, 10); } } void CGame::NotifyMsg_ForceDisconn(char *pData) { WORD * wpCount; wpCount = (WORD *)(pData + 6); m_bForceDisconn = TRUE; //m_cLogOutCount = (char)*wpCount; if( m_bIsProgramActive ) { if( m_cLogOutCount < 0 || m_cLogOutCount > 5 ) m_cLogOutCount = 5; AddEventList(NOTIFYMSG_FORCE_DISCONN1, 10); }else { delete m_pGSock; m_pGSock = NULL; m_bEscPressed = FALSE; if (m_bSoundFlag) m_pESound[38]->bStop(); if ((m_bSoundFlag) && (m_bMusicStat == TRUE)) { if (m_pBGM != NULL) m_pBGM->bStop(); } if (strlen(G_cCmdLineTokenA) != 0) ChangeGameMode(GAMEMODE_ONQUIT); else ChangeGameMode(GAMEMODE_ONMAINMENU); } } void CGame::NotifyMsg_GiveItemFin_CountChanged(char *pData) { char * cp, cName[21], cTxt[256]; WORD * wp, wItemIndex; int * ip, iAmount; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; wItemIndex = *wp; cp += 2; ip = (int *)cp; iAmount = *ip; cp += 4; ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 20); cp += 20; char cStr1[64], cStr2[64], cStr3[64]; GetItemName(m_pItemList[wItemIndex]->m_cName, m_pItemList[wItemIndex]->m_dwAttribute, cStr1, cStr2, cStr3); if( iAmount == 1 ) wsprintf(cTxt, NOTIFYMSG_GIVEITEMFIN_COUNTCHANGED1, cStr1, cName); wsprintf(cTxt, NOTIFYMSG_GIVEITEMFIN_COUNTCHANGED2, iAmount, cStr1, cName); AddEventList(cTxt, 10); } void CGame::NotifyMsg_GiveItemFin_EraseItem(char *pData) { char * cp; WORD * wp; int * ip, iAmount; short sItemIndex; char cName[21], cTxt[250]; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; sItemIndex = *wp; cp += 2; ip = (int *)cp; iAmount = *ip; cp += 4; ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 20); cp += 20; char cStr1[64], cStr2[64], cStr3[64]; GetItemName(m_pItemList[sItemIndex]->m_cName, m_pItemList[sItemIndex]->m_dwAttribute, cStr1, cStr2, cStr3); if (m_bIsItemEquipped[sItemIndex] == TRUE) { wsprintf(cTxt, ITEM_EQUIPMENT_RELEASED, cStr1); AddEventList(cTxt, 10); m_sItemEquipmentStatus[ m_pItemList[sItemIndex]->m_cEquipPos ] = -1; m_bIsItemEquipped[sItemIndex] = FALSE; } if (strlen(cName) == 0) wsprintf(cTxt, NOTIFYMSG_GIVEITEMFIN_ERASEITEM2, iAmount, cStr1); else { if (strcmp(cName, "Howard") == 0) wsprintf(cTxt, NOTIFYMSG_GIVEITEMFIN_ERASEITEM3, iAmount, cStr1); else if (strcmp(cName, "William") == 0) wsprintf(cTxt, NOTIFYMSG_GIVEITEMFIN_ERASEITEM4, iAmount, cStr1); else if (strcmp(cName, "Kennedy") == 0) wsprintf(cTxt, NOTIFYMSG_GIVEITEMFIN_ERASEITEM5, iAmount, cStr1); else if (strcmp(cName, "Tom") == 0) wsprintf(cTxt, NOTIFYMSG_GIVEITEMFIN_ERASEITEM7, iAmount, cStr1); else wsprintf(cTxt, NOTIFYMSG_GIVEITEMFIN_ERASEITEM8, iAmount, cStr1, cName); } AddEventList(cTxt, 10); EraseItem((char)sItemIndex); _bCheckBuildItemStatus(); } void CGame::NotifyMsg_GlobalAttackMode(char *pData) { char * cp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); switch (*cp) { case 0: AddEventList(NOTIFYMSG_GLOBAL_ATTACK_MODE1, 10); AddEventList(NOTIFYMSG_GLOBAL_ATTACK_MODE2, 10); break; case 1: AddEventList(NOTIFYMSG_GLOBAL_ATTACK_MODE3, 10); break; } cp++; } void CGame::NotifyMsg_HP(char * pData) { DWORD * dwp; int iPrevHP; char cTxt[120]; int iPrevMP; iPrevHP = m_iHP; dwp = (DWORD *)(pData + INDEX2_MSGTYPE + 2); m_iHP = (int)*dwp; iPrevMP = m_iMP; dwp = (DWORD *)(pData + INDEX2_MSGTYPE + 6); m_iMP = (int)*dwp; if (m_iHP > iPrevHP) { if ((m_iHP - iPrevHP) < 10) return; wsprintf(cTxt, NOTIFYMSG_HP_UP, m_iHP - iPrevHP); AddEventList(cTxt, 10); PlaySound('E', 21, 0); }else if(iPrevHP > m_iHP) { if(m_cLogOutCount > 0 && !m_bForceDisconn) { m_cLogOutCount = -1; AddEventList(NOTIFYMSG_HP2, 10); } m_dwDamagedTime = timeGetTime(); if (m_iHP < 20) AddEventList(NOTIFYMSG_HP3, 10); if ((iPrevHP - m_iHP) < 10) return; wsprintf(cTxt, NOTIFYMSG_HP_DOWN, iPrevHP - m_iHP); AddEventList(cTxt, 10); } } void CGame::NotifyMsg_Hunger(char * pData) { char * cp, cHLv; cp = (char *)(pData + INDEX2_MSGTYPE + 2); cHLv = *cp; if ((cHLv <= 40) && (cHLv > 30)) AddEventList(NOTIFYMSG_HUNGER1, 10);//" if ((cHLv <= 25) && (cHLv > 20)) AddEventList(NOTIFYMSG_HUNGER2, 10);//" if ((cHLv <= 20) && (cHLv > 15)) AddEventList(NOTIFYMSG_HUNGER3, 10);//" if ((cHLv <= 15) && (cHLv > 10)) AddEventList(NOTIFYMSG_HUNGER4, 10);//" if ((cHLv <= 10) && (cHLv >= 0)) AddEventList(NOTIFYMSG_HUNGER5, 10);//" } void CGame::NotifyMsg_ItemColorChange(char *pData) { short * sp, sItemIndex, sItemColor; char * cp; char cTxt[120]; cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sItemIndex = *sp; cp += 2; sp = (short *)cp; sItemColor = (short)*sp; cp += 2; if (m_pItemList[sItemIndex] != NULL) { char cStr1[64], cStr2[64], cStr3[64]; GetItemName( m_pItemList[sItemIndex], cStr1, cStr2, cStr3 ); if (sItemColor != -1) { m_pItemList[sItemIndex]->m_cItemColor = (char)sItemColor; wsprintf(cTxt, NOTIFYMSG_ITEMCOLOR_CHANGE1, cStr1); AddEventList(cTxt, 10); } else { wsprintf(cTxt, NOTIFYMSG_ITEMCOLOR_CHANGE2, cStr1); AddEventList(cTxt, 10); } } } void CGame::NotifyMsg_ItemDepleted_EraseItem(char * pData) { char * cp; WORD * wp; short sItemIndex; BOOL bIsUseItemResult; char cTxt[120]; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; sItemIndex = *wp; cp += 2; bIsUseItemResult = (BOOL)*cp; cp += 2; ZeroMemory(cTxt, sizeof(cTxt)); char cStr1[64], cStr2[64], cStr3[64]; GetItemName(m_pItemList[sItemIndex], cStr1, cStr2, cStr3); if (m_bIsItemEquipped[sItemIndex] == TRUE) { wsprintf(cTxt, ITEM_EQUIPMENT_RELEASED, cStr1); AddEventList(cTxt, 10); m_sItemEquipmentStatus[ m_pItemList[sItemIndex]->m_cEquipPos ] = -1; m_bIsItemEquipped[sItemIndex] = FALSE; } ZeroMemory(cTxt, sizeof(cTxt)); switch(m_pItemList[sItemIndex]->m_cItemType) { case ITEMTYPE_CONSUME: case ITEMTYPE_ARROW: wsprintf(cTxt, NOTIFYMSG_ITEMDEPlETED_ERASEITEM2, cStr1); break; case ITEMTYPE_USE_DEPLETE: if (bIsUseItemResult) wsprintf(cTxt, NOTIFYMSG_ITEMDEPlETED_ERASEITEM3, cStr1); break; case ITEMTYPE_EAT: if (bIsUseItemResult) { wsprintf(cTxt, NOTIFYMSG_ITEMDEPlETED_ERASEITEM4, cStr1); if ( (m_sPlayerType >= 1) && (m_sPlayerType <= 3) ) PlaySound('C', 19, 0); if ( (m_sPlayerType >= 4) && (m_sPlayerType <= 6) ) PlaySound('C', 20, 0); } break; case ITEMTYPE_USE_DEPLETE_DEST: if (bIsUseItemResult) wsprintf(cTxt, NOTIFYMSG_ITEMDEPlETED_ERASEITEM3, cStr1); break; default: if (bIsUseItemResult) { wsprintf(cTxt, NOTIFYMSG_ITEMDEPlETED_ERASEITEM6, cStr1); PlaySound('E', 10, 0); } break; } AddEventList(cTxt, 10); if (bIsUseItemResult == TRUE) m_bItemUsingStatus = FALSE; EraseItem((char)sItemIndex); _bCheckBuildItemStatus(); } void CGame::NotifyMsg_ItemLifeSpanEnd(char * pData) { char * cp; short * sp, sEquipPos, sItemIndex; char cTxt[120]; cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sEquipPos = *sp; cp += 2; sp = (short *)cp; sItemIndex = *sp; cp += 2; char cStr1[64], cStr2[64], cStr3[64]; GetItemName( m_pItemList[sItemIndex], cStr1, cStr2, cStr3 ); wsprintf(cTxt, NOTIFYMSG_ITEMLIFE_SPANEND1, cStr1); AddEventList(cTxt, 10); m_sItemEquipmentStatus[ m_pItemList[sItemIndex]->m_cEquipPos ] = -1; m_bIsItemEquipped[sItemIndex] = FALSE; m_pItemList[sItemIndex]->m_wCurLifeSpan = 0; PlaySound('E', 10, 0); } void CGame::NotifyMsg_ItemObtained(char * pData) { char * cp; short * sp; DWORD * dwp; int i, j; DWORD dwCount, dwAttribute; char cName[21], cItemType, cEquipPos; BOOL bIsEquipped; short sSprite, sSpriteFrame, sLevelLimit, sSpecialEV2; char cTxt[120], cGenderLimit, cItemColor; WORD * wp, wWeight, wCurLifeSpan; cp = (char *)(pData + INDEX2_MSGTYPE + 2); cp++; ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 20); cp += 20; dwp = (DWORD *)cp; dwCount = *dwp; cp += 4; cItemType = *cp; cp++; cEquipPos = *cp; cp++; bIsEquipped = (BOOL)*cp; cp++; sp = (short *)cp; sLevelLimit = *sp; cp += 2; cGenderLimit = *cp; cp++; wp = (WORD *)cp; wCurLifeSpan = *wp; cp += 2; wp = (WORD *)cp; wWeight = *wp; cp += 2; sp = (short *)cp; sSprite = *sp; cp += 2; sp = (short *)cp; sSpriteFrame = *sp; cp += 2; cItemColor = *cp; cp++; sSpecialEV2 = (short)*cp; cp++; dwp = (DWORD *)cp; dwAttribute = *dwp; cp += 4; /* bIsCustomMade = (BOOL)*cp; cp++; */ char cStr1[64], cStr2[64], cStr3[64]; GetItemName(cName, dwAttribute, cStr1, cStr2, cStr3); ZeroMemory(cTxt, sizeof(cTxt)); if( dwCount == 1 ) wsprintf(cTxt, NOTIFYMSG_ITEMOBTAINED2, cStr1); else wsprintf(cTxt, NOTIFYMSG_ITEMOBTAINED1, dwCount, cStr1); AddEventList(cTxt, 10); PlaySound('E', 20, 0); if ((cItemType == ITEMTYPE_CONSUME) || (cItemType == ITEMTYPE_ARROW)) { for (i = 0; i < MAXITEMS; i++) if ((m_pItemList[i] != NULL) && (memcmp(m_pItemList[i]->m_cName, cName, 20) == 0)) { m_pItemList[i]->m_dwCount += dwCount; m_bIsItemDisabled[i] = FALSE; return; } } short nX, nY; for (i = 0; i < MAXITEMS; i++) { if ( ( m_pItemList[i] != NULL) && (memcmp(m_pItemList[i]->m_cName, cName, 20) == 0)) { nX = m_pItemList[i]->m_sX; nY = m_pItemList[i]->m_sY; break; }else { nX = 40; nY = 30; } } for (i = 0; i < MAXITEMS; i++) if (m_pItemList[i] == NULL) { m_pItemList[i] = new class CItem; memcpy(m_pItemList[i]->m_cName, cName, 20); m_pItemList[i]->m_dwCount = dwCount; //m_pItemList[i]->m_sX = 40; //m_pItemList[i]->m_sY = 30; m_pItemList[i]->m_sX = nX; m_pItemList[i]->m_sY = nY; bSendCommand(MSGID_REQUEST_SETITEMPOS, NULL, i, nX, nY, NULL, NULL); m_pItemList[i]->m_cItemType = cItemType; m_pItemList[i]->m_cEquipPos = cEquipPos; m_bIsItemDisabled[i] = FALSE; m_bIsItemEquipped[i] = FALSE; m_pItemList[i]->m_sLevelLimit = sLevelLimit; m_pItemList[i]->m_cGenderLimit = cGenderLimit; m_pItemList[i]->m_wCurLifeSpan = wCurLifeSpan; m_pItemList[i]->m_wWeight = wWeight; m_pItemList[i]->m_sSprite = sSprite; m_pItemList[i]->m_sSpriteFrame = sSpriteFrame; m_pItemList[i]->m_cItemColor = cItemColor; m_pItemList[i]->m_sItemSpecEffectValue2 = sSpecialEV2; m_pItemList[i]->m_dwAttribute = dwAttribute; //m_pItemList[i]->m_bIsCustomMade = bIsCustomMade; _bCheckBuildItemStatus(); for (j = 0; j < MAXITEMS; j++) if (m_cItemOrder[j] == -1) { m_cItemOrder[j] = i; return; } return; } } void CGame::NotifyMsg_ItemPurchased(char * pData) { char * cp; short * sp; DWORD * dwp; WORD * wp; int i, j; DWORD dwCount; char cName[21], cItemType, cEquipPos, cGenderLimit; BOOL bIsEquipped; short sSprite, sSpriteFrame, sLevelLimit; WORD wCost, wWeight, wCurLifeSpan; char cTxt[120], cItemColor; cp = (char *)(pData + INDEX2_MSGTYPE + 2); cp++; ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 20); cp += 20; dwp = (DWORD *)cp; dwCount = *dwp; cp += 4; cItemType = *cp; cp++; cEquipPos = *cp; cp++; bIsEquipped = (BOOL)*cp; cp++; sp = (short *)cp; sLevelLimit = *sp; cp += 2; cGenderLimit = *cp; cp++; wp = (WORD *)cp; wCurLifeSpan = *wp; cp += 2; wp = (WORD *)cp; wWeight = *wp; cp += 2; sp = (short *)cp; sSprite = *sp; cp += 2; sp = (short *)cp; sSpriteFrame = *sp; cp += 2; cItemColor = *cp; cp++; wp = (WORD *)cp; wCost = *wp; ZeroMemory(cTxt, sizeof(cTxt)); char cStr1[64], cStr2[64], cStr3[64]; GetItemName( cName, NULL, cStr1, cStr2, cStr3 ); wsprintf(cTxt, NOTIFYMSG_ITEMPURCHASED, cStr1, wCost); AddEventList(cTxt, 10); if ( (cItemType == ITEMTYPE_CONSUME) || (cItemType == ITEMTYPE_ARROW)) { for (i = 0; i < MAXITEMS; i++) if ((m_pItemList[i] != NULL) && (memcmp(m_pItemList[i]->m_cName, cName, 20) == 0)) { m_pItemList[i]->m_dwCount += dwCount; return; } } short nX, nY; for (i = 0; i < MAXITEMS; i++) { if ( ( m_pItemList[i] != NULL) && (memcmp(m_pItemList[i]->m_cName, cName, 20) == 0)) { nX = m_pItemList[i]->m_sX; nY = m_pItemList[i]->m_sY; break; }else { nX = 40; nY = 30; } } for (i = 0; i < MAXITEMS; i++) if (m_pItemList[i] == NULL) { m_pItemList[i] = new class CItem; memcpy(m_pItemList[i]->m_cName, cName, 20); m_pItemList[i]->m_dwCount = dwCount; //m_pItemList[i]->m_sX = 40; //m_pItemList[i]->m_sY = 30; m_pItemList[i]->m_sX = nX; m_pItemList[i]->m_sY = nY; bSendCommand(MSGID_REQUEST_SETITEMPOS, NULL, i, nX, nY, NULL, NULL); m_pItemList[i]->m_cItemType = cItemType; m_pItemList[i]->m_cEquipPos = cEquipPos; m_bIsItemDisabled[i] = FALSE; m_bIsItemEquipped[i] = FALSE; m_pItemList[i]->m_sLevelLimit = sLevelLimit; m_pItemList[i]->m_cGenderLimit = cGenderLimit; m_pItemList[i]->m_wCurLifeSpan = wCurLifeSpan; m_pItemList[i]->m_wWeight = wWeight; m_pItemList[i]->m_sSprite = sSprite; m_pItemList[i]->m_sSpriteFrame = sSpriteFrame; m_pItemList[i]->m_cItemColor = cItemColor; // fixed v1.11 for (j = 0; j < MAXITEMS; j++) if (m_cItemOrder[j] == -1) { m_cItemOrder[j] = i; return; } return; } } void CGame::NotifyMsg_ItemReleased(char * pData) { char * cp; short * sp, sEquipPos, sItemIndex; char cTxt[120]; cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sEquipPos = *sp; cp += 2; sp = (short *)cp; sItemIndex = *sp; cp += 2; char cStr1[64], cStr2[64], cStr3[64]; GetItemName(m_pItemList[sItemIndex], cStr1, cStr2, cStr3); wsprintf(cTxt, ITEM_EQUIPMENT_RELEASED, cStr1); AddEventList(cTxt, 10); m_bIsItemEquipped[sItemIndex] = FALSE; m_sItemEquipmentStatus[ m_pItemList[sItemIndex]->m_cEquipPos ] = -1; if(memcmp(m_pItemList[sItemIndex]->m_cName, "AngelicPendant", 14) == 0) PlaySound('E', 53, 0); else PlaySound('E', 29, 0); } void CGame::NotifyMsg_ItemRepaired(char * pData) { char * cp, cTxt[120]; DWORD * dwp, dwItemID, dwLife; cp = (char *)(pData + INDEX2_MSGTYPE + 2); dwp = (DWORD *)cp; dwItemID = *dwp; cp += 4; dwp = (DWORD *)cp; dwLife = *dwp; cp += 4; m_pItemList[dwItemID]->m_wCurLifeSpan = (WORD)dwLife; m_bIsItemDisabled[dwItemID] = FALSE; char cStr1[64], cStr2[64], cStr3[64]; GetItemName( m_pItemList[dwItemID], cStr1, cStr2, cStr3 ); wsprintf(cTxt, NOTIFYMSG_ITEMREPAIRED1, cStr1); AddEventList(cTxt, 10); } void CGame::NotifyMsg_ItemToBank(char *pData) { char * cp, cIndex; DWORD * dwp, dwCount, dwAttribute; char cName[21], cItemType, cEquipPos, cGenderLimit, cItemColor; BOOL bIsEquipped; short * sp, sSprite, sSpriteFrame, sLevelLimit, sItemEffectValue2, sItemSpecEffectValue2; WORD * wp, wWeight, wCurLifeSpan; char cTxt[120]; cp = (pData + INDEX2_MSGTYPE + 2); cIndex = *cp; cp++; cp++; ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 20); cp += 20; dwp = (DWORD *)cp; dwCount = *dwp; cp += 4; cItemType = *cp; cp++; cEquipPos = *cp; cp++; bIsEquipped = (BOOL)*cp; cp++; sp = (short *)cp; sLevelLimit = *sp; cp += 2; cGenderLimit = *cp; cp++; wp = (WORD *)cp; wCurLifeSpan = *wp; cp += 2; wp = (WORD *)cp; wWeight = *wp; cp += 2; sp = (short *)cp; sSprite = *sp; cp += 2; sp = (short *)cp; sSpriteFrame = *sp; cp += 2; cItemColor = *cp; cp++; sp = (short *)cp; sItemEffectValue2 = *sp; cp += 2; dwp = (DWORD *)cp; dwAttribute = *dwp; cp += 4; sItemSpecEffectValue2 = (short) *cp ; cp ++ ; char cStr1[64], cStr2[64], cStr3[64]; GetItemName(cName, dwAttribute, cStr1, cStr2, cStr3); if (m_pBankList[cIndex] == NULL) { m_pBankList[cIndex] = new class CItem; memcpy(m_pBankList[cIndex]->m_cName, cName, 20); m_pBankList[cIndex]->m_dwCount = dwCount; m_pBankList[cIndex]->m_cItemType = cItemType; m_pBankList[cIndex]->m_cEquipPos = cEquipPos; m_pBankList[cIndex]->m_sLevelLimit = sLevelLimit; m_pBankList[cIndex]->m_cGenderLimit = cGenderLimit; m_pBankList[cIndex]->m_wCurLifeSpan = wCurLifeSpan; m_pBankList[cIndex]->m_wWeight = wWeight; m_pBankList[cIndex]->m_sSprite = sSprite; m_pBankList[cIndex]->m_sSpriteFrame = sSpriteFrame; m_pBankList[cIndex]->m_cItemColor = cItemColor; m_pBankList[cIndex]->m_sItemEffectValue2 = sItemEffectValue2; m_pBankList[cIndex]->m_dwAttribute = dwAttribute; m_pBankList[cIndex]->m_sItemSpecEffectValue2 = sItemSpecEffectValue2 ; ZeroMemory(cTxt, sizeof(cTxt)); if( dwCount == 1 ) wsprintf(cTxt, NOTIFYMSG_ITEMTOBANK3, cStr1); else wsprintf(cTxt, NOTIFYMSG_ITEMTOBANK2, dwCount, cStr1); if( m_bIsDialogEnabled[14] == TRUE ) m_stDialogBoxInfo[14].sView = MAXBANKITEMS-12; AddEventList(cTxt, 10); } } void CGame::NotifyMsg_Killed(char * pData) { char * cp, cAttackerName[21]; m_bCommandAvailable = FALSE; m_cCommand = OBJECTSTOP; m_iHP = 0; m_cCommand = -1; // Restart m_bItemUsingStatus = FALSE; ClearSkillUsingStatus(); ZeroMemory(cAttackerName, sizeof(cAttackerName)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); memcpy(cAttackerName, cp, 20); cp += 20; /* if (strlen(cAttackerName) == 0) // removed in v2.20 (bug?) Many servers send the info themselves. AddEventList(NOTIFYMSG_KILLED1, 10); else { wsprintf(G_cTxt, NOTIFYMSG_KILLED2, cAttackerName); AddEventList(G_cTxt, 10); }*/ // Snoopy: reduced 3 lines -> 2 lines AddEventList(NOTIFYMSG_KILLED1, 10); AddEventList(NOTIFYMSG_KILLED3, 10); //AddEventList(NOTIFYMSG_KILLED4, 10);//"Log Out } // This msg is sent by server when lvl-up void CGame::NotifyMsg_LevelUp(char * pData) {char * cp; int * ip; int i, iPrevLevel; char cTxt[120]; iPrevLevel = m_iLevel; cp = (char *)(pData + INDEX2_MSGTYPE + 2); ip = (int *)cp; m_iLevel = *ip; cp += 4; ip = (int *)cp; m_stat[STAT_STR] = *ip; cp += 4; ip = (int *)cp; m_stat[STAT_VIT] = *ip; cp += 4; ip = (int *)cp; m_stat[STAT_DEX] = *ip; cp += 4; ip = (int *)cp; m_stat[STAT_INT] = *ip; cp += 4; ip = (int *)cp; m_stat[STAT_MAG] = *ip; cp += 4; ip = (int *)cp; m_stat[STAT_CHR] = *ip; cp += 4; // CLEROTH - LU m_iLU_Point = m_iLevel*3 - ( (m_stat[STAT_STR] + m_stat[STAT_VIT] + m_stat[STAT_DEX] + m_stat[STAT_INT] + m_stat[STAT_MAG] + m_stat[STAT_CHR]) - 70) - 3 + m_angelStat[STAT_STR] + m_angelStat[STAT_DEX] + m_angelStat[STAT_INT] + m_angelStat[STAT_MAG]; m_luStat[STAT_STR] = m_luStat[STAT_VIT] = m_luStat[STAT_DEX] = m_luStat[STAT_INT] = m_luStat[STAT_MAG] = m_luStat[STAT_CHR] = 0; wsprintf(cTxt, NOTIFYMSG_LEVELUP1, m_iLevel);// "Level up!!! Level %d!" AddEventList(cTxt, 10); switch (m_sPlayerType) { case 1: case 2: case 3: PlaySound('C', 21, 0); break; case 4: case 5: case 6: PlaySound('C', 22, 0); break; } _RemoveChatMsgListByObjectID(m_sPlayerObjectID); for (i = 1; i < MAXCHATMSGS; i++) if (m_pChatMsgList[i] == NULL) { ZeroMemory(cTxt, sizeof(cTxt)); strcpy(cTxt, "Level up!"); m_pChatMsgList[i] = new class CMsg(23, cTxt, m_dwCurTime); m_pChatMsgList[i]->m_iObjectID = m_sPlayerObjectID; if (m_pMapData->bSetChatMsgOwner(m_sPlayerObjectID, -10, -10, i) == FALSE) { delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } return; } } // CLEROTH - LU void CGame::NotifyMsg_SettingSuccess(char * pData) {char * cp; int * ip; int iPrevLevel; char cTxt[120]; iPrevLevel = m_iLevel; cp = (char *)(pData + INDEX2_MSGTYPE + 2); ip = (int *)cp; m_iLevel = *ip; cp += 4; ip = (int *)cp; m_stat[STAT_STR] = *ip; cp += 4; ip = (int *)cp; m_stat[STAT_VIT] = *ip; cp += 4; ip = (int *)cp; m_stat[STAT_DEX] = *ip; cp += 4; ip = (int *)cp; m_stat[STAT_INT] = *ip; cp += 4; ip = (int *)cp; m_stat[STAT_MAG] = *ip; cp += 4; ip = (int *)cp; m_stat[STAT_CHR] = *ip; cp += 4; wsprintf(cTxt, "Your stat has been changed."); AddEventList(cTxt, 10); // CLEROTH - LU m_iLU_Point = m_iLevel*3 - ( (m_stat[STAT_STR] + m_stat[STAT_VIT] + m_stat[STAT_DEX] + m_stat[STAT_INT] + m_stat[STAT_MAG] + m_stat[STAT_CHR]) - 70) - 3 + m_angelStat[STAT_STR] + m_angelStat[STAT_DEX] + m_angelStat[STAT_INT] + m_angelStat[STAT_MAG]; m_luStat[STAT_STR] = m_luStat[STAT_VIT] = m_luStat[STAT_DEX] = m_luStat[STAT_INT] = m_luStat[STAT_MAG] = m_luStat[STAT_CHR] = 0; } void CGame::NotifyMsg_MagicEffectOff(char * pData) {char * cp; WORD * wp; short sMagicType, sMagicEffect; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; sMagicType = (short)*wp; cp += 2; wp = (WORD *)cp; sMagicEffect = (short)*wp; cp += 2; switch (sMagicType) { case MAGICTYPE_PROTECT: switch (sMagicEffect) { case 1: // "Protection from arrows has vanished." AddEventList(NOTIFYMSG_MAGICEFFECT_OFF1, 10); break; case 2: // "Protection from magic has vanished." AddEventList(NOTIFYMSG_MAGICEFFECT_OFF2, 10); break; case 3: // "Defense shield effect has vanished." case 4: // "Defense shield effect has vanished." AddEventList(NOTIFYMSG_MAGICEFFECT_OFF3, 10); break; case 5: // "Absolute Magic Protection has been vanished." AddEventList(NOTIFYMSG_MAGICEFFECT_OFF14, 10); break; } break; case MAGICTYPE_HOLDOBJECT: switch (sMagicEffect) { case 1: // "Hold person magic effect has vanished." m_bParalyze = FALSE; AddEventList(NOTIFYMSG_MAGICEFFECT_OFF4, 10); break; case 2: // "Paralysis magic effect has vanished." m_bParalyze = FALSE; AddEventList(NOTIFYMSG_MAGICEFFECT_OFF5, 10); break; } break; case MAGICTYPE_INVISIBILITY: switch (sMagicEffect) { case 1: // "Invisibility magic effect has vanished." AddEventList(NOTIFYMSG_MAGICEFFECT_OFF6, 10); break; } break; case MAGICTYPE_CONFUSE: switch (sMagicEffect) { case 1: // "Language confuse magic effect has vanished." AddEventList(NOTIFYMSG_MAGICEFFECT_OFF7, 10); break; case 2: // "Confusion magic has vanished." AddEventList(NOTIFYMSG_MAGICEFFECT_OFF8, 10); m_bIsConfusion = FALSE; break; case 3: // "Illusion magic has vanished." AddEventList(NOTIFYMSG_MAGICEFFECT_OFF9, 10); m_iIlusionOwnerH = NULL; break; case 4: // "At last, you gather your senses." // snoopy AddEventList(NOTIFYMSG_MAGICEFFECT_OFF15, 10); m_bIllusionMVT = FALSE; break; } break; case MAGICTYPE_POISON: if (m_bIsPoisoned) AddEventList(NOTIFYMSG_MAGICEFFECT_OFF10, 10); m_bIsPoisoned = FALSE; break; case MAGICTYPE_BERSERK: switch (sMagicEffect) { case 1: AddEventList(NOTIFYMSG_MAGICEFFECT_OFF11, 10); break; } break; case MAGICTYPE_POLYMORPH: switch (sMagicEffect) { case 1: AddEventList(NOTIFYMSG_MAGICEFFECT_OFF12, 10); break; } break; case MAGICTYPE_ICE: AddEventList(NOTIFYMSG_MAGICEFFECT_OFF13, 10); break; } } void CGame::NotifyMsg_MagicEffectOn(char * pData) {char * cp; DWORD * dwp; WORD * wp; short sMagicType, sMagicEffect, sOwnerH; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; sMagicType = (short)*wp; cp += 2; dwp = (DWORD *)cp; sMagicEffect = (short)*dwp; cp += 4; dwp = (DWORD *)cp; sOwnerH = (short)*dwp; cp += 4; switch (sMagicType) { case MAGICTYPE_PROTECT: switch (sMagicEffect) { case 1: // "You are completely protected from arrows!" AddEventList(NOTIFYMSG_MAGICEFFECT_ON1, 10); break; case 2: // "You are protected from magic!" AddEventList(NOTIFYMSG_MAGICEFFECT_ON2, 10); break; case 3: // "Defense ratio increased by a magic shield!" case 4: // "Defense ratio increased by a magic shield!" AddEventList(NOTIFYMSG_MAGICEFFECT_ON3, 10); break; case 5: // "You are completely protected from magic!" AddEventList(NOTIFYMSG_MAGICEFFECT_ON14, 10); break; } break; case MAGICTYPE_HOLDOBJECT: switch (sMagicEffect) { case 1: // "You were bounded by a Hold Person spell! Unable to move!" m_bParalyze = TRUE; AddEventList(NOTIFYMSG_MAGICEFFECT_ON4, 10); break; case 2: // "You were bounded by a Paralysis spell! Unable to move!" m_bParalyze = TRUE; AddEventList(NOTIFYMSG_MAGICEFFECT_ON5, 10); break; } break; case MAGICTYPE_INVISIBILITY: switch (sMagicEffect) { case 1: // "You are now invisible, no one can see you!" AddEventList(NOTIFYMSG_MAGICEFFECT_ON6, 10); break; } break; case MAGICTYPE_CONFUSE: switch (sMagicEffect) { case 1: // Confuse Language "No one understands you because of language confusion magic!" AddEventList(NOTIFYMSG_MAGICEFFECT_ON7, 10); break; case 2: // Confusion "Confusion magic casted, impossible to determine player allegience." AddEventList(NOTIFYMSG_MAGICEFFECT_ON8, 10); m_bIsConfusion = TRUE; break; case 3: // Illusion "Illusion magic casted, impossible to tell who is who!" AddEventList(NOTIFYMSG_MAGICEFFECT_ON9, 10); _SetIlusionEffect(sOwnerH); break; case 4: // IllusionMouvement "You are thrown into confusion, and you are flustered yourself." // snoopy AddEventList(NOTIFYMSG_MAGICEFFECT_ON15, 10); m_bIllusionMVT = TRUE; break; } break; case MAGICTYPE_POISON: AddEventList(NOTIFYMSG_MAGICEFFECT_ON10, 10); m_bIsPoisoned = TRUE; break; case MAGICTYPE_BERSERK: switch (sMagicEffect) { case 1: AddEventList(NOTIFYMSG_MAGICEFFECT_ON11, 10); break; } break; case MAGICTYPE_POLYMORPH: switch (sMagicEffect) { case 1: AddEventList(NOTIFYMSG_MAGICEFFECT_ON12, 10); break; } break; case MAGICTYPE_ICE: AddEventList(NOTIFYMSG_MAGICEFFECT_ON13, 10); break; } } void CGame::NotifyMsg_MagicStudyFail(char * pData) { char * cp, cMagicNum, cName[31], cFailCode; char cTxt[120]; int * ip, iCost, iReqInt; cp = (char *)(pData + INDEX2_MSGTYPE + 2); cFailCode = *cp; cp++; cMagicNum = *cp; cp++; ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 30); cp += 30; ip = (int *)cp; iCost = *ip; cp += 4; ip = (int *)cp; iReqInt = *ip; cp += 4; /* // Snoopy: remove special CLEROTH's feature ip = (int *)cp; iReqStr = *ip; cp += 4; // CLEROTH wsprintf(cTxt, NOTIFYMSG_MAGICSTUDY_FAIL4, cName, iCost, iReqInt, iReqStr); AddEventList(cTxt, 10);*/ if (iCost > 0) { wsprintf(cTxt, NOTIFYMSG_MAGICSTUDY_FAIL1, cName); AddEventList(cTxt, 10); }else { wsprintf(cTxt, NOTIFYMSG_MAGICSTUDY_FAIL2, cName); AddEventList(cTxt, 10); wsprintf(cTxt, NOTIFYMSG_MAGICSTUDY_FAIL3, iReqInt); AddEventList(cTxt, 10); } } void CGame::NotifyMsg_MagicStudySuccess(char * pData) {char * cp, cMagicNum, cName[31]; char cTxt[120]; cp = (char *)(pData + INDEX2_MSGTYPE + 2); cMagicNum = *cp; cp++; m_cMagicMastery[cMagicNum] = 1; ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 30); wsprintf(cTxt, NOTIFYMSG_MAGICSTUDY_SUCCESS1, cName); AddEventList(cTxt, 10); PlaySound('E', 23, 0); } void CGame::NotifyMsg_MP(char * pData) {DWORD * dwp; int iPrevMP; char cTxt[120]; iPrevMP = m_iMP; dwp = (DWORD *)(pData + INDEX2_MSGTYPE + 2); m_iMP = (int)*dwp; if (abs(m_iMP - iPrevMP) < 10) return; if (m_iMP > iPrevMP) { wsprintf(cTxt, NOTIFYMSG_MP_UP, m_iMP - iPrevMP); AddEventList(cTxt, 10); PlaySound('E', 21, 0); }else { wsprintf(cTxt, NOTIFYMSG_MP_DOWN, iPrevMP - m_iMP); AddEventList(cTxt, 10); } } void CGame::NotifyMsg_NewGuildsMan(char * pData) {char * cp, cName[12], cTxt[120]; cp = (char *)(pData + INDEX2_MSGTYPE + 2); ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 10); wsprintf(cTxt, NOTIFYMSG_NEW_GUILDMAN1, cName); AddEventList(cTxt, 10); ClearGuildNameList(); } void CGame::NotifyMsg_PKcaptured(char *pData) {char * cp; DWORD * dwp; WORD * wp; int iPKcount, iLevel, iExp, iRewardGold; char cTxt[120], cName[12]; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; iPKcount = *wp; cp += 2; wp = (WORD *)cp; iLevel = *wp; cp += 2; ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 10); cp += 10; dwp = (DWORD *)cp; iRewardGold = *dwp; cp += 4; dwp = (DWORD *)cp; iExp = *dwp; cp += 4; wsprintf(cTxt, NOTIFYMSG_PK_CAPTURED1, iLevel, cName, iPKcount); AddEventList(cTxt, 10); wsprintf(cTxt, EXP_INCREASED, iExp - m_iExp); AddEventList(cTxt, 10); wsprintf(cTxt, NOTIFYMSG_PK_CAPTURED3, iExp - m_iExp); AddEventList(cTxt, 10); } void CGame::NotifyMsg_PKpenalty(char *pData) {char * cp; DWORD * dwp; int iPKcount, iExp, iStr, iVit, iDex, iInt, iMag, iChr; cp = (char *)(pData + INDEX2_MSGTYPE + 2); dwp = (DWORD *)cp; iExp = *dwp; cp += 4; dwp = (DWORD *)cp; iStr = *dwp; cp += 4; dwp = (DWORD *)cp; iVit = *dwp; cp += 4; dwp = (DWORD *)cp; iDex = *dwp; cp += 4; dwp = (DWORD *)cp; iInt = *dwp; cp += 4; dwp = (DWORD *)cp; iMag = *dwp; cp += 4; dwp = (DWORD *)cp; iChr = *dwp; cp += 4; dwp = (DWORD *)cp; iPKcount = *dwp; cp += 4; wsprintf(G_cTxt, NOTIFYMSG_PK_PENALTY1, iPKcount); AddEventList(G_cTxt, 10); if (m_iExp > iExp) { wsprintf(G_cTxt, NOTIFYMSG_PK_PENALTY2, m_iExp - iExp); AddEventList(G_cTxt, 10); } m_iExp = iExp; m_stat[STAT_STR] = iStr; m_stat[STAT_VIT] = iVit; m_stat[STAT_DEX] = iDex; m_stat[STAT_INT] = iInt; m_stat[STAT_MAG] = iMag; m_stat[STAT_CHR] = iChr; m_iPKCount = iPKcount; } void CGame::NotifyMsg_PlayerShutUp(char * pData) {char * cp, cName[12]; WORD * wp, wTime; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; wTime = *wp; cp += 2; ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 10); cp += 10; if (memcmp(m_cPlayerName, cName, 10) == 0) wsprintf(G_cTxt, NOTIFYMSG_PLAYER_SHUTUP1, wTime); else wsprintf(G_cTxt, NOTIFYMSG_PLAYER_SHUTUP2, cName, wTime); AddEventList(G_cTxt, 10); } void CGame::NotifyMsg_PlayerStatus(BOOL bOnGame, char * pData) {char cName[12], cMapName[12], * cp; WORD * wp ; WORD dx= 1 ,dy = 1; cp = (char *)(pData + INDEX2_MSGTYPE + 2); ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 10); cp += 10; ZeroMemory(cMapName, sizeof(cMapName)); memcpy(cMapName, cp, 10); cp += 10; wp = (WORD * ) cp ; dx = (WORD ) *wp ; cp += 2 ; wp = (WORD * ) cp ; dy = (WORD ) *wp ; cp += 2 ; ZeroMemory(G_cTxt, sizeof(G_cTxt)); if (bOnGame == TRUE) { if (strlen(cMapName) == 0) wsprintf(G_cTxt, NOTIFYMSG_PLAYER_STATUS1, cName); else wsprintf(G_cTxt, NOTIFYMSG_PLAYER_STATUS2, cName, cMapName, dx, dy); } else wsprintf(G_cTxt, NOTIFYMSG_PLAYER_STATUS3, cName); AddEventList(G_cTxt, 10); } void CGame::NotifyMsg_QuestReward(char *pData) {short * sp, sWho, sFlag; char * cp, cRewardName[21], cTxt[120]; int * ip, iAmount, iIndex, iPreCon; cp = (char *)(pData + INDEX2_MSGTYPE + 2); sp = (short *)cp; sWho = *sp; cp += 2; sp = (short *)cp; sFlag = *sp; cp += 2; ip = (int *)cp; iAmount = *ip; cp += 4; ZeroMemory(cRewardName, sizeof(cRewardName)); memcpy(cRewardName, cp, 20); cp += 20; iPreCon = m_iContribution; ip = (int *)cp; m_iContribution = *ip; // m_iContributionPrice = 0; cp += 4; if (sFlag == 1) { m_stQuest.sWho = NULL; m_stQuest.sQuestType = NULL; m_stQuest.sContribution = NULL; m_stQuest.sTargetType = NULL; m_stQuest.sTargetCount = NULL; m_stQuest.sX = NULL; m_stQuest.sY = NULL; m_stQuest.sRange = NULL; m_stQuest.sCurrentCount = NULL; m_stQuest.bIsQuestCompleted = FALSE; ZeroMemory(m_stQuest.cTargetName, sizeof(m_stQuest.cTargetName)); EnableDialogBox(21, 0, sWho+110, 0); iIndex = m_stDialogBoxInfo[21].sV1; m_pMsgTextList2[iIndex] = new class CMsg(NULL, " ", NULL); iIndex++; ZeroMemory(cTxt, sizeof(cTxt)); if (memcmp(cRewardName, "°æÇèÄ¡", 6) == 0) { if (iAmount > 0) wsprintf(cTxt, NOTIFYMSG_QUEST_REWARD1, iAmount); }else { wsprintf(cTxt, NOTIFYMSG_QUEST_REWARD2, iAmount, cRewardName); } m_pMsgTextList2[iIndex] = new class CMsg(NULL, cTxt, NULL); iIndex++; m_pMsgTextList2[iIndex] = new class CMsg(NULL, " ", NULL); iIndex++; ZeroMemory(cTxt, sizeof(cTxt)); if (iPreCon < m_iContribution) wsprintf(cTxt, NOTIFYMSG_QUEST_REWARD3, m_iContribution - iPreCon); else wsprintf(cTxt, NOTIFYMSG_QUEST_REWARD4, iPreCon - m_iContribution); m_pMsgTextList2[iIndex] = new class CMsg(NULL, " ", NULL); iIndex++; } else EnableDialogBox(21, 0, sWho+120, 0); } void CGame::NotifyMsg_RatingPlayer(char * pData) {//int * ip; char * cp, cName[12]; WORD cValue; cp = (char *)(pData + INDEX2_MSGTYPE + 2); cValue = *cp; cp++; ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 10); cp += 10; // ip = (int *)cp; // m_iRating = *ip; cp += 4; ZeroMemory(G_cTxt, sizeof(G_cTxt)); if (memcmp(m_cPlayerName, cName, 10) == 0) { if (cValue == 1) { strcpy(G_cTxt, NOTIFYMSG_RATING_PLAYER1); PlaySound('E', 23, 0); } }else { if (cValue == 1) wsprintf(G_cTxt, NOTIFYMSG_RATING_PLAYER2, cName); else wsprintf(G_cTxt, NOTIFYMSG_RATING_PLAYER3, cName); } AddEventList(G_cTxt, 10); } void CGame::NotifyMsg_ServerChange(char * pData) { char * cp, cWorldServerAddr[16]; //Snoopy: change names for better readability int * ip, iWorldServerPort; //Snoopy: change names for better readability ZeroMemory(m_cMapName, sizeof(m_cMapName)); ZeroMemory(m_cMapMessage, sizeof(m_cMapMessage)); ZeroMemory(cWorldServerAddr, sizeof(cWorldServerAddr)); cp = (char *)(pData + INDEX2_MSGTYPE + 2); memcpy(m_cMapName, cp, 10); // m_cMapIndex = GetOfficialMapName(m_cMapName, m_cMapMessage); cp += 10; memcpy(cWorldServerAddr, cp, 15); cp += 15; ip = (int *)cp; iWorldServerPort = *ip; cp += 4; if (m_pGSock != NULL) { delete m_pGSock; m_pGSock = NULL; } if (m_pLSock != NULL) { delete m_pLSock; m_pLSock = NULL; } m_pLSock = new class XSocket(m_hWnd, SOCKETBLOCKLIMIT); if (m_iGameServerMode == 1) // LAN { m_pLSock->bConnect(m_cLogServerAddr, iWorldServerPort, WM_USER_LOGSOCKETEVENT); }else { m_pLSock->bConnect(cWorldServerAddr, iWorldServerPort, WM_USER_LOGSOCKETEVENT); } m_pLSock->bInitBufferSize(30000); m_bIsPoisoned = FALSE; ChangeGameMode(GAMEMODE_ONCONNECTING); m_dwConnectMode = MSGID_REQUEST_ENTERGAME; //m_wEnterGameType = ENTERGAMEMSGTYPE_NEW; //Gateway m_wEnterGameType = ENTERGAMEMSGTYPE_CHANGINGSERVER; ZeroMemory(m_cMsg, sizeof(m_cMsg)); strcpy(m_cMsg,"55"); } void CGame::NotifyMsg_SetItemCount(char * pData) {char * cp; WORD * wp; DWORD * dwp; short sItemIndex; DWORD dwCount; BOOL bIsItemUseResponse; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; sItemIndex = *wp; cp += 2; dwp = (DWORD *)cp; dwCount = *dwp; cp += 4; bIsItemUseResponse = (BOOL)*cp; cp++; if (m_pItemList[sItemIndex] != NULL) { m_pItemList[sItemIndex]->m_dwCount = dwCount; if (bIsItemUseResponse == TRUE) m_bIsItemDisabled[sItemIndex] = FALSE; } } void CGame::NotifyMsg_ShowMap(char * pData) {char * cp; WORD * wp, w1, w2; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; w1 = *wp; cp += 2; wp = (WORD *)cp; w2 = *wp; cp += 2; if (w2 == 0) AddEventList(NOTIFYMSG_SHOW_MAP1, 10); else EnableDialogBox(22, NULL, w1, w2 -1); } void CGame::NotifyMsg_Skill(char *pData) { WORD * wp; short sSkillIndex, sValue; char * cp; char cTxt[120]; int i; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; sSkillIndex = (short)*wp; cp += 2; wp = (WORD *)cp; sValue = (short)*wp; cp += 2; _RemoveChatMsgListByObjectID(m_sPlayerObjectID); if(!m_pSkillCfgList[sSkillIndex]) return; if (m_pSkillCfgList[sSkillIndex]->m_iLevel < sValue) { wsprintf(cTxt, NOTIFYMSG_SKILL1, m_pSkillCfgList[sSkillIndex]->m_cName, sValue - m_pSkillCfgList[sSkillIndex]->m_iLevel); AddEventList(cTxt, 10); PlaySound('E', 23, 0); for (i = 1; i < MAXCHATMSGS; i++) if (m_pChatMsgList[i] == NULL) { ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, "%s +%d%%", m_pSkillCfgList[sSkillIndex]->m_cName, sValue - m_pSkillCfgList[sSkillIndex]->m_iLevel); m_pChatMsgList[i] = new class CMsg(20, cTxt, m_dwCurTime); m_pChatMsgList[i]->m_iObjectID = m_sPlayerObjectID; if (m_pMapData->bSetChatMsgOwner(m_sPlayerObjectID, -10, -10, i) == FALSE) { delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } break; } }else if (m_pSkillCfgList[sSkillIndex]->m_iLevel > sValue) { wsprintf(cTxt, NOTIFYMSG_SKILL2, m_pSkillCfgList[sSkillIndex]->m_cName, m_pSkillCfgList[sSkillIndex]->m_iLevel - sValue); AddEventList(cTxt, 10); PlaySound('E', 24, 0); for (i = 1; i < MAXCHATMSGS; i++) if (m_pChatMsgList[i] == NULL) { ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, "%s -%d%%", m_pSkillCfgList[sSkillIndex]->m_cName, sValue - m_pSkillCfgList[sSkillIndex]->m_iLevel); m_pChatMsgList[i] = new class CMsg(20, cTxt, m_dwCurTime); m_pChatMsgList[i]->m_iObjectID = m_sPlayerObjectID; if (m_pMapData->bSetChatMsgOwner(m_sPlayerObjectID, -10, -10, i) == FALSE) { delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } break; } } m_pSkillCfgList[sSkillIndex]->m_iLevel = sValue; m_cSkillMastery[sSkillIndex] = (unsigned char)sValue; } void CGame::NotifyMsg_SkillTrainSuccess(char * pData) {char * cp, cSkillNum, cSkillLevel; char cTemp[120]; cp = (char *)(pData + INDEX2_MSGTYPE + 2); cSkillNum = *cp; cp++; cSkillLevel = *cp; cp++; if(!m_pSkillCfgList[cSkillNum]) return; ZeroMemory(cTemp, sizeof(cTemp)); wsprintf(cTemp, NOTIFYMSG_SKILL_TRAIN_SUCCESS1, m_pSkillCfgList[cSkillNum]->m_cName, cSkillLevel); AddEventList(cTemp, 10); m_pSkillCfgList[cSkillNum]->m_iLevel = cSkillLevel; m_cSkillMastery[cSkillNum] = (unsigned char)cSkillLevel; PlaySound('E', 23, 0); } void CGame::NotifyMsg_SkillUsingEnd(char * pData) {char * cp; WORD * wp, wResult; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; wResult = * wp; switch (wResult) { case NULL: AddEventList(NOTIFYMSG_SKILL_USINGEND1, 10); break; case 1: AddEventList(NOTIFYMSG_SKILL_USINGEND2, 10); break; } m_bSkillUsingStatus = FALSE; } void CGame::NotifyMsg_SP(char * pData) {DWORD * dwp; int iPrevSP; iPrevSP = m_iSP; dwp = (DWORD *)(pData + INDEX2_MSGTYPE + 2); m_iSP = (int)*dwp; if (abs(m_iSP - iPrevSP) < 10) return; if (m_iSP > iPrevSP) { wsprintf(G_cTxt, NOTIFYMSG_SP_UP, m_iSP - iPrevSP); AddEventList(G_cTxt, 10); PlaySound('E', 21, 0); }else { wsprintf(G_cTxt, NOTIFYMSG_SP_DOWN, iPrevSP - m_iSP); AddEventList(G_cTxt, 10); } } void CGame::NotifyMsg_TotalUsers(char * pData) { WORD *wp; int iTotal; wp = (WORD *)(pData + INDEX2_MSGTYPE + 2); iTotal = (int)*wp; wsprintf(G_cTxt, NOTIFYMSG_TOTAL_USER1, iTotal); AddEventList(G_cTxt, 10); } void CGame::NotifyMsg_RelicInAltar(char * pData) { char *cp; Side altarSide; cp = (char *)(pData + INDEX2_MSGTYPE + 2); altarSide = (Side)*cp; wsprintf(G_cTxt, NOTIFYMSG_RELICINALTAR, sideName[altarSide]); SetTopMsg(G_cTxt, 10); m_relicOwnedSide = altarSide; m_relicOwnedTime = timeGetTime() + 1 _s; } void CGame::NotifyMsg_RelicGrabbed(char * pData) { char *cp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); char playerName[12]; ZeroMemory(playerName, sizeof(playerName)); memcpy(playerName, cp, 10); wsprintf(G_cTxt, NOTIFYMSG_RELICGRABBED, playerName); AddEventList(G_cTxt, 10); m_relicOwnedTime = 0; } void CGame::NotifyMsg_CTRWinner(char * pData) { char *cp; Side winnerSide; cp = (char *)(pData + INDEX2_MSGTYPE + 2); winnerSide = (Side)*cp; wsprintf(G_cTxt, NOTIFYMSG_CTRWINNER, sideName[winnerSide]); SetTopMsg(G_cTxt, 10); m_bIsAstoriaMode = FALSE; } void CGame::NotifyMsg_EventStarting(char * pData) { char *cp; EventType eType; WORD * wp = (WORD *)(pData + INDEX2_MSGTYPE); DWORD msgID = *wp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); eType = (EventType)*cp; sstream msg; msg.str().c_str(); msg.flush(); msg.str().c_str(); msg << "A " << eventName[eType] << " event will be starting in "; switch(msgID) { case NOTIFY_EVENTSTARTING: msg << "2 hours."; break; case NOTIFY_EVENTSTARTING2: msg << "30 minutes."; break; case NOTIFY_EVENTSTARTING3: msg << "10 minutes."; break; } SetTopMsg(msg.str().c_str(), 10); } void CGame::NotifyMsg_EventStart(char * pData) { char *cp; EventType eType; cp = (char *)(pData + INDEX2_MSGTYPE + 2); eType = (EventType)*cp; for(int i=0; i < MAXSIDES; i++) { m_astoriaStats[i].deaths = 0; m_astoriaStats[i].kills = 0; } m_bIsAstoriaMode = TRUE; m_relicOwnedTime = 0; switch(eType) { case ET_CAPTURE: wsprintf(G_cTxt, NOTIFYMSG_EVENTSTART_CTR); break; default: return; } strcat(G_cTxt, NOTIFYMSG_EVENTSTART); SetTopMsg(G_cTxt, 10); } void CGame::NotifyMsg_Casualties(char * pData) { WORD *wp; wp = (WORD *)(pData + INDEX2_MSGTYPE + 2); m_astoriaStats[ARESDEN].deaths = *wp; wp++; m_astoriaStats[ELVINE].deaths = *wp; wp++; m_astoriaStats[ISTRIA].deaths = *wp; wp++; m_astoriaStats[ARESDEN].kills = *wp; wp++; m_astoriaStats[ELVINE].kills = *wp; wp++; m_astoriaStats[ISTRIA].kills = *wp; m_bIsAstoriaMode = TRUE; } void CGame::NotifyMsg_WhisperMode(BOOL bActive, char * pData) { char * cp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); ZeroMemory(m_cWhisperName, sizeof(m_cWhisperName)); memcpy(m_cWhisperName, cp, 10); if (bActive == TRUE) { wsprintf(G_cTxt, NOTIFYMSG_WHISPERMODE1, m_cWhisperName); if (m_pWhisperMsg[MAXWHISPERMSG - 1] != NULL) { delete m_pWhisperMsg[MAXWHISPERMSG - 1]; m_pWhisperMsg[MAXWHISPERMSG - 1] = NULL; } for (int i = MAXWHISPERMSG - 2; i >= 0; i--) { m_pWhisperMsg[i+1] = m_pWhisperMsg[i]; m_pWhisperMsg[i] = NULL; } m_pWhisperMsg[0] = new class CMsg(NULL, m_cWhisperName, NULL); m_cWhisperIndex = 0; } else wsprintf(G_cTxt, NOTIFYMSG_WHISPERMODE2, m_cWhisperName); AddEventList(G_cTxt, 10); } void CGame::NotifyMsg_FriendOnGame(char * pData) { char cName[12], * cp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); ZeroMemory(cName, sizeof(cName)); memcpy(cName, cp, 10); for(int i = 0; i < m_iTotalFriends; i++) if(strcmp(cName,friendsList[i].friendName) == 0){ friendsList[i].online = true; friendsList[i].updated = true; } } void CGame::DrawDialogBox_CrusadeJob(short msX, short msY) {short sX, sY; sX = m_stDialogBoxInfo[33].sX; sY = m_stDialogBoxInfo[33].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 0); switch (m_stDialogBoxInfo[33].cMode) { case 1: PutAlignedString(sX +24, sX +246, sY +45+20, DRAWDIALOGBOX_CRUSADEJOB1); PutAlignedString(sX +24, sX +246, sY +60+20, DRAWDIALOGBOX_CRUSADEJOB2); PutAlignedString(sX +24, sX +246, sY +75+20, DRAWDIALOGBOX_CRUSADEJOB3); PutAlignedString(sX +24, sX +246, sY +90+20, DRAWDIALOGBOX_CRUSADEJOB4); if( m_side == ARESDEN ) { if (m_iGuildRank == 0) { if ((msX > sX + 24) && (msX < sX + 246) && (msY > sY + 150) && (msY < sY + 165)) PutAlignedString(sX +24, sX +246, sY+150, DRAWDIALOGBOX_CRUSADEJOB5, 255,255,255);//(Commander)" else PutAlignedString(sX +24, sX +246, sY+150, DRAWDIALOGBOX_CRUSADEJOB5, 4,0,50);//(Commander)" }else{ if ((msX > sX + 24) && (msX < sX + 246) && (msY > sY + 150) && (msY < sY + 165)) PutAlignedString(sX +24, sX +246, sY+150, DRAWDIALOGBOX_CRUSADEJOB7, 255,255,255);//(Soldier)" else PutAlignedString(sX +24, sX +246, sY+150, DRAWDIALOGBOX_CRUSADEJOB7, 4,0,50);//(Soldier)" if (m_iGuildRank != -1) { if ((msX > sX + 24) && (msX < sX + 246) && (msY > sY + 175) && (msY < sY + 190)) PutAlignedString(sX +24, sX +246, sY+175, DRAWDIALOGBOX_CRUSADEJOB9, 255,255,255);//(Constructor)" else PutAlignedString(sX +24, sX +246, sY+175, DRAWDIALOGBOX_CRUSADEJOB9, 4,0,50);//(Constructor)" } } }else if( m_side == ELVINE ) { if (m_iGuildRank == 0) { if ((msX > sX + 24) && (msX < sX + 246) && (msY > sY + 150) && (msY < sY + 165)) PutAlignedString(sX +24, sX +246, sY+150, DRAWDIALOGBOX_CRUSADEJOB5, 255,255,255);//(Commander)" else PutAlignedString(sX +24, sX +246, sY+150, DRAWDIALOGBOX_CRUSADEJOB5, 4,0,50);//(Commander)" }else { if ((msX > sX + 24) && (msX < sX + 246) && (msY > sY + 150) && (msY < sY + 165)) PutAlignedString(sX +24, sX +246, sY+150, DRAWDIALOGBOX_CRUSADEJOB7, 255,255,255);//(Soldier)" else PutAlignedString(sX +24, sX +246, sY+150, DRAWDIALOGBOX_CRUSADEJOB7, 4,0,50);//(Soldier)" if (m_iGuildRank != -1) { if ((msX > sX + 24) && (msX < sX + 246) && (msY > sY + 175) && (msY < sY + 190)) PutAlignedString(sX +24, sX +246, sY+175, DRAWDIALOGBOX_CRUSADEJOB9, 255,255,255);//(Constructor)" else PutAlignedString(sX +24, sX +246, sY+175, DRAWDIALOGBOX_CRUSADEJOB9, 4,0,50);//(Constructor)" } } } PutAlignedString(sX +24, sX +246, sY +290 -40, DRAWDIALOGBOX_CRUSADEJOB10); PutAlignedString(sX +24, sX +246, sY +305 -40, DRAWDIALOGBOX_CRUSADEJOB17); if ((msX > sX + 210) && (msX < sX + 260) && (msY >= sY + 296) && (msY <= sY + 316)) PutString_SprFont(sX +50+160, sY +296, "Help", 6,6,20); else PutString_SprFont(sX +50+160, sY +296, "Help", 0, 0, 7); break; case 2: PutAlignedString(sX +24, sX +246, sY +90+20, DRAWDIALOGBOX_CRUSADEJOB18); switch (m_iCrusadeDuty) { case 1: PutAlignedString(sX +24, sX +246, sY+125, DRAWDIALOGBOX_CRUSADEJOB19); break;//"(Soldier) case 2: PutAlignedString(sX +24, sX +246, sY+125, DRAWDIALOGBOX_CRUSADEJOB20); break;//"(Constructor) case 3: PutAlignedString(sX +24, sX +246, sY+125, DRAWDIALOGBOX_CRUSADEJOB21); break;//"(Commander) } PutAlignedString(sX +24, sX +246, sY +145, DRAWDIALOGBOX_CRUSADEJOB22); if ((msX > sX + 24) && (msX < sX + 246) && (msY > sY + 160) && (msY < sY + 175)) PutAlignedString(sX +24, sX +246, sY+160, DRAWDIALOGBOX_CRUSADEJOB23, 255,255,255); else PutAlignedString(sX +24, sX +246, sY+160, DRAWDIALOGBOX_CRUSADEJOB23, 4,0,50); PutAlignedString(sX +24, sX +246, sY +175, DRAWDIALOGBOX_CRUSADEJOB25); PutAlignedString(sX +24, sX +246, sY +190, DRAWDIALOGBOX_CRUSADEJOB26); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; } } void CGame::_Draw_OnLogin(char *pAccount, char *pPassword, int msX, int msY, int iFrame) { BOOL bFlag = TRUE; DWORD dwTime = timeGetTime(); m_DDraw.ClearBackB4(); DrawNewDialogBox(SPRID_INTERFACE_ND_LOGIN, 0,0,0, TRUE); DrawVersion(); //if ((iFrame >= 15) && (iFrame <= 20)) m_pSprite[SPRID_INTERFACE_ND_LOGIN]->PutTransSprite25(39,121, 2, TRUE); //else if (iFrame > 20) DrawNewDialogBox(SPRID_INTERFACE_ND_LOGIN, 39,121, 2, TRUE); if (m_cCurFocus != 1) { if (m_Misc.bCheckValidName(pAccount) != FALSE) PutString2(312, 192, pAccount, 200,200,200); else PutString2(312, 192, pAccount, 200,100,100); } if ((m_Misc.bCheckValidName(pAccount) == FALSE) || (strlen(pAccount) == 0)) bFlag = FALSE; if (m_cCurFocus != 2) { if ((m_Misc.bCheckValidString(pPassword) != FALSE)) PutString(312, 224, pPassword, RGB(200,200,200), TRUE, 1); else PutString(312, 224, pPassword, RGB(200,100,100), TRUE, 1); } if ((m_Misc.bCheckValidString(pPassword) == FALSE) || (strlen(pPassword) == 0)) bFlag = FALSE; if (m_cCurFocus == 1) ShowReceivedString(); else if (m_cCurFocus == 2) ShowReceivedString(TRUE); if (bFlag == TRUE) { if (m_cCurFocus == 3) DrawNewDialogBox(SPRID_INTERFACE_ND_LOGIN, 241,307, 1, TRUE); } if (m_cCurFocus == 4) DrawNewDialogBox(SPRID_INTERFACE_ND_LOGIN, 340,307,2, TRUE); if ((m_bIsHideLocalCursor != TRUE) && (msX != 0) && (msY != 0)) { m_pSprite[SPRID_MOUSECURSOR]->PutSpriteFast(msX, msY, 0, dwTime); } } void CGame::ShowEventList(DWORD dwTime) { int i; m_DDraw._GetBackBufferDC(); for (i = 0; i < 6; i++) if ((dwTime - m_stEventHistory[i].dwTime) < 5000) { switch (m_stEventHistory[i].cColor) { case 0: PutString(10, 10 + i*15, m_stEventHistory[i].cTxt, RGB(225,225,225), FALSE, 1, TRUE); break; case 1: PutString(10, 10 + i*15, m_stEventHistory[i].cTxt, RGB(130,255,130), FALSE, 1, TRUE); break; case 2: PutString(10, 10 + i*15, m_stEventHistory[i].cTxt, RGB(255,130,130), FALSE, 1, TRUE); break; case 3: PutString(10, 10 + i*15, m_stEventHistory[i].cTxt, RGB(130,130,255), FALSE, 1, TRUE); break; case 4: PutString(10, 10 + i*15, m_stEventHistory[i].cTxt, RGB(230, 230, 130), FALSE, 1, TRUE); break; case 10: PutString(10, 10 + i*15, m_stEventHistory[i].cTxt, RGB(180,255,180), FALSE, 1, TRUE); break; case 20: PutString(10, 10 + i*15, m_stEventHistory[i].cTxt, RGB(150,150,170), FALSE, 1, TRUE); break; } } for (i = 0; i < 6; i++) if ((dwTime - m_stEventHistory2[i].dwTime) < 5000) { switch (m_stEventHistory2[i].cColor) { case 0: PutString(10, 322 + i*15, m_stEventHistory2[i].cTxt, RGB(225,225,225), FALSE, 1, TRUE); break; case 1: PutString(10, 322 + i*15, m_stEventHistory2[i].cTxt, RGB(130,255,130), FALSE, 1, TRUE); break; case 2: PutString(10, 322 + i*15, m_stEventHistory2[i].cTxt, RGB(255,130,130), FALSE, 1, TRUE); break; case 3: PutString(10, 322 + i*15, m_stEventHistory2[i].cTxt, RGB(130,130,255), FALSE, 1, TRUE); break; case 4: PutString(10, 322 + i*15, m_stEventHistory2[i].cTxt, RGB(230, 230, 130), FALSE, 1, TRUE); break; case 10: PutString(10, 322 + i*15, m_stEventHistory2[i].cTxt, RGB(180,255,180), FALSE, 1, TRUE); break; case 20: PutString(10, 322 + i*15, m_stEventHistory2[i].cTxt, RGB(150,150,170), FALSE, 1, TRUE); break; } } if (m_bSkillUsingStatus == TRUE) { PutString(280 -29, 280 -52, SHOW_EVENT_LIST1, RGB(235,235,235), FALSE, 1, TRUE); } m_DDraw._ReleaseBackBufferDC(); } void CGame::RequestTeleportAndWaitData() { bSendCommand(MSGID_REQUEST_TELEPORT, NULL, NULL, NULL, NULL, NULL, NULL); ChangeGameMode(GAMEMODE_ONWAITINGINITDATA); } void CGame::InitDataResponseHandler(char * pData) { int * ip, i; short * sp, sX, sY; char * cp, cMapFileName[32], cTxt[120], cPreCurLocation[12]; BOOL bIsObserverMode; HANDLE hFile; DWORD dwFileSize; ZeroMemory( cPreCurLocation, sizeof(cPreCurLocation) ); m_bParalyze = FALSE; m_pMapData->Init(); m_sMonsterID = 0; m_dwMonsterEventTime = 0; DisableDialogBox(7); DisableDialogBox(11); DisableDialogBox(13); DisableDialogBox(14); DisableDialogBox(16); DisableDialogBox(22); DisableDialogBox(20); DisableDialogBox(21); DisableDialogBox(23); DisableDialogBox(51); // Gail's diag m_cCommand = OBJECTSTOP; //m_bCommandAvailable = TRUE; m_cCommandCount = 0; m_bIsGetPointingMode = FALSE; m_iPointCommandType = -1; m_iIlusionOwnerH = NULL; m_cIlusionOwnerType = NULL; m_bIsTeleportRequested = FALSE; m_bIsConfusion = FALSE; m_bSkillUsingStatus = FALSE; m_bItemUsingStatus = FALSE ; m_cRestartCount = -1; m_dwRestartCountTime = NULL; m_relicX = m_relicY = 0; m_armorDisabled = false; m_shieldDisabled = false; for (i = 0; i < m_stPartyMember.size(); i++) m_stPartyMember[i]->sX = m_stPartyMember[i]->sY = 0; for (i = 0; i < MAXMAGICTYPE; i++) m_magicDisabled[i] = false; for (i = 0; i < MAXEFFECTS; i++) { if (m_pEffectList[i] != NULL) delete m_pEffectList[i]; m_pEffectList[i] = NULL; } for (i = 0; i < MAXWHETHEROBJECTS; i++) { m_stWhetherObject[i].sX = 0; m_stWhetherObject[i].sBX = 0; m_stWhetherObject[i].sY = 0; m_stWhetherObject[i].cStep = 0; } for (i = 0; i < MAXGUILDNAMES; i++) { m_stGuildName[i].dwRefTime = 0; m_stGuildName[i].iGuildRank = -1; ZeroMemory(m_stGuildName[i].cCharName, sizeof(m_stGuildName[i].cCharName)); ZeroMemory(m_stGuildName[i].cGuildName, sizeof(m_stGuildName[i].cGuildName)); } for (i = 0; i < MAXCHATMSGS; i++) { if (m_pChatMsgList[i] != NULL) delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } cp = (char *)(pData + INDEX2_MSGTYPE + 2); // PlayerObjectID sp = (short *)cp; m_sPlayerObjectID = *sp; cp += 2; sp = (short *)cp; sX = *sp; cp += 2; sp = (short *)cp; sY = *sp; cp += 2; sp = (short *)cp; m_sPlayerType = *sp; cp += 2; sp = (short *)cp; m_sPlayerAppr1 = *sp; cp += 2; sp = (short *)cp; m_sPlayerAppr2 = *sp; cp += 2; sp = (short *)cp; m_sPlayerAppr3 = *sp; cp += 2; sp = (short *)cp; m_sPlayerAppr4 = *sp; cp += 2; ip = (int *)cp; m_iPlayerApprColor = *ip; cp += 4; // CLEROTH - BLACK FIX ip = (int *)cp; m_iPlayerStatus = *ip; cp += 4; ZeroMemory(m_cMapName, sizeof(m_cMapName)); ZeroMemory(m_cMapMessage, sizeof(m_cMapMessage)); memcpy(m_cMapName, cp, 10); m_cMapIndex = GetOfficialMapName(m_cMapName, m_cMapMessage); if( m_cMapIndex < 0 ) { m_stDialogBoxInfo[9].sSizeX = -1; m_stDialogBoxInfo[9].sSizeY = -1; }else { m_stDialogBoxInfo[9].sSizeX = 128; m_stDialogBoxInfo[9].sSizeY = 128; } cp += 10; strcpy( cPreCurLocation, m_cCurLocation ); ZeroMemory(m_cCurLocation, sizeof(m_cCurLocation)); memcpy(m_cCurLocation, cp, 10); cp += 10; G_cSpriteAlphaDegree = *cp; cp++; m_cWhetherStatus = *cp; cp++; switch (G_cSpriteAlphaDegree) { //Snoopy: Xmas bulbs // Will be sent by server if DayTime is 3 (and a snowy weather) case 1: m_bIsXmas = FALSE; break; case 2: m_bIsXmas = FALSE; break; case 3: // Snoopy Special night with chrismas bulbs if (m_cWhetherStatus >3) m_bIsXmas = TRUE; else m_bIsXmas = FALSE; G_cSpriteAlphaDegree = 2; break; } ip = (int *)cp; m_iContribution = *ip; // m_iContributionPrice = 0; cp += 4; bIsObserverMode = (BOOL)*cp; cp++; ip = (int *)cp; // m_iRating = *ip; cp += 4; ip = (int *)cp; m_iHP = *ip; cp += 4; m_cDiscount = (char )*cp; cp++; if (m_cWhetherStatus != NULL) SetWhetherStatus(TRUE, m_cWhetherStatus); else SetWhetherStatus(FALSE, m_cWhetherStatus); ZeroMemory(cMapFileName, sizeof(cMapFileName)); strcat(cMapFileName, "mapdata\\"); // CLEROTH - MW MAPS if(memcmp(m_cMapName,"defaultmw", 9)==0) { strcat(cMapFileName, "mw\\defaultmw"); }else { strcat(cMapFileName, m_cMapName); } strcat(cMapFileName, ".amd"); m_pMapData->OpenMapDataFile(cMapFileName); m_pMapData->m_sPivotX = sX; m_pMapData->m_sPivotY = sY; m_sPlayerX = sX + 14 + 5; m_sPlayerY = sY + 12 + 5; m_cPlayerDir = 5; if (bIsObserverMode == FALSE) { m_pMapData->bSetOwner(m_sPlayerObjectID, m_sPlayerX, m_sPlayerY, m_sPlayerType, m_cPlayerDir, m_sPlayerAppr1, m_sPlayerAppr2, m_sPlayerAppr3, m_sPlayerAppr4, m_iPlayerApprColor, m_iPlayerStatus, m_cPlayerName, OBJECTSTOP, NULL, NULL, NULL); } m_sViewDstX = m_sViewPointX = (sX+4+5)*32; m_sViewDstY = m_sViewPointY = (sY+5+5)*32; _ReadMapData(sX + 4 + 5, sY + 5 + 5, cp); m_bIsRedrawPDBGS = TRUE; // ------------------------------------------------------------------------+ wsprintf(cTxt, INITDATA_RESPONSE_HANDLER1, m_cMapMessage); AddEventList(cTxt, 10); /*if ( ( memcmp( m_cCurLocation, "middleland" ,10 ) == 0 ) || ( memcmp( m_cCurLocation, "dglv2" , 5 ) == 0 ) || ( memcmp( m_cCurLocation, "middled1n" , 9 ) == 0 )) EnableDialogBox(6, NULL,NULL, NULL);*/ // Snoopy: removed for v351 compatibility. Maybe usefull later... /* BOOL bPrevSafe, bNowSafe; if( memcmp( cPreCurLocation, m_cLocation, 3 ) == 0 ) bPrevSafe = TRUE; else bPrevSafe = FALSE; if( memcmp( m_cCurLocation, m_cLocation, 3 ) == 0 ) bNowSafe = TRUE; else bNowSafe = FALSE; if( memcmp( m_cCurLocation, "2nd", 3 ) == 0 ) bNowSafe = TRUE; if( m_iPKCount != 0 ) bNowSafe = FALSE; if( bPrevSafe ) { if( bNowSafe == FALSE ) SetTopMsg(MSG_DANGERZONE, 5); }else { if( bNowSafe ) SetTopMsg(MSG_SAFEZONE, 5); }*/ // ------------------------------------------------------------------------+ ChangeGameMode(GAMEMODE_ONMAINGAME); m_DDraw.ClearBackB4(); //v1.41 if ((m_sPlayerAppr2 & 0xF000) != 0) m_bIsCombatMode = TRUE; else m_bIsCombatMode = FALSE; //v1.42 if (m_bIsFirstConn == TRUE) { m_bIsFirstConn = FALSE; hFile = CreateFile("contents\\contents1000.txt", GENERIC_READ, NULL, NULL, OPEN_EXISTING, NULL, NULL); if (hFile == INVALID_HANDLE_VALUE) dwFileSize = 0; else { dwFileSize = GetFileSize(hFile, NULL); CloseHandle(hFile); } bSendCommand(MSGID_REQUEST_NOTICEMENT, NULL, NULL, (int)dwFileSize, NULL, NULL, NULL); } //cp += 2; LoadMuteList(); } void CGame::MotionEventHandler(char * pData) {WORD * wp, wEventType, wObjectID; short * sp, sX, sY, sType, sAppr1, sAppr2, sAppr3, sAppr4, sV1, sV2, sV3, sPrevAppr2; int iStatus; char * cp, cDir, cName[12]; int * ip, iApprColor, iLoc; char cTxt[300]; int i; ZeroMemory(cName, sizeof(cName)); sV1 = sV2 = sV3 = NULL; wp = (WORD *)(pData + INDEX2_MSGTYPE); wEventType = *wp; cp = (char *)(pData + INDEX2_MSGTYPE + 2); wp = (WORD *)cp; wObjectID = *wp; cp += 2; iLoc = 0; if (wObjectID < 30000) { if (wObjectID < 10000) // Player { sp = (short *)cp; sX = *sp; cp += 2; sp = (short *)cp; sY = *sp; cp += 2; sp = (short *)cp; sType = *sp; cp += 2; cDir = *cp; cp++; memcpy(cName, cp, 10); cp += 10; sp = (short *)cp; sAppr1 = *sp; cp += 2; sp = (short *)cp; sAppr2 = *sp; cp += 2; sp = (short *)cp; sAppr3 = *sp; cp += 2; sp = (short *)cp; sAppr4 = *sp; cp += 2; ip = (int *)cp; iApprColor = *ip; cp += 4; // CLEROTH - CRASH BUG ( STATUS ) ip = (int *)cp; iStatus = *ip; cp += 4; iLoc = *cp; cp++; }else // Npc or mob { sp = (short *)cp; sX = *sp; cp += 2; sp = (short *)cp; sY = *sp; cp += 2; sp = (short *)cp; sType = *sp; cp += 2; cDir = *cp; cp++; memcpy(cName, cp, 5); cp += 5; sAppr1 = sAppr3 = sAppr4 = 0; sp = (short *)cp; sAppr2 = *sp; cp += 2; ip = (int *)cp; iStatus = *ip; cp += 4; iLoc = *cp; cp++; } }else { switch (wEventType) { case OBJECTMAGIC: case OBJECTDAMAGEMOVE: case OBJECTDAMAGE: cDir = *cp; cp++; sV1 = (short)*cp; //Damage cp++; sV2 = (short)*cp; // cp++; break; case OBJECTDYING: cDir = *cp; cp++; sV1 = (short)*cp; //Damage cp++; sV2 = (short)*cp; // cp++; sp = (short *)cp; sX = *sp; cp += 2; sp = (short *)cp; sY = *sp; cp += 2; break; case OBJECTATTACK: cDir = *cp; cp++; sV1 = *cp; cp++; sV2 = *cp; cp++; sp = (short *)cp; sV3 = *sp; cp += 2; break; default: cDir = *cp; cp++; break; } } if ((wEventType == OBJECTNULLACTION) && (memcmp(cName, m_cPlayerName, 10) == 0)) { m_sPlayerType = sType; m_sPlayerAppr1 = sAppr1; sPrevAppr2 = m_sPlayerAppr2; m_sPlayerAppr2 = sAppr2; m_sPlayerAppr3 = sAppr3; m_sPlayerAppr4 = sAppr4; m_iPlayerApprColor = iApprColor; m_iPlayerStatus = iStatus; if ((sPrevAppr2 & 0xF000) == 0) { if ((sAppr2 & 0xF000) != 0) { AddEventList(MOTION_EVENT_HANDLER1, 10); m_bIsCombatMode = TRUE; } }else { if ((sAppr2 & 0xF000) == 0) { AddEventList(MOTION_EVENT_HANDLER2, 10); m_bIsCombatMode = FALSE; } } if (m_cCommand != OBJECTRUN && m_cCommand != OBJECTMAGIC) m_pMapData->bSetOwner(wObjectID, sX, sY, sType, cDir, sAppr1, sAppr2, sAppr3, sAppr4, iApprColor, iStatus, cName, (char)wEventType, sV1, sV2, sV3, iLoc); }else if(!(wObjectID -30000 == m_sPlayerObjectID && wEventType == OBJECTDYING && (m_cCommand == OBJECTRUN || m_cCommand == OBJECTMOVE))) m_pMapData->bSetOwner(wObjectID, sX, sY, sType, cDir, sAppr1, sAppr2, sAppr3, sAppr4, iApprColor, iStatus, cName, (char)wEventType, sV1, sV2, sV3, iLoc); switch (wEventType) { case OBJECTMAGIC: // Casting _RemoveChatMsgListByObjectID(wObjectID - 30000); for (i = 1; i < MAXCHATMSGS; i++) if (m_pChatMsgList[i] == NULL) { ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, "%s!", m_pMagicCfgList[sV1]->m_cName); m_pChatMsgList[i] = new class CMsg(41, cTxt, m_dwCurTime); m_pChatMsgList[i]->m_iObjectID = wObjectID - 30000; if (m_pMapData->bSetChatMsgOwner(wObjectID - 30000, -10, -10, i) == FALSE) { delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } return; } break; case OBJECTDYING: for (i = 1; i < MAXCHATMSGS; i++) { if (m_pChatMsgList[i] == NULL) { int index = m_pMapData->getChatMsgIndex(wObjectID - 30000); if(m_showAllDmg && m_pChatMsgList[index] && strlen(m_pChatMsgList[index]->m_pMsg) < sizeof(cTxt)-30) { if(index != -1 && m_dwCurTime - m_pChatMsgList[index]->m_dwTime < 150 _ms && m_pChatMsgList[index]->m_cType >= 21 && m_pChatMsgList[index]->m_cType <= 23) { if (sV1 > 0) wsprintf(cTxt, "%s-%d!", m_pChatMsgList[index]->m_pMsg, sV1); else wsprintf(cTxt, "%s-Crit!", m_pChatMsgList[index]->m_pMsg, sV1); } else { if (sV1 > 0) wsprintf(cTxt, "-%d!", sV1); else strcpy(cTxt, "Crit!"); } }else{ if (sV1 > 0) wsprintf(cTxt, "-%d!", sV1); else strcpy(cTxt, COMMAND_PROCESSOR6); // Critical! } int iFontType; if ((sV1 >= 0) && (sV1 < 12)) iFontType = 21; else if ((sV1 >= 12) && (sV1 < 40)) iFontType = 22; else if ((sV1 >= 40) || (sV1 < 0)) iFontType = 23; _RemoveChatMsgListByObjectID(wObjectID - 30000); m_pChatMsgList[i] = new class CMsg(iFontType, cTxt, m_dwCurTime); m_pChatMsgList[i]->m_iObjectID = wObjectID - 30000; if (m_pMapData->bSetChatMsgOwner(wObjectID - 30000, -10, -10, i) == FALSE) { delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } return; } } break; case OBJECTDAMAGEMOVE: case OBJECTDAMAGE: if (memcmp(cName, m_cPlayerName, 10) == 0) { m_bIsGetPointingMode = FALSE; m_iPointCommandType = -1; m_stMCursor.sCursorFrame = 0; ClearSkillUsingStatus(); } for (i = 1; i < MAXCHATMSGS; i++) if (m_pChatMsgList[i] == NULL) { ZeroMemory(cTxt, sizeof(cTxt)); if (sV1 != 0) { int index = m_pMapData->getChatMsgIndex(wObjectID - 30000); if(m_showAllDmg && m_pChatMsgList[index] && strlen(m_pChatMsgList[index]->m_pMsg) < sizeof(cTxt)-30) { if(index != -1 && m_dwCurTime - m_pChatMsgList[index]->m_dwTime < 150 _ms && m_pChatMsgList[index]->m_cType >= 21 && m_pChatMsgList[index]->m_cType <= 23) { if (sV1 > 0) wsprintf(cTxt, "%s-%d", m_pChatMsgList[index]->m_pMsg, sV1); else wsprintf(cTxt, "%s-Crit", m_pChatMsgList[index]->m_pMsg, sV1); } else { if (sV1 > 0) wsprintf(cTxt, "-%d", sV1); else strcpy(cTxt, "Crit"); } }else{ if (sV1 > 0) wsprintf(cTxt, "-%d", sV1); else strcpy(cTxt, MOTION_EVENT_HANDLER3); } int iFontType; if ((sV1 >= 0) && (sV1 < 12)) iFontType = 21; else if ((sV1 >= 12) && (sV1 < 40)) iFontType = 22; else if ((sV1 >= 40) || (sV1 < 0)) iFontType = 23; _RemoveChatMsgListByObjectID(wObjectID - 30000); m_pChatMsgList[i] = new class CMsg(iFontType, cTxt, m_dwCurTime); }else { strcpy(cTxt, " * Failed! *"); _RemoveChatMsgListByObjectID(wObjectID - 30000); m_pChatMsgList[i] = new class CMsg(22, cTxt, m_dwCurTime); PlaySound('C', 17, 0); } m_pChatMsgList[i]->m_iObjectID = wObjectID - 30000; if (m_pMapData->bSetChatMsgOwner(wObjectID - 30000, -10, -10, i) == FALSE) { delete m_pChatMsgList[i]; m_pChatMsgList[i] = NULL; } return; } break; } } void CGame::DrawDialogBox_Commander(int msX, int msY) // Snoopy: Fixed for 351 {short sX, sY, szX, szY, MapSzX, MapSzY; DWORD dwTime = G_dwGlobalTime; double dV1, dV2, dV3; int i, tX, tY; sX = m_stDialogBoxInfo[36].sX; sY = m_stDialogBoxInfo[36].sY; szX = m_stDialogBoxInfo[36].sSizeX; if ((dwTime - m_dwCommanderCommandRequestedTime) > 1000*10) { _RequestMapStatus("middleland", 3); _RequestMapStatus("middleland", 1); m_dwCommanderCommandRequestedTime = dwTime; } DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX, sY-5, 0, FALSE, m_bDialogTrans); // Main image DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 15, FALSE, m_bDialogTrans); switch (m_stDialogBoxInfo[36].cMode) { case 0: // Main dlg m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20, sY + 340, 3, dwTime); // btn m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +50, sY + 340, 1, dwTime); // btn m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100, sY + 340, 2, dwTime); // btn m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150, sY + 340, 30,dwTime); // Btn TP m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 +74, sY + 340, 4, dwTime); // btn ? //PutAlignedString(sX, sX + szX, sY + 40, DRAW_DIALOGBOX_COMMANDER1);//"Middleland warfare building structure situation" PutAlignedString(sX, sX + szX, sY + 37, DRAW_DIALOGBOX_COMMANDER1);//"Middleland warfare building structure situation" if ( (msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20, sY + 340, 17, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER2, 255,255,255);//"Middleland teleport position set" }else if ( (msX >= sX +20 +50) && (msX <= sX +20 +46 +50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +50, sY + 340, 15, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER3, 255,255,255);//"Teleport to the selected area" }else if ( (msX >= sX +20 +100) && (msX <= sX +20 +46 +100) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100, sY + 340, 16, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER4, 255,255,255);//"Recall warfare units" }else if ((msX >= sX +20 +150) && (msX <= sX +20 +46 +150) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150, sY + 340, 24,dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER5, 255,255,255);//"Middleland construction building set" }else if ( (msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 18, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER6, 255,255,255);//"Commander's duty help" } DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX, sY, 21, FALSE, m_bDialogTrans);// Map break; case 1: // Set TP m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100 + 74, sY + 340, 20, dwTime); //btn <- m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 4, dwTime); //btn ? PutAlignedString(sX, sX + szX, sY + 40, DRAW_DIALOGBOX_COMMANDER7); // "Click and select the teleport location." if ( (msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100 + 74, sY + 340, 19, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER8, 255,255,255); }else if ( (msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 18, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER9, 255,255,255); } DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX, sY, 21, FALSE, m_bDialogTrans); if ( (msX >= sX + 15) && (msX <= sX + 15 + 278) && (msY >= sY + 60) && (msY <= sY + 60 + 272)) // shows TP posit on map following the mouse { DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, msX, msY, 42, FALSE, TRUE); } break; case 2: // Use TP m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +50, sY + 340, 1, dwTime); // Btn TP m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100 + 74, sY + 340, 20, dwTime); // Btn <- m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 4, dwTime); // Btn ? PutAlignedString(sX, sX + szX, sY + 40, DRAW_DIALOGBOX_COMMANDER10); // "Teleport to the selected area" if ( (msX >= sX +20 +50) && (msX <= sX +20 +46 +50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +50, sY + 340, 15, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER11, 255,255,255); }else if ( (msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100 + 74, sY + 340, 19, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER12, 255,255,255); }else if ( (msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 18, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER13, 255,255,255); } DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX, sY, 21, FALSE, m_bDialogTrans); break; case 3: // Choose summon if(m_side == ARESDEN) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20, sY +220, 6, dwTime); m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +50, sY +220, 5, dwTime); m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100, sY +220, 7, dwTime); m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150, sY +220, 35, dwTime); }else if (m_side == ELVINE) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20, sY +220, 9, dwTime); m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +50, sY +220, 8, dwTime); m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100, sY +220, 7, dwTime); m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150, sY +220, 35, dwTime); } m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100 + 74, sY + 340, 20, dwTime); m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 4, dwTime); PutAlignedString(sX, sX + szX, sY + 40, DRAW_DIALOGBOX_COMMANDER14); // "Recall warfare units" wsprintf(G_cTxt, "%s %d",DRAW_DIALOGBOX_COMMANDER15, m_iConstructionPoint); PutAlignedString(sX, sX +323, sY +190, G_cTxt); if(m_side == ARESDEN) { if ((msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 3000) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20, sY +220, 11, dwTime); } PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER16, 255,255,255); PutString2(msX +20, msY +50, DRAW_DIALOGBOX_COMMANDER17, 255,255,255);//"3000" }else if ((msX >= sX +20 +50) && (msX <= sX +20 +50 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 2000) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +50, sY +220, 10, dwTime); } PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER18, 255,255,255);//"(Temple Knight)" PutString2(msX +20, msY +50, DRAW_DIALOGBOX_COMMANDER19, 255,255,255);//"2000" }else if ((msX >= sX +20 +100) && (msX <= sX +20 +100 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 1000) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100, sY +220, 12, dwTime); } PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER20, 255,255,255);//"(Light War Beetle)" PutString2(msX +20, msY +50, DRAW_DIALOGBOX_COMMANDER21, 255,255,255);//" 1000" }else if ((msX >= sX +20 +150) && (msX <= sX +20 +150 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 5000) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150, sY +220, 29, dwTime); } PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER22, 255,255,255);//"(Catapult)" PutString2(msX +20, msY +50, DRAW_DIALOGBOX_COMMANDER23, 255,255,255);// 1500" }else if ((msX >= sX +20) && (msX <= sX +380) && (msY > sY +140) && (msY < sY +160)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER24, 255,255,255); }else if ((msX >= sX +20) && (msX <= sX +380) && (msY > sY +160) && (msY < sY +175)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER25, 255,255,255); }else if ( (msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100 + 74, sY + 340, 19, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER26, 255,255,255); }else if ( (msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 18, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER27, 255,255,255); //"Warfare units recall related help" } }else if (m_side == ELVINE) { if ((msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 3000) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20, sY +220, 14, dwTime); } PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER28, 255,255,255);//"(God's Hand Knight Cavalry)" PutString2(msX +20, msY +50, DRAW_DIALOGBOX_COMMANDER29, 255,255,255);//"3000" }else if ( (msX >= sX +20 +50) && (msX <= sX +20 +50 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 2000) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +50, sY +220, 13, dwTime); } PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER30, 255,255,255); PutString2(msX +20, msY +50, DRAW_DIALOGBOX_COMMANDER31, 255,255,255);//"2000" }else if ((msX >= sX +20 +100) && (msX <= sX +20 +100 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 1000) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100, sY +220, 12, dwTime); } PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER32, 255,255,255);//"(Light War Beetle)" PutString2(msX +20, msY +50, DRAW_DIALOGBOX_COMMANDER33, 255,255,255);//" 1000" }else if ((msX >= sX +20 +150) && (msX <= sX +20 +150 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { if (m_iConstructionPoint >= 5000) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150, sY +220, 29, dwTime); } PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER34, 255,255,255);//"(Catapult)" PutString2(msX +20, msY +50, DRAW_DIALOGBOX_COMMANDER35, 255,255,255);//" 1500" }else if ((msX >= sX +20) && (msX <= sX +380) && (msY > sY +140) && (msY < sY +160)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER36, 255,255,255); }else if ((msX >= sX +20) && (msX <= sX +380) && (msY > sY +160) && (msY < sY +175)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER37, 255,255,255); }else if ( (msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100 + 74, sY + 340, 19, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER38, 255,255,255); }else if ( (msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 18, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER39, 255,255,255); } } PutAlignedString(sX, sX +323, sY +80, DRAW_DIALOGBOX_COMMANDER40); PutAlignedString(sX, sX +323, sY +95, DRAW_DIALOGBOX_COMMANDER41); PutAlignedString(sX, sX +323, sY +110, DRAW_DIALOGBOX_COMMANDER42); switch (m_stDialogBoxInfo[36].sV1) { case 0: PutAlignedString(sX, sX +323, sY +140, DRAW_DIALOGBOX_COMMANDER43, 255, 255, 255);//"Guard Mode" PutAlignedString(sX, sX +323, sY +160, DRAW_DIALOGBOX_COMMANDER44, 4,0,50);//"Hold Mode" break; case 1: PutAlignedString(sX, sX +323, sY +140, DRAW_DIALOGBOX_COMMANDER43, 4,0,50);//"Guard Mode" PutAlignedString(sX, sX +323, sY +160, DRAW_DIALOGBOX_COMMANDER44, 255, 255, 255);//"Hold Mode" break; } break; case 4: // Set Construction point m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100 + 74, sY + 340, 20, dwTime); m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 4, dwTime); PutAlignedString(sX, sX + szX, sY + 40, DRAW_DIALOGBOX_COMMANDER47); // "Select the construction area and click." if ( (msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100 + 74, sY + 340, 19, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER48, 255,255,255); // "Returns to commander's main menu" }else if ( (msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 18, dwTime); PutString2(msX +20, msY +35, DRAW_DIALOGBOX_COMMANDER49, 255,255,255); // "Construction area set related help" } DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX, sY, 21); if ( (msX >= sX + 15) && (msX <= sX + 15 + 278) && (msY >= sY + 60) && (msY <= sY + 60 + 272)) // shows posit on map following the mouse { DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, msX, msY, 41, FALSE, TRUE); } break; } switch (m_stDialogBoxInfo[36].cMode) { case 0: // Main case 1: // Set TP case 2: // Use TP case 4: // Set construc szX = NULL; szY = NULL; MapSzX = NULL; MapSzY = NULL; if (strcmp(m_cStatusMapName, "aresden") == 0) { szX = 250; szY = 250; }else if (strcmp(m_cStatusMapName, "elvine") == 0) { szX = 250; szY = 250; }else if (strcmp(m_cStatusMapName, "middleland") == 0) { szX = 279; szY = 280; MapSzX = 524; MapSzY = 524; } if (szX != NULL) { for (i = 0; i < MAXCRUSADESTRUCTURES; i++) if (m_stCrusadeStructureInfo[i].cType != NULL) { dV1 = (double)MapSzX; dV2 = (double)m_stCrusadeStructureInfo[i].sX; dV3 = (dV2*(double)szX)/dV1; tX = (int)dV3; dV1 = (double)MapSzY; dV2 = (double)m_stCrusadeStructureInfo[i].sY; dV3 = (dV2*(double)szY)/dV1; tY = (int)dV3; switch (m_stCrusadeStructureInfo[i].cType) { case 38: if (m_stCrusadeStructureInfo[i].cSide == 1) DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 39, FALSE, TRUE); // Base else DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 37, FALSE, TRUE); break; case 36: case 37: case 39: if (m_stCrusadeStructureInfo[i].cSide == 1) DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 38, FALSE, TRUE); // Base else DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 36, FALSE, TRUE); break; case 42: DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 40); // ManaStone break; } } if (m_iTeleportLocX != -1) { dV1 = (double)MapSzX; dV2 = (double)m_iTeleportLocX; dV3 = (dV2*(double)szX)/dV1; tX = (int)dV3; dV1 = (double)MapSzY; dV2 = (double)m_iTeleportLocY; dV3 = (dV2*(double)szY)/dV1; tY = (int)dV3; if ((m_stDialogBoxInfo[36].cMode == 1) && (tY >= 30) && (tY <= 494)) // Place the TP { DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 42, FALSE, TRUE); //TP }else DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 42, FALSE, TRUE); //TP } if ((m_stDialogBoxInfo[36].cMode != 2) && (m_iConstructLocX != -1)) { dV1 = (double)MapSzX; dV2 = (double)m_iConstructLocX; dV3 = (dV2*(double)szX)/dV1; tX = (int)dV3; dV1 = (double)MapSzY; dV2 = (double)m_iConstructLocY; dV3 = (dV2*(double)szY)/dV1; tY = (int)dV3; DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 41, FALSE, TRUE); // Contr pt } if (strcmp(m_cMapName, "middleland") == 0) { dV1 = (double)MapSzX;//m_pMapData->m_sMapSizeX; dV2 = (double)m_sPlayerX; dV3 = (dV2*(double)szX)/dV1; tX = (int)dV3; dV1 = (double)MapSzY;//m_pMapData->m_sMapSizeY; dV2 = (double)m_sPlayerY; dV3 = (dV2*(double)szY)/dV1; tY = (int)dV3; DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 43); // Player place } } if (m_stDialogBoxInfo[36].cMode != 3) { if ( (msX >= sX + 15) && (msX <= sX + 15 +278) && (msY >= sY + 60) && (msY <= sY + 60 +272)) // Draw mouse coordinates { dV1 = (double)(msX - (sX + 15)); dV2 = (double)MapSzX;//(752.0f); dV3 = (dV2*dV1)/szX;//280.0f; tX = (int)dV3; dV1 = (double)(msY - (sY + 60)); dV2 = (double)MapSzX;//(680.0f); dV3 = (dV2*dV1)/szY;//253.0f; tY = (int)dV3; if (tX < 30) tX = 30; if (tY < 30) tY = 30; if (tX > MapSzX-30) tX = MapSzX-30; if (tY > MapSzY-30) tY = MapSzY-30; wsprintf(G_cTxt, "%d,%d", tX, tY); PutString_SprFont3(msX + 10, msY -10, G_cTxt, m_wR[13]*4, m_wG[13]*4, m_wB[13]*4, FALSE, 2); } } break; } } void CGame::DrawDialogBox_Constructor(int msX, int msY) // Snoopy: Fixed for 351 {short sX, sY, szX, szY, MapSzX, MapSzY; DWORD dwTime = G_dwGlobalTime; double dV1, dV2, dV3; int tX, tY; char cMapName[12]; sX = m_stDialogBoxInfo[37].sX; sY = m_stDialogBoxInfo[37].sY; szX = m_stDialogBoxInfo[37].sSizeX; if ((dwTime - m_dwCommanderCommandRequestedTime) > 1000*10) { _RequestMapStatus("middleland", 3); _RequestMapStatus("middleland", 1); m_dwCommanderCommandRequestedTime = dwTime; } DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX, sY-5, 0, FALSE, m_bDialogTrans); // Main image DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 16, FALSE, m_bDialogTrans); switch (m_stDialogBoxInfo[37].cMode) { case 0: // Main dlg if (m_iConstructLocX != -1) { ZeroMemory(cMapName, sizeof(cMapName)); GetOfficialMapName(m_cConstructMapName, cMapName); wsprintf(G_cTxt, DRAW_DIALOGBOX_CONSTRUCTOR1, cMapName, m_iConstructLocX, m_iConstructLocY); PutAlignedString(sX, sX + szX, sY + 40, G_cTxt); }else PutAlignedString(sX, sX + szX, sY + 40, DRAW_DIALOGBOX_CONSTRUCTOR2); //"Construction unavailable: Unable to construct" DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX, sY, 21, FALSE, m_bDialogTrans); // Map if ( (msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20, sY + 340, 24, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20, sY + 340, 30, dwTime); if ( (msX >= sX +20 +50) && (msX <= sX +20 +46 +50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +50, sY + 340, 15, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +50, sY + 340, 1, dwTime); if ( (msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 18, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 4, dwTime); if ( (msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_CONSTRUCTOR3, 255,255,255); }else if ( (msX >= sX +20 +50) && (msX <= sX +20 +46 +50) && (msY >= sY + 322) && (msY <= sY + 322 + 52)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_CONSTRUCTOR4, 255,255,255); }else if ( (msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 322) && (msY <= sY + 322 + 52)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_CONSTRUCTOR5, 255,255,255); } break; case 1: // Select building PutAlignedString(sX, sX +szX, sY +40, DRAW_DIALOGBOX_CONSTRUCTOR6); //"Select war building" PutAlignedString(sX, sX +323, sY +80, DRAW_DIALOGBOX_CONSTRUCTOR7); //"Constructs the war building here." PutAlignedString(sX, sX +323, sY +95, DRAW_DIALOGBOX_CONSTRUCTOR8); //"Press the building icon and" PutAlignedString(sX, sX +323, sY +110, DRAW_DIALOGBOX_CONSTRUCTOR9); //"the base will be formed and slowly finished" PutAlignedString(sX, sX +323, sY +125, DRAW_DIALOGBOX_CONSTRUCTOR10);//"Attack the building with Pickaxe." PutAlignedString(sX, sX +323, sY +140, DRAW_DIALOGBOX_CONSTRUCTOR11);//"Building is not activated" PutAlignedString(sX, sX +323, sY +155, DRAW_DIALOGBOX_CONSTRUCTOR12);//"while constructing." if ((msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY +220) && (msY <= sY +220 +50)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20, sY +220, 27, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20, sY +220, 33, dwTime); if ((msX >= sX +20 +50) && (msX <= sX +20 +50 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +50, sY +220, 28, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +50, sY +220, 34, dwTime); if ((msX >= sX +20 +100) && (msX <= sX +20 +100 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100, sY +220, 26, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100, sY +220, 32, dwTime); if ((msX >= sX +20 +150) && (msX <= sX +20 +150 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150, sY +220, 25, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150, sY +220, 31, dwTime); if ((msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 322) && (msY <= sY + 322 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100 + 74, sY + 322, 19, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100 + 74, sY + 322, 20, dwTime); if ((msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 322) && (msY <= sY + 322 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 322, 18, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 322, 4, dwTime); if ((msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY +220) && (msY <= sY +220 +50)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_CONSTRUCTOR13, 255,255,255);//"(Mana Collector)" }else if ((msX >= sX +20 +50) && (msX <= sX +20 +50 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_CONSTRUCTOR14, 255,255,255);//"(Detector)" }else if ((msX >= sX +20 +100) && (msX <= sX +20 +100 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_CONSTRUCTOR15, 255,255,255);//"(Arrow Guard Tower)" }else if ((msX >= sX +20 +150) && (msX <= sX +20 +150 +45) && (msY >= sY +220) && (msY <= sY +220 +50)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_CONSTRUCTOR16, 255,255,255);//(Cannon Guard Tower)" }else if ((msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 322) && (msY <= sY + 322 + 52)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_CONSTRUCTOR17, 255,255,255); }else if ((msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 322) && (msY <= sY + 322 + 52)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_CONSTRUCTOR18, 255,255,255); } break; case 2: // Teleport PutAlignedString(sX, sX + szX, sY + 40, DRAW_DIALOGBOX_CONSTRUCTOR19); //"Teleport to position that commander pointed" DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX, sY, 21, FALSE, m_bDialogTrans); // map if ( (msX >= sX +20 +50) && (msX <= sX +20 +46 +50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +50, sY + 340, 15, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +50, sY + 340, 1, dwTime); if ( (msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100 + 74, sY + 340, 19, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +100 + 74, sY + 340, 20, dwTime); if ( (msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 18, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 4, dwTime); if ((msX >= sX +20 +50) && (msX <= sX +20 +46 +50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_CONSTRUCTOR20, 255,255,255); }else if ( (msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_CONSTRUCTOR21, 255,255,255); }else if ( (msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_CONSTRUCTOR22, 255,255,255); } break; } switch (m_stDialogBoxInfo[37].cMode) { case 0: // Main dlg case 2: // TP szX = NULL; szY = NULL; MapSzX = NULL; MapSzY = NULL; if (strcmp(m_cStatusMapName, "aresden") == 0) { szX = 250; szY = 250; }else if (strcmp(m_cStatusMapName, "elvine") == 0) { szX = 250; szY = 250; }else if (strcmp(m_cStatusMapName, "middleland") == 0) { szX = 279; szY = 280; MapSzX = 524; MapSzY = 524; } if (szX != 0) { for (int i = 0; i < MAXCRUSADESTRUCTURES; i++) if (m_stCrusadeStructureInfo[i].cType == 42) { dV1 = (double)MapSzX; dV2 = (double)m_stCrusadeStructureInfo[i].sX; dV3 = (dV2*(double)szX)/dV1; tX = (int)dV3; dV1 = (double)MapSzY; dV2 = (double)m_stCrusadeStructureInfo[i].sY; dV3 = (dV2*(double)szY)/dV1; tY = (int)dV3; switch (m_stCrusadeStructureInfo[i].cType) { case 42: DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 40); // ManaStone break; } } if (m_iTeleportLocX != -1) { dV1 = (double)MapSzX; dV2 = (double)m_iTeleportLocX; dV3 = (dV2*(double)szX)/dV1; tX = (int)dV3; dV1 = (double)MapSzY; dV2 = (double)m_iTeleportLocY; dV3 = (dV2*(double)szY)/dV1; tY = (int)dV3; DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 42, FALSE, TRUE); //TP } if ((m_stDialogBoxInfo[37].cMode != 2) && (m_iConstructLocX != -1)) { dV1 = (double)MapSzX; dV2 = (double)m_iConstructLocX; dV3 = (dV2*(double)szX)/dV1; tX = (int)dV3; dV1 = (double)MapSzY; dV2 = (double)m_iConstructLocY; dV3 = (dV2*(double)szY)/dV1; tY = (int)dV3; DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 41, FALSE, TRUE); // Contr pt } if (strcmp(m_cMapName, "middleland") == 0) { dV1 = (double)MapSzX;//m_pMapData->m_sMapSizeX; dV2 = (double)m_sPlayerX; dV3 = (dV2*(double)szX)/dV1; tX = (int)dV3; dV1 = (double)MapSzY;//m_pMapData->m_sMapSizeY; dV2 = (double)m_sPlayerY; dV3 = (dV2*(double)szY)/dV1; tY = (int)dV3; DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 43); // Player place } } if ( (msX >= sX + 15) && (msX <= sX + 15 +278) && (msY >= sY + 60) && (msY <= sY + 60 +272)) // Draw mouse coordinates { dV1 = (double)(msX - (sX + 15)); dV2 = (double)MapSzX;//(752.0f); dV3 = (dV2*dV1)/szX;//280.0f; tX = (int)dV3; dV1 = (double)(msY - (sY + 60)); dV2 = (double)MapSzX;//(680.0f); dV3 = (dV2*dV1)/szY;//253.0f; tY = (int)dV3; if (tX < 30) tX = 30; if (tY < 30) tY = 30; if (tX > MapSzX-30) tX = MapSzX-30; if (tY > MapSzY-30) tY = MapSzY-30; wsprintf(G_cTxt, "%d,%d", tX, tY); PutString_SprFont3(msX + 10, msY -10, G_cTxt, m_wR[13]*4, m_wG[13]*4, m_wB[13]*4, FALSE, 2); } break; } } void CGame::DrawDialogBox_Soldier(int msX, int msY) // Snoopy: Fixed for 351 {short sX, sY, szX, szY, MapSzX, MapSzY; DWORD dwTime = G_dwGlobalTime; char cMapName[120]; double dV1, dV2, dV3; int tX, tY; sX = m_stDialogBoxInfo[38].sX; sY = m_stDialogBoxInfo[38].sY; szX = m_stDialogBoxInfo[38].sSizeX; if ((dwTime - m_dwCommanderCommandRequestedTime) > 1000*10) { _RequestMapStatus("middleland", 3); _RequestMapStatus("middleland", 1); m_dwCommanderCommandRequestedTime = dwTime; } DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX, sY-5, 0, FALSE, m_bDialogTrans); DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX, sY, 21, FALSE, m_bDialogTrans); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 17, FALSE, m_bDialogTrans); // Crusade Soldier Menu Text switch (m_stDialogBoxInfo[38].cMode) { case 0: // Main dlg, Map if (m_iTeleportLocX != -1) { ZeroMemory(cMapName, sizeof(cMapName)); GetOfficialMapName(m_cTeleportMapName, cMapName); wsprintf(G_cTxt, DRAW_DIALOGBOX_SOLDIER1, cMapName, m_iTeleportLocX, m_iTeleportLocY); PutAlignedString(sX, sX + szX, sY + 40, G_cTxt); // "Teleport position: %s near %d, %d" }else PutAlignedString(sX, sX + szX, sY + 40, DRAW_DIALOGBOX_SOLDIER2); //"Teleport position is not set." if ( (msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20, sY + 340, 15, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20, sY + 340, 1, dwTime); if ( (msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 18, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 4, dwTime); if ( (msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY +340) && (msY <= sY + 340 + 52)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_SOLDIER3, 255,255,255); // "Teleport to position that commander pointed" }else if ( (msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY +340) && (msY <= sY + 340 + 52)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_SOLDIER4, 255,255,255); // "Help for soldier" } break; case 1: // TP now PutAlignedString(sX, sX + szX, sY + 40, DRAW_DIALOGBOX_SOLDIER5); // "Teleport to position that commander pointed" if ( (msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20, sY + 340, 15, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20, sY + 340, 1, dwTime); if ( (msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74 -50, sY + 340, 19, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74 -50, sY + 340, 20, dwTime); if ( (msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 18, dwTime); }else m_pSprite[SPRID_INTERFACE_ND_CRUSADE]->PutSpriteFast(sX +20 +150 + 74, sY + 340, 4, dwTime); if ( (msX >= sX +20) && (msX <= sX +20 +46) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_SOLDIER6, 255,255,255); }else if ( (msX >= sX +20 +150 + 74 -50) && (msX <= sX +20 +46 +150 + 74 -50) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_SOLDIER7, 255,255,255); }else if ( (msX >= sX +20 +150 + 74) && (msX <= sX +20 +46 +150 + 74) && (msY >= sY + 340) && (msY <= sY + 340 + 52)) { PutString2(msX +20, msY +35, DRAW_DIALOGBOX_SOLDIER8, 255,255,255);//"Help for teleport" } break; } switch (m_stDialogBoxInfo[38].cMode) { case 0: // Main case 1: // TP szX = NULL; szY = NULL; MapSzX = NULL; MapSzY = NULL; if (strcmp(m_cStatusMapName, "aresden") == 0) { szX = 250; szY = 250; }else if (strcmp(m_cStatusMapName, "elvine") == 0) { szX = 250; szY = 250; }else if (strcmp(m_cStatusMapName, "middleland") == 0) { szX = 279; szY = 280; // Fix for ML MapSzX = 524; // Fix for ML MapSzY = 524; // Fix for ML } if (szX != 0) { for (int i = 0; i < MAXCRUSADESTRUCTURES; i++) if (m_stCrusadeStructureInfo[i].cType == 42) { dV1 = (double)MapSzX; dV2 = (double)m_stCrusadeStructureInfo[i].sX; dV3 = (dV2*(double)szX)/dV1; tX = (int)dV3; dV1 = (double)MapSzY; dV2 = (double)m_stCrusadeStructureInfo[i].sY; dV3 = (dV2*(double)szY)/dV1; tY = (int)dV3; switch (m_stCrusadeStructureInfo[i].cType) { case 42: DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 40); // ManaStone break; } } if (m_iTeleportLocX != -1) { dV1 = (double)MapSzX; dV2 = (double)m_iTeleportLocX; dV3 = (dV2*(double)szX)/dV1; tX = (int)dV3; dV1 = (double)MapSzY; dV2 = (double)m_iTeleportLocY; dV3 = (dV2*(double)szY)/dV1; tY = (int)dV3; DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 42, FALSE, TRUE); //TP } if (strcmp(m_cMapName, "middleland") == 0) { dV1 = (double)MapSzX;//m_pMapData->m_sMapSizeX; dV2 = (double)m_sPlayerX; dV3 = (dV2*(double)szX)/dV1; tX = (int)dV3; dV1 = (double)MapSzY;//m_pMapData->m_sMapSizeY; dV2 = (double)m_sPlayerY; dV3 = (dV2*(double)szY)/dV1; tY = (int)dV3; DrawNewDialogBox(SPRID_INTERFACE_ND_CRUSADE, sX +tX + 15, sY +tY + 60, 43); // Player place } } if ( (msX >= sX + 15) && (msX <= sX + 15 +278) && (msY >= sY + 60) && (msY <= sY + 60 +272)) // Draw mouse coordinates { dV1 = (double)(msX - (sX + 15)); dV2 = (double)MapSzX;//(752.0f); dV3 = (dV2*dV1)/szX;//280.0f; tX = (int)dV3; dV1 = (double)(msY - (sY + 60)); dV2 = (double)MapSzX;//(680.0f); dV3 = (dV2*dV1)/szY;//253.0f; tY = (int)dV3; if (tX < 30) tX = 30; if (tY < 30) tY = 30; if (tX > MapSzX-30) tX = MapSzX-30; if (tY > MapSzY-30) tY = MapSzY-30; wsprintf(G_cTxt, "%d,%d", tX, tY); PutString_SprFont3(msX + 10, msY -10, G_cTxt, m_wR[13]*4, m_wG[13]*4, m_wB[13]*4, FALSE, 2); } break; } } void CGame::GrandMagicResult(char *pMapName, int iV1, int iV2, int iV3, int iV4, int iHP1, int iHP2, int iHP3, int iHP4) {int i, iTxtIdx=0; char cTemp[120]; for (i = 0; i < TEXTDLGMAXLINES; i++) { if (m_pMsgTextList[i] != NULL) delete m_pMsgTextList[i]; m_pMsgTextList[i] = NULL; } if (strcmp(pMapName, "aresden") == 0) { m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE2, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE3, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, " ", NULL); ZeroMemory(cTemp, sizeof(cTemp)); wsprintf(cTemp, "%s %d", CRUSADE_MESSAGE4, iV1); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, cTemp, NULL); ZeroMemory(cTemp, sizeof(cTemp)); wsprintf(cTemp, "%s %d", CRUSADE_MESSAGE5, iV2); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, cTemp, NULL); ZeroMemory(cTemp, sizeof(cTemp)); wsprintf(cTemp, "%s %d", CRUSADE_MESSAGE6, iV3); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, cTemp, NULL); ZeroMemory(cTemp, sizeof(cTemp)); wsprintf(cTemp, "%s %d", CRUSADE_MESSAGE58, iV4); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, cTemp, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, " ", NULL); ZeroMemory(cTemp, sizeof(cTemp)); wsprintf(cTemp, "%s %d %d %d %d", NOTIFY_MSG_STRUCTURE_HP, iHP1,iHP2,iHP3,iHP4); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, cTemp, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, " ", NULL); if (iV2 == 0) { PlaySound('E', 25, 0, 0); if(m_side == ELVINE) { m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE59, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE60, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE61, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE62, NULL); for (i = iTxtIdx; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); } else if (m_side == ARESDEN) { m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE69, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE70, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE71, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE72, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE73, NULL); for (i = iTxtIdx; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); } }else { if (iV1 != 0) { if(m_side == ELVINE) { PlaySound('E', 23, 0, 0); PlaySound('C', 21, 0, 0); PlaySound('C', 22, 0, 0); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE63, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE64, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE65, NULL); for (i = iTxtIdx; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); }else if (m_side == ARESDEN) { PlaySound('E', 24, 0, 0); PlaySound('C', 12, 0, 0); PlaySound('C', 13, 0, 0); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE74, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE75, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE76, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE77, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE78, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE79, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE80, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE81, NULL); for (i = iTxtIdx; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); }else PlaySound('E', 25, 0, 0); }else { if(m_side == ELVINE) { PlaySound('E', 23, 0, 0); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE66, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE67, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE68, NULL); for (i = iTxtIdx; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); }else if (m_side == ARESDEN) { PlaySound('E', 24, 0, 0); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE82, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE83, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE84, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE85, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE86, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE87, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE88, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE89, NULL); for (i = iTxtIdx; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); }else PlaySound('E', 25, 0, 0); } } }else if (strcmp(pMapName, "elvine") == 0) { m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE7, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE8, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, " ", NULL); ZeroMemory(cTemp, sizeof(cTemp)); wsprintf(cTemp, "%s %d", CRUSADE_MESSAGE4, iV1); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, cTemp, NULL); ZeroMemory(cTemp, sizeof(cTemp)); wsprintf(cTemp, "%s %d", CRUSADE_MESSAGE5, iV2); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, cTemp, NULL); ZeroMemory(cTemp, sizeof(cTemp)); wsprintf(cTemp, "%s %d", CRUSADE_MESSAGE6, iV3); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, cTemp, NULL); ZeroMemory(cTemp, sizeof(cTemp)); wsprintf(cTemp, "%s %d", CRUSADE_MESSAGE58, iV4); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, cTemp, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, " ", NULL); ZeroMemory(cTemp, sizeof(cTemp)); wsprintf(cTemp, "%s %d %d %d %d", NOTIFY_MSG_STRUCTURE_HP, iHP1,iHP2,iHP3,iHP4); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, cTemp, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, " ", NULL); if (iV2 == 0) { if (m_side == ARESDEN) { PlaySound('E', 25, 0, 0); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE59, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE60, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE61, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE62, NULL); for (i = iTxtIdx; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); }else if (m_side == ELVINE) { PlaySound('E', 25, 0, 0); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE69, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE70, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE71, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE72, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE73, NULL); for (i = iTxtIdx; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); }else PlaySound('E', 25, 0, 0); }else { if (iV1 != 0) { if (m_side == ARESDEN) { PlaySound('E', 23, 0, 0); PlaySound('C', 21, 0, 0); PlaySound('C', 22, 0, 0); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE63, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE64, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE65, NULL); for (i = iTxtIdx; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); }else if (m_side == ELVINE) { PlaySound('E', 24, 0, 0); PlaySound('C', 12, 0, 0); PlaySound('C', 13, 0, 0); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE74, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE75, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE76, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE77, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE78, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE79, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE80, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE81, NULL); for (i = iTxtIdx; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); }else PlaySound('E', 25, 0, 0); }else { if ( (TRUE) && (m_side == ARESDEN) ) { PlaySound('E', 23, 0, 0); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE66, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE67, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE68, NULL); for (i = iTxtIdx; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); } else if ( (TRUE) && (m_side == ELVINE) ) { PlaySound('E', 24, 0, 0); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE82, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE83, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE84, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE85, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE86, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE87, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE88, NULL); m_pMsgTextList[iTxtIdx++] = new class CMsg(NULL, CRUSADE_MESSAGE89, NULL); for (i = iTxtIdx; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); }else PlaySound('E', 25, 0, 0); } } } EnableDialogBox(18, NULL, NULL, NULL); } void CGame::DrawDialogBox_Help(int msX, int msY) { short sX, sY, szX; sX = m_stDialogBoxInfo[35].sX; sY = m_stDialogBoxInfo[35].sY; szX = m_stDialogBoxInfo[35].sSizeX; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*0) && (msY < sY +50+15*1)) PutAlignedString(sX, sX+szX, sY + 50 +15*0, DRAW_DIALOGBOX_HELP2, 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*0, DRAW_DIALOGBOX_HELP2, 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*1) && (msY < sY +50+15*2)) PutAlignedString(sX, sX+szX, sY + 50 +15*1, DRAW_DIALOGBOX_HELP1, 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*1, DRAW_DIALOGBOX_HELP1, 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*2) && (msY < sY +50+15*3)) PutAlignedString(sX, sX+szX, sY + 50 +15*2, DRAW_DIALOGBOX_HELP3, 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*2, DRAW_DIALOGBOX_HELP3, 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*3) && (msY < sY +50+15*4)) PutAlignedString(sX, sX+szX, sY + 50 +15*3, DRAW_DIALOGBOX_HELP4, 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*3, DRAW_DIALOGBOX_HELP4, 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*4) && (msY < sY +50+15*5)) PutAlignedString(sX, sX+szX, sY + 50 +15*4, DRAW_DIALOGBOX_HELP5, 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*4, DRAW_DIALOGBOX_HELP5, 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*5) && (msY < sY +50+15*6)) PutAlignedString(sX, sX+szX, sY + 50 +15*5, DRAW_DIALOGBOX_HELP6, 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*5, DRAW_DIALOGBOX_HELP6, 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*6) && (msY < sY +50+15*7)) PutAlignedString(sX, sX+szX, sY + 50 +15*6, DRAW_DIALOGBOX_HELP7, 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*6, DRAW_DIALOGBOX_HELP7, 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*7) && (msY < sY +50+15*8)) PutAlignedString(sX, sX+szX, sY + 50 +15*7, DRAW_DIALOGBOX_HELP8, 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*7, DRAW_DIALOGBOX_HELP8, 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*8) && (msY < sY +50+15*9)) PutAlignedString(sX, sX+szX, sY + 50 +15*8, DRAW_DIALOGBOX_HELP9, 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*8, DRAW_DIALOGBOX_HELP9, 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*9) && (msY < sY +50+15*10)) PutAlignedString(sX, sX+szX, sY + 50 +15*9, DRAW_DIALOGBOX_HELP10, 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*9, DRAW_DIALOGBOX_HELP10, 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*10) && (msY < sY +50+15*11)) PutAlignedString(sX, sX+szX, sY + 50 +15*10, DRAW_DIALOGBOX_HELP11, 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*10, DRAW_DIALOGBOX_HELP11, 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*11) && (msY < sY +50+15*12)) PutAlignedString(sX, sX+szX, sY + 50 +15*11,DRAW_DIALOGBOX_HELP12, 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*11,DRAW_DIALOGBOX_HELP12, 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*12) && (msY < sY +50+15*13)) PutAlignedString(sX, sX+szX, sY + 50 +15*12,"F.A.Q.", 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*12,"F.A.Q.", 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*13) && (msY < sY +50+15*14)) PutAlignedString(sX, sX+szX, sY + 50 +15*13,DRAW_DIALOGBOX_HELP13, 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*13,DRAW_DIALOGBOX_HELP13, 4, 0, 50); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); } void CGame::DrawDialogBox_ItemUpgrade(int msX, int msY) {int i, sX, sY, iValue; char cItemColor, cStr1[120], cStr2[120], cStr3[120]; DWORD dwTime = timeGetTime(); sX = m_stDialogBoxInfo[34].sX; sY = m_stDialogBoxInfo[34].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 0); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT , sX, sY, 5); //Item Upgrade Text switch (m_stDialogBoxInfo[34].cMode) { case 1://Gizon box Drag item needed to be upgraded" DrawNewDialogBox(SPRID_INTERFACE_ND_GAME3, sX, sY, 3); PutAlignedString(sX + 24, sX + 248, sY + 20 + 30, DRAW_DIALOGBOX_ITEMUPGRADE1); // Drag item needed to be upgraded" PutAlignedString(sX + 24, sX + 248, sY + 20 + 45, DRAW_DIALOGBOX_ITEMUPGRADE2); // "from the inventory. Then press" PutAlignedString(sX + 24, sX + 248, sY + 20 + 60, DRAW_DIALOGBOX_ITEMUPGRADE3); // 'Upgrade' button." DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 46); wsprintf(G_cTxt, DRAW_DIALOGBOX_ITEMUPGRADE11, m_iGizonItemUpgradeLeft); // "Item upgrade point : %d" PutAlignedString(sX + 24, sX + 248, sY + 100, G_cTxt); if (m_stDialogBoxInfo[34].sV1 != -1) { DrawNewDialogBox(SPRID_INTERFACE_ND_GAME3, sX, sY, 3); iValue = (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_dwAttribute & 0xF0000000) >> 28; iValue = iValue*(iValue+6)/8 + 2; if ( (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos >= 11) && (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cItemType == 1)) { if( (memcmp(m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cName, "AngelicPendant(STR)", 19) == 0) || (memcmp(m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cName, "AngelicPendant(DEX)", 19) == 0) || (memcmp(m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cName, "AngelicPendant(INT)", 19) == 0) || (memcmp(m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cName, "AngelicPendant(MAG)", 19) == 0)) { iValue = (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_dwAttribute & 0xF0000000) >> 28; switch (iValue) { case 0: iValue = 6; break; case 1: iValue = 8; break; case 2: iValue = 10; break; case 3: iValue = 13; break; case 4: iValue = 16; break; case 5: iValue = 20; break; case 6: iValue = 24; break; case 7: iValue = 29; break; case 8: iValue = 34; break; case 9: iValue = 39; break; case 10: iValue = 44; break; case 11: iValue = 49; break; case 12: iValue = 54; break; case 13: iValue = 59; break; case 14: iValue = 64; break; } } } wsprintf( G_cTxt, DRAW_DIALOGBOX_ITEMUPGRADE12, iValue ); //"Needed upgrade point : %d" if( m_iGizonItemUpgradeLeft < iValue ) PutAlignedString(sX + 24, sX + 248, sY + 115, G_cTxt, 195,25,25); else PutAlignedString(sX + 24, sX + 248, sY + 115, G_cTxt); i = m_stDialogBoxInfo[34].sV1; cItemColor = m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cItemColor; if ( (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_LHAND) || (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_RHAND) || (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_TWOHAND)) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSprite]->PutSpriteRGB(sX + 134, sY +182, m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSpriteFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], dwTime); }else { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSprite]->PutSpriteRGB(sX + 134, sY +182, m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSpriteFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], dwTime); } ZeroMemory(cStr1, sizeof(cStr1)); ZeroMemory(cStr2, sizeof(cStr2)); ZeroMemory(cStr3, sizeof(cStr3)); GetItemName(m_pItemList[m_stDialogBoxInfo[34].sV1], cStr1, cStr2, cStr3); PutAlignedString(sX + 24, sX + 248, sY +230 +20, cStr1); PutAlignedString(sX + 24, sX + 248, sY +245 +20, cStr2); PutAlignedString(sX + 24, sX + 248, sY +260 +20, cStr3); if( m_iGizonItemUpgradeLeft < iValue ) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 46); else { if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY +BTNPOSY, 47); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY +BTNPOSY, 46); } } else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 46); // Cancel if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 17); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 16); break; case 2: // in progress PutAlignedString(sX + 24, sX + 248, sY + 55 + 30 + 282 -117 -170, DRAW_DIALOGBOX_ITEMUPGRADE5); PutAlignedString(sX + 24, sX + 248, sY + 55 + 45 + 282 -117 -170, DRAW_DIALOGBOX_ITEMUPGRADE6); if (m_stDialogBoxInfo[34].sV1 != -1) { DrawNewDialogBox(SPRID_INTERFACE_ND_GAME3, sX, sY, 3); i = m_stDialogBoxInfo[34].sV1; cItemColor = m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cItemColor; if ( (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_LHAND) || (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_RHAND) || (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_TWOHAND)) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSprite]->PutSpriteRGB(sX + 134, sY +182 , m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSpriteFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], dwTime); }else { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSprite]->PutSpriteRGB(sX + 134, sY +182 , m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSpriteFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], dwTime); } if ((rand() % 5) == 0) m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSprite]->PutTransSprite25(sX + 134, sY +182, m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSpriteFrame, dwTime); ZeroMemory(cStr1, sizeof(cStr1)); ZeroMemory(cStr2, sizeof(cStr2)); ZeroMemory(cStr3, sizeof(cStr3)); GetItemName(m_pItemList[m_stDialogBoxInfo[34].sV1], cStr1, cStr2, cStr3); PutAlignedString(sX + 24, sX + 248, sY +230 +20, cStr1); PutAlignedString(sX + 24, sX + 248, sY +245 +20, cStr2); PutAlignedString(sX + 24, sX + 248, sY +260 +20, cStr3); } if (((dwTime - m_stDialogBoxInfo[34].dwV1)/1000 > 4) && (m_stDialogBoxInfo[34].dwV1 != NULL)) { m_stDialogBoxInfo[34].dwV1 = NULL; bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_UPGRADEITEM, NULL, m_stDialogBoxInfo[34].sV1, NULL, NULL, NULL); } break; case 3: // Congratulations PutAlignedString(sX + 24, sX + 248, sY + 55 + 30 + 282 -117 -170, DRAW_DIALOGBOX_ITEMUPGRADE7);//"Congratulation! item upgrade" PutAlignedString(sX + 24, sX + 248, sY + 55 + 45 + 282 -117 -170, DRAW_DIALOGBOX_ITEMUPGRADE8);//"has been succeeded." if (m_stDialogBoxInfo[34].sV1 != -1) { DrawNewDialogBox(SPRID_INTERFACE_ND_GAME3, sX, sY, 3); i = m_stDialogBoxInfo[34].sV1; cItemColor = m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cItemColor; if ( (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_LHAND) || (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_RHAND) || (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_TWOHAND)) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSprite]->PutSpriteRGB(sX + 134, sY +182 , m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSpriteFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], dwTime); }else { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSprite]->PutSpriteRGB(sX + 134, sY +182 , m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSpriteFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], dwTime); } ZeroMemory(cStr1, sizeof(cStr1)); ZeroMemory(cStr2, sizeof(cStr2)); ZeroMemory(cStr3, sizeof(cStr3)); GetItemName(m_pItemList[m_stDialogBoxInfo[34].sV1], cStr1, cStr2, cStr3); PutAlignedString(sX + 24, sX + 248, sY +230 +20, cStr1); PutAlignedString(sX + 24, sX + 248, sY +245 +20, cStr2); PutAlignedString(sX + 24, sX + 248, sY +260 +20, cStr3); } // OK if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 4: // Failed PutAlignedString(sX + 24, sX + 248, sY + 55 + 30 + 282 -117 -170, DRAW_DIALOGBOX_ITEMUPGRADE9);//"Item upgrade has failed." if ((m_stDialogBoxInfo[34].sV1 != -1) && (m_pItemList[m_stDialogBoxInfo[34].sV1] == NULL)) { PlaySound('E', 24, 0, 0); m_stDialogBoxInfo[34].cMode = 7; return; } if (m_stDialogBoxInfo[34].sV1 != -1) { DrawNewDialogBox(SPRID_INTERFACE_ND_GAME3, sX, sY, 3); i = m_stDialogBoxInfo[34].sV1; cItemColor = m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cItemColor; if ( (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_LHAND) || (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_RHAND) || (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_TWOHAND)) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSprite]->PutSpriteRGB(sX + 134, sY +182 , m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSpriteFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], dwTime); }else { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSprite]->PutSpriteRGB(sX + 134, sY +182 , m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSpriteFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], dwTime); } ZeroMemory(cStr1, sizeof(cStr1)); ZeroMemory(cStr2, sizeof(cStr2)); ZeroMemory(cStr3, sizeof(cStr3)); GetItemName(m_pItemList[m_stDialogBoxInfo[34].sV1], cStr1, cStr2, cStr3); PutAlignedString(sX + 24, sX + 248, sY +230 +20, cStr1); PutAlignedString(sX + 24, sX + 248, sY +245 +20, cStr2); PutAlignedString(sX + 24, sX + 248, sY +260 +20, cStr3); } // OK if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 5: // select Stone/ Gizon PutAlignedString(sX + 24, sX + 248, sY + 20 + 45, DRAW_DIALOGBOX_ITEMUPGRADE13); // "Select which kind of items to upgrade." if ((msX > sX +24) && (msX < sX +248) && (msY > sY +100) && (msY < sY +115)) { PutAlignedString(sX + 24, sX + 248, sY + 100, DRAW_DIALOGBOX_ITEMUPGRADE14, 255,255,255); // "Normal item upgrade" PutAlignedString(sX + 24, sX + 248, sY + 150, DRAW_DIALOGBOX_ITEMUPGRADE16); // "Upgrading a normal item." PutAlignedString(sX + 24, sX + 248, sY + 165, DRAW_DIALOGBOX_ITEMUPGRADE17); // "With upgrading weapon" PutAlignedString(sX + 24, sX + 248, sY + 180, DRAW_DIALOGBOX_ITEMUPGRADE18); // "items, Stone of Xelima" PutAlignedString(sX + 24, sX + 248, sY + 195, DRAW_DIALOGBOX_ITEMUPGRADE19); // "is needed. With upgrading" PutAlignedString(sX + 24, sX + 248, sY + 210, DRAW_DIALOGBOX_ITEMUPGRADE20); // "armor items, Stone of" PutAlignedString(sX + 24, sX + 248, sY + 225, DRAW_DIALOGBOX_ITEMUPGRADE21); // "Merien is needed." PutAlignedString(sX + 24, sX + 248, sY + 255, DRAW_DIALOGBOX_ITEMUPGRADE26); // "* Majestic items cannot be" PutAlignedString(sX + 24, sX + 248, sY + 270, DRAW_DIALOGBOX_ITEMUPGRADE27); // "upgraded with this performance." }else PutAlignedString(sX + 24, sX + 248, sY + 100, DRAW_DIALOGBOX_ITEMUPGRADE14, 4,0,50); // "Normal item upgrade" if ((msX > sX +24) && (msX < sX +248) && (msY > sY +120) && (msY < sY +135)) { PutAlignedString(sX + 24, sX + 248, sY + 120, DRAW_DIALOGBOX_ITEMUPGRADE15, 255,255,255); // "Majestic item upgrade" PutAlignedString(sX + 24, sX + 248, sY + 150, DRAW_DIALOGBOX_ITEMUPGRADE22); // "Upgrading majestic items." PutAlignedString(sX + 24, sX + 248, sY + 165, DRAW_DIALOGBOX_ITEMUPGRADE23); // "In order to upgrade majestic items," PutAlignedString(sX + 24, sX + 248, sY + 180, DRAW_DIALOGBOX_ITEMUPGRADE24); // "enough upgrade points for" PutAlignedString(sX + 24, sX + 248, sY + 195, DRAW_DIALOGBOX_ITEMUPGRADE25); // "majestic items are required." PutAlignedString(sX + 24, sX + 248, sY + 225, DRAW_DIALOGBOX_ITEMUPGRADE28); // "* Normal items cannot be" PutAlignedString(sX + 24, sX + 248, sY + 240, DRAW_DIALOGBOX_ITEMUPGRADE29); // "upgraded with this performance." }else PutAlignedString(sX + 24, sX + 248, sY + 120, DRAW_DIALOGBOX_ITEMUPGRADE15, 4,0,50); // "Majestic item upgrade" // Cancel if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 17); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 16); break; case 6: // Stone upgrade DrawNewDialogBox(SPRID_INTERFACE_ND_GAME3, sX, sY, 3); PutAlignedString(sX + 24, sX + 248, sY + 20 + 30, DRAW_DIALOGBOX_ITEMUPGRADE31); // "After bring a normal item to" PutAlignedString(sX + 24, sX + 248, sY + 20 + 45, DRAW_DIALOGBOX_ITEMUPGRADE32); // PutAlignedString(sX + 24, sX + 248, sY + 20 + 60, DRAW_DIALOGBOX_ITEMUPGRADE33); // if( m_stDialogBoxInfo[34].sV2 == 0 ) { PutAlignedString(sX + 24, sX + 248, sY + 20 + 80, DRAW_DIALOGBOX_ITEMUPGRADE41, 195,25,25);//"You can upgrade only armor." }else { wsprintf(G_cTxt, DRAW_DIALOGBOX_ITEMUPGRADE34, m_stDialogBoxInfo[34].sV2);//"The number of upgrade(weapon): %d" PutAlignedString(sX + 24, sX + 248, sY + 20 + 80, G_cTxt); } if( m_stDialogBoxInfo[34].sV3 == 0 ) { PutAlignedString(sX + 24, sX + 248, sY + 20 + 95, DRAW_DIALOGBOX_ITEMUPGRADE42, 195,25,25);//"You can upgrade only weapon." }else { wsprintf(G_cTxt, DRAW_DIALOGBOX_ITEMUPGRADE35, m_stDialogBoxInfo[34].sV3);//"The number of upgrade(armor): %d" PutAlignedString(sX + 24, sX + 248, sY + 20 + 95, G_cTxt); } DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 46); if (m_stDialogBoxInfo[34].sV1 != -1) { DrawNewDialogBox(SPRID_INTERFACE_ND_GAME3, sX, sY, 3); i = m_stDialogBoxInfo[34].sV1; cItemColor = m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cItemColor; if ( (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_LHAND) || (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_RHAND) || (m_pItemList[m_stDialogBoxInfo[34].sV1]->m_cEquipPos == EQUIPPOS_TWOHAND)) { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSprite]->PutSpriteRGB(sX + 134, sY +182 , m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSpriteFrame, m_wWR[cItemColor] -m_wR[0], m_wWG[cItemColor] -m_wG[0], m_wWB[cItemColor] -m_wB[0], dwTime); }else { m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSprite]->PutSpriteRGB(sX + 134, sY +182 , m_pItemList[m_stDialogBoxInfo[34].sV1]->m_sSpriteFrame, m_wR[cItemColor] -m_wR[0], m_wG[cItemColor] -m_wG[0], m_wB[cItemColor] -m_wB[0], dwTime); } ZeroMemory(cStr1, sizeof(cStr1)); ZeroMemory(cStr2, sizeof(cStr2)); ZeroMemory(cStr3, sizeof(cStr3)); GetItemName(m_pItemList[m_stDialogBoxInfo[34].sV1], cStr1, cStr2, cStr3); PutAlignedString(sX + 24, sX + 248, sY +230 +20, cStr1); PutAlignedString(sX + 24, sX + 248, sY +245 +20, cStr2); PutAlignedString(sX + 24, sX + 248, sY +260 +20, cStr3); if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 47); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 46); } // Cancel if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 17); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 16); break; case 7: // lost item PutAlignedString(sX + 24, sX + 248, sY + 20 + 130, DRAW_DIALOGBOX_ITEMUPGRADE36);//"Due to the failure of upgrade, the" PutAlignedString(sX + 24, sX + 248, sY + 20 + 145, DRAW_DIALOGBOX_ITEMUPGRADE37);//"item is gone. Try next time!" // OK if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 8: // impossible deja an max PutAlignedString(sX + 24, sX + 248, sY + 20 + 130, DRAW_DIALOGBOX_ITEMUPGRADE38);//"Upgrading the item is not possible any more." // OK if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 9: // impossible PutAlignedString(sX + 24, sX + 248, sY + 20 + 130, DRAW_DIALOGBOX_ITEMUPGRADE39);//"Upgrading the item is not possible." // OK if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; case 10: // plus de gizons PutAlignedString(sX + 24, sX + 248, sY + 20 + 130, DRAW_DIALOGBOX_ITEMUPGRADE40);//"A point to upgrade items is not present" // OK if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); break; } } LONG CGame::GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata) { HKEY hkey; LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey); if (retval == ERROR_SUCCESS) { long datasize = MAX_PATH; TCHAR data[MAX_PATH]; RegQueryValue(hkey, NULL, data, &datasize); lstrcpy(retdata,data); RegCloseKey(hkey); } return retval; } void CGame::GoHomepage() { LPCTSTR url; url = MSG_HOMEPAGE; int showcmd = SW_SHOW; char key[MAX_PATH + MAX_PATH]; SendMessage( G_hWnd, WM_ACTIVATEAPP, 0, 0 ); // First try ShellExecute() HINSTANCE result = ShellExecute(NULL, "open", url, NULL,NULL, showcmd); // If it failed, get the .htm regkey and lookup the program if ((UINT)result <= HINSTANCE_ERROR) { if (GetRegKey(HKEY_CLASSES_ROOT, ".htm", key) == ERROR_SUCCESS) { lstrcat(key, "\\shell\\open\\command"); if (GetRegKey(HKEY_CLASSES_ROOT,key,key) == ERROR_SUCCESS) { char *pos; pos = strstr(key, "\"%1\""); if (pos == NULL) // No quotes found { pos = strstr(key, "%1"); // Check for %1, without quotes if (pos == NULL) // No parameter at all... pos = key+lstrlen(key)-1; else *pos = '\0'; // Remove the parameter }else *pos = '\0'; // Remove the parameter lstrcat(pos, " "); lstrcat(pos, url); result = (HINSTANCE) WinExec(key,showcmd); } } } } // num : 1 - F2, 2 - F3 void CGame::UseShortCut( int num ) {int index; if( num < 3 ) index = num+1; else index = num+7; if(m_cGameMode != GAMEMODE_ONMAINGAME) return; if (m_bCtrlPressed == TRUE) { if (m_sRecentShortCut == -1) { AddEventList(MSG_SHORTCUT1, 10); wsprintf( G_cTxt, MSG_SHORTCUT2, index );// [F%d] AddEventList(G_cTxt, 10); wsprintf( G_cTxt, MSG_SHORTCUT3, index );// [Control]-[F%d] AddEventList(G_cTxt, 10); }else { m_sShortCut[num] = m_sRecentShortCut; if (m_sShortCut[num] < 100) { if (m_pItemList[m_sShortCut[num]] == NULL) { m_sShortCut[num] = -1; m_sRecentShortCut = -1; return; } char cStr1[64], cStr2[64], cStr3[64]; ZeroMemory(cStr1, sizeof(cStr1)); ZeroMemory(cStr2, sizeof(cStr2)); ZeroMemory(cStr3, sizeof(cStr3)); GetItemName(m_pItemList[m_sShortCut[num]], cStr1, cStr2, cStr3); wsprintf(G_cTxt, MSG_SHORTCUT4, cStr1, cStr2, cStr3, index);// (%s %s %s) [F%d] AddEventList(G_cTxt, 10); }else if (m_sShortCut[num] >= 100) { if (m_pMagicCfgList[m_sShortCut[num]-100] == NULL) { m_sShortCut[num] = -1; m_sRecentShortCut = -1; return; } wsprintf(G_cTxt, MSG_SHORTCUT5, m_pMagicCfgList[m_sShortCut[num]-100]->m_cName, index);// %s) [F%d] AddEventList(G_cTxt, 10); } } }else { if (m_sShortCut[num] == -1) { AddEventList(MSG_SHORTCUT1, 10); wsprintf( G_cTxt, MSG_SHORTCUT2, index );// [F%d] AddEventList(G_cTxt, 10); wsprintf( G_cTxt, MSG_SHORTCUT3, index );// [Control]-[F%d] AddEventList(G_cTxt, 10); }else if (m_sShortCut[num] < 100) { ItemEquipHandler((char)m_sShortCut[num]); } else if (m_sShortCut[num] >= 100) UseMagic(m_sShortCut[num]-100); } } int CGame::iGetManaCost(int iMagicNo) { int i, iManaSave, iManaCost; iManaSave = 0; if( iMagicNo < 0 || iMagicNo >= 100 ) return 1; for( i=0; i<MAXITEMS ; i++ ) { if( m_pItemList[i] == NULL ) continue; if( m_bIsItemEquipped[i] == TRUE ) { if( strcmp( m_pItemList[i]->m_cName, "MagicWand(MS10)" ) == 0) iManaSave += 10; else if( strcmp( m_pItemList[i]->m_cName, "MagicWand(MS20)" ) == 0) iManaSave += 20; else if( strcmp( m_pItemList[i]->m_cName, "MagicWand(MS30-LLF)" ) == 0) iManaSave += 30; else if( strcmp( m_pItemList[i]->m_cName, "WizMagicWand(MS10)" ) == 0) iManaSave += 10; else if( strcmp( m_pItemList[i]->m_cName, "WizMagicWand(MS20)" ) == 0) iManaSave += 20; else if( strcmp( m_pItemList[i]->m_cName, "MagicNecklace(MS10)" ) == 0) iManaSave += 10; else if( strcmp( m_pItemList[i]->m_cName, "MagicNecklace(MS12)" ) == 0) iManaSave += 12; else if( strcmp( m_pItemList[i]->m_cName, "MagicNecklace(MS14)" ) == 0) iManaSave += 14; else if( strcmp( m_pItemList[i]->m_cName, "MagicNecklace(MS16)" ) == 0) iManaSave += 16; else if( strcmp( m_pItemList[i]->m_cName, "MagicNecklace(MS18)" ) == 0) iManaSave += 18; else if( strcmp( m_pItemList[i]->m_cName, "DMMagicStaff" ) == 0) iManaSave += 22; else if( strcmp( m_pItemList[i]->m_cName, "DMMagicWand" ) == 0) iManaSave += 25; else if( strcmp( m_pItemList[i]->m_cName, "BlackMageTemple" ) == 0) iManaSave += 28; else if( strcmp( m_pItemList[i]->m_cName, "NecklaceOfLiche") ==0) iManaSave += 20; else if( strcmp( m_pItemList[i]->m_cName, "BerserkWand(MS.20)" ) == 0) iManaSave += 20; else if( strcmp( m_pItemList[i]->m_cName, "BerserkWand(MS.10)" ) == 0) iManaSave += 10; else if( strcmp( m_pItemList[i]->m_cName, "KlonessWand(MS.20)" ) == 0) iManaSave += 20; else if( strcmp( m_pItemList[i]->m_cName, "KlonessWand(MS.10)" ) == 0) iManaSave += 10; else if( strcmp( m_pItemList[i]->m_cName, "ResurWand(MS.20)" ) == 0) iManaSave += 20; else if( strcmp( m_pItemList[i]->m_cName, "ResurWand(MS.10)" ) == 0) iManaSave += 10; } } iManaCost = m_pMagicCfgList[iMagicNo]->m_sValue1; if (m_bIsSafeAttackMode) iManaCost *= 1.1; if (iManaSave > 0) { double dV1 = (double)iManaSave; double dV2 = (double)(dV1 / 100.0f); double dV3 = (double)iManaCost; dV1 = dV2 * dV3; dV2 = dV3 - dV1; iManaCost = (int)dV2; } if( iManaCost < 1 ) iManaCost = 1; return iManaCost; } void CGame::UseMagic(int iMagicNo) { char cTemp[100]; if( iMagicNo < 0 || iMagicNo >= MAXMAGICTYPE ) return; if ((m_cMagicMastery[iMagicNo] == NULL) || (m_pMagicCfgList[iMagicNo] == NULL)) return; // Casting if (m_iHP <= 0) return; if (m_bIsGetPointingMode == TRUE) return; if (iGetManaCost(iMagicNo) > m_iMP) return; if (_bIsItemOnHand() == TRUE) { AddEventList(DLGBOX_CLICK_MAGIC1, 10); return; } if (m_bSkillUsingStatus == TRUE) { AddEventList(DLGBOX_CLICK_MAGIC2, 10); return; } if (m_magicDisabled[iMagicNo]){ wsprintf(cTemp, NOTIFYMSG_SPELLDISABLED, m_pMagicCfgList[iMagicNo]->m_cName); AddEventList(cTemp, 10); return; } if ((m_sPlayerAppr2 & 0xF000) == 0) bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_TOGGLECOMBATMODE, NULL, NULL, NULL, NULL, NULL); m_cCommand = OBJECTMAGIC; m_iCastingMagicType = iMagicNo; m_sMagicShortCut = iMagicNo; m_sRecentShortCut = iMagicNo + 100; m_iPointCommandType = iMagicNo + 100; //m_bIsGetPointingMode = TRUE; DisableDialogBox(3); } void CGame::ReleaseEquipHandler(char cEquipPos) { char cStr1[64], cStr2[64], cStr3[64]; if( m_sItemEquipmentStatus[cEquipPos] < 0 ) return; // Remove Angelic Stats if ( (cEquipPos >= 11) && (m_pItemList[m_sItemEquipmentStatus[cEquipPos]]->m_cItemType == 1)) { char cItemID = m_sItemEquipmentStatus[cEquipPos]; if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(STR)", 19) == 0) { m_angelStat[STAT_STR] = 0; }else if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(DEX)", 19) == 0) { m_angelStat[STAT_DEX] = 0; }else if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(INT)", 19) == 0) { m_angelStat[STAT_INT] = 0; }else if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(MAG)", 19) == 0) { m_angelStat[STAT_MAG] = 0; } } GetItemName(m_pItemList[m_sItemEquipmentStatus[cEquipPos]], cStr1, cStr2, cStr3); wsprintf(G_cTxt, ITEM_EQUIPMENT_RELEASED, cStr1); AddEventList(G_cTxt, 10); m_bIsItemEquipped[m_sItemEquipmentStatus[cEquipPos]] = FALSE; m_sItemEquipmentStatus[cEquipPos] = -1; } void CGame::ItemEquipHandler(char cItemID) { if (bCheckItemOperationEnabled(cItemID) == FALSE) return; if (m_bIsItemEquipped[cItemID] == TRUE) return; if (m_pItemList[cItemID]->m_cEquipPos == EQUIPPOS_NONE) { AddEventList(BITEMDROP_CHARACTER3, 10);//"The item is not available." return; } if ( m_pItemList[cItemID]->m_wCurLifeSpan == 0 ) { AddEventList(BITEMDROP_CHARACTER1, 10); //"The item is exhausted. Fix it to use it." return; } if (m_pItemList[cItemID]->m_wWeight / 100 > m_stat[STAT_STR]) { AddEventList(BITEMDROP_CHARACTER2, 10); return; } if (((m_pItemList[cItemID]->m_dwAttribute & 0x00000001) == 0) && (m_pItemList[cItemID]->m_sLevelLimit > m_iLevel) ) { AddEventList(BITEMDROP_CHARACTER4, 10); return; } if (m_bSkillUsingStatus == TRUE) { AddEventList(BITEMDROP_CHARACTER5, 10); return; } if (m_pItemList[cItemID]->m_cGenderLimit != 0) { switch (m_sPlayerType) { case 1: case 2: case 3: if (m_pItemList[cItemID]->m_cGenderLimit != 1) { AddEventList(BITEMDROP_CHARACTER6, 10); return; } break; case 4: case 5: case 6: if (m_pItemList[cItemID]->m_cGenderLimit != 2) { AddEventList(BITEMDROP_CHARACTER7, 10); return; } break; } } if (m_armorDisabled && (m_pItemList[cItemID]->m_cEquipPos == EQUIPPOS_HEAD || m_pItemList[cItemID]->m_cEquipPos == EQUIPPOS_ARMS || m_pItemList[cItemID]->m_cEquipPos == EQUIPPOS_BODY || m_pItemList[cItemID]->m_cEquipPos == EQUIPPOS_PANTS)) { AddEventList(NOTIFYMSG_ARMORDISABLED, 10);//"Use of armors have been disabled." return; } if (m_shieldDisabled && m_pItemList[cItemID]->m_cEquipPos == EQUIPPOS_LHAND) { AddEventList(NOTIFYMSG_SHIELDDISABLED, 10);//"Shields have been disabled." return; } bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_EQUIPITEM, NULL, cItemID, NULL, NULL, NULL); m_sRecentShortCut = cItemID; ReleaseEquipHandler(m_pItemList[cItemID]->m_cEquipPos); switch( m_pItemList[cItemID]->m_cEquipPos ) { case EQUIPPOS_HEAD: case EQUIPPOS_BODY: case EQUIPPOS_ARMS: case EQUIPPOS_PANTS: case EQUIPPOS_BOOTS: case EQUIPPOS_BACK: ReleaseEquipHandler(EQUIPPOS_FULLBODY); break; case EQUIPPOS_FULLBODY: ReleaseEquipHandler(EQUIPPOS_HEAD); ReleaseEquipHandler(EQUIPPOS_BODY); ReleaseEquipHandler(EQUIPPOS_ARMS); ReleaseEquipHandler(EQUIPPOS_PANTS); ReleaseEquipHandler(EQUIPPOS_BOOTS); ReleaseEquipHandler(EQUIPPOS_BACK); break; case EQUIPPOS_LHAND: case EQUIPPOS_RHAND: ReleaseEquipHandler(EQUIPPOS_TWOHAND); break; case EQUIPPOS_TWOHAND: ReleaseEquipHandler(EQUIPPOS_RHAND); ReleaseEquipHandler(EQUIPPOS_LHAND); break; } m_sItemEquipmentStatus[ m_pItemList[cItemID]->m_cEquipPos ] = cItemID; m_bIsItemEquipped[cItemID] = TRUE; // Add Angelic Stats if ( (m_pItemList[cItemID]->m_cItemType == 1) && (m_pItemList[cItemID]->m_cEquipPos >= 11)) { int iAngelValue = 0; if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(STR)", 19) == 0) { iAngelValue = (m_pItemList[cItemID]->m_dwAttribute & 0xF0000000) >> 28; m_angelStat[STAT_STR] = 1 + iAngelValue; }else if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(DEX)", 19) == 0) { iAngelValue = (m_pItemList[cItemID]->m_dwAttribute & 0xF0000000) >> 28; m_angelStat[STAT_DEX] = 1 + iAngelValue; }else if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(INT)", 19) == 0) { iAngelValue = (m_pItemList[cItemID]->m_dwAttribute & 0xF0000000) >> 28; m_angelStat[STAT_INT] = 1 + iAngelValue; }else if(memcmp(m_pItemList[cItemID]->m_cName, "AngelicPendant(MAG)", 19) == 0) { iAngelValue = (m_pItemList[cItemID]->m_dwAttribute & 0xF0000000) >> 28; m_angelStat[STAT_MAG] = 1 + iAngelValue; } } char cStr1[64], cStr2[64], cStr3[64]; GetItemName(m_pItemList[cItemID], cStr1, cStr2, cStr3); wsprintf(G_cTxt, BITEMDROP_CHARACTER9, cStr1); AddEventList(G_cTxt, 10); PlaySound('E', 28, 0); } /********************************************************************************************************************* ** void CheckActiveAura(short sX, short sY, DWORD dwTime, short sOwnerType)( initially Cleroth fixed by Snoopy ) ** ** description : Generates special auras around players ** ** : v351 implements this in each drawn function,beter to regroup in single function. ** **********************************************************************************************************************/ void CGame::CheckActiveAura(short sX, short sY, DWORD dwTime, short sOwnerType) { // Used at the beginning of character drawing // DefenseShield if ((_tmp_iStatus & STATUS_DEFENSESHIELD) != 0) //m_pEffectSpr[80]->PutTransSprite(sX+75, sY+107, _tmp_iEffectFrame%17, dwTime); m_pEffectSpr[80]->PutTransSprite50(sX+75, sY+107, _tmp_iEffectFrame%17, dwTime); // Protection From Magic if ((_tmp_iStatus & STATUS_PFM) != 0) //m_pEffectSpr[79]->PutTransSprite(sX+101, sY+135, _tmp_iEffectFrame%15, dwTime); m_pEffectSpr[79]->PutTransSprite70(sX+101, sY+135, _tmp_iEffectFrame%15, dwTime); // Protection From Arrow if ((_tmp_iStatus & STATUS_PFA) != 0) //m_pEffectSpr[72]->PutTransSprite(sX, sY+35, _tmp_iEffectFrame%30, dwTime); m_pEffectSpr[72]->PutTransSprite70(sX, sY+35, _tmp_iEffectFrame%30, dwTime); // Illusion if ((_tmp_iStatus & STATUS_ILLUSION) != 0) //m_pEffectSpr[73]->PutTransSprite(sX+125, sY+95, _tmp_iEffectFrame%24, dwTime); m_pEffectSpr[73]->PutTransSprite70(sX+125, sY+130 - _iAttackerHeight[sOwnerType], _tmp_iEffectFrame%24, dwTime); // Illusion movement if ((_tmp_iStatus & STATUS_ILLUSIONMOVEMENT) != 0) //m_pEffectSpr[151]->PutTransSprite(sX+90, sY+55, _tmp_iEffectFrame%24, dwTime); m_pEffectSpr[151]->PutTransSprite70(sX+90, sY+90 - _iAttackerHeight[sOwnerType], _tmp_iEffectFrame%24, dwTime); // Slate red (HP) Flame au sol if ((_tmp_iStatus & STATUS_REDSLATE) != 0) //m_pEffectSpr[149]->PutTransSprite(sX+90, sY+120, _tmp_iEffectFrame%15, dwTime); m_pEffectSpr[149]->PutTransSprite70(sX+90, sY+120, _tmp_iEffectFrame%15, dwTime); // Slate Blue (Mana) Bleu au sol if ((_tmp_iStatus & STATUS_BLUESLATE) != 0) //m_pEffectSpr[150]->PutTransSprite(sX+1, sY+26, _tmp_iEffectFrame%15, dwTime); m_pEffectSpr[150]->PutTransSprite70(sX+1, sY+26, _tmp_iEffectFrame%15, dwTime); // Slate Green (XP) Mauve au sol if ((_tmp_iStatus & STATUS_GREENSLATE) != 0) //m_pEffectSpr[148]->PutTransSprite(sX, sY+32, _tmp_iEffectFrame%23, dwTime); m_pEffectSpr[148]->PutTransSprite70(sX, sY+32, _tmp_iEffectFrame%23, dwTime); // the ZZZ's if ((_tmp_iStatus & STATUS_AFK) != 0) m_pEffectSpr[85]->PutTransSprite70(sX+50, sY+30, _tmp_iEffectFrame%29, dwTime); if (_tmp_iStatus & STATUS_RELICHOLDER) { int framesNum = m_pEffectSpr[26]->m_iTotalFrame -4; m_pEffectSpr[26]->PutTransSprite(sX, sY, 4 + _tmp_iEffectFrame % framesNum , dwTime); m_pEffectSpr[26]->PutTransSprite70(sX, sY, 4 + (_tmp_iEffectFrame + framesNum/2) % framesNum , dwTime); // m_pEffectSpr[150]->PutTransSprite50(sX+1, sY+26, (_tmp_iEffectFrame+7)%15, dwTime); // m_pEffectSpr[148]->PutTransSprite50(sX, sY+32, (_tmp_iEffectFrame+15)%23, dwTime); } } /********************************************************************************************************************* ** void CheckActiveAura2(short sX, short sY, DWORD dwTime, _tmp_sOwnerType) ( initially Cleroth fixed by Snoopy ) ** ** description : Generates poison aura around players. This one should be use later... ** ** : v351 implements this in each drawn function,beter to regroup in single function. ** **********************************************************************************************************************/ void CGame::CheckActiveAura2(short sX, short sY, DWORD dwTime, short sOwnerType) { // Poison if ((_tmp_iStatus & STATUS_POISON) != 0) //m_pEffectSpr[81]->PutTransSprite(sX+115, sY+85, _tmp_iEffectFrame%21, dwTime); m_pEffectSpr[81]->PutTransSprite70(sX+115, sY+120 - _iAttackerHeight[sOwnerType], _tmp_iEffectFrame%21, dwTime); // _iAttackerHeight[] if ((m_bIsHeldenianMode) && (m_bIsHeldenianMap)) { if ((_tmp_iStatus & 0x00400000) != 0) // BloodyMantle m_pEffectSpr[107]->PutTransSprite70(sX-5, sY, _tmp_iEffectFrame%15, dwTime); else if ((_tmp_iStatus & 0x00800000) != 0) // Magic Mantle m_pEffectSpr[114]->PutTransSprite70(sX-5, sY, _tmp_iEffectFrame%15, dwTime); else if ((_tmp_iStatus & 0x00010000) != 0) // ArrowMantle m_pEffectSpr[115]->PutTransSprite70(sX-5, sY, _tmp_iEffectFrame%15, dwTime); else if ((_tmp_iStatus & 0x00020000) != 0) m_pEffectSpr[87]->PutTransSprite70(sX+53, sY+54, _tmp_iEffectFrame%29, dwTime); } } // 3.51 Level Up Dialog - Changes stats Using Majestic points - Diuuude void CGame::DrawDialogBox_ChangeStatsMajestic(short msX, short msY) { short sX, sY, szX; DWORD dwTime = m_dwCurTime; char cTxt[120]; int iStats; sX = m_stDialogBoxInfo[42].sX; sY = m_stDialogBoxInfo[42].sY; szX = m_stDialogBoxInfo[42].sSizeX; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 0); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 2); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME4, sX+16, sY+100, 4); PutAlignedString(sX, sX + szX, sY + 50, DRAW_DIALOGBOX_LEVELUP_SETTING14); PutAlignedString(sX, sX + szX, sY + 65, DRAW_DIALOGBOX_LEVELUP_SETTING15); // Majestic Points Left - Display in green if > 0 PutString(sX + 20, sY + 85, DRAW_DIALOGBOX_LEVELUP_SETTING16, RGB(0,0,0)); wsprintf(cTxt, "%d", m_iGizonItemUpgradeLeft); if (m_iGizonItemUpgradeLeft > 0) { PutString(sX + 73, sY + 102, cTxt, RGB(0,255,0)); }else { PutString(sX + 73, sY + 102, cTxt, RGB(0,0,0)); } // Display only MouseOver Button for - (+ is disabled) // Strength PutString(sX + 24, sY + 125, DRAW_DIALOGBOX_LEVELUP_SETTING4, RGB(5,5,5)); wsprintf(cTxt, "%d", m_stat[STAT_STR] - m_angelStat[STAT_STR]); PutString(sX + 109, sY + 125, cTxt, RGB(25,35,25)); iStats = m_stat[STAT_STR] + m_luStat[STAT_STR] - m_angelStat[STAT_STR]; wsprintf(cTxt, "%d", iStats); if (iStats < m_stat[STAT_STR] - m_angelStat[STAT_STR]) { PutString(sX + 162, sY + 125, cTxt, RGB(255,0,0)); }else { PutString(sX + 162, sY + 125, cTxt, RGB(25,35,25)); } if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 127) && (msY <= sY + 133)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 210, sY + 127, 6, dwTime); PutString(sX + 24, sY + 144, DRAW_DIALOGBOX_LEVELUP_SETTING5, RGB(5,5,5)); wsprintf(cTxt, "%d", m_stat[STAT_VIT]); PutString(sX + 109, sY + 144, cTxt, RGB(25,35,25)); iStats = m_stat[STAT_VIT] + m_luStat[STAT_VIT]; wsprintf(cTxt, "%d", iStats); if (iStats < m_stat[STAT_VIT]) { PutString(sX + 162, sY + 144, cTxt, RGB(255,0,0)); }else { PutString(sX + 162, sY + 144, cTxt, RGB(25,35,25)); } if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 146) && (msY <= sY + 152)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 210, sY + 146, 6, dwTime); // Dexterity PutString(sX + 24, sY + 163, DRAW_DIALOGBOX_LEVELUP_SETTING6, RGB(5,5,5)); wsprintf(cTxt, "%d", m_stat[STAT_DEX] - m_angelStat[STAT_DEX]); PutString(sX + 109, sY + 163, cTxt, RGB(25,35,25)); iStats = m_stat[STAT_DEX] + m_luStat[STAT_DEX] - m_angelStat[STAT_DEX]; wsprintf(cTxt, "%d", iStats); if (iStats < m_stat[STAT_DEX] - m_angelStat[STAT_DEX]) { PutString(sX + 162, sY + 163, cTxt, RGB(255,0,0)); }else { PutString(sX + 162, sY + 163, cTxt, RGB(25,35,25)); } if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 165) && (msY <= sY + 171)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 210, sY + 165, 6, dwTime); // Intelligence PutString(sX + 24, sY + 182, DRAW_DIALOGBOX_LEVELUP_SETTING7, RGB(5,5,5)); wsprintf(cTxt, "%d", m_stat[STAT_INT] - m_angelStat[STAT_INT]); PutString(sX + 109, sY + 182, cTxt, RGB(25,35,25)); iStats = m_stat[STAT_INT] + m_luStat[STAT_INT] - m_angelStat[STAT_INT]; wsprintf(cTxt, "%d", iStats); if (iStats < m_stat[STAT_INT] - m_angelStat[STAT_INT]) { PutString(sX + 162, sY + 182, cTxt, RGB(255,0,0)); }else { PutString(sX + 162, sY + 182, cTxt, RGB(25,35,25)); } if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 184) && (msY <= sY + 190)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 210, sY + 184, 6, dwTime); // Magic PutString(sX + 24, sY + 201, DRAW_DIALOGBOX_LEVELUP_SETTING8, RGB(5,5,5)); wsprintf(cTxt, "%d", m_stat[STAT_MAG] - m_angelStat[STAT_MAG]); PutString(sX + 109, sY + 201, cTxt, RGB(25,35,25)); iStats = m_stat[STAT_MAG] + m_luStat[STAT_MAG] - m_angelStat[STAT_MAG]; wsprintf(cTxt, "%d", iStats); if (iStats < m_stat[STAT_MAG] - m_angelStat[STAT_MAG]) { PutString(sX + 162, sY + 201, cTxt, RGB(255,0,0)); }else { PutString(sX + 162, sY + 201, cTxt, RGB(25,35,25)); } if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 203) && (msY <= sY + 209)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 210, sY + 203, 6, dwTime); // Charisma PutString(sX + 24, sY + 220, DRAW_DIALOGBOX_LEVELUP_SETTING9, RGB(5,5,5)); wsprintf(cTxt, "%d", m_stat[STAT_CHR]); PutString(sX + 109, sY + 220, cTxt, RGB(25,35,25)); iStats = m_stat[STAT_CHR] + m_luStat[STAT_CHR]; wsprintf(cTxt, "%d", iStats); if (iStats < m_stat[STAT_CHR]) { PutString(sX + 162, sY + 220, cTxt, RGB(255,0,0)); }else { PutString(sX + 162, sY + 220, cTxt, RGB(25,35,25)); } if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 222) && (msY <= sY + 228)) m_pSprite[SPRID_INTERFACE_ND_GAME4]->PutSpriteFast(sX + 210, sY + 222, 6, dwTime); if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 17); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 16); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); } // 3.51 LevelUp Box - Change stats using Majestic - Diuuude void CGame::DlgBoxClick_ChangeStatsMajestic(short msX, short msY) { short sX, sY; sX = m_stDialogBoxInfo[42].sX; sY = m_stDialogBoxInfo[42].sY; if ((cStateChange1 != 0) || (cStateChange2 != 0) || (cStateChange3 != 0)){ // Strength UP - Diuuude if ((msX >= sX + 195) && (msX <= sX + 205) && (msY >= sY + 127) && (msY <= sY + 133) && (m_luStat[STAT_STR] < 0)) { if (cStateChange1 == MJSTAT_STR) { cStateChange1 = 0; m_luStat[STAT_STR] += 1; m_iLU_Point -= 1; }else if (cStateChange2 == MJSTAT_STR) { cStateChange2 = 0; m_luStat[STAT_STR] += 1; m_iLU_Point -= 1; }else if (cStateChange3 == MJSTAT_STR) { cStateChange3 = 0; m_luStat[STAT_STR] += 1; m_iLU_Point -= 1; } PlaySound('E', 14, 5); } if ((msX >= sX + 195) && (msX <= sX + 205) && (msY >= sY + 146) && (msY <= sY + 152) && (m_luStat[STAT_VIT] < 0)) { if (cStateChange1 == MJSTAT_VIT) { cStateChange1 = 0; m_luStat[STAT_VIT] += 1; m_iLU_Point -= 1; }else if (cStateChange2 == MJSTAT_VIT) { cStateChange2 = 0; m_luStat[STAT_VIT] += 1; m_iLU_Point -= 1; }else if (cStateChange3 == MJSTAT_VIT) { cStateChange3 = 0; m_luStat[STAT_VIT] += 1; m_iLU_Point -= 1; } PlaySound('E', 14, 5); } // Dexterity UP - Diuuude if ((msX >= sX + 195) && (msX <= sX + 205) && (msY >= sY + 165) && (msY <= sY + 171) && (m_luStat[STAT_DEX] < 0)) { if (cStateChange1 == MJSTAT_DEX){ cStateChange1 = 0; m_luStat[STAT_DEX] += 1; m_iLU_Point -= 1; } else if (cStateChange2 == MJSTAT_DEX){ cStateChange2 = 0; m_luStat[STAT_DEX] += 1; m_iLU_Point -= 1; } else if (cStateChange3 == MJSTAT_DEX){ cStateChange3 = 0; m_luStat[STAT_DEX] += 1; m_iLU_Point -= 1; } PlaySound('E', 14, 5); } // Intelligence UP - Diuuude if ((msX >= sX + 195) && (msX <= sX + 205) && (msY >= sY + 184) && (msY <= sY + 190) && (m_luStat[STAT_INT] < 0)) { if (cStateChange1 == MJSTAT_INT){ cStateChange1 = 0; m_luStat[STAT_INT] += 1; m_iLU_Point -= 1; } else if (cStateChange2 == MJSTAT_INT){ cStateChange2 = 0; m_luStat[STAT_INT] += 1; m_iLU_Point -= 1; } else if (cStateChange3 == MJSTAT_INT){ cStateChange3 = 0; m_luStat[STAT_INT] += 1; m_iLU_Point -= 1; } PlaySound('E', 14, 5); } // Magic UP - Diuuude if ((msX >= sX + 195) && (msX <= sX + 205) && (msY >= sY + 203) && (msY <= sY + 209) && (m_luStat[STAT_MAG] < 0)) { if (cStateChange1 == MJSTAT_MAG){ cStateChange1 = 0; m_luStat[STAT_MAG] += 1; m_iLU_Point -= 1; } else if (cStateChange2 == MJSTAT_MAG){ cStateChange2 = 0; m_luStat[STAT_MAG] += 1; m_iLU_Point -= 1; } else if (cStateChange3 == MJSTAT_MAG){ cStateChange3 = 0; m_luStat[STAT_MAG] += 1; m_iLU_Point -= 1; } PlaySound('E', 14, 5); } // Charisma UP - Diuuude if ((msX >= sX + 195) && (msX <= sX + 205) && (msY >= sY + 222) && (msY <= sY + 228) && (m_luStat[STAT_CHR] < 0)) { if (cStateChange1 == MJSTAT_CHR){ cStateChange1 = 0; m_luStat[STAT_CHR] += 1; m_iLU_Point -= 1; } else if (cStateChange2 == MJSTAT_CHR){ cStateChange2 = 0; m_luStat[STAT_CHR] += 1; m_iLU_Point -= 1; } else if (cStateChange3 == MJSTAT_CHR){ cStateChange3 = 0; m_luStat[STAT_CHR] += 1; m_iLU_Point -= 1; } PlaySound('E', 14, 5); } } if ((cStateChange1 == 0) || (cStateChange2 == 0) || (cStateChange3 == 0) && (m_iGizonItemUpgradeLeft > 0)) { // Strength DOWN - Diuuude if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 127) && (msY <= sY + 133) && (m_stat[STAT_STR] > 10)) { if (cStateChange1 == 0) { cStateChange1 = MJSTAT_STR; m_luStat[STAT_STR] -= 1; m_iLU_Point += 1; }else if (cStateChange2 == 0) { cStateChange2 = MJSTAT_STR; m_luStat[STAT_STR] -= 1; m_iLU_Point += 1; }else { cStateChange3 = MJSTAT_STR; m_luStat[STAT_STR] -= 1; m_iLU_Point += 1; } PlaySound('E', 14, 5); } if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 146) && (msY <= sY + 152) && (m_stat[STAT_VIT] > 10)) { if (cStateChange1 == 0){ cStateChange1 = MJSTAT_VIT; m_luStat[STAT_VIT] -= 1; m_iLU_Point += 1; } else if (cStateChange2 == 0){ cStateChange2 = MJSTAT_VIT; m_luStat[STAT_VIT] -= 1; m_iLU_Point += 1; } else{ cStateChange3 = MJSTAT_VIT; m_luStat[STAT_VIT] -= 1; m_iLU_Point += 1; } PlaySound('E', 14, 5); } // Dexterity DOWN - Diuuude if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 165) && (msY <= sY + 171) && (m_stat[STAT_DEX] > 10)) { if (cStateChange1 == 0){ cStateChange1 = MJSTAT_DEX; m_luStat[STAT_DEX] -= 1; m_iLU_Point += 1; } else if (cStateChange2 == 0){ cStateChange2 = MJSTAT_DEX; m_luStat[STAT_DEX] -= 1; m_iLU_Point += 1; } else{ cStateChange3 = MJSTAT_DEX; m_luStat[STAT_DEX] -= 1; m_iLU_Point += 1; } PlaySound('E', 14, 5); } // Intelligence DOWN - Diuuude if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 184) && (msY <= sY + 190) && (m_stat[STAT_INT] > 10)) { if (cStateChange1 == 0) { cStateChange1 = MJSTAT_INT; m_luStat[STAT_INT] -= 1; m_iLU_Point += 1; }else if (cStateChange2 == 0) { cStateChange2 = MJSTAT_INT; m_luStat[STAT_INT] -= 1; m_iLU_Point += 1; }else { cStateChange3 = MJSTAT_INT; m_luStat[STAT_INT] -= 1; m_iLU_Point += 1; } PlaySound('E', 14, 5); } // Magic DOWN - Diuuude if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 203) && (msY <= sY + 209) && (m_stat[STAT_MAG] > 10)) { if (cStateChange1 == 0){ cStateChange1 = MJSTAT_MAG; m_luStat[STAT_MAG] -= 1; m_iLU_Point += 1; } else if (cStateChange2 == 0){ cStateChange2 = MJSTAT_MAG; m_luStat[STAT_MAG] -= 1; m_iLU_Point += 1; } else{ cStateChange3 = MJSTAT_MAG; m_luStat[STAT_MAG] -= 1; m_iLU_Point += 1; } PlaySound('E', 14, 5); } // Charisma DOWN - Diuuude if ((msX >= sX + 210) && (msX <= sX + 220) && (msY >= sY + 222) && (msY <= sY + 228) && (m_stat[STAT_CHR] > 10)) { if (cStateChange1 == 0){ cStateChange1 = MJSTAT_CHR; m_luStat[STAT_CHR] -= 1; m_iLU_Point += 1; } else if (cStateChange2 == 0){ cStateChange2 = MJSTAT_CHR; m_luStat[STAT_CHR] -= 1; m_iLU_Point += 1; } else{ cStateChange3 = MJSTAT_CHR; m_luStat[STAT_CHR] -= 1; m_iLU_Point += 1; } PlaySound('E', 14, 5); } }else { if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { // Send command to HG - Diuuude bSendCommand(MSGID_STATECHANGEPOINT, NULL, NULL, NULL, NULL, NULL, NULL); DisableDialogBox(42); PlaySound('E', 14, 5); } } if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { DisableDialogBox(42); PlaySound('E', 14, 5); } } void CGame::DrawAngel(int iSprite, short sX, short sY, char cFrame, DWORD dwTime) { if ((_tmp_iStatus & 0x1000) != 0) m_pSprite[SPRID_TUTELARYANGELS_PIVOTPOINT+iSprite]->PutSpriteFast(sX, sY, cFrame, dwTime); //AngelicPendant(STR) else if ((_tmp_iStatus & 0x2000) != 0) m_pSprite[SPRID_TUTELARYANGELS_PIVOTPOINT+(50*1)+iSprite]->PutSpriteFast(sX, sY, cFrame, dwTime); //AngelicPendant(DEX) else if ((_tmp_iStatus & 0x4000) != 0) m_pSprite[SPRID_TUTELARYANGELS_PIVOTPOINT+(50*2)+iSprite]->PutSpriteFast(sX, sY-20, cFrame, dwTime);//AngelicPendant(INT) else if ((_tmp_iStatus & 0x8000) != 0) m_pSprite[SPRID_TUTELARYANGELS_PIVOTPOINT+(50*3)+iSprite]->PutSpriteFast(sX, sY-20, cFrame, dwTime);//AngelicPendant(MAG) } /********************************************************************************************************************* ** int CGame::bHasHeroSet( short m_sAppr3, short m_sAppr3, char OwnerType) ( Snoopy ) ** ** description :: check weather the object (is character) is using a hero set (1:war, 2:mage) ** **********************************************************************************************************************/ int CGame::bHasHeroSet(short Appr3, short Appr4, char OwnerType) { char cArmor, cLeg, cBerk, cHat; cArmor = (Appr3 & 0xF000) >> 12; cLeg = (Appr3 & 0x0F00) >> 8; cHat = (Appr3 & 0x00F0) >> 4; cBerk = Appr3 & 0x000F; switch (OwnerType){ case 1: case 2: case 3: if ((cArmor == 8) &&(cLeg == 5)&&(cHat == 9) &&(cBerk == 3)) return (1); // Warr elv M if ((cArmor == 9) &&(cLeg == 6)&&(cHat == 10)&&(cBerk == 4)) return (1); // Warr ares M if ((cArmor == 10)&&(cLeg == 5)&&(cHat == 11)&&(cBerk == 3)) return (2); // Mage elv M if ((cArmor == 11)&&(cLeg == 6)&&(cHat == 12)&&(cBerk == 4)) return (2); // Mage ares M break; case 4: case 5: case 6: // fixed if ((cArmor == 9) &&(cLeg == 6)&&(cHat == 9) &&(cBerk == 4)) return (1); //warr elv W if ((cArmor == 10)&&(cLeg == 7)&&(cHat == 10)&&(cBerk == 5)) return (1); //warr ares W if ((cArmor == 11)&&(cLeg == 6)&&(cHat == 11)&&(cBerk == 4)) return (2); //mage elv W if ((cArmor == 12)&&(cLeg == 7)&&(cHat == 12)&&(cBerk == 5)) return (2); //mage ares W break; } return 0; } /********************************************************************************************************************* ** void ShowHeldenianVictory( short sSide) ( Snoopy ) ** ** description : Shows the Heldenian's End window ** **********************************************************************************************************************/ void CGame::ShowHeldenianVictory(short sSide) { int i; DisableDialogBox(18); for (i = 0; i < TEXTDLGMAXLINES; i++) { if (m_pMsgTextList[i] != NULL) delete m_pMsgTextList[i]; m_pMsgTextList[i] = NULL; } switch (m_side) { case 0: PlaySound('E', 25, 0, 0); m_pMsgTextList[0] = new class CMsg(NULL, "Heldenian holy war has been closed!", NULL); m_pMsgTextList[1] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[2] = new class CMsg(NULL, "Heldenian Holy war ended", NULL); m_pMsgTextList[3] = new class CMsg(NULL, "in a tie.", NULL); break; case 1: PlaySound('E', 25, 0, 0); m_pMsgTextList[0] = new class CMsg(NULL, "Heldenian holy war has been closed!", NULL); m_pMsgTextList[1] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[2] = new class CMsg(NULL, "Heldenian Holy war ended", NULL); m_pMsgTextList[3] = new class CMsg(NULL, "in favor of Aresden.", NULL); break; case 2: PlaySound('E', 25, 0, 0); m_pMsgTextList[0] = new class CMsg(NULL, "Heldenian holy war has been closed!", NULL); m_pMsgTextList[1] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[2] = new class CMsg(NULL, "Heldenian Holy war ended", NULL); m_pMsgTextList[3] = new class CMsg(NULL, "in favor of Elvine.", NULL); break; } m_pMsgTextList[4] = new class CMsg(NULL, " ", NULL); if ( ((m_side != 1) && (m_side != 2)) // Player not a normal citizen || (sSide == 0)) // or no winner { PlaySound('E', 25, 0, 0); m_pMsgTextList[5] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[6] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[7] = new class CMsg(NULL, " ", NULL); m_pMsgTextList[8] = new class CMsg(NULL, " ", NULL); }else { if (sSide == m_side) { PlaySound('E', 23, 0, 0); PlaySound('C', 21, 0, 0); PlaySound('C', 22, 0, 0); m_pMsgTextList[5] = new class CMsg(NULL, "Congratulations.", NULL); m_pMsgTextList[6] = new class CMsg(NULL, "As a victorious citizen,", NULL); m_pMsgTextList[7] = new class CMsg(NULL, "You will receive a reward.", NULL); m_pMsgTextList[8] = new class CMsg(NULL, " ", NULL); }else { PlaySound('E', 24, 0, 0); PlaySound('C', 12, 0, 0); PlaySound('C', 13, 0, 0); m_pMsgTextList[5] = new class CMsg(NULL, "To our regret", NULL); m_pMsgTextList[6] = new class CMsg(NULL, "As a defeated citizen,", NULL); m_pMsgTextList[7] = new class CMsg(NULL, "You won't receive any reward.", NULL); m_pMsgTextList[8] = new class CMsg(NULL, " ", NULL); } } for (i = 9; i < 18; i++) m_pMsgTextList[i] = new class CMsg(NULL, " ", NULL); EnableDialogBox(18, NULL, NULL, NULL); DisableDialogBox(36); DisableDialogBox(37); DisableDialogBox(38); } /********************************************************************************************************************* ** void DrawDialogBox_Resurect(short msX, short msY) ( Snoopy ) ** ** description : Asks the player if he accepts resurection ** **********************************************************************************************************************/ void CGame::DrawDialogBox_Resurect(short msX, short msY) { short sX = m_stDialogBoxInfo[50].sX; short sY = m_stDialogBoxInfo[50].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME1, sX, sY, 2); PutString(sX + 50, sY + 20, "Someone intends to resurrect you.", RGB(4,0,50)); PutString(sX + 80, sY + 35, "Will you revive here?", RGB(4,0,50)); if ((msX >= sX + 30) && (msX <= sX + 30 + BTNSZX) && (msY >= sY + 55) && (msY <= sY + 55 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 30, sY + 55 ,19); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 30, sY + 55 , 18); if ((msX >= sX + 170 ) && (msX <= sX + 170 + BTNSZX ) && (msY >= sY + 55 ) && (msY <= sY + 55 + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 170 , sY + 55 , 3); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + 170, sY + 55 , 2); } /********************************************************************************************************************* ** void DlgBoxClick_ItemDrop(short msX, short msY) ( Snoopy ) ** ** description : Response of the player if he accepts resurection or not ** **********************************************************************************************************************/ void CGame::DlgBoxClick_Resurect(short msX, short msY) { short sX = m_stDialogBoxInfo[50].sX; short sY = m_stDialogBoxInfo[50].sY; if ((msX >= sX + 30) && (msX <= sX + 30 + BTNSZX) && (msY >= sY + 55) && (msY <= sY + 55 + BTNSZY)) { // yes bSendCommand(MSGID_REQUEST_RESURRECTPLAYER_YES, 0, 0, 0, 0 ,0, NULL, 0); DisableDialogBox(50); }else if ((msX >= sX + 170 ) && (msX <= sX + 170 + BTNSZX ) && (msY >= sY + 55 ) && (msY <= sY + 55 + BTNSZY)) { // no bSendCommand(MSGID_REQUEST_RESURRECTPLAYER_NO, 0, 0, 0, 0 ,0, NULL, 0); DisableDialogBox(50); } } /********************************************************************************************************************* ** void ResponseHeldenianTeleportList(char *pData) ( Snoopy ) ** ** description : Gail's TP ** **********************************************************************************************************************/ void CGame::ResponseHeldenianTeleportList(char *pData) { char *cp; int *ip, i; #ifdef _DEBUG AddEventList("Teleport ???", 10); #endif cp = pData + 6; ip = (int*) cp; m_iTeleportMapCount = *ip; cp += 4; for ( i = 0 ; i < m_iTeleportMapCount ; i++) { ip = (int*)cp; m_stTeleportList[i].iIndex = *ip; cp += 4; ZeroMemory(m_stTeleportList[i].mapname, sizeof(m_stTeleportList[i].mapname) ); memcpy(m_stTeleportList[i].mapname, cp, 10); cp += 10; ip = (int*)cp; m_stTeleportList[i].iX = *ip; cp += 4; ip = (int*)cp; m_stTeleportList[i].iY = *ip; cp += 4; ip = (int*)cp; m_stTeleportList[i].iCost = *ip; cp += 4; } } /********************************************************************************************************************* ** void DrawDialogBox_CMDHallMenu(short msX, short msY) ( Snoopy ) ** ** description : Draw the diag ** **********************************************************************************************************************/ void CGame::DrawDialogBox_CMDHallMenu(short msX, short msY) {short sX, sY, szX; char cTxt[120]; sX = m_stDialogBoxInfo[51].sX; sY = m_stDialogBoxInfo[51].sY; szX = m_stDialogBoxInfo[51].sSizeX; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); switch (m_stDialogBoxInfo[51].cMode) { case 0: // initial diag if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 70) && (msY < sY + 95)) PutAlignedString(sX, sX + szX, sY + 70, DRAW_CMDHALL1, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 70, DRAW_CMDHALL1, 4,0,50); if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 95) && (msY < sY + 120)) PutAlignedString(sX, sX + szX, sY + 95, DRAW_CMDHALL2, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 95, DRAW_CMDHALL2, 4,0,50); if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 120) && (msY < sY + 145)) PutAlignedString(sX, sX + szX, sY + 120, DRAW_CMDHALL3, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 120, DRAW_CMDHALL3, 4,0,50); // Angels if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 145) && (msY < sY + 170)) PutAlignedString(sX, sX + szX, sY + 145, DRAW_CMDHALL4, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 145, DRAW_CMDHALL4, 4,0,50); break; case 1: // TP diag if( m_iTeleportMapCount > 0 ) { for( int i=0 ; i<m_iTeleportMapCount ; i++ ) { ZeroMemory( cTxt, sizeof(cTxt) ); GetOfficialMapName( m_stTeleportList[i].mapname, cTxt ); wsprintf( G_cTxt, DRAW_DIALOGBOX_CITYHALL_MENU77, cTxt, m_stTeleportList[i].iCost ); if( (msX >= sX + LBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + 130 + i*15) && (msY <= sY + 144 + i*15) ) PutAlignedString(sX, sX + szX, sY + 130 + i*15, G_cTxt, 255, 255, 255); else PutAlignedString(sX, sX + szX, sY + 130 + i*15, G_cTxt, 250, 250, 0); } }else if( m_iTeleportMapCount == -1 ) { PutAlignedString(sX, sX + szX, sY + 125, DRAW_DIALOGBOX_CITYHALL_MENU73, 55,25,25); PutAlignedString(sX, sX + szX, sY + 150, DRAW_DIALOGBOX_CITYHALL_MENU74, 55,25,25); }else { PutAlignedString(sX, sX + szX, sY + 150, DRAW_DIALOGBOX_CITYHALL_MENU76, 55,25,25);//"There is no area that you can teleport." } break; case 2: // Soldier diag PutAlignedString(sX, sX + szX, sY + 45, DRAW_CMDHALL5, 255,255,255); if ((m_iConstructionPoint >= 2000) && (m_bIsCrusadeMode == FALSE)) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 70) && (msY < sY + 95)) PutAlignedString(sX, sX + szX, sY + 70, DRAW_CMDHALL6, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 70, DRAW_CMDHALL6, 4,0,50); }else PutAlignedString(sX, sX + szX, sY + 70, DRAW_CMDHALL6, 65,65,65); if ((m_iConstructionPoint >= 3000) && (m_bIsCrusadeMode == FALSE)) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 95) && (msY < sY + 120)) PutAlignedString(sX, sX + szX, sY + 95, DRAW_CMDHALL7, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 95, DRAW_CMDHALL7, 4,0,50); }else PutAlignedString(sX, sX + szX, sY + 95, DRAW_CMDHALL7, 65,65,65); if ((m_iConstructionPoint >= 1500) && (m_bIsCrusadeMode == FALSE)) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 120) && (msY < sY + 145)) PutAlignedString(sX, sX + szX, sY + 120, DRAW_CMDHALL8, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 120, DRAW_CMDHALL8, 4,0,50); }else PutAlignedString(sX, sX + szX, sY + 120, DRAW_CMDHALL8, 65,65,65); if ((m_iConstructionPoint >= 3000) && (m_bIsCrusadeMode == FALSE)) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 145) && (msY < sY + 171)) PutAlignedString(sX, sX + szX, sY + 145, DRAW_CMDHALL9, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 145, DRAW_CMDHALL9, 4,0,50); }else PutAlignedString(sX, sX + szX, sY + 145, DRAW_CMDHALL9, 65,65,65); if ((m_iConstructionPoint >= 4000) && (m_bIsCrusadeMode == FALSE)) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 170) && (msY < sY + 195)) PutAlignedString(sX, sX + szX, sY + 170, DRAW_CMDHALL10, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 170, DRAW_CMDHALL10, 4,0,50); }else PutAlignedString(sX, sX + szX, sY + 170, DRAW_CMDHALL10, 65,65,65); if ((m_iConstructionPoint >= 3000) && (m_bIsCrusadeMode == FALSE)) { if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 195) && (msY < sY + 220)) PutAlignedString(sX, sX + szX, sY + 195, DRAW_CMDHALL11, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 195, DRAW_CMDHALL11, 4,0,50); }else PutAlignedString(sX, sX + szX, sY + 195, DRAW_CMDHALL11, 65,65,65); PutAlignedString(sX, sX + szX, sY + 220,DRAW_CMDHALL12, 4,0,50); wsprintf(G_cTxt,DRAW_CMDHALL13, m_iConstructionPoint); PutAlignedString(sX, sX + szX, sY + 250, G_cTxt, 4,0,50); PutAlignedString(sX, sX + szX, sY + 280, DRAW_CMDHALL14, 4,0,50); PutAlignedString(sX, sX + szX, sY + 300, DRAW_CMDHALL15, 4,0,50); break; case 3: // Hire a Flag Diag PutAlignedString(sX, sX + szX, sY + 45,DRAW_CMDHALL16, 4,0,50); PutAlignedString(sX, sX + szX, sY + 70,DRAW_CMDHALL17, 4,0,50); if( (msX >= sX + 35) && (msX <= sX + 220) && (msY >= sY + 140) && (msY <= sY + 165) ) PutAlignedString(sX, sX + szX, sY + 140, DRAW_CMDHALL18, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 140, DRAW_CMDHALL18, 250,250,0); break; case 4: // Tutelar Angel Diag PutAlignedString(sX, sX + szX, sY + 45, DRAW_CMDHALL19, 4,0,50); PutAlignedString(sX, sX + szX, sY + 80, DRAW_CMDHALL20, 4,0,50); PutAlignedString(sX, sX + szX, sY + 105, DRAW_CMDHALL21, 4,0,50); wsprintf(G_cTxt, DRAW_DIALOGBOX_ITEMUPGRADE11, m_iGizonItemUpgradeLeft);// "Item upgrade point : %d" PutAlignedString(sX, sX + szX, sY + 140, G_cTxt, 0,0,0); if ( (msX > sX + 35) && (msX < sX + 220) && (msY > sY + 175) && (msY < sY + 200) && (m_iGizonItemUpgradeLeft >4)) PutAlignedString(sX, sX + szX, sY + 175, DRAW_CMDHALL22, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 175, DRAW_CMDHALL22, 250,250,0); if ( (msX > sX + 35) && (msX < sX + 220) && (msY > sY + 200) && (msY < sY + 225) && (m_iGizonItemUpgradeLeft >4)) PutAlignedString(sX, sX + szX, sY + 200, DRAW_CMDHALL23, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 200, DRAW_CMDHALL23, 250,250,0); if ( (msX > sX + 35) && (msX < sX + 220) && (msY > sY + 225) && (msY < sY + 250) && (m_iGizonItemUpgradeLeft >4)) PutAlignedString(sX, sX + szX, sY + 225, DRAW_CMDHALL24, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 225, DRAW_CMDHALL24, 250,250,0); if ( (msX > sX + 35) && (msX < sX + 220) && (msY > sY + 250) && (msY < sY + 275) && (m_iGizonItemUpgradeLeft >4)) PutAlignedString(sX, sX + szX, sY + 250, DRAW_CMDHALL25, 255,255,255); else PutAlignedString(sX, sX + szX, sY + 250, DRAW_CMDHALL25, 250,250,0); break; } } /********************************************************************************************************************* ** void DlgBoxClick_CMDHallMenu(short msX, short msY) ( Snoopy ) ** ** description : Response of the player if he accepts resurection or not ** **********************************************************************************************************************/ void CGame::DlgBoxClick_CMDHallMenu(short msX, short msY) {short sX, sY; sX = m_stDialogBoxInfo[51].sX; sY = m_stDialogBoxInfo[51].sY; switch (m_stDialogBoxInfo[51].cMode) { case 0: // initial diag if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 70) && (msY < sY + 95)) { m_stDialogBoxInfo[51].cMode = 1; // TP diag m_iTeleportMapCount = -1; bSendCommand(MSGID_REQUEST_TELEPORT_LIST, NULL, NULL, NULL, NULL, NULL, "Gail"); PlaySound('E', 14, 5); } if ((msX > sX + 35) && (msX < sX + 220) && (msY > sY + 95) && (msY < sY + 120)) { m_stDialogBoxInfo[51].cMode = 2; // Soldier Diag PlaySound('E', 14, 5); } if ( (msX > sX + 35) && (msX < sX + 220) && (msY > sY + 120) && (msY < sY + 145) /*&& (m_iEnemyKillCount >= 3)*/) { m_stDialogBoxInfo[51].cMode = 3; // Flag Diag PlaySound('E', 14, 5); } if ( (msX > sX + 35) && (msX < sX + 220) && (msY > sY + 145) && (msY < sY + 170)) { m_stDialogBoxInfo[51].cMode = 4; // Angel Diag PlaySound('E', 14, 5); } case 1: // TP now if( m_iTeleportMapCount > 0 ) { for( int i=0 ; i<m_iTeleportMapCount ; i++ ) { if( (msX >= sX + LBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + 130 + i*15) && (msY <= sY + 144 + i*15) ) { bSendCommand(MSGID_REQUEST_CHARGED_TELEPORT, NULL, NULL, m_stTeleportList[i].iIndex, NULL, NULL, NULL); DisableDialogBox(51); return; } } } break; case 2: // Buy a soldier scroll if ( (msX >= sX + 35) && (msX <= sX + 220) && (msY > sY + 70) && (msY < sY + 95) && (m_iConstructionPoint >= 2000) && (m_bIsCrusadeMode == FALSE)) // Sorceress { bSendCommand(MSGID_REQUEST_HELDENIAN_SCROLL, 875, 1, 2, 3, 4, "Gail", 5); PlaySound('E', 14, 5); } if ( (msX >= sX + 35) && (msX <= sX + 220) && (msY > sY + 95) && (msY < sY + 120) && (m_iConstructionPoint >= 3000) && (m_bIsCrusadeMode == FALSE)) // ATK { bSendCommand(MSGID_REQUEST_HELDENIAN_SCROLL, 876, 0, 0, 0, 0, "Gail", 0); PlaySound('E', 14, 5); } if ( (msX >= sX + 35) && (msX <= sX + 220) && (msY > sY + 120) && (msY < sY + 145) && (m_iConstructionPoint >= 1500) && (m_bIsCrusadeMode == FALSE)) // Elf { bSendCommand(MSGID_REQUEST_HELDENIAN_SCROLL, 877, 0, 0, 0, 0, "Gail", 0); PlaySound('E', 14, 5); } if ( (msX >= sX + 35) && (msX <= sX + 220) && (msY > sY + 145) && (msY < sY + 170) && (m_iConstructionPoint >= 3000) && (m_bIsCrusadeMode == FALSE)) // DSK { bSendCommand(MSGID_REQUEST_HELDENIAN_SCROLL, 878, 0, 0, 0, 0, "Gail", 0); PlaySound('E', 14, 5); } if ( (msX >= sX + 35) && (msX <= sX + 220) && (msY > sY + 170) && (msY < sY + 195) && (m_iConstructionPoint >= 4000) && (m_bIsCrusadeMode == FALSE)) // HBT { bSendCommand(MSGID_REQUEST_HELDENIAN_SCROLL, 879, 0, 0, 0, 0, "Gail", 0); PlaySound('E', 14, 5); } if ( (msX >= sX + 35) && (msX <= sX + 220) && (msY > sY + 195) && (msY < sY + 220) && (m_iConstructionPoint >= 3000) && (m_bIsCrusadeMode == FALSE)) // Barbarian { bSendCommand(MSGID_REQUEST_HELDENIAN_SCROLL, 880, 0, 0, 0, 0, "Gail", 0); PlaySound('E', 14, 5); } break; case 3: // Buy a Flag if ( (msX >= sX + 35) && (msX <= sX + 220) && (msY >= sY + 140) && (msY <= sY + 165) && (m_iEnemyKillCount >=3)) { bSendCommand(MSGID_COMMAND_COMMON, COMMONTYPE_REQ_GETOCCUPYFLAG, 0, 0, 0, 0, 0, 0); PlaySound('E', 14, 5); } break; case 4: // Buy an Angel if ( (msX >= sX + 35) && (msX <= sX + 220) && (msY >= sY + 175) && (msY <= sY + 200) && ( m_iGizonItemUpgradeLeft>=5)) { bSendCommand(MSGID_REQUEST_ANGEL, NULL, NULL, 1, NULL, NULL, "Gail", NULL); PlaySound('E', 14, 5); } if ( (msX >= sX + 35) && (msX <= sX + 220) && (msY >= sY + 200) && (msY <= sY + 225) && ( m_iGizonItemUpgradeLeft>=5)) { bSendCommand(MSGID_REQUEST_ANGEL, NULL, NULL, 2, NULL, NULL, "Gail", NULL); PlaySound('E', 14, 5); } if ( (msX >= sX + 35) && (msX <= sX + 220) && (msY >= sY + 225) && (msY <= sY + 250) && ( m_iGizonItemUpgradeLeft>=5)) { bSendCommand(MSGID_REQUEST_ANGEL, NULL, NULL, 3, NULL, NULL, "Gail", NULL); PlaySound('E', 14, 5); } if ( (msX >= sX + 35) && (msX <= sX + 220) && (msY >= sY + 250) && (msY <= sY + 275) && ( m_iGizonItemUpgradeLeft>=5)) { bSendCommand(MSGID_REQUEST_ANGEL, NULL, NULL, 4, NULL, NULL, "Gail", NULL); PlaySound('E', 14, 5); } break; } } /********************************************************************************************************************* ** bool DKGlare(int iWeaponIndex, int iWeaponIndex, int *iWeaponGlare) ( Snoopy ) ** ** description : test glowing condition for DK set ** **********************************************************************************************************************/ void CGame::DKGlare(int iWeaponColor, int iWeaponIndex, int *iWeaponGlare) { if (iWeaponColor != 9) return; if ( ((iWeaponIndex >= SPRID_WEAPON_M + 64*14)&&(iWeaponIndex < SPRID_WEAPON_M + 64*14 + 56)) //msw3 || ((iWeaponIndex >= SPRID_WEAPON_W + 64*14)&&(iWeaponIndex < SPRID_WEAPON_W + 64*14 + 56))) //wsw3 { *iWeaponGlare = 3; }else if ( ((iWeaponIndex >= SPRID_WEAPON_M + 64*37)&&(iWeaponIndex < SPRID_WEAPON_M + 64*37 + 56)) //MStaff3 || ((iWeaponIndex >= SPRID_WEAPON_W + 64*37)&&(iWeaponIndex < SPRID_WEAPON_W + 64*37 + 56)))//WStaff3 { *iWeaponGlare = 2; } } /********************************************************************************************************************* ** void DrawDruncncity() ( Snoopy ) ** ** description : Placeholder for Druncncity effects (nota: bubbles already coded) ** **********************************************************************************************************************/ void CGame::DrawDruncncity() { //DebugLog("druncncity"); } // Manque ondulations et coloration des persos en verdatre.... // Druncncity: /*401E60 /$ 83EC 7C SUB ESP,7C 00401E63 |. 56 PUSH ESI 00401E64 |. 8BF1 MOV ESI,ECX 00401E66 |. 8B86 10000300 MOV EAX,DWORD PTR DS:[ESI+30010] 00401E6C |. 85C0 TEST EAX,EAX 00401E6E |. 75 05 JNZ SHORT 00401E75 00401E70 |. 5E POP ESI 00401E71 |. 83C4 7C ADD ESP,7C 00401E74 |. C3 RETN 00401E75 |> 6A 00 PUSH 0 00401E77 |. 8D5424 08 LEA EDX,DWORD PTR SS:[ESP+8] 00401E7B |. 6A 01 PUSH 1 00401E7D |. C74424 0C 7C000000 MOV DWORD PTR SS:[ESP+C],7C 00401E85 |. 8B08 MOV ECX,DWORD PTR DS:[EAX] 00401E87 |. 52 PUSH EDX 00401E88 |. 6A 00 PUSH 0 00401E8A |. 50 PUSH EAX 00401E8B |. FF51 64 CALL NEAR DWORD PTR DS:[ECX+64] 00401E8E |. 85C0 TEST EAX,EAX 00401E90 |. 74 07 JE SHORT 00401E99 00401E92 |. 33C0 XOR EAX,EAX 00401E94 |. 5E POP ESI 00401E95 |. 83C4 7C ADD ESP,7C 00401E98 |. C3 RETN 00401E99 |> 8B4C24 0C MOV ECX,DWORD PTR SS:[ESP+C] 00401E9D |. 8B4424 28 MOV EAX,DWORD PTR SS:[ESP+28] 00401EA1 |. 8B5424 10 MOV EDX,DWORD PTR SS:[ESP+10] 00401EA5 |. 83C1 D8 ADD ECX,-28 00401EA8 |. 50 PUSH EAX ; /Arg3 00401EA9 |. 51 PUSH ECX ; |Arg2 00401EAA |. 8B8E DC010300 MOV ECX,DWORD PTR DS:[ESI+301DC] ; | 00401EB0 |. 52 PUSH EDX ; |Arg1 00401EB1 |. E8 4AF2FFFF CALL 00401100 ; \Original.00401100 00401EB6 |. 8B86 10000300 MOV EAX,DWORD PTR DS:[ESI+30010] 00401EBC |. 6A 00 PUSH 0 00401EBE |. 50 PUSH EAX 00401EBF |. 8B08 MOV ECX,DWORD PTR DS:[EAX] 00401EC1 |. FF91 80000000 CALL NEAR DWORD PTR DS:[ECX+80] 00401EC7 |. B8 01000000 MOV EAX,1 00401ECC |. 5E POP ESI 00401ECD |. 83C4 7C ADD ESP,7C 00401ED0 \. C3 RETN*/ /*00401100 /$ 81EC C0010000 SUB ESP,1C0 ; colore le personage 00401106 |. 53 PUSH EBX 00401107 |. 56 PUSH ESI 00401108 |. 8BF1 MOV ESI,ECX 0040110A |. 33DB XOR EBX,EBX 0040110C |. 8B8C24 D4010000 MOV ECX,DWORD PTR SS:[ESP+1D4] 00401113 |. 3BCB CMP ECX,EBX 00401115 |. 0F84 CE030000 JE 004014E9 0040111B |. 55 PUSH EBP 0040111C |. 8BAC24 D0010000 MOV EBP,DWORD PTR SS:[ESP+1D0] 00401123 |. 0FAFAC24 D4010000 IMUL EBP,DWORD PTR SS:[ESP+1D4] 0040112B |. 57 PUSH EDI 0040112C |. 896C24 14 MOV DWORD PTR SS:[ESP+14],EBP 00401130 |. 8D442D 00 LEA EAX,DWORD PTR SS:[EBP+EBP] 00401134 |. 894424 10 MOV DWORD PTR SS:[ESP+10],EAX 00401138 |. 50 PUSH EAX 00401139 |. 8B46 34 MOV EAX,DWORD PTR DS:[ESI+34] 0040113C |. 51 PUSH ECX 0040113D |. 50 PUSH EAX 0040113E |. FF15 E0C04B00 CALL NEAR DWORD PTR DS:[4BC0E0] ; Original.00401000 00401144 |. BA 06000000 MOV EDX,6 00401149 |. B9 03000000 MOV ECX,3 0040114E |. 899424 80000000 MOV DWORD PTR SS:[ESP+80],EDX 00401155 |. 899424 84000000 MOV DWORD PTR SS:[ESP+84],EDX 0040115C |. 899424 88000000 MOV DWORD PTR SS:[ESP+88],EDX 00401163 |. 899424 8C000000 MOV DWORD PTR SS:[ESP+8C],EDX 0040116A |. 899424 90000000 MOV DWORD PTR SS:[ESP+90],EDX 00401171 |. 899424 94000000 MOV DWORD PTR SS:[ESP+94],EDX 00401178 |. 899424 98000000 MOV DWORD PTR SS:[ESP+98],EDX 0040117F |. 899424 9C000000 MOV DWORD PTR SS:[ESP+9C],EDX 00401186 |. 899424 A0000000 MOV DWORD PTR SS:[ESP+A0],EDX 0040118D |. 899424 A4000000 MOV DWORD PTR SS:[ESP+A4],EDX 00401194 |. BF 04000000 MOV EDI,4 00401199 |. B8 05000000 MOV EAX,5 0040119E |. BA 02000000 MOV EDX,2 004011A3 |. 83C4 0C ADD ESP,0C 004011A6 |. 894C24 18 MOV DWORD PTR SS:[ESP+18],ECX 004011AA |. 894C24 1C MOV DWORD PTR SS:[ESP+1C],ECX 004011AE |. 894C24 20 MOV DWORD PTR SS:[ESP+20],ECX 004011B2 |. 894C24 24 MOV DWORD PTR SS:[ESP+24],ECX 004011B6 |. 894C24 28 MOV DWORD PTR SS:[ESP+28],ECX 004011BA |. 897C24 2C MOV DWORD PTR SS:[ESP+2C],EDI 004011BE |. 897C24 30 MOV DWORD PTR SS:[ESP+30],EDI 004011C2 |. 897C24 34 MOV DWORD PTR SS:[ESP+34],EDI 004011C6 |. 897C24 38 MOV DWORD PTR SS:[ESP+38],EDI 004011CA |. 897C24 3C MOV DWORD PTR SS:[ESP+3C],EDI 004011CE |. 897C24 40 MOV DWORD PTR SS:[ESP+40],EDI 004011D2 |. 897C24 44 MOV DWORD PTR SS:[ESP+44],EDI 004011D6 |. 897C24 48 MOV DWORD PTR SS:[ESP+48],EDI 004011DA |. 894424 4C MOV DWORD PTR SS:[ESP+4C],EAX 004011DE |. 894424 50 MOV DWORD PTR SS:[ESP+50],EAX 004011E2 |. 894424 54 MOV DWORD PTR SS:[ESP+54],EAX 004011E6 |. 894424 58 MOV DWORD PTR SS:[ESP+58],EAX 004011EA |. 894424 5C MOV DWORD PTR SS:[ESP+5C],EAX 004011EE |. 894424 60 MOV DWORD PTR SS:[ESP+60],EAX 004011F2 |. 894424 64 MOV DWORD PTR SS:[ESP+64],EAX 004011F6 |. 894424 68 MOV DWORD PTR SS:[ESP+68],EAX 004011FA |. 894424 6C MOV DWORD PTR SS:[ESP+6C],EAX 004011FE |. 894424 70 MOV DWORD PTR SS:[ESP+70],EAX 00401202 |. 898424 9C000000 MOV DWORD PTR SS:[ESP+9C],EAX 00401209 |. 898424 A0000000 MOV DWORD PTR SS:[ESP+A0],EAX 00401210 |. 898424 A4000000 MOV DWORD PTR SS:[ESP+A4],EAX 00401217 |. 898424 A8000000 MOV DWORD PTR SS:[ESP+A8],EAX 0040121E |. 898424 AC000000 MOV DWORD PTR SS:[ESP+AC],EAX 00401225 |. 898424 B0000000 MOV DWORD PTR SS:[ESP+B0],EAX 0040122C |. 898424 B4000000 MOV DWORD PTR SS:[ESP+B4],EAX 00401233 |. 898424 B8000000 MOV DWORD PTR SS:[ESP+B8],EAX 0040123A |. 898424 BC000000 MOV DWORD PTR SS:[ESP+BC],EAX 00401241 |. 89BC24 C0000000 MOV DWORD PTR SS:[ESP+C0],EDI 00401248 |. 89BC24 C4000000 MOV DWORD PTR SS:[ESP+C4],EDI 0040124F |. 89BC24 C8000000 MOV DWORD PTR SS:[ESP+C8],EDI 00401256 |. 89BC24 CC000000 MOV DWORD PTR SS:[ESP+CC],EDI 0040125D |. 89BC24 D0000000 MOV DWORD PTR SS:[ESP+D0],EDI 00401264 |. 89BC24 D4000000 MOV DWORD PTR SS:[ESP+D4],EDI 0040126B |. 89BC24 D8000000 MOV DWORD PTR SS:[ESP+D8],EDI 00401272 |. 89BC24 DC000000 MOV DWORD PTR SS:[ESP+DC],EDI 00401279 |. 89BC24 E0000000 MOV DWORD PTR SS:[ESP+E0],EDI 00401280 |. 898C24 E4000000 MOV DWORD PTR SS:[ESP+E4],ECX 00401287 |. 898C24 E8000000 MOV DWORD PTR SS:[ESP+E8],ECX 0040128E |. 898C24 EC000000 MOV DWORD PTR SS:[ESP+EC],ECX 00401295 |. 898C24 F0000000 MOV DWORD PTR SS:[ESP+F0],ECX 0040129C |. 898C24 F4000000 MOV DWORD PTR SS:[ESP+F4],ECX 004012A3 |. 898C24 F8000000 MOV DWORD PTR SS:[ESP+F8],ECX 004012AA |. 898C24 FC000000 MOV DWORD PTR SS:[ESP+FC],ECX 004012B1 |. 898C24 00010000 MOV DWORD PTR SS:[ESP+100],ECX 004012B8 |. 899424 04010000 MOV DWORD PTR SS:[ESP+104],EDX 004012BF |. 899424 08010000 MOV DWORD PTR SS:[ESP+108],EDX 004012C6 |. 899424 0C010000 MOV DWORD PTR SS:[ESP+10C],EDX 004012CD |. 899424 10010000 MOV DWORD PTR SS:[ESP+110],EDX 004012D4 |. 898C24 BC010000 MOV DWORD PTR SS:[ESP+1BC],ECX 004012DB |. 898C24 C0010000 MOV DWORD PTR SS:[ESP+1C0],ECX 004012E2 |. 898C24 C4010000 MOV DWORD PTR SS:[ESP+1C4],ECX 004012E9 |. 898C24 C8010000 MOV DWORD PTR SS:[ESP+1C8],ECX 004012F0 |. 898C24 CC010000 MOV DWORD PTR SS:[ESP+1CC],ECX 004012F7 |. B8 01000000 MOV EAX,1 004012FC |. 33C9 XOR ECX,ECX 004012FE |. 3BEB CMP EBP,EBX 00401300 |. 899424 14010000 MOV DWORD PTR SS:[ESP+114],EDX 00401307 |. 899424 18010000 MOV DWORD PTR SS:[ESP+118],EDX 0040130E |. 899424 1C010000 MOV DWORD PTR SS:[ESP+11C],EDX 00401315 |. 899424 20010000 MOV DWORD PTR SS:[ESP+120],EDX 0040131C |. 899424 24010000 MOV DWORD PTR SS:[ESP+124],EDX 00401323 |. 898424 28010000 MOV DWORD PTR SS:[ESP+128],EAX 0040132A |. 898424 2C010000 MOV DWORD PTR SS:[ESP+12C],EAX 00401331 |. 898424 30010000 MOV DWORD PTR SS:[ESP+130],EAX 00401338 |. 898424 34010000 MOV DWORD PTR SS:[ESP+134],EAX 0040133F |. 898424 38010000 MOV DWORD PTR SS:[ESP+138],EAX 00401346 |. 898424 3C010000 MOV DWORD PTR SS:[ESP+13C],EAX 0040134D |. 898424 40010000 MOV DWORD PTR SS:[ESP+140],EAX 00401354 |. 898424 44010000 MOV DWORD PTR SS:[ESP+144],EAX 0040135B |. 898424 48010000 MOV DWORD PTR SS:[ESP+148],EAX 00401362 |. 898424 4C010000 MOV DWORD PTR SS:[ESP+14C],EAX 00401369 |. 898424 50010000 MOV DWORD PTR SS:[ESP+150],EAX 00401370 |. 899C24 54010000 MOV DWORD PTR SS:[ESP+154],EBX 00401377 |. 899C24 58010000 MOV DWORD PTR SS:[ESP+158],EBX 0040137E |. 899C24 5C010000 MOV DWORD PTR SS:[ESP+15C],EBX 00401385 |. 899C24 60010000 MOV DWORD PTR SS:[ESP+160],EBX 0040138C |. 899C24 64010000 MOV DWORD PTR SS:[ESP+164],EBX 00401393 |. 899C24 68010000 MOV DWORD PTR SS:[ESP+168],EBX 0040139A |. 899C24 6C010000 MOV DWORD PTR SS:[ESP+16C],EBX 004013A1 |. 899C24 70010000 MOV DWORD PTR SS:[ESP+170],EBX 004013A8 |. 899C24 74010000 MOV DWORD PTR SS:[ESP+174],EBX 004013AF |. 899C24 78010000 MOV DWORD PTR SS:[ESP+178],EBX 004013B6 |. 898424 7C010000 MOV DWORD PTR SS:[ESP+17C],EAX 004013BD |. 898424 80010000 MOV DWORD PTR SS:[ESP+180],EAX 004013C4 |. 898424 84010000 MOV DWORD PTR SS:[ESP+184],EAX 004013CB |. 898424 88010000 MOV DWORD PTR SS:[ESP+188],EAX 004013D2 |. 898424 8C010000 MOV DWORD PTR SS:[ESP+18C],EAX 004013D9 |. 898424 90010000 MOV DWORD PTR SS:[ESP+190],EAX 004013E0 |. 898424 94010000 MOV DWORD PTR SS:[ESP+194],EAX 004013E7 |. 898424 98010000 MOV DWORD PTR SS:[ESP+198],EAX 004013EE |. 898424 9C010000 MOV DWORD PTR SS:[ESP+19C],EAX 004013F5 |. 899424 A0010000 MOV DWORD PTR SS:[ESP+1A0],EDX 004013FC |. 899424 A4010000 MOV DWORD PTR SS:[ESP+1A4],EDX 00401403 |. 899424 A8010000 MOV DWORD PTR SS:[ESP+1A8],EDX 0040140A |. 899424 AC010000 MOV DWORD PTR SS:[ESP+1AC],EDX 00401411 |. 899424 B0010000 MOV DWORD PTR SS:[ESP+1B0],EDX 00401418 |. 899424 B4010000 MOV DWORD PTR SS:[ESP+1B4],EDX 0040141F |. 899424 B8010000 MOV DWORD PTR SS:[ESP+1B8],EDX 00401426 |. 0F8E A1000000 JLE 004014CD 0040142C |> 83F9 0A /CMP ECX,0A 0040142F |. 7D 10 |JGE SHORT 00401441 00401431 |. 8B56 34 |MOV EDX,DWORD PTR DS:[ESI+34] 00401434 |. 8B46 30 |MOV EAX,DWORD PTR DS:[ESI+30] 00401437 |. 66:8B144A |MOV DX,WORD PTR DS:[EDX+ECX*2] 0040143B |. 66:891448 |MOV WORD PTR DS:[EAX+ECX*2],DX 0040143F |. EB 7F |JMP SHORT 004014C0 00401441 |> 8BC1 |MOV EAX,ECX 00401443 |. BD 80020000 |MOV EBP,280 00401448 |. 99 |CDQ 00401449 |. F7FD |IDIV EBP 0040144B |. 3BD3 |CMP EDX,EBX 0040144D |. 75 11 |JNZ SHORT 00401460 0040144F |. 8B6E 38 |MOV EBP,DWORD PTR DS:[ESI+38] 00401452 |. 45 |INC EBP 00401453 |. 8BC5 |MOV EAX,EBP 00401455 |. 896E 38 |MOV DWORD PTR DS:[ESI+38],EBP 00401458 |. 83F8 6E |CMP EAX,6E 0040145B |. 7C 03 |JL SHORT 00401460 0040145D |. 895E 38 |MOV DWORD PTR DS:[ESI+38],EBX 00401460 |> 3BD7 |CMP EDX,EDI 00401462 |. 7D 19 |JGE SHORT 0040147D 00401464 |. 8B46 38 |MOV EAX,DWORD PTR DS:[ESI+38] 00401467 |. 395484 18 |CMP DWORD PTR SS:[ESP+EAX*4+18],EDX 0040146B |. 7E 10 |JLE SHORT 0040147D 0040146D |. 8B56 34 |MOV EDX,DWORD PTR DS:[ESI+34] 00401470 |. 8B46 30 |MOV EAX,DWORD PTR DS:[ESI+30] 00401473 |. 66:8B144A |MOV DX,WORD PTR DS:[EDX+ECX*2] 00401477 |. 66:891448 |MOV WORD PTR DS:[EAX+ECX*2],DX 0040147B |. EB 43 |JMP SHORT 004014C0 0040147D |> 81FA 7B020000 |CMP EDX,27B 00401483 |. 7E 20 |JLE SHORT 004014A5 00401485 |. 8B46 38 |MOV EAX,DWORD PTR DS:[ESI+38] 00401488 |. 8B4484 18 |MOV EAX,DWORD PTR SS:[ESP+EAX*4+18] 0040148C |. 05 7B020000 |ADD EAX,27B 00401491 |. 3BC2 |CMP EAX,EDX 00401493 |. 7D 10 |JGE SHORT 004014A5 00401495 |. 8B56 34 |MOV EDX,DWORD PTR DS:[ESI+34] 00401498 |. 8B46 30 |MOV EAX,DWORD PTR DS:[ESI+30] 0040149B |. 66:8B144A |MOV DX,WORD PTR DS:[EDX+ECX*2] 0040149F |. 66:891448 |MOV WORD PTR DS:[EAX+ECX*2],DX 004014A3 |. EB 1B |JMP SHORT 004014C0 004014A5 |> 8B46 38 |MOV EAX,DWORD PTR DS:[ESI+38] 004014A8 |. 8BD1 |MOV EDX,ECX 004014AA |. 8B6C84 18 |MOV EBP,DWORD PTR SS:[ESP+EAX*4+18] 004014AE |. 8B46 34 |MOV EAX,DWORD PTR DS:[ESI+34] 004014B1 |. 2BD5 |SUB EDX,EBP 004014B3 |. 8B6E 30 |MOV EBP,DWORD PTR DS:[ESI+30] 004014B6 |. 66:8B5450 08 |MOV DX,WORD PTR DS:[EAX+EDX*2+8] 004014BB |. 66:89544D 00 |MOV WORD PTR SS:[EBP+ECX*2],DX 004014C0 |> 8B4424 14 |MOV EAX,DWORD PTR SS:[ESP+14] 004014C4 |. 41 |INC ECX 004014C5 |. 3BC8 |CMP ECX,EAX 004014C7 |.^0F8C 5FFFFFFF \JL 0040142C 004014CD |> 8B4424 10 MOV EAX,DWORD PTR SS:[ESP+10] 004014D1 |. 8B4E 30 MOV ECX,DWORD PTR DS:[ESI+30] 004014D4 |. 8B9424 DC010000 MOV EDX,DWORD PTR SS:[ESP+1DC] 004014DB |. 50 PUSH EAX ; /Arg3 004014DC |. 51 PUSH ECX ; |Arg2 004014DD |. 52 PUSH EDX ; |Arg1 004014DE |. FF15 E0C04B00 CALL NEAR DWORD PTR DS:[4BC0E0] ; \Original.00401000 004014E4 |. 83C4 0C ADD ESP,0C 004014E7 |. 5F POP EDI 004014E8 |. 5D POP EBP 004014E9 |> 5E POP ESI 004014EA |. 5B POP EBX 004014EB |. 81C4 C0010000 ADD ESP,1C0 004014F1 \. C2 0C00 RETN 0C*/ /********************************************************************************************************************* ** void CGame::Abaddon_corpse(int sX, int sY); ( Snoopy ) ** ** description : Placeholder for abaddon's death lightnings ** **********************************************************************************************************************/ void CGame::Abaddon_corpse(int sX, int sY) { int ir = (rand()%20)-10; _DrawThunderEffect(sX+30 , 0, sX+30 , sY-10 , ir, ir, 1); _DrawThunderEffect(sX+30 , 0, sX+30 , sY-10 , ir+2, ir, 2); _DrawThunderEffect(sX+30 , 0, sX+30 , sY-10 , ir-2, ir, 2); ir = (rand()%20)-10; _DrawThunderEffect(sX-20 , 0, sX-20 , sY-35 , ir, ir, 1); _DrawThunderEffect(sX-20 , 0, sX-20 , sY-35 , ir+2, ir, 2); _DrawThunderEffect(sX-20 , 0, sX-20 , sY-35 , ir-2, ir, 2); ir = (rand()%20)-10; _DrawThunderEffect(sX-10 , 0, sX-10 , sY+30 , ir, ir, 1); _DrawThunderEffect(sX-10 , 0, sX-10 , sY+30 , ir+2, ir+2, 2); _DrawThunderEffect(sX-10 , 0, sX-10 , sY+30 , ir-2, ir+2, 2); ir = (rand()%20)-10; _DrawThunderEffect(sX+50 , 0, sX+50 , sY+35 , ir, ir, 1); _DrawThunderEffect(sX+50 , 0, sX+50 , sY+35 , ir+2, ir+2, 2); _DrawThunderEffect(sX+50 , 0, sX+50 , sY+35 , ir-2, ir+2, 2); ir = (rand()%20)-10; _DrawThunderEffect(sX+65 , 0, sX+65 , sY-5 , ir, ir, 1); _DrawThunderEffect(sX+65 , 0, sX+65 , sY-5 , ir+2, ir+2, 2); _DrawThunderEffect(sX+65 , 0, sX+65 , sY-5 , ir-2, ir+2, 2); ir = (rand()%20)-10; _DrawThunderEffect(sX+45 , 0, sX+45 , sY-50 , ir, ir, 1); _DrawThunderEffect(sX+45 , 0, sX+45 , sY-50 , ir+2, ir+2, 2); _DrawThunderEffect(sX+45 , 0, sX+45 , sY-50 , ir-2, ir+2, 2); for (int x=sX-50; x<=sX+100; x+= rand()%35) for (int y=sY-30; y<=sY+50; y+= rand()%45) { ir = (rand()%20)-10; _DrawThunderEffect(x , 0, x , y, ir, ir, 2); } } /********************************************************************************************************************* ** void DebugLog(char * cStr) ( Snoopy ) ** ** description : writes data into "Debug.txt" ** **********************************************************************************************************************/ void CGame::DebugLog(char * cStr) {FILE * pFile; char cBuffer[512]; SYSTEMTIME SysTime; pFile = fopen("Debug.txt", "at"); if (pFile == NULL) return; ZeroMemory(cBuffer, sizeof(cBuffer)); GetLocalTime(&SysTime); wsprintf(cBuffer, "(%4d:%2d:%2d_%2d:%2d:%2d) - ", SysTime.wYear, SysTime.wMonth, SysTime.wDay, SysTime.wHour, SysTime.wMinute,SysTime.wSecond); strcat(cBuffer, cStr); strcat(cBuffer, "\n"); fwrite(cBuffer, 1, strlen(cBuffer), pFile); fclose(pFile); } void CGame::DrawQuestHelper() { char cTemp[21], cTxt[120]; if (m_stQuest.sQuestType != NULL) { PutString2(530, 130, QUESTHELPER, 255,200,0);//"Quest Helper" if ((m_stQuest.sTargetCount - m_stQuest.sCurrentCount) >= m_stQuest.sTargetCount) { PutString2(530, 154, QUESTHELPERCOMPLETE, 255, 0, 0); }else{ ZeroMemory(cTemp, sizeof(cTemp)); GetNpcName(m_stQuest.sTargetType, cTemp); ZeroMemory(cTxt, sizeof(cTxt)); wsprintf(cTxt, "%s: %d/%d", cTemp, ( m_stQuest.sTargetCount - m_stQuest.sCurrentCount), m_stQuest.sTargetCount); PutString2(530, 142, cTxt, 55,255,255); } } } void CGame::DrawDialogBox_FriendList(short msX, short msY)//43 { short sX, sY, szX,szY; int y; char cTxt[120]; int nickheight=16; sX = m_stDialogBoxInfo[43].sX; sY = m_stDialogBoxInfo[43].sY; szX = m_stDialogBoxInfo[43].sSizeX; szY = m_stDialogBoxInfo[43].sSizeY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); PutString_SprFont(sX+90,sY+35,MSG_FRIENDSLIST3,1,1,8); switch (m_stDialogBoxInfo[43].cMode) { case 0: int i=0; for (i=0;i<m_iTotalFriends;i++) { if (strcmp(friendsList[i].friendName,"") != 0) { y=sY+45+((i+1)*nickheight); PutString(sX+25,y,friendsList[i].friendName,RGB(0,0,0)); if (friendsList[i].online) { PutString(sX+90,y,MSG_FRIENDSLIST4,RGB(0,200,0)); } else{ PutString(sX+90,y,MSG_FRIENDSLIST4,RGB(200,0,0)); } } } if(m_iFriendIndex != -1){ PutString(sX+25,sY+45+((m_iFriendIndex+1)*nickheight),friendsList[m_iFriendIndex].friendName,RGB(255,255,255)); wsprintf(cTxt,MSG_FRIENDSLIST5,friendsList[m_iFriendIndex].friendName); }else{ wsprintf(cTxt,MSG_FRIENDSLIST6); } m_stDialogBoxInfo[43].sV1 = m_iFriendIndex; PutString(sX+25,sY+45+(13*nickheight),cTxt,RGB(0,0,0)); if ((msX>sX+25) && (msX<sX+25+25) && (msY>sY+45+14*nickheight) && (msY<sY+45+15*nickheight)) { PutString(sX+25,sY+45+(14*nickheight),MSG_FRIENDSLIST7,RGB(255,255,255)); } else { PutString(sX+25,sY+45+(14*nickheight),MSG_FRIENDSLIST7,RGB(0,0,0)); } if ((msX>sX+80) && (msX<sX+80+30) && (msY>sY+45+14*nickheight) && (msY<sY+45+15*nickheight)) { PutString(sX+80,sY+45+(14*nickheight),MSG_FRIENDSLIST8,RGB(255,255,255)); } else { PutString(sX+80,sY+45+(14*nickheight),MSG_FRIENDSLIST8,RGB(0,0,0)); } if ((msX>sX+140) && (msX<sX+140+45) && (msY>sY+45+14*nickheight) && (msY<sY+45+15*nickheight)) { PutString(sX+140,sY+45+(14*nickheight),MSG_FRIENDSLIST9,RGB(255,255,255)); } else { PutString(sX+140,sY+45+(14*nickheight),MSG_FRIENDSLIST9,RGB(0,0,0)); } break; } } void CGame::DlgBoxClick_FriendList(short msX, short msY) // 43 - drajwer { short sX, sY, szX,szY; int tmp,i; char cTxt[100]; sX = m_stDialogBoxInfo[43].sX; sY = m_stDialogBoxInfo[43].sY; szX = m_stDialogBoxInfo[43].sSizeX; szY = m_stDialogBoxInfo[43].sSizeY; if ((msX>sX+25) && (msX<sX+szX-25)&&(msY>sY+45+16)&&(msY<sY+45+(13)*16)) { tmp=msY-sY-45-16; tmp=tmp/16; if (strcmp(friendsList[tmp].friendName,"") != 0){ m_iFriendIndex=tmp; } else { m_iFriendIndex=-1; } return; } if ((msX>sX+25) && (msX<sX+25+25) && (msY>sY+45+14*16) && (msY<sY+45+15*16)) { if (m_iTotalFriends==12) { AddEventList(MSG_FRIENDSLIST1,10); return; } m_bIsGetPointingMode = TRUE; m_iPointCommandType = 250; PlaySound('E', 14, 5); AddEventList(MSG_FRIENDSLIST2,10); //pointing mode return; } if(m_iFriendIndex == -1) return; if ((msX>sX+80) && (msX<sX+80+30) && (msY>sY+45+14*16) && (msY<sY+45+15*16)) { for (i = m_iFriendIndex+1;i<13;i++) { ZeroMemory(friendsList[i-1].friendName,sizeof(friendsList[i-1].friendName)); memcpy(friendsList[i-1].friendName,friendsList[i].friendName,10); ZeroMemory(friendsList[i].friendName,sizeof(friendsList[i].friendName)); friendsList[i-1].online = friendsList[i].online; } m_iTotalFriends--; SaveFriendList(); } if ((msX>sX+140) && (msX<sX+140+45) && (msY>sY+45+14*16) && (msY<sY+45+15*16)) { ZeroMemory(cTxt,sizeof(cTxt)); wsprintf(cTxt,"/to %s",friendsList[m_iFriendIndex].friendName); bSendCommand(MSGID_COMMAND_CHATMSG, NULL, NULL, NULL, NULL, NULL, cTxt); } } void CGame::SaveFriendList() { char cFn[256]/*, cTemp[255]*/; ZeroMemory(cFn,sizeof(cFn)); if(strlen(m_cPlayerName) > 0) wsprintf(cFn,"contents\\friends\\%s.txt", m_cPlayerName); FILE* f=fopen(cFn,"w"); int i; char wr[12]; _mkdir("CONTENTS\\friends"); //_mkdir(cFn); for (i=0;i<m_iTotalFriends;i++) { ZeroMemory(wr,sizeof(wr)); wsprintf(wr,"%s\n",friendsList[i].friendName); fputs(wr,f); } fclose(f); } void CGame::LoadFriendList() { char buf[1024]; int konieclinii; unsigned long linie=0; //new load by char name char cFn[256]/*, cTemp[255]*/; ZeroMemory(cFn,sizeof(cFn)); if(strlen(m_cPlayerName) > 0) wsprintf(cFn,"contents\\friends\\%s.txt", m_cPlayerName); FILE* f=fopen(cFn,"rt"); m_iTotalFriends=0; if(f == NULL) { _mkdir("contents\\friends"); return; } while(fgets(buf,1024,f)){ konieclinii=0; int i=strlen(buf); if(i>0 && buf[--i]=='\n'){ buf[i]=0; konieclinii=1; linie++; } if (linie-1<13) { strcpy(friendsList[linie-1].friendName,buf); m_iTotalFriends++; } } fclose(f); } void CGame::UpdateFriendsStatus() { if((G_dwGlobalTime - lastFriendUpdate) < 4000) return; lastFriendUpdate = G_dwGlobalTime; char namesBuf[255]; ZeroMemory(namesBuf, sizeof(namesBuf)); for(int i = 0; i < m_iTotalFriends; i++){ friendsList[i].updated = false; strcat(namesBuf, friendsList[i].friendName); strcat(namesBuf, " "); } bSendCommand(MSGID_REQUEST_UPDATE_FRIENDS,NULL,NULL,NULL,NULL,NULL,namesBuf); } void CGame::DrawDialogBox_Shop(short msX, short msY, short msZ, char cLB) {short sX, sY; DWORD dwTime = m_dwCurTime; int i, iTemp; char cTemp[255], cStr2[255], cStr3[255]; int iCost, iDiscountCost, iDiscountRatio; double dTmp1, dTmp2, dTmp3; int iTotalLines, iPointerLoc; BOOL bFlagStatLow = FALSE; BOOL bFlagRedShown = FALSE; double d1, d2, d3; sX = m_stDialogBoxInfo[11].sX; sY = m_stDialogBoxInfo[11].sY; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); DrawNewDialogBox(SPRID_INTERFACE_ND_TEXT, sX, sY, 11); switch (m_stDialogBoxInfo[11].cMode) { case 0: iTotalLines = 0; for (i = 0; i < MAXMENUITEMS; i++) if (m_pItemForSaleList[i] != NULL) iTotalLines++; if (iTotalLines > 13) { d1 = (double)m_stDialogBoxInfo[11].sView; d2 = (double)(iTotalLines-13); d3 = (274.0f * d1)/d2; iPointerLoc = (int)(d3); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 3); DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX+242, sY + iPointerLoc + 35, 7); }else iPointerLoc = 0; if (cLB != 0 && iTotalLines > 13) { if ((iGetTopDialogBoxIndex() == 11)) { if ((msX >= sX + 235) && (msX <= sX + 260) && (msY >= sY + 10) && (msY <= sY + 330)) { d1 = (double)(msY -(sY+35)); d2 = (double)(iTotalLines-13); d3 = (d1 * d2)/274.0f; m_stDialogBoxInfo[11].sView = (int)(d3+0.5); } } }else m_stDialogBoxInfo[11].bIsScrollSelected = FALSE; if( iGetTopDialogBoxIndex() == 11 && msZ != 0 ) { m_stDialogBoxInfo[11].sView = m_stDialogBoxInfo[11].sView - msZ/60; m_DInput.m_sZ = 0; } if( iTotalLines > 13 && m_stDialogBoxInfo[11].sView > iTotalLines-13 ) m_stDialogBoxInfo[11].sView = iTotalLines-13; if( m_stDialogBoxInfo[11].sView < 0 || iTotalLines < 13 ) m_stDialogBoxInfo[11].sView = 0; PutAlignedString(sX + 22, sX +165, sY + 45, DRAW_DIALOGBOX_SHOP1); // "ITEM" PutAlignedString(sX + 23, sX +166, sY + 45, DRAW_DIALOGBOX_SHOP1); PutAlignedString(sX +153, sX +250, sY + 45, DRAW_DIALOGBOX_SHOP3); PutAlignedString(sX +154, sX +251, sY + 45, DRAW_DIALOGBOX_SHOP3); for (i = 0; i < 13; i++) if (((i+ m_stDialogBoxInfo[11].sView) < MAXMENUITEMS) && (m_pItemForSaleList[i + m_stDialogBoxInfo[11].sView] != NULL)) { ZeroMemory(cTemp, sizeof(cTemp)); GetItemName(m_pItemForSaleList[i + m_stDialogBoxInfo[11].sView], cTemp, cStr2, cStr3); if ((msX >= sX + 20) && (msX <= sX + 220) && (msY >= sY + i*18 + 65) && (msY <= sY + i*18 + 79)) { PutAlignedString(sX +10, sX +190, sY + i*18 + 65, cTemp, 255, 255, 255); }else PutAlignedString(sX +10, sX +190, sY + i*18 + 65, cTemp, 4,0,50); } for (i = 0; i < 13; i++) if (((i+ m_stDialogBoxInfo[11].sView) < MAXMENUITEMS) && (m_pItemForSaleList[i + m_stDialogBoxInfo[11].sView] != NULL)) { iDiscountRatio = ((m_stat[STAT_CHR] - 10) / 4) ; dTmp1 = (double)iDiscountRatio; dTmp2 = dTmp1 / 100.0f; dTmp1 = (double)m_pItemForSaleList[i + m_stDialogBoxInfo[11].sView]->m_wPrice; dTmp3 = dTmp1 * dTmp2; iDiscountCost = (int)dTmp3; iCost = (int)(m_pItemForSaleList[i + m_stDialogBoxInfo[11].sView]->m_wPrice * ((100 + m_cDiscount)/100.) ); iCost = iCost - iDiscountCost; if (iCost < (m_pItemForSaleList[i + m_stDialogBoxInfo[11].sView]->m_wPrice/2)) iCost = (m_pItemForSaleList[i + m_stDialogBoxInfo[11].sView]->m_wPrice/2) - 1; ZeroMemory(cTemp, sizeof(cTemp)); wsprintf(cTemp, "%6d", iCost); if ((msX >= sX+20) && (msX <= sX+220) && (msY >= sY+i*18+65) && (msY <= sY+i*18+79)) PutAlignedString(sX+148, sX+260, sY+i*18+65, cTemp, 255, 255, 255); else PutAlignedString(sX+148, sX+260, sY+i*18+65, cTemp, 4,0,50); } break; default: m_pSprite[SPRID_ITEMPACK_PIVOTPOINT + m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sSprite]->PutSpriteFast(sX + 62 + 30 -35, sY + 84 + 30 -10, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sSpriteFrame, dwTime); ZeroMemory(cTemp, sizeof(cTemp)); GetItemName(m_pItemForSaleList[m_stDialogBoxInfo[11].cMode-1], cTemp, cStr2, cStr3); PutAlignedString(sX +25, sX+240, sY+50, cTemp, 255,255,255); PutAlignedString(sX +26, sX+241, sY+50, cTemp, 255,255,255); strcpy(cTemp, DRAW_DIALOGBOX_SHOP3); //"PRICE" PutString(sX + 90, sY + 78 + 30 -10, cTemp, RGB(40,10,10)); PutString(sX + 91, sY + 78 + 30 -10, cTemp, RGB(40,10,10)); strcpy(cTemp, DRAW_DIALOGBOX_SHOP6); // "Weight" PutString(sX + 90, sY + 93 + 30 -10, cTemp, RGB(40,10,10)); PutString(sX + 91, sY + 93 + 30 -10, cTemp, RGB(40,10,10)); iDiscountRatio = ((m_stat[STAT_CHR] -10) / 4) ; dTmp1 = (double)iDiscountRatio; dTmp2 = dTmp1 / 100.0f; dTmp1 = (double)m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_wPrice; dTmp3 = dTmp1 * dTmp2; iDiscountCost = (int)dTmp3; iCost = (int)(m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_wPrice * ((100 +m_cDiscount)/100.) ); iCost = iCost - iDiscountCost; if (iCost < (m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_wPrice/2)) iCost = (m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_wPrice/2) - 1; wsprintf(cTemp, DRAW_DIALOGBOX_SHOP7, iCost ); //": %d Gold" PutString(sX + 140, sY + 98, cTemp, RGB(45,25,25)); iTemp = m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_wWeight/100; wsprintf(cTemp, DRAW_DIALOGBOX_SHOP8, iTemp); //": %d Stone" PutString(sX + 140, sY + 113, cTemp, RGB(45,25,25)); switch (m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_cEquipPos) { case EQUIPPOS_RHAND: case EQUIPPOS_TWOHAND: strcpy(cTemp, DRAW_DIALOGBOX_SHOP9); // Damage PutString(sX + 90, sY + 145, cTemp, RGB(40,10,10)); PutString(sX + 91, sY + 145, cTemp, RGB(40,10,10)); strcpy(cTemp, DRAW_DIALOGBOX_SHOP10); //"Speed(Min.~Max.)" PutString(sX + 40, sY + 175, cTemp, RGB(40,10,10)); PutString(sX + 41, sY + 175, cTemp, RGB(40,10,10)); if (m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue3 != 0) { wsprintf(cTemp, ": %dD%d+%d (S-M)", m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue1, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue2, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue3); }else { wsprintf(cTemp, ": %dD%d (S-M)", m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue1, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue2); } PutString(sX + 140, sY + 145, cTemp, RGB(45,25,25)); if (m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue6 != 0) { wsprintf(cTemp, ": %dD%d+%d (L)", m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue4, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue5, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue6); }else { wsprintf(cTemp, ": %dD%d (L)", m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue4, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue5); } PutString(sX + 140, sY + 160, cTemp, RGB(45,25,25)); if (m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_cSpeed == 0) wsprintf(cTemp, ": 0(10~10)"); else wsprintf(cTemp, ": %d(%d ~ %d)",m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_cSpeed, iTemp,m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_cSpeed*13); PutString(sX + 140, sY + 175, cTemp, RGB(45,25,25)); if ((m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_wWeight/100) > m_stat[STAT_STR]) { wsprintf(cTemp,DRAW_DIALOGBOX_SHOP11, (m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_wWeight/100)) ; PutAlignedString(sX +25, sX+240, sY + 258, cTemp, 195,25,25); PutAlignedString(sX +26, sX+241, sY + 258, cTemp, 195,25,25); // *Your STR should be at least %d to use this item." bFlagRedShown = TRUE; } break; case EQUIPPOS_LHAND: strcpy(cTemp, DRAW_DIALOGBOX_SHOP12); // "Defence" PutString(sX + 90, sY + 145, cTemp, RGB(40,10,10)); PutString(sX + 91, sY + 145, cTemp, RGB(40,10,10)); wsprintf(cTemp, ": +%d%", m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue1); PutString(sX + 140, sY + 145, cTemp, RGB(45,25,25)); if ((m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_wWeight/100) > m_stat[STAT_STR]) { wsprintf(cTemp,DRAW_DIALOGBOX_SHOP11, (m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_wWeight/100)) ; PutAlignedString(sX +25, sX+240, sY + 258, cTemp, 195,25,25); // "*Your STR should be at least %d to use this item." PutAlignedString(sX +26, sX+241, sY + 258, cTemp, 195,25,25); bFlagRedShown = TRUE; } break; case EQUIPPOS_HEAD: case EQUIPPOS_BODY: case EQUIPPOS_BOOTS: case EQUIPPOS_ARMS: case EQUIPPOS_PANTS: strcpy(cTemp, DRAW_DIALOGBOX_SHOP12); // "Defence" PutString(sX + 90, sY + 145, cTemp, RGB(40,10,10)); PutString(sX + 91, sY + 145, cTemp, RGB(40,10,10)); wsprintf(cTemp, ": +%d%", m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue1); PutString(sX + 140, sY + 145, cTemp, RGB(45,25,25)); bFlagStatLow = FALSE; switch(m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue4) { case 10://"Available for above Str %d" wsprintf(cTemp, DRAW_DIALOGBOX_SHOP15, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue5); if (m_stat[STAT_STR] >= m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue5) { PutAlignedString(sX +25, sX+240, sY + 160, cTemp, 45,25,25); PutAlignedString(sX +26, sX+241, sY + 160, cTemp, 45,25,25); }else { PutAlignedString(sX +25, sX+240, sY + 160, cTemp, 125,25,25); PutAlignedString(sX +26, sX+241, sY + 160, cTemp, 125,25,25); bFlagStatLow = TRUE; // Means some red msg need to be shown at the bottom } break; case 11: // "Available for above Dex %d" wsprintf(cTemp, DRAW_DIALOGBOX_SHOP16, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue5); if (m_stat[STAT_DEX] >= m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue5) { PutAlignedString(sX +25, sX+240, sY + 160, cTemp, 45,25,25); PutAlignedString(sX +26, sX+241, sY + 160, cTemp, 45,25,25); }else { PutAlignedString(sX +25, sX+240, sY + 160, cTemp, 125,25,25); PutAlignedString(sX +26, sX+241, sY + 160, cTemp, 125,25,25); bFlagStatLow = TRUE; // Means some red msg need to be shown at the bottom } break; case 12: // "Available for above Vit %d" wsprintf(cTemp, DRAW_DIALOGBOX_SHOP17, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue5); if (m_stat[STAT_VIT] >= m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue5) { PutAlignedString(sX +25, sX+240, sY + 160, cTemp, 45,25,25); PutAlignedString(sX +26, sX+241, sY + 160, cTemp, 45,25,25); }else { PutAlignedString(sX +25, sX+240, sY + 160, cTemp, 125,25,25); PutAlignedString(sX +26, sX+241, sY + 160, cTemp, 125,25,25); bFlagStatLow = TRUE; // Means some red msg need to be shown at the bottom } break; case 13: // "Available for above Int %d" wsprintf(cTemp, DRAW_DIALOGBOX_SHOP18, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue5); if (m_stat[STAT_INT] >= m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue5) { PutAlignedString(sX +25, sX+240, sY + 160, cTemp, 45,25,25); PutAlignedString(sX +26, sX+241, sY + 160, cTemp, 45,25,25); }else { PutAlignedString(sX +25, sX+240, sY + 160, cTemp, 125,25,25); PutAlignedString(sX +26, sX+241, sY + 160, cTemp, 125,25,25); bFlagStatLow = TRUE; // Means some red msg need to be shown at the bottom } break; case 14: // "Available for above Mag %d" wsprintf(cTemp, DRAW_DIALOGBOX_SHOP19, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue5); if (m_stat[STAT_MAG] >= m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue5) { PutAlignedString(sX +25, sX+240, sY + 160, cTemp, 45,25,25); PutAlignedString(sX +26, sX+241, sY + 160, cTemp, 45,25,25); }else { PutAlignedString(sX +25, sX+240, sY + 160, cTemp, 125,25,25); PutAlignedString(sX +26, sX+241, sY + 160, cTemp, 125,25,25); bFlagStatLow = TRUE; // Means some red msg need to be shown at the bottom } break; case 15: // "Available for above Chr %d" wsprintf(cTemp, DRAW_DIALOGBOX_SHOP20, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue5); if (m_stat[STAT_CHR] >= m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sItemEffectValue5) { PutAlignedString(sX +25, sX+240, sY + 160, cTemp, 45,25,25); PutAlignedString(sX +26, sX+241, sY + 160, cTemp, 45,25,25); }else { PutAlignedString(sX +25, sX+240, sY + 160, cTemp, 125,25,25); PutAlignedString(sX +26, sX+241, sY + 160, cTemp, 125,25,25); bFlagStatLow = TRUE; // Means some red msg need to be shown at the bottom } break; default: break; } if ((m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_wWeight/100) > m_stat[STAT_STR]) { wsprintf(cTemp,DRAW_DIALOGBOX_SHOP11, (m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_wWeight/100)) ; PutAlignedString(sX +25, sX+240, sY + 288, cTemp, 195,25,25); PutAlignedString(sX +26, sX+241, sY + 288, cTemp, 195,25,25); // "*Your STR should be at least %d to use this item." bFlagRedShown = TRUE; }else if (bFlagStatLow == TRUE) // Means some stat is too low { strcpy(cTemp, DRAW_DIALOGBOX_SHOP21); // "(Warning!) Your stat is too low for this item." PutAlignedString(sX +25, sX+240, sY + 258, cTemp, 195,25,25); PutAlignedString(sX +26, sX+241, sY + 258, cTemp, 195,25,25); bFlagRedShown = TRUE; }else if ( (strstr(m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_cName, "(M)") != NULL) && (m_sPlayerType > 3)) { strcpy(cTemp, DRAW_DIALOGBOX_SHOP22); // "(Warning!) only for male." PutAlignedString(sX +25, sX+240, sY + 258, cTemp, 195,25,25); PutAlignedString(sX +26, sX+241, sY + 258, cTemp, 195,25,25); bFlagRedShown = TRUE; }else if ( (strstr(m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_cName, "(W)") != NULL) && (m_sPlayerType <= 3)) { strcpy(cTemp, DRAW_DIALOGBOX_SHOP23); // "(Warning!) only for female." PutAlignedString(sX +25, sX+240, sY + 258, cTemp, 195,25,25); PutAlignedString(sX +26, sX+241, sY + 258, cTemp, 195,25,25); bFlagRedShown = TRUE; } break; case EQUIPPOS_NONE: break; } if (m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sLevelLimit != 0) { strcpy(cTemp, DRAW_DIALOGBOX_SHOP24); // "Level" if (m_iLevel >= m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sLevelLimit) { PutString(sX + 90, sY + 190, cTemp, RGB(40,10,10)); PutString(sX + 91, sY + 190, cTemp, RGB(40,10,10)); wsprintf(cTemp, DRAW_DIALOGBOX_SHOP25, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sLevelLimit); PutString(sX + 140, sY + 190, cTemp, RGB(45,25,25));// ": above %d" }else { PutString(sX + 90, sY + 190, cTemp, RGB(40,10,10)); PutString(sX + 91, sY + 190, cTemp, RGB(40,10,10)); wsprintf(cTemp, DRAW_DIALOGBOX_SHOP25, m_pItemForSaleList[m_stDialogBoxInfo[11].cMode - 1]->m_sLevelLimit); PutString(sX + 140, sY + 190, cTemp, RGB(125,25,25));// ": above %d" if (bFlagRedShown == FALSE) { strcpy(cTemp, DRAW_DIALOGBOX_SHOP26); // "(Warning!) Your level is too low for this item." PutAlignedString(sX +25 , sX+240 , sY + 258, cTemp, 195,25,25); PutAlignedString(sX +25 +1, sX+240 +1, sY + 258, cTemp, 195,25,25); bFlagRedShown = TRUE; } } } m_pSprite[SPRID_INTERFACE_ND_GAME2]->PutSpriteFast(sX + 156, sY + 219, 19, dwTime); m_pSprite[SPRID_INTERFACE_ND_GAME2]->PutSpriteFast(sX + 170, sY + 219, 19, dwTime); PutString(sX + 123 -35, sY + 237 -10, DRAW_DIALOGBOX_SHOP27, RGB(40,10,10)); // "Quantity:" PutString(sX + 124 -35, sY + 237 -10, DRAW_DIALOGBOX_SHOP27, RGB(40,10,10)); if( iGetTopDialogBoxIndex() == 11 && msZ != 0 ) { m_stDialogBoxInfo[11].sV3 = m_stDialogBoxInfo[11].sV3 + msZ/60; m_DInput.m_sZ = 0; } if (m_stDialogBoxInfo[11].sV3 > (50 - _iGetTotalItemNum())) m_stDialogBoxInfo[11].sV3 = (50 - _iGetTotalItemNum()); if (m_stDialogBoxInfo[11].sV3 < 1) m_stDialogBoxInfo[11].sV3 = 1; if (m_stDialogBoxInfo[11].sV3 >= 10) { ZeroMemory(cTemp, sizeof(cTemp)); _itoa(m_stDialogBoxInfo[11].sV3, cTemp, 10); cTemp[1] = NULL; PutString(sX -35 + 186, sY -10 + 237, cTemp, RGB(40,10,10)); PutString(sX -35 + 187, sY -10 + 237, cTemp, RGB(40,10,10)); ZeroMemory(cTemp, sizeof(cTemp)); _itoa(m_stDialogBoxInfo[11].sV3, cTemp, 10); PutString(sX -35 + 200, sY -10 + 237, (cTemp+1), RGB(40,10,10)); PutString(sX -35 + 201, sY -10 + 237, (cTemp+1), RGB(40,10,10)); }else { PutString(sX -35 + 186, sY -10 + 237, "0", RGB(40,10,10)); PutString(sX -35 + 187, sY -10 + 237, "0", RGB(40,10,10)); ZeroMemory(cTemp, sizeof(cTemp)); _itoa(m_stDialogBoxInfo[11].sV3, cTemp, 10); PutString(sX -35 + 200, sY -10 + 237, (cTemp), RGB(40,10,10)); PutString(sX -35 + 201, sY -10 + 237, (cTemp), RGB(40,10,10)); } m_pSprite[SPRID_INTERFACE_ND_GAME2]->PutSpriteFast(sX +156, sY + 244, 20, dwTime); m_pSprite[SPRID_INTERFACE_ND_GAME2]->PutSpriteFast(sX +170, sY + 244, 20, dwTime); if ((msX >= sX + LBTNPOSX) && (msX <= sX + LBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 31); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + LBTNPOSX, sY + BTNPOSY, 30); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY >= sY + BTNPOSY) && (msY <= sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 17); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 16); break; } } void CGame::DrawDialogBox_DKMenuWeapons(int msX, int msY) { short sX, sY, szX; sX = m_stDialogBoxInfo[53].sX; sY = m_stDialogBoxInfo[53].sY; szX = m_stDialogBoxInfo[53].sSizeX; DrawNewDialogBox(SPRID_INTERFACE_ND_GAME2, sX, sY, 2); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*0) && (msY < sY +50+15*1)) PutAlignedString(sX, sX+szX, sY + 50 +15*0, "Dark Mage Wand", 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*0, "Dark Mage Wand", 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*1) && (msY < sY +50+15*2)) PutAlignedString(sX, sX+szX, sY + 50 +15*1, "Dark Knight Rapier", 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*1, "Dark Knight Rapier", 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*2) && (msY < sY +50+15*3)) PutAlignedString(sX, sX+szX, sY + 50 +15*2, "Dark Knight Great Sword", 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*2, "Dark Knight Great Sword", 4, 0, 50); if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*3) && (msY < sY +50+15*4)) PutAlignedString(sX, sX+szX, sY + 50 +15*3, "Dark Knight Flameberge", 255, 255, 255); else PutAlignedString(sX, sX+szX, sY + 50 +15*3, "Dark Knight Flameberge", 4, 0, 50); if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 1); else DrawNewDialogBox(SPRID_INTERFACE_ND_BUTTON, sX + RBTNPOSX, sY + BTNPOSY, 0); } // Jehovah void CGame::DlgBoxClick_DKMenuWeapons(int msX, int msY) { short sX, sY; sX = m_stDialogBoxInfo[53].sX; sY = m_stDialogBoxInfo[53].sY; // DK Weapons if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*0) && (msY < sY +50+15*1) && ( m_iLevel >= MAXLEVEL)) // Dark Mage Staff { bSendCommand(MSGID_REQUEST_DKITEM, NULL, NULL, 10, NULL, NULL, "Gail", NULL); PlaySound('E', 14, 5); } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*1) && (msY < sY +50+15*2) && ( m_iLevel >= MAXLEVEL)) // Dark Knight Rapier { bSendCommand(MSGID_REQUEST_DKITEM, NULL, NULL, 11, NULL, NULL, "Gail", NULL); PlaySound('E', 14, 5); } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*2) && (msY < sY +50+15*3) && ( m_iLevel >= MAXLEVEL)) // Dark Knight Great Sword { bSendCommand(MSGID_REQUEST_DKITEM, NULL, NULL, 12, NULL, NULL, "Gail", NULL); PlaySound('E', 14, 5); } if ((msX >= sX+25) && (msX <= sX+248) && (msY >= sY +50+15*3) && (msY < sY +50+15*4) && ( m_iLevel >= MAXLEVEL)) // Dark Knight Flameberge { bSendCommand(MSGID_REQUEST_DKITEM, NULL, NULL, 13, NULL, NULL, "Gail", NULL); PlaySound('E', 14, 5); } if ((msX >= sX + RBTNPOSX) && (msX <= sX + RBTNPOSX + BTNSZX) && (msY > sY + BTNPOSY) && (msY < sY + BTNPOSY + BTNSZY)) { PlaySound('E', 14, 5); DisableDialogBox(53); } } void CGame::LoadMuteList() { char buffer[64]; char fileLocation[64]; m_MuteList.clear(); ZeroMemory(fileLocation,sizeof(fileLocation)); if(strlen(m_cPlayerName) > 0) wsprintf(fileLocation,"CONTENTS\\mutes\\%s.txt", m_cPlayerName); FILE* f = fopen(fileLocation,"rt"); if(f == NULL) { _mkdir("CONTENTS\\mutes"); return; } while(fgets(buffer,64,f)){ int i = strlen(buffer); if(i > 0 && buffer[--i]=='\n') { buffer[i] = 0; m_MuteList.insert(string(buffer)); } } fclose(f); } void CGame::SaveMuteList() { char fileLocation[64]; ZeroMemory(fileLocation,sizeof(fileLocation)); if(strlen(m_cPlayerName) > 0) wsprintf(fileLocation,"CONTENTS\\mutes\\%s.txt", m_cPlayerName); FILE* f = fopen(fileLocation,"w"); _mkdir("CONTENTS\\mutes"); for(std::set<string>::iterator it = m_MuteList.begin(); it != m_MuteList.end(); it++){ fputs((*it).c_str(),f); fputs("\n",f); } fclose(f); } void CGame::DlgBoxClick_GuideMap(short msX, short msY) { if (m_bCtrlPressed == FALSE) return; short shX; short shY; int recallPoint = 0; int town; int range = 25; int recallPoints[2][5][2] = { {{140,49}, {68,125}, {170,145}, {140,205}, {116,245}}, //Aresden {{158,57}, {110,89}, {170,145}, {242,129}, {158,249}} //Elvine }; if( m_bZoomMap ) { shX = m_sPlayerX-64; shY = m_sPlayerY-64; if( shX < 0 ) shX = 0; else if( shX > m_pMapData->m_sMapSizeX-128 ) shX = m_pMapData->m_sMapSizeX-128; if( shY < 0 ) shY = 0; else if( shY > m_pMapData->m_sMapSizeY-128 ) shY = m_pMapData->m_sMapSizeY-128; shX += msX - m_stDialogBoxInfo[9].sX; shY += msY - m_stDialogBoxInfo[9].sY; } else { shX = (msX-m_stDialogBoxInfo[9].sX)*m_pMapData->m_sMapSizeX/128; shY = (msY-m_stDialogBoxInfo[9].sY)*m_pMapData->m_sMapSizeY/128; } if (m_cMapIndex == 11) town = 0; else if (m_cMapIndex == 3) town = 1; else return; for(int i = 0; i < 6; i++) if(shX > (recallPoints[town][i][0] - range) && shX < (recallPoints[town][i][0] + range) && shY > (recallPoints[town][i][1] - range) && shY < (recallPoints[town][i][1] + range)){ recallPoint = i + 1; break; } if(recallPoint != 0) { bSendCommand(MSGID_REQUEST_SETRECALLPNT, NULL, NULL, recallPoint, NULL, NULL, NULL, NULL); PlaySound('E', 14, 5); } }
[ "isolatorhk@gmail.com" ]
isolatorhk@gmail.com
ade4daec14a709e3b90101c472a85430bc38ba68
25c2f64bc1a56f6634375b4481516970bbd61287
/winebox.cpp
8127cc774316b309cc0054bf588bfe527ee801bf
[]
no_license
keyze/wine_db
583b316c13adb0e7477b8193c5e9f3e672f5dbc6
90aab57f5a5b73bf00794797692b6c9dc07f4788
refs/heads/master
2021-05-23T05:24:08.660998
2017-11-18T08:44:13
2017-11-18T08:44:13
95,182,692
0
0
null
null
null
null
UTF-8
C++
false
false
1,654
cpp
#include "winebox.h" #include <QDebug> WineBox::WineBox(QMessageBox *parent) : QMessageBox(parent) { } void WineBox::setSuccessAdd() { this->setWindowTitle(tr("Success!!!")); this->setText(tr("You have successfully added the wine to your collection!!!")); } void WineBox::setFailAddGeneric() { this->setWindowTitle(tr("Failure")); this->setText(tr("I'm sorry you have failed to add the wine to your collection.")); } void WineBox::setFailAddMinimum() { this->setWindowTitle(tr("Failure")); this->setText(tr("I'm sorry you have failed to add the wine to your collection.")); this->setInformativeText("Please include a minimum of Name, Vintage, Colour, Variety and Quantity to add your wine."); } void WineBox::setSuccessDrink() { this->setWindowTitle(tr("Success!!!")); this->setText(tr("Enjoy your wine.")); } void WineBox::setFailDrink() { this->setWindowTitle(tr("Failure")); } void WineBox::setFailNotEnoughDrink() { this->setWindowTitle(tr("Not Enough")); this->setText(tr("You don't have enough in your cellar to take this many.")); } void WineBox::setNoQuantityDrink() { this->setWindowTitle("Enter Quantity"); this->setText("Please enter number of bottles of wine to drink."); } void WineBox::setNoWineSelectedtoDrink() { this->setWindowTitle("No Wine Selected"); this->setText("Please select a wine to drink."); } void WineBox::ok() { int ret = this->exec(); switch(ret) { case QMessageBox::Ok : this->setText(""); this->setInformativeText(""); break; default : qDebug() << "Something went wrong"; break; } }
[ "adam@adam.com" ]
adam@adam.com
77d072dbec584aedba960258d11909ed0dccb322
e83aaf423d3624748522b9adecdeb15659f5bdee
/ditfw-gfx/src/platform/wxw/WxDriver.cpp
065af765e84f17d2569c89740d5ebeda2057317a
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
chartly/portfolio
4b432c212968b56d6a1514efe3dae87ae9a0c0e0
bd1782c274604f29f0edaa1407efce2a80d2c58f
refs/heads/master
2021-01-19T18:33:16.143552
2016-11-29T03:03:25
2016-11-29T03:03:25
30,293,065
3
1
null
null
null
null
WINDOWS-1252
C++
false
false
802
cpp
/************************************************************************ * * Flood Project © (2008-201x) * Licensed under the simplified BSD license. All rights reserved. * ************************************************************************/ #include "API.h" #include "WxDriver.h" namespace dit { //-----------------------------------// bool WxDriver::OnInit() { if (!wxApp::OnInit()) return false; wxInitAllImageHandlers(); core = new Core{}; core->Init(); //core->platform->wxApp->Show(); return true; } //-----------------------------------// void WxDriver::CleanUp() { core->Shutdown(); delete core; core = nullptr; } //-----------------------------------// }
[ "the.corbin.hart@gmail.com" ]
the.corbin.hart@gmail.com
f2cd6e7e43afa3af763758c784594cc8ab69d75d
5c6ca8bf171f500853d7cae03c00714a749ad06b
/Assignments/Assignment2/DataStructureTestFile/PriorityQueueTest.cpp
ca45a30fffd8e9ba819ce63911dab26d9571dc6b
[]
no_license
ngDuyAnh/Comp2150
3861541a298339717fe0b5bbbe31f052d89e4d41
606342a47008d8849134cfe1e0862c98e91515f4
refs/heads/master
2023-04-10T13:53:24.254780
2021-04-21T22:26:34
2021-04-21T22:26:34
330,733,658
1
0
null
null
null
null
UTF-8
C++
false
false
1,630
cpp
#include <iostream> #include <cassert> #include "PriorityQueue.h" #include "IntegerItem.h" using namespace std; // Macro #define NUM_INSERT 6 #define INSERT 5, 2, 1, 0, 3, 4 int main() { // Local variable dictionary const int INSERT_ARRAY[] = { INSERT }; PriorityQueue* testPriorityQueue = new PriorityQueue(); // Print std::cout << "Testing the priority queue." << std::endl; // Insert into the priority queue normal conditions for (int counter = 0; counter < NUM_INSERT; counter++) { // The number of data in the queue much match with count insert assert(testPriorityQueue->getLength() == counter); // Create process to insert IntegerItem* insertProcess = new IntegerItem(INSERT_ARRAY[counter]); // Insert input queue testPriorityQueue->enqueue(insertProcess); } // Pop the data from queue and check for (int counter = 0; counter < NUM_INSERT; counter++) { // The number of data in the queue much match with the count insert assert(testPriorityQueue->getLength() == NUM_INSERT - counter); // Get the datum ListItem* datum = testPriorityQueue->dequeue(); // Check assert(datum->getValue() == counter); // Release memory delete datum; } // Debug mode check if 2 same value insert, the second should go to the back IntegerItem* insert0 = new IntegerItem(0); IntegerItem* insert1 = new IntegerItem(0); IntegerItem* insert2 = new IntegerItem(0); testPriorityQueue->enqueue(insert0); testPriorityQueue->enqueue(insert1); testPriorityQueue->enqueue(insert2); // Release memory delete testPriorityQueue; // Return cout << "Program ends sucessfully." << endl; return 0; }
[ "In_Drop@outlook.com" ]
In_Drop@outlook.com
90e7a8e1a8e776734cd87ac9eaf4429524983b3c
318cae5305ac7e881b12ab234f5576f9823c7a38
/examples/Modules/PAJ7620/PAJ7620.ino
8ee1323fbd32f8494c4b77cdfa43d68d712c69e5
[ "Apache-2.0" ]
permissive
upahead/Rubik_Mini1-Arduino
e511426350be0d0afaf5eea2cfa74ac8023eeac6
7408c3469a07dc7dd288132af2a89f04da7f40ea
refs/heads/master
2023-04-01T01:31:41.114309
2021-04-09T08:51:02
2021-04-09T08:51:02
356,197,889
4
0
null
null
null
null
UTF-8
C++
false
false
3,489
ino
#include "PAJ7620.h" #include <Wire.h> #define GES_REACTION_TIME 500 // You can adjust the reaction time according to the actual circumstance. #define GES_ENTRY_TIME 800 // When you want to recognize the Forward/Backward gestures, your gestures' reaction time must less than GES_ENTRY_TIME(0.8s). #define GES_QUIT_TIME 1000 PAJ7620 b; void setup() { uint8_t error = 0; Serial.begin(115200); Serial.println("\nPAJ7620U2 TEST DEMO: Recognize 9 gestures."); error = b.paj7620Init(); // initialize Paj7620 registers if (error) { Serial.print("INIT ERROR,CODE:"); Serial.println(error); } else { Serial.println("INIT OK"); } Serial.println("Please input your gestures:\n"); } void loop() { uint8_t data = 0, data1 = 0, error; error = b.paj7620ReadReg(0x43, 1, &data); // Read Bank_0_Reg_0x43/0x44 for gesture result. if (!error) { switch (data) // When different gestures be detected, the variable 'data' will be set to different values by paj7620ReadReg(0x43, 1, &data). { case GES_RIGHT_FLAG: delay(GES_ENTRY_TIME); b.paj7620ReadReg(0x43, 1, &data); if(data == GES_FORWARD_FLAG) { Serial.println("Forward"); delay(GES_QUIT_TIME); } else if(data == GES_BACKWARD_FLAG) { Serial.println("Backward"); delay(GES_QUIT_TIME); } else { Serial.println("Right"); } break; case GES_LEFT_FLAG: delay(GES_ENTRY_TIME); b.paj7620ReadReg(0x43, 1, &data); if(data == GES_FORWARD_FLAG) { Serial.println("Forward"); delay(GES_QUIT_TIME); } else if(data == GES_BACKWARD_FLAG) { Serial.println("Backward"); delay(GES_QUIT_TIME); } else { Serial.println("Left"); } break; case GES_UP_FLAG: delay(GES_ENTRY_TIME); b.paj7620ReadReg(0x43, 1, &data); if(data == GES_FORWARD_FLAG) { Serial.println("Forward"); delay(GES_QUIT_TIME); } else if(data == GES_BACKWARD_FLAG) { Serial.println("Backward"); delay(GES_QUIT_TIME); } else { Serial.println("Up"); } break; case GES_DOWN_FLAG: delay(GES_ENTRY_TIME); b.paj7620ReadReg(0x43, 1, &data); if(data == GES_FORWARD_FLAG) { Serial.println("Forward"); delay(GES_QUIT_TIME); } else if(data == GES_BACKWARD_FLAG) { Serial.println("Backward"); delay(GES_QUIT_TIME); } else { Serial.println("Down"); } break; case GES_FORWARD_FLAG: Serial.println("Forward"); delay(GES_QUIT_TIME); break; case GES_BACKWARD_FLAG: Serial.println("Backward"); delay(GES_QUIT_TIME); break; case GES_CLOCKWISE_FLAG: Serial.println("Clockwise"); break; case GES_COUNT_CLOCKWISE_FLAG: Serial.println("anti-clockwise"); break; default: b.paj7620ReadReg(0x44, 1, &data1); if (data1 == GES_WAVE_FLAG) { Serial.println("wave"); } break; } } delay(100); }
[ "1398776451@qq.com" ]
1398776451@qq.com
eb7c64c45412f346eb929ab7b85644671e882a88
9d364070c646239b2efad7abbab58f4ad602ef7b
/platform/external/chromium_org/content/test/plugin/npapi_constants.h
d748bf897018251331acf6a639f54fcff8a9338e
[ "BSD-3-Clause" ]
permissive
denix123/a32_ul
4ffe304b13c1266b6c7409d790979eb8e3b0379c
b2fd25640704f37d5248da9cc147ed267d4771c2
refs/heads/master
2021-01-17T20:21:17.196296
2016-08-16T04:30:53
2016-08-16T04:30:53
65,786,970
0
2
null
2020-03-06T22:00:52
2016-08-16T04:15:54
null
UTF-8
C++
false
false
390
h
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_TEST_PLUGIN_NPAPI_CONSTANTS_H_ #define CONTENT_TEST_PLUGIN_NPAPI_CONSTANTS_H_ namespace NPAPIClient { extern const char kTestCompleteCookie[]; extern const char kTestCompleteSuccess[]; } #endif
[ "allegrant@mail.ru" ]
allegrant@mail.ru
0f3294078166c164ae803ea87430c4309a4a357f
258cb026f59dff826ada21702e6efa3f952981c4
/Test/frametest/frametest/MyRenderWnd.h
17f2f07efbe3b428a50360b9d6fac5f8396b4440
[]
no_license
sryanyuan/Srender
dbac0e1aa1b1c06f41d67dc7b93d407f776434cd
bb168d969f5008e99a06bc831fbb1a3db619e3ef
refs/heads/master
2021-01-01T17:32:05.017317
2014-08-14T08:06:53
2014-08-14T08:06:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
611
h
#ifndef _INC_MYRENDERWND_ #define _INC_MYRENDERWND_ ////////////////////////////////////////////////////////////////////////// #include <core/SRRenderWnd.h> #include <core/SIMessageListener.h> ////////////////////////////////////////////////////////////////////////// class CMyListener : public SIMessageListener { public: bool OnMessage(HWND _hWnd, UINT _uMsg, WPARAM _wParam, LPARAM _lParam); }; class CMyRenderWnd : public SRRenderWnd { public: virtual bool OnEnvCreate(); virtual void OnDrawFrame(); }; ////////////////////////////////////////////////////////////////////////// #endif
[ "sryan@qq.com" ]
sryan@qq.com
1f0249f5d55362e235f2f2d246391171ec27c497
acde52b01a43888fbe5ad5179cd3b914207bc916
/src/prems-office-problems/Test_Preparation/SW_Comp_Test_GraphMaze1.cpp
20c211740bb38c7053774e122ffaf7d4a84adadd
[]
no_license
amitverma2/programming
8b39615ded80f8f86f7fef56416e659b4a18c10c
1200adb3274c12ca98eda6184797fb34c009d503
refs/heads/master
2022-05-04T21:34:51.639987
2022-04-05T21:27:43
2022-04-05T21:27:43
116,874,935
0
0
null
null
null
null
UTF-8
C++
false
false
1,749
cpp
#include<iostream> using namespace std; #define N 16 bool DFSUtil(int g[N][N], int x, int y, bool** visited) { if(g[x][y] == 3) return true; visited[x][y] = true; if(x-1 >=0 && visited[x-1][y] == false && (g[x-1][y] == 0 || g[x-1][y] == 3) && DFSUtil(g, x-1, y, visited ) ) return true; if(x+1 < N && visited[x+1][y] == false && (g[x+1][y] == 0 || g[x+1][y] == 3) && DFSUtil(g, x+1, y, visited ) ) return true; if(y-1 >=0 && visited[x][y-1] == false && (g[x][y-1] == 0 || g[x][y-1] == 3) && DFSUtil(g, x, y-1, visited ) ) return true; if(y+1 < N && visited[x][y+1] == false && (g[x][y+1] == 0 || g[x][y+1] == 3) && DFSUtil(g, x, y+1, visited ) ) return true; return false; } bool compute(int g[N][N]) { bool find = false; bool** visited; visited = new bool* [N]; for(int i=0; i<N; i++) visited[i] = new bool [N]; for(int i=0; i<N; i++) { for(int j=0; j<N; j++) { visited[i][j] = false; } } int x,y; bool flag = false; for(x=0; x<N; x++) { for(y=0; y<N; y++) { if(g[x][y] == 2) { flag = true; break; } } if(flag) break; } find = DFSUtil(g, x, y, visited); for(int i=0; i<N; i++) delete[] visited[i]; delete[] visited; return find; } int main(int argc, char** argv) { int test_case; freopen("input.txt", "r", stdin); char str[N+1]; int g[N][N]; int number; for(test_case = 1; test_case <= 10; ++test_case) { cin >> number; for(int i=0; i<N; i++) { cin >> str; for(int j=0; j<N;j++) { g[i][j] = str[j]-'0'; } } bool find; find = compute(g); cout << "#" << test_case << " " << (find?1:0) << endl; } return 0; }
[ "amit.verma2@gmail.com" ]
amit.verma2@gmail.com
0a752de7658eae4a2e3ece0e3efeebca6530adc8
a1859bbfc6cef11345ca554a85469de857d17e03
/amqpclient/receiver.h
0abdb8aee039d7d7f2db2aa0dea8c4effc36b30d
[]
no_license
ashraful100/Web-Service-Broker
272cc8f3ef64fad076a73bd4529ea1c60299c7e1
3ff53e6bbc869c5c66abb4fc043c2cb403dee302
refs/heads/master
2020-06-11T12:52:34.777579
2019-06-26T20:26:13
2019-06-26T20:26:13
193,970,445
0
0
null
null
null
null
UTF-8
C++
false
false
2,818
h
#ifndef RECEIVER_H #define RECEIVER_H #include <QObject> #include <QRunnable> #include <QDebug> #include <QTime> #include "qamqp/amqp.h" #include "qamqp/amqp_queue.h" namespace QAMQP { //! //! \brief The Receiver class provides an interface to receive AMPQ data from the server //! \ingroup amqpclient //! class Receiver : public QObject { Q_OBJECT typedef QObject super; public: explicit Receiver(QObject* parent=0) : super(parent) { // Create AMQP client client = new QAMQP::Client(this); key=""; } void closeConnection() { client->close(); } bool clientIsConnected() { return client->isConnected(); } void setQueueName(QString queueName) { this->queueName = queueName; } void setQueueName(QString queueName,QString key) { this->queueName = queueName; this->key =key; } void setServerAddress(QString servAdd) { this->servAdd = servAdd; } void setFanoutName(QString fanoutName) { this->fanoutName = fanoutName; } void updateSettings() { if(client->isConnected()) { client->close(); } connect(client,SIGNAL(connected()),this,SLOT(slotConnected())); connect(client,SIGNAL(disconnected()),this,SLOT(slotDisconnected())); client->open(QUrl(servAdd)); // Create an exclusive queue queue_ = client->createQueue(); queue_->declare(queueName,Queue::Durable); connect(queue_, SIGNAL(declared()), this, SLOT(declared())); connect(queue_, SIGNAL(messageReceived(QAMQP::Queue*)), this, SLOT(newMessage(QAMQP::Queue*))); } signals: void onMessageReceived(QByteArray receivedMsg); void connected(); void disconnected(); void signalConnectionStatus(bool connected); public slots: void slotConnected() { emit connected(); emit signalConnectionStatus(true); } void slotDisconnected() { purgeQ(); queue_->unbind(fanoutName,key); emit disconnected(); emit signalConnectionStatus(false); } void purgeQ() { queue_->purge(); } void deleteQ(){ queue_->remove(); } protected slots: void declared() { queue_->purge(); queue_->bind(fanoutName,key); queue_->consume(); } void newMessage(QAMQP::Queue* queue_) { QAMQP::MessagePtr message = queue_->getMessage(); queue_->ack(message); // qDebug()<<"Receive"; emit onMessageReceived(message->payload); } private: QAMQP::Queue* queue_; QString queueName,fanoutName,servAdd,key; QAMQP::Client* client; }; } #endif // RECEIVER_H
[ "write2ashraf_eee@yahoo.com" ]
write2ashraf_eee@yahoo.com
8dc563ec1ce96dde2c38d2fd061f3695fe3b1515
521f867f59c89f63c15eabc076adc6b692e1e7d8
/RGB7221.cpp
78414a669a1894ec52ec2bf1cba60263fb50ecaa
[]
no_license
Oyun-Erdene/bod
08c077d13a9068291506a332d9a727943db39990
769cb3b57a120e865fda14e9915df8957f15fd8c
refs/heads/master
2021-01-13T10:19:54.828901
2016-10-01T17:19:25
2016-10-01T17:19:25
68,976,428
0
0
null
null
null
null
UTF-8
C++
false
false
237
cpp
//Ogogdson tsifr hurtelh tsifruudiig neg hooson zaigaar tusgaarlan hevle. Suuliin tsifriin ard hooson zai bhk mor duusga #include<stdio.h> int a; main() { scanf("%d",&a); for(int b=0; b<a; b++) { printf("%d ",b); } }
[ "holly_1227@yahoo.com" ]
holly_1227@yahoo.com
fa4f3690003d7549899fc3ff76431060e78efe22
2d24f074daa64b2f8f32c55a6ff0a6f9eef41eaa
/Sources/Part12/Entity/Actor.cpp
1ea431522fee8351bc177aa40fe7d2273f41fd60
[ "MIT" ]
permissive
marukrap/RoguelikeTutorial2020
f39600696b2c9de1f9e63e3f540bc7f741387fa2
6fbed9068dff6279f1e3a885329cc2dfaec1ad4a
refs/heads/master
2022-12-04T11:56:17.892520
2020-08-20T02:33:42
2020-08-20T02:33:42
273,975,736
33
3
null
null
null
null
UTF-8
C++
false
false
4,514
cpp
#include "Actor.hpp" #include "World.hpp" #include "Engine/Direction.hpp" #include "Engine/Rng.hpp" #include <unordered_map> #include <algorithm> // max struct ActorData { char ch; Color color; int hp; int attack; int defense; int xp; }; namespace { const std::unordered_map<std::string, ActorData> Table = { { "you", { '@', 0xFFFFFF, 100, 4, 1, 0 } }, { "orc", { 'o', 0x14A02E, 20, 4, 0, 35 } }, { "troll", { 'T', 0x1A7A3E, 30, 8, 2, 100 } }, }; } Actor::Actor(const std::string& name) : m_name(name) , m_data(Table.at(name)) , m_hp(m_data.hp) { m_ch = m_data.ch; m_color = m_data.color; } std::string_view Actor::getName() const { return m_name; } bool Actor::isPlayer() const { return this == s_world->getPlayerActor(); } bool Actor::isDestroyed() const { return m_hp <= 0; } int Actor::getHp() const { return m_hp; } int Actor::getMaxHp() const { return m_data.hp; } int Actor::getAttack() const { return m_data.attack; } int Actor::getDefense() const { return m_data.defense; } int Actor::getXp() const { return m_data.xp; } void Actor::takeDamage(int damage) { if (damage > 0) m_hp -= damage; } void Actor::restoreHp(int points) { m_hp = std::min(m_hp + points, getMaxHp()); } void Actor::attack(Actor& target) { const int damage = std::max(0, getAttack() - target.getDefense()); target.takeDamage(damage); // TODO: C++20 format std::string message = getTheName() + " hit " + target.getTheName() + " for " + std::to_string(damage) + " damage."; s_world->addMessage(std::move(message)); if (target.isDestroyed()) { if (target.isPlayer()) message = "you died."; else message = target.getTheName() + " is dead."; s_world->addMessage(std::move(message)); s_world->closeDoor(target.getPosition()); s_world->markRemoveWrecks(); } } Actor* Actor::getTarget() const { return m_target; } void Actor::setTarget(Actor* target) { m_target = target; } void Actor::updateAi() { if (!m_target) return; const Vec2i targetPos = m_target->getPosition(); if (hasStatusEffect(StatusEffect::Confused)) { int dx = 0; int dy = 0; do { dx = randomInt(-1, 1); dy = randomInt(-1, 1); } while (dx == 0 && dy == 0); Vec2i nextPos; nextPos.x = m_position.x + dx; nextPos.y = m_position.y + dy; if (Actor* actor = s_world->getActor(nextPos)) attack(*actor); else if (s_world->isPassable(nextPos)) { s_world->closeDoor(m_position); setPosition(nextPos); s_world->openDoor(m_position); } } else if ((targetPos - m_position).lengthSquared() <= 2) attack(*m_target); else { const auto path = s_world->findPath(targetPos, m_position); if (path.size() > 2) { s_world->closeDoor(m_position); const Vec2i nextPos = path[1]; if (s_world->getActor(nextPos)) { const Direction nextDir = nextPos - m_position; const Vec2i leftPos = m_position + nextDir.left45(); const Vec2i rightPos = m_position + nextDir.right45(); if (s_world->isPassable(leftPos) && !s_world->getActor(leftPos)) setPosition(leftPos); else if (s_world->isPassable(rightPos) && !s_world->getActor(rightPos)) setPosition(rightPos); } else setPosition(nextPos); s_world->openDoor(m_position); } } } Inventory* Actor::getInventory() { return nullptr; } bool Actor::hasStatusEffect(StatusEffect effect) const { for (auto& e : m_statusEffects) { if (e.first == effect) return true; } return false; } void Actor::addStatusEffect(StatusEffect effect, int duration) { for (auto& e : m_statusEffects) { if (e.first == effect) { e.second += duration; return; } } m_statusEffects.emplace_back(effect, duration); } void Actor::removeStatusEffect(StatusEffect effect) { const auto found = std::find_if(m_statusEffects.begin(), m_statusEffects.end(), [&] (const auto& e) { return e.first == effect; }); if (found != m_statusEffects.end()) m_statusEffects.erase(found); } void Actor::clearStatusEffects() { m_statusEffects.clear(); } void Actor::finishTurn() { // Update status effects for (auto it = m_statusEffects.begin(); it != m_statusEffects.end(); ) { if (--(*it).second <= 0) it = m_statusEffects.erase(it); else ++it; } } void Actor::save(std::ostream& os) { serialize(os, m_name); serialize(os, m_hp); serialize(os, m_statusEffects); Entity::save(os); } void Actor::load(std::istream& is) { //deserialize(is, m_name); deserialize(is, m_hp); deserialize(is, m_statusEffects); Entity::load(is); }
[ "marukrap@gmail.com" ]
marukrap@gmail.com
56d95a5cf1fcc6ab0d267fbd58b7ad09adfa86af
90eab7e1e18f4f06b8aede466f5ffffbb33546d7
/객체지향프로그래밍/2주차/DDD/DDD/DDDDlg.h
056776899292b1a32445a1861bd7d3d5da86e075
[]
no_license
juhyeonkwon/homeworks
3f098cf4479ab0904600bbebab6ee2aa6660490d
bdb1e05dde5f66c124326abd3e34d725bb9c080f
refs/heads/main
2023-03-29T04:05:08.960545
2021-04-04T14:47:53
2021-04-04T14:47:53
353,884,938
0
0
null
null
null
null
UTF-8
C++
false
false
859
h
 // DDDDlg.h: 헤더 파일 // #pragma once // CDDDDlg 대화 상자 class CDDDDlg : public CDialogEx { // 생성입니다. public: CDDDDlg(CWnd* pParent = nullptr); // 표준 생성자입니다. // 대화 상자 데이터입니다. #ifdef AFX_DESIGN_TIME enum { IDD = IDD_DDD_DIALOG }; #endif protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원입니다. // 구현입니다. protected: HICON m_hIcon; // 생성된 메시지 맵 함수 virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() public: CString mValEdit1; CString mValEdit2; afx_msg void OnBnClickedFind(); CString mValResult; afx_msg void OnBnClickedDelete(); afx_msg void OnBnClickedInsert(); CEdit mCtrlEdit1; CEdit mCtrlEdit2; };
[ "asshole96@naver.com" ]
asshole96@naver.com
63e3cad4fd95883d829387333d879d1888ac191b
1aa8209b02e8cb7226ff1d81e1914412041b9e97
/Composition.h
fe5d8780f4dcc0093d26de7e9fb2dfb17eebfc96
[]
no_license
tmyt/tsfwrapper
9ac61a377cd26ddd94ccc70e8e7c1fcd0e9fe787
0f63923ccd9d36b9a997d91ef46fb27145e4d4a3
refs/heads/master
2020-05-17T15:23:14.404914
2014-08-12T05:19:44
2014-08-12T05:19:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,382
h
#pragma once #define prop(__type, __name) \ private: \ __type m_##__name; \ public: \ property __type __name { \ __type get() { return m_##__name; } \ void set(__type value) { m_##__name = value; } \ } #define propr(__type, __name) \ private: \ __type m_##__name; \ public: \ property __type __name { \ __type get() { return m_##__name; } \ } #include <Windows.h> #include <atlcomcli.h> #include <msctf.h> namespace TextServiceFramework { public ref class Composition sealed { private: static Composition^ instance; CComQIPtr<ITfThreadMgr2> mgr; bool getIsInComposition(); template<typename T, typename U> std::vector<CComQIPtr<T>> convertToVector(U* enumInterface) { ULONG fetched; std::vector<CComQIPtr<T>> ret; while (1){ T* obj; enumInterface->Next(1, &obj, &fetched); if (fetched == 0) break; ret.push_back(CComQIPtr<T>(obj)); } return ret; } Composition(); public: static property Composition^ Instance { Composition^ get() { if (instance) return instance; return (instance = ref new Composition()); } } property bool IsInComposition { bool get() { return getIsInComposition(); } } }; }
[ "shigure@refy.net" ]
shigure@refy.net
2be68a47652dd8937e7deac196ae51642c508438
414efe112db52b6b2309c5b7032065a23a017d0f
/Source/BearBroomstick/BearBroomstick.cpp
0fc5adccd5fe6a97c99173806259998b0fc45f83
[]
no_license
palaster/the-bear-and-the-broomstick
9c7f20e8ff42ca15fc2c32d4481103f7342741b4
0fac775697adf402fab2d9c668ac7609dfdd9236
refs/heads/master
2023-01-27T15:24:32.794971
2020-08-25T17:32:55
2020-08-25T17:32:55
286,346,539
1
0
null
2020-12-07T23:36:43
2020-08-10T01:16:37
C++
UTF-8
C++
false
false
163
cpp
#include "BearBroomstick.h" #include "Modules/ModuleManager.h" IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, BearBroomstick, "BearBroomstick" );
[ "palaster307@gmail.com" ]
palaster307@gmail.com
accbb0419acd2e774fd659c047df3325c17778f7
18850649cfa4b5a0a813a4b1a58a28941a73f848
/Source/FPSTemplate/HUD/SpectatorHUD.cpp
a22a98662ab75e15a0d8bd915c2fd2ca1be61270
[]
no_license
DavidPereira00/Crown-Descendants
4a6f3553d97eb7e3fc6f53dcb7173c4340c47fbc
43afdcbd9ab5c79680aa9b55bcebcca15a622695
refs/heads/master
2023-03-23T11:59:41.042816
2021-03-16T23:34:24
2021-03-16T23:34:24
268,814,110
0
1
null
null
null
null
UTF-8
C++
false
false
298
cpp
#include "FPSTemplate.h" #include "SpectatorHUD.h" ASpectatorHUD::ASpectatorHUD() { static ConstructorHelpers::FObjectFinder<UObject> NewMainWidgetClass(TEXT("WidgetBlueprint'/Game/FPSTemplate/HUD/Widgets/WBP_Spectator.WBP_Spectator_C'")); MainWidgetClass = (UClass*)NewMainWidgetClass.Object; }
[ "39087853+DavidPereira00@users.noreply.github.com" ]
39087853+DavidPereira00@users.noreply.github.com
08477eebad6f579a9a830991fcff8b9dd76081c6
cc9db74ae72802a5682b4f9b3bcf78daa2b636ae
/nana/source/paint/image.cpp
b7881af288ac7ff8e27c945a17acfd9f90dda32f
[ "BSL-1.0" ]
permissive
testing-in-chrome/nana_test
c0e57211446a0f3958fade368c2ed819a3dac00b
34c903a312df81ec4e82f42b2e87f29787188410
refs/heads/master
2020-04-06T06:04:34.542678
2017-03-22T07:23:51
2017-03-22T07:23:51
73,659,228
1
0
null
null
null
null
UTF-8
C++
false
false
10,949
cpp
/* * Paint Image Implementation * Nana C++ Library(http://www.nanapro.org) * Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * @file: nana/paint/image.cpp * @contributors: * nabijaczleweli(pr#106) */ #include <nana/detail/platform_spec_selector.hpp> #include <nana/paint/image.hpp> #include <algorithm> #include <fstream> #include <iterator> #include <stdexcept> #include <nana/paint/detail/image_impl_interface.hpp> #include <nana/paint/pixel_buffer.hpp> #include <nana/filesystem/filesystem_ext.hpp> #include <nana/push_ignore_diagnostic.hpp> #if defined(NANA_ENABLE_JPEG) #include "detail/image_jpeg.hpp" #endif #if defined(NANA_ENABLE_PNG) #include "detail/image_png.hpp" #endif #include "detail/image_bmp.hpp" #include "detail/image_ico.hpp" #include "image_accessor.hpp" namespace fs = std::experimental::filesystem; namespace nana { namespace paint { #if defined(NANA_WINDOWS) HICON image_accessor::icon(const nana::paint::image& img) { auto ico = dynamic_cast<paint::detail::image_ico*>(img.image_ptr_.get()); if (ico && ico->ptr()) return *(ico->ptr()); return nullptr; } #else int image_accessor::icon(const image&) { return 0; } #endif namespace detail { //class image_ico image_ico::image_ico(bool is_ico): is_ico_(is_ico){} bool image_ico::open(const fs::path& file) { close(); #if defined(NANA_WINDOWS) HICON handle = 0; if(is_ico_) { handle = (HICON)::LoadImage(0, file.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE); } else { SHFILEINFO sfi; ::SHGetFileInfo(file.c_str(), 0, &sfi, sizeof(sfi), SHGFI_ICON); handle = sfi.hIcon; } if(handle) { HICON * p = new HICON(handle); ptr_ = std::shared_ptr<HICON>(p, handle_deleter()); ICONINFO info; ::GetIconInfo(handle, &info); size_.width = (info.xHotspot << 1); size_.height = (info.yHotspot << 1); ::DeleteObject(info.hbmColor); ::DeleteObject(info.hbmMask); return true; } #else static_cast<void>(is_ico_); //eliminate the unused compiler warning in Linux. static_cast<void>(file); //to eliminate the unused parameter compiler warning. #endif return false; } bool image_ico::open(const void* data, std::size_t bytes) { close(); #if defined(NANA_WINDOWS) // use actual resource size, stopped using CreateIconFromResource since it loads blurry image HICON handle = ::CreateIconFromResourceEx((PBYTE)data, static_cast<DWORD>(bytes), TRUE, 0x00030000, 0, 0, LR_DEFAULTCOLOR); if(handle) { ICONINFO info; if (::GetIconInfo(handle, &info) != 0) { HICON * p = new HICON(handle); ptr_ = std::shared_ptr<HICON>(p, handle_deleter()); size_.width = (info.xHotspot << 1); size_.height = (info.yHotspot << 1); ::DeleteObject(info.hbmColor); ::DeleteObject(info.hbmMask); return true; } } #else static_cast<void>(is_ico_); //kill the unused compiler warning in Linux. static_cast<void>(data); //to eliminate unused parameter compiler warning. static_cast<void>(bytes); #endif return false; } bool image_ico::alpha_channel() const { return false; } bool image_ico::empty() const { return (nullptr == ptr_); } void image_ico::close() { ptr_.reset(); } nana::size image_ico::size() const { return size_; } void image_ico::paste(const nana::rectangle& src_r, graph_reference graph, const point& p_dst) const { if(ptr_ && (graph.empty() == false)) { #if defined(NANA_WINDOWS) ::DrawIconEx(graph.handle()->context, p_dst.x, p_dst.y, *ptr_, src_r.width, src_r.height, 0, 0, DI_NORMAL); #else static_cast<void>(src_r); //eliminate unused parameter compiler warning. static_cast<void>(p_dst); #endif } } void image_ico::stretch(const nana::rectangle&, graph_reference graph, const nana::rectangle& r) const { if(ptr_ && (graph.empty() == false)) { #if defined(NANA_WINDOWS) ::DrawIconEx(graph.handle()->context, r.x, r.y, *ptr_, r.width, r.height, 0, 0, DI_NORMAL); #else static_cast<void>(r); //eliminate unused parameter compiler warning. #endif } } const image_ico::ptr_t& image_ico::ptr() const { return ptr_; } #if defined(NANA_WINDOWS) //struct handle_deleter void image_ico::handle_deleter::operator()(HICON* p) const { if(p && *p) ::DestroyIcon(*p); delete p; } //end struct handle_deleter #endif //end class image_ico } image::image_impl_interface::~image_impl_interface() {} //class image image::image() noexcept {} image::image(const image& rhs) : image_ptr_(rhs.image_ptr_) {} image::image(image&& r) : image_ptr_(std::move(r.image_ptr_)) {} image::image(const std::string& file) { open(file); } image::image(const std::wstring& file) { open(file); } image::~image() { close(); } image& image::operator=(const image& r) { if(this != &r) image_ptr_ = r.image_ptr_; return * this; } image& image::operator=(image&& r) { if(this != &r) image_ptr_ = std::move(r.image_ptr_); return *this; } std::shared_ptr<image::image_impl_interface> create_image(const fs::path & p) { std::shared_ptr<image::image_impl_interface> ptr; auto ext = p.extension().native(); if (ext.empty()) return ptr; std::transform(ext.begin(), ext.end(), ext.begin(), [](int ch) { if ('A' <= ch && ch <= 'Z') ch -= ('A' - 'a'); return ch; }); #if defined(NANA_WINDOWS) const wchar_t* ext_ico = L".ico"; const wchar_t* ext_png = L".png"; const wchar_t* ext_jpg = L".jpg"; const wchar_t* ext_jpeg = L".jpeg"; #else const char* ext_ico = ".ico"; const char* ext_png = ".png"; const char* ext_jpg = ".jpg"; const char* ext_jpeg = ".jpeg"; #endif do { if (ext_ico == ext) { #if defined(NANA_WINDOWS) ptr = std::make_shared<detail::image_ico>(true); #else return ptr; #endif break; } if (ext_png == ext) { #if defined(NANA_ENABLE_PNG) ptr = std::make_shared<detail::image_png>(); #else return ptr; #endif break; } if (ext_jpg == ext || ext_jpeg == ext) { #if defined(NANA_ENABLE_JPEG) ptr = std::make_shared<detail::image_jpeg>(); #else return ptr; #endif break; } } while (false); //Check for BMP if (!ptr) { #ifndef NANA_MINGW std::ifstream ifs(p.c_str(), std::ios::binary); #else std::ifstream ifs(to_osmbstr(to_utf8(p.native())).c_str(), std::ios::binary); #endif if (ifs) { unsigned short meta = 0; ifs.read(reinterpret_cast<char*>(&meta), 2); if (*reinterpret_cast<const short*>("BM") == meta) ptr = std::make_shared<detail::image_bmp>(); else if (*reinterpret_cast<const short*>("MZ") == meta) ptr = std::make_shared<detail::image_ico>(false); } } return ptr; } bool image::open(const ::std::string& file) { fs::path path(file); image_ptr_ = create_image(path); return (image_ptr_ ? image_ptr_->open(path) : false); } bool image::open(const std::wstring& file) { fs::path path(file); image_ptr_ = create_image(path); return (image_ptr_ ? image_ptr_->open(path) : false); } bool image::open(const void* data, std::size_t bytes) { close(); if (bytes > 2) { std::shared_ptr<image::image_impl_interface> ptr; auto meta = *reinterpret_cast<const unsigned short*>(data); if (*reinterpret_cast<const short*>("BM") == meta) ptr = std::make_shared<detail::image_bmp>(); else if (*reinterpret_cast<const short*>("MZ") == meta) ptr = std::make_shared<detail::image_ico>(false); else { if (bytes > 8 && (0x474e5089 == *reinterpret_cast<const unsigned*>(data))) { #if defined(NANA_ENABLE_PNG) ptr = std::make_shared<detail::image_png>(); #endif } else { #if defined(NANA_ENABLE_JPEG) //JFIF if (bytes > 11 && (0xe0ffd8ff == *reinterpret_cast<const unsigned*>(data)) && 0x4649464A == *reinterpret_cast<const unsigned*>(reinterpret_cast<const char*>(data)+6)) ptr = std::make_shared<detail::image_jpeg>(); else if (bytes > 9 && (0x66697845 == *reinterpret_cast<const unsigned*>(reinterpret_cast<const char*>(data)+5))) //Exif ptr = std::make_shared<detail::image_jpeg>(); #endif #if defined(NANA_WINDOWS) // suppose icon data is bitmap data if (!ptr && bytes > 40 /* sizeof(BITMAPINFOHEADER) */ && (40 == *reinterpret_cast<const uint32_t*>(data))) { ptr = std::make_shared<detail::image_ico>(true); } #endif } } if (ptr) { image_ptr_.swap(ptr); return image_ptr_->open(data, bytes); } } return false; } bool image::empty() const noexcept { return ((nullptr == image_ptr_) || image_ptr_->empty()); } image::operator unspecified_bool_t() const { return (image_ptr_ ? &image::empty : nullptr); } //Fixed missing noexcept specifier by nabijaczleweli(pr#106) void image::close() noexcept { image_ptr_.reset(); } //Fixed missing noexcept specifier by nabijaczleweli(pr#106) bool image::alpha() const noexcept { return (image_ptr_ ? image_ptr_->alpha_channel() : false); } //Fixed missing noexcept specifier by nabijaczleweli(pr#106) nana::size image::size() const noexcept { return (image_ptr_ ? image_ptr_->size() : nana::size()); } void image::paste(graphics& dst, const point& p_dst) const { this->paste(rectangle{ this->size() }, dst, p_dst); } void image::paste(const rectangle& r_src, graphics & dst, const point& p_dst) const { if (image_ptr_) { if (dst.empty()) dst.make({ r_src.width, r_src.height }); //throws if failed to create image_ptr_->paste(r_src, dst, p_dst); } else throw std::runtime_error("image is empty"); } void image::stretch(const nana::rectangle& r_src, graphics& dst, const nana::rectangle & r_dst) const { if (image_ptr_) { if (dst.empty()) dst.make({ r_src.width, r_src.height }); //throws if failed to create image_ptr_->stretch(r_src, dst, r_dst); } else throw std::runtime_error("image is empty"); } //end class image }//end namespace paint }//end namespace nana
[ "testing.in.chrome@gmail.com" ]
testing.in.chrome@gmail.com
6275808330ee1710629034a06a0ecb5b93619dbe
25c8e6cbe599a3e1a8d1eae7393e9ff8549d073f
/Lab/Gaddis_9thEd_Chap3_Prob19_MonthlyPayments/main.cpp
35de81654330c2d392d528af155daa73284d014d
[]
no_license
juansterrr/2020_Spring_CIS_CSC_5
ceaeb482aff7cd5d8fba9c035a662f67241b93f3
ee2bfa465a64cadabb11da5fe2d1106c2d9f3059
refs/heads/master
2022-04-25T15:30:38.629797
2020-04-24T17:09:31
2020-04-24T17:09:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,068
cpp
/* * File: main.cpp * Author: Dr. Mark E. Lehr * Created on March 10th, 2020, 10:03 AM * Purpose: Loan Problem */ //System Level Libraries #include <iostream> //I/O Library #include <cmath> //cmath library for pow function #include <iomanip> //Format Library using namespace std; //Libraries compiled under std //User Level Libraries //Global Constants - Science/Math Related //Conversions, Higher Dimensions const unsigned char CNVMNTH=12; //Number of months/year const unsigned char CNVPERC=100;//Percent to Decimal //Function Prototypes //Execution Begins Here! int main(int argc, char** argv) { //Variable Declarations float intRate,//Interest Rate in %/year loanAmt; //Loan Amount in $'s unsigned char numCmpd;//Number of compounding periods Months float mnPymnt,//Monthly Payment in $'s totPaid,//Total amount paid in $'s intPaid;//Interest Paid in $'s //Variable Initialization intRate=12; //12 percent/year loanAmt=1e4f;//$10,000 numCmpd=36; //Number of Compounding Periods //Mapping Process Inputs to Outputs intRate/=static_cast<float>(CNVMNTH);//Convert %/month intRate/=static_cast<float>(CNVPERC);//Convert to Decimal float temp=pow(1+intRate,numCmpd);//Calc once use twice mnPymnt=intRate>0?//Monthly Payment blows up at 0% interest rate intRate*temp*loanAmt/(temp-1)://temp used twice loanAmt/numCmpd;//What if interest rate was equal to 0 totPaid=mnPymnt*numCmpd;//Total Paid for Loan intPaid=totPaid-loanAmt;//Total interest paid for Loan //Display Outputs cout<<fixed<<setprecision(2)<<showpoint; cout<<"Loan Amount: $"<<loanAmt<<endl; cout<<"Interest Rate: "<<setw(5) <<static_cast<int>(intRate*CNVPERC) <<"%"<<endl; cout<<"Monthly Payment: $"<<setw(8)<<mnPymnt<<endl; cout<<"Interest Paid: $"<<setw(8)<<intPaid<<endl; cout<<"Total Paid: $"<<setw(8)<<totPaid<<endl; //Exit stage right! return 0; }
[ "mark.lehr@rcc.edu" ]
mark.lehr@rcc.edu
82404d3af79dc9e725d44ee4f52365dd8f26ac39
34b22618cc53750a239ee7d3c98314d8e9b19093
/framework/samples/cmadtv/src/Windows/Planning/StatsRatingsWindow.cpp
007f5e7e87465df00bb724f66a4798272f28ad3f
[]
no_license
ivan-kits/cframework
7beef16da89fb4f9559c0611863d05ac3de25abd
30015ddf1e5adccd138a2988455fe8010d1d9f50
refs/heads/master
2023-06-12T05:09:30.355989
2021-07-04T09:00:00
2021-07-04T09:00:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
15,392
cpp
#include "cmadtv/Windows/Planning/StatsRatingsWindow.h" #include <math.h> #include "cfoundation/Enum/EnumIncrement.h" #include "cfoundation/Math/Utils.h" #include "csystem/Input/Input.h" #include "cgui/Gui/Button.h" #include "cgui/Gui/TextBox.h" #include "cgui/Tooltip/TooltipSystem.h" #include "cmadtv/Data/Database/Database.h" #include "cmadtv/Data/Player/DayStat.h" #include "cmadtv/Data/Player/Player.h" #include "cmadtv/Data/Player/PlayerCompSpectators.h" #include "cmadtv/Data/Player/PlayerCompStats.h" #include "cmadtv/Data/Player/PlayerContext.h" #include "cmadtv/Data/Game/Game.h" #include "cmadtv/Tooltip/StatsRatingTooltipController.h" #include "cmadtv/Windows/Planning/StatsImageWindow.h" using namespace CMadTV; CFoundation::String StatsRatingsWindow::GetXMLFileName() { return "data/windows/StatsRatingsWindow.xml"; } StatsRatingsWindow::StatsRatingsWindow() : m_u32Player( MAX_U32 ), m_ePeriod( PERIOD_NONE ), m_u32MaxBarHeight( 0 ) { m_spDelegatePeriodPushed = CGui::StateEventDelegate0Ptr( new CGui::StateEventDelegate0( this, &StatsRatingsWindow::OnPeriodPushed ) ); m_spDelegateImagePushed = CGui::StateEventDelegate0Ptr( new CGui::StateEventDelegate0( this, &StatsRatingsWindow::OnImagePushed ) ); m_spDelegateChangedPlayerSelection = CCtrl::ButtonGroupButtonEventDelegate3Ptr( new CCtrl::ButtonGroupButtonEventDelegate3( this, &StatsRatingsWindow::OnChangedPlayerSelection ) ); } StatsRatingsWindow::~StatsRatingsWindow() { } void StatsRatingsWindow::InitWindow() { // Create button group m_spPlayerButtons = CCtrl::ButtonGroupPtr( new CCtrl::ButtonGroup() ); // Register delegate m_spPlayerButtons->RegisterDelegate( CCtrl::BUTTON_GROUP_EVENT_SELECTION_CHANGED, m_spDelegateChangedPlayerSelection ); // Get player buttons CGui::ButtonPtr spBtPlayer1 = GetButton( "BtPlayer1" ); m_mapButtonPlayers[ spBtPlayer1 ] = 0; CGui::ButtonPtr spBtPlayer2 = GetButton( "BtPlayer2" ); m_mapButtonPlayers[ spBtPlayer2 ] = 1; CGui::ButtonPtr spBtPlayer3 = GetButton( "BtPlayer3" ); m_mapButtonPlayers[ spBtPlayer3 ] = 2; // Add to button group m_spPlayerButtons->AddButton( spBtPlayer1 ); m_spPlayerButtons->AddButton( spBtPlayer2 ); m_spPlayerButtons->AddButton( spBtPlayer3 ); // Get axis labels for ( Unsigned32 u32Idx = 0; u32Idx < NUM_AXIS_LABELS; ++u32Idx ) { m_aspAxisLabels.push_back( GetTextBox( CFoundation::String::Build( "TbAxisLabel%d", u32Idx + 1 ) ) ); } // Get bars for ( Unsigned32 u32Idx = HOUR_BEGIN; u32Idx < HOUR_END; ++u32Idx ) { m_mapBars[ u32Idx ] = GetPanel( CFoundation::String::Build( "PnlBar%d", u32Idx ) ); } // Get initial bar height CGui::PanelPtr spPnlBarPanel = GetPanel( "PnlBar1" ); CGui::GuiObjectPtr spPnlBar = spPnlBarPanel != NULL ? spPnlBarPanel->FindChild( "PnlBar" ) : CGui::GuiObjectPtr(); if ( spPnlBar != NULL ) { m_u32MaxBarHeight = spPnlBar->GetHeight(); } m_spBtPeriod = GetButton( "BtPeriod" ); m_spBtPeriod->RegisterDelegate( CGui::INPUT_EVENT_PUSHED, m_spDelegatePeriodPushed ); m_spBtImage = GetButton( "BtRatings" ); m_spBtImage->RegisterDelegate( CGui::INPUT_EVENT_PUSHED, m_spDelegateImagePushed ); WindowController::InitWindow(); } void StatsRatingsWindow::DeinitWindow() { // Remove delegates m_spPlayerButtons->RemoveDelegate( CCtrl::BUTTON_GROUP_EVENT_SELECTION_CHANGED, m_spDelegateChangedPlayerSelection ); m_spBtPeriod->RemoveDelegate( CGui::INPUT_EVENT_PUSHED, m_spDelegatePeriodPushed ); m_spBtImage->RemoveDelegate( CGui::INPUT_EVENT_PUSHED, m_spDelegateImagePushed ); WindowController::DeinitWindow(); } void StatsRatingsWindow::ProcessInput( const CSystem::InputState& _State ) { if ( _State.WasPressed( CSystem::MOUSE_RIGHT ) || _State.WasPressed( CSystem::KEY_ESC ) ) { Close(); } } void StatsRatingsWindow::OnContextChanged() { SetGame( m_spContext != NULL ? m_spContext->GetGame() : GamePtr() ); SetPlayer( m_spContext != NULL ? m_spContext->GetPlayerIdx() : MAX_U32 ); } void StatsRatingsWindow::SetGame( GamePtr _spGame ) { if ( _spGame == m_spGame ) { return; } m_spGame = _spGame; if ( m_spGame != NULL ) { // Set button texts Unsigned32 u32NumButtons = m_spPlayerButtons->GetNumButtons(); for ( Unsigned32 u32Idx = 0; u32Idx < u32NumButtons; ++u32Idx ) { CGui::ButtonPtr spButton = m_spPlayerButtons->GetButton( u32Idx ); PlayerPtr spPlayer = m_spGame->GetPlayer( u32Idx ); spButton->SetVisible( spPlayer != NULL && spPlayer->GetImage() > 0 ); if ( spPlayer != NULL ) { // TODO Set station name instead of player name spButton->SetText( spPlayer->GetName() ); } } } // Update player UpdatePlayer(); } void StatsRatingsWindow::SetPlayer( Unsigned32 _u32Player ) { if ( _u32Player == m_u32Player ) { return; } m_u32Player = _u32Player; // Activate correct player button m_spPlayerButtons->SetActiveButton( m_u32Player ); // Update player UpdatePlayer(); } void StatsRatingsWindow::UpdatePlayer() { // Get player pointer SetPlayer( m_spGame != NULL ? m_spGame->GetPlayer( m_u32Player ) : PlayerPtr() ); } void StatsRatingsWindow::SetPlayer( PlayerPtr _spPlayer ) { if ( _spPlayer == m_spPlayer ) { return; } m_spPlayer = _spPlayer; // Set period SetPeriod( PERIOD_TODAY ); // Update stats UpdateStats(); } void StatsRatingsWindow::SetPeriod( Period _ePeriod ) { if ( _ePeriod == m_ePeriod ) { return; } m_ePeriod = _ePeriod; // Set button text CFoundation::String strText; switch ( m_ePeriod ) { case PERIOD_TODAY: { strText = "Today"; } break; case PERIOD_YESTERDAY: { strText = "Yesterday"; } break; case PERIOD_WEEK: { strText = "Week"; } break; } SAFE_CALL( m_spBtPeriod )->SetText( strText ); // Update stats UpdateStats(); } void StatsRatingsWindow::UpdateStats() { if ( m_spGame == NULL || m_spPlayer == NULL ) { return; } // Get maximum value Unsigned32 u32MaxSpectators = m_spPlayer->GetCompSpectators()->GetMaxNumSpectators( m_spContext->GetDatabase()->GetMap() ); Unsigned32 u32Step = u32MaxSpectators / 5; u32Step = std::max( static_cast< Unsigned32 >( 1000000 ), u32Step ); Unsigned32 u32NumDigits = CFoundation::Math::GetNumDigits( u32Step ); Unsigned32 u32Multiplier = static_cast< Unsigned32 >( pow( 10.0f, static_cast< int >( u32NumDigits - 1 ) ) ); u32Step /= u32Multiplier; u32Step *= u32Multiplier; Unsigned32 u32MaxValue = u32Step * 5; // Set axis labels Unsigned32 u32NumSteps = m_aspAxisLabels.size(); for ( Unsigned32 u32Idx = 0; u32Idx < u32NumSteps; ++u32Idx ) { Unsigned32 u32Value = u32Step * ( u32Idx + 1 ); // Get value in millions u32Value /= 1000000; // Set text m_aspAxisLabels[ u32Idx ]->SetText( CFoundation::String::Build( "%d", u32Value ) ); } switch ( m_ePeriod ) { case PERIOD_TODAY: case PERIOD_YESTERDAY: { // Check which day to show CFoundation::Date date = m_spGame->GetDate(); if ( m_ePeriod == PERIOD_YESTERDAY ) { date.AddDays( -1 ); } // Get day stat PlayerCompStatsPtr spCompStats = m_spPlayer->GetCompStats(); DayStatPtr spDayStat = spCompStats->GetDayStat( date ); // Fill stats for ( Hour eHour = HOUR_BEGIN; eHour != HOUR_END; ++eHour ) { CGui::PanelPtr spPnlBarPanel = m_mapBars[ eHour ]; if ( spPnlBarPanel == NULL ) { continue; } // Get stat BlockStatPtr spBlockStat = spDayStat->GetBlockStat( eHour ); // Setup news bar { // Get spectators Unsigned32 u32NumSpectators = spBlockStat->GetNewsSpectators(); Unsigned32 u32Height = m_u32MaxBarHeight * u32NumSpectators / u32MaxValue; // Set bar and shadow height CGui::PanelPtr spPnlBar = static_pointer_cast< CGui::Panel >( spPnlBarPanel->FindChild( "PnlBarNews" ) ); spPnlBar->SetVisible( true ); spPnlBar->SetCustomHeight( u32Height ); CGui::GuiObjectPtr spImgShadow = spPnlBarPanel->FindChild( "ImgShadowNews" ); spImgShadow->SetVisible( true ); spImgShadow->SetCustomHeight( u32Height ); // Set player color CGui::GuiObjectPtr spImgColor = spPnlBar->FindChild( "ImgColor" ); spImgColor->SetBgColor( m_spPlayer->GetColorLight() ); } // Setup broadcast bar { // Get spectators Unsigned32 u32NumSpectators = spBlockStat->GetBroadcastSpectators(); Unsigned32 u32Height = m_u32MaxBarHeight * u32NumSpectators / u32MaxValue; // Set bar and shadow height CGui::PanelPtr spPnlBar = static_pointer_cast< CGui::Panel >( spPnlBarPanel->FindChild( "PnlBar" ) ); spPnlBar->SetCustomHeight( u32Height ); CGui::GuiObjectPtr spImgShadow = spPnlBarPanel->FindChild( "ImgShadow" ); spImgShadow->SetCustomHeight( u32Height ); // Set player color CGui::GuiObjectPtr spImgColor = spPnlBar->FindChild( "ImgColor" ); spImgColor->SetBgColor( m_spPlayer->GetColor() ); } // Show/hide arrows CGui::GuiObjectPtr spImgArrowUp = spPnlBarPanel->FindChild( "ImgArrowUp" ); spImgArrowUp->SetVisible( spBlockStat->GetImageEffect() == BlockStat::IMAGE_EFFECT_INCREASE ); CGui::GuiObjectPtr spImgArrowDown = spPnlBarPanel->FindChild( "ImgArrowDown" ); spImgArrowDown->SetVisible( spBlockStat->GetImageEffect() == BlockStat::IMAGE_EFFECT_DECREASE ); // Set text CGui::TextBoxPtr spTbHour= static_pointer_cast< CGui::TextBox >( spPnlBarPanel->FindChild( "TbHour" ) ); spTbHour->SetText( CFoundation::String::Build( "%d", 17 + eHour ) ); // Set tooltip StatsRatingTooltipControllerPtr spTooltipController = StatsRatingTooltipControllerPtr( new StatsRatingTooltipController() ); spTooltipController->SetBlockStat( spBlockStat ); CGui::TooltipSystem::GetInstance().SetTooltipController( spTbHour, spTooltipController ); } } break; case PERIOD_WEEK: { // Check which day to show CFoundation::Date today = m_spGame->GetDate(); Unsigned32 u32PassedDays = m_spGame->GetDays(); PlayerCompStatsPtr spCompStats = m_spPlayer->GetCompStats(); // Fill stats Unsigned32 u32NumBars = m_mapBars.size(); for ( Unsigned32 u32DaysAgo = 1; u32DaysAgo <= u32NumBars; ++u32DaysAgo ) { CFoundation::Date date = today; Integer32 i32DaysSubstract = u32DaysAgo; date.AddDays( -i32DaysSubstract ); // Get day stat DayStatPtr spDayStat = spCompStats->GetDayStat( date, false ); CGui::PanelPtr spPnlBarPanel = m_mapBars[ u32NumBars - u32DaysAgo + 1 ]; if ( spPnlBarPanel == NULL ) { continue; } // Hide news bar { CGui::PanelPtr spPnlBar = static_pointer_cast< CGui::Panel >( spPnlBarPanel->FindChild( "PnlBarNews" ) ); spPnlBar->SetVisible( false ); CGui::GuiObjectPtr spImgShadow = spPnlBarPanel->FindChild( "ImgShadowNews" ); spImgShadow->SetVisible( false ); } // Get spectators Unsigned32 u32NumSpectators = spDayStat != NULL ? spDayStat->GetAvgBroadcastSpectators() : 0; Unsigned32 u32Height = m_u32MaxBarHeight * u32NumSpectators / u32MaxValue; // Set bar and shadow height CGui::PanelPtr spPnlBar = static_pointer_cast< CGui::Panel >( spPnlBarPanel->FindChild( "PnlBar" ) ); spPnlBar->SetCustomHeight( u32Height ); CGui::GuiObjectPtr spImgShadow = spPnlBarPanel->FindChild( "ImgShadow" ); spImgShadow->SetCustomHeight( u32Height ); // Set player color CGui::GuiObjectPtr spImgColor = spPnlBar->FindChild( "ImgColor" ); spImgColor->SetBgColor( m_spPlayer->GetColor() ); // Hide arrows CGui::GuiObjectPtr spImgArrowUp = spPnlBarPanel->FindChild( "ImgArrowUp" ); spImgArrowUp->SetVisible( false ); CGui::GuiObjectPtr spImgArrowDown = spPnlBarPanel->FindChild( "ImgArrowDown" ); spImgArrowDown->SetVisible( false ); // Set text CGui::TextBoxPtr spTbHour= static_pointer_cast< CGui::TextBox >( spPnlBarPanel->FindChild( "TbHour" ) ); if ( u32PassedDays >= u32DaysAgo ) { spTbHour->SetText( CFoundation::String::Build( "%d.", u32PassedDays - u32DaysAgo + 1 ) ); } else { spTbHour->SetText( "-" ); } // Remove tooltip controller CGui::TooltipSystem::GetInstance().RemoveTooltipController( spTbHour ); } } break; } } void StatsRatingsWindow::OnPeriodPushed() { // Get next period Period eNewPeriod = m_ePeriod; enum_increment( eNewPeriod, PERIOD_NONE, PERIOD_END ); // Don't show yesterday's stats if no day played yet if ( eNewPeriod == PERIOD_YESTERDAY ) { if ( m_spGame != NULL && m_spGame->GetDays() == 0 ) { enum_increment( eNewPeriod, PERIOD_NONE, PERIOD_END ); } } if ( eNewPeriod == PERIOD_END ) { eNewPeriod = PERIOD_TODAY; } SetPeriod( eNewPeriod ); } void StatsRatingsWindow::OnImagePushed() { StatsImageWindowPtr spStatsImage = Create< StatsImageWindow >( GetParent() ); spStatsImage->SetContext( m_spContext ); Close(); } void StatsRatingsWindow::OnChangedPlayerSelection( CCtrl::ButtonGroupPtr _spButtonGroup, CGui::ButtonPtr _spNewActiveButton, CGui::ButtonPtr _spOldActiveButton ) { // Set new player SetPlayer( m_mapButtonPlayers[ _spNewActiveButton ] ); }
[ "dev@oeing.eu" ]
dev@oeing.eu
04ae1205c3dd3e2519be13f0a04c6495dd62d5f8
c258ecfc7fd11507da15e25bfcf5c6548c6f5874
/656A.cpp
1ccb8f2d5b924f89494e350e526b2ce8189bdd0a
[]
no_license
sagarsingla14/Codechef
724ae9b8563deed5cb6c8648cbc39603f0283c57
74384679a2eec984b2fbb762e0a8a8e8f60cc103
refs/heads/master
2021-07-13T17:17:34.026783
2020-09-27T14:07:27
2020-09-27T14:07:27
208,868,122
0
0
null
null
null
null
UTF-8
C++
false
false
680
cpp
#include <bits/stdc++.h> using namespace std; #define ll long long int #define ld long double #define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); int main() { ll t; cin >> t; while(t--) { ll x , y , z; cin >> x >> y >> z; map <ll , ll> mp; ll mx = 0; mx = max(x , y); mx = max(mx , z); ll mn = min(x , y); mn = min(mn , z); mp[x] ++; mp[y] ++; mp[z] ++; if(mp[mx] >= 2) { cout << "YES" << endl; cout << mn << " " << mn << " " << mx << endl; } else{ cout << "NO" << endl; } } return 0; }
[ "sagarrock1499@gmail.com" ]
sagarrock1499@gmail.com
a5a29f69d0f278a58d767c0ab6cda583a8c641e1
cdf84839fa036ac25bdcf9bcc30f181e9aff4d8e
/key/src/main/cpp/native-lib.cpp
b11f0b38e811904f88b41aa307fc258c50aa7408
[]
no_license
lizhifeng-sky/CustomNdk
a9874b57df6eac7684dc218a3a5a17a87bcff400
bcfd982a5dd907aa0a1241782b3679bbced37fc3
refs/heads/master
2022-12-06T03:12:31.110516
2020-08-21T02:54:47
2020-08-21T02:54:47
289,160,991
0
0
null
null
null
null
UTF-8
C++
false
false
8,241
cpp
#include <jni.h> #include <string> #include <iostream> extern "C" const char *KEY1 = "密钥1"; const char *KEY2 = "密钥2"; const char *KEY3 = "密钥3"; const char *UNKNOWN = "unknown"; const char *PACKAGE_NAME = "com.android.ndk"; //(签名的md5值自己可以写方法获取,或者用签名工具直接获取, //一般对接微信sdk的时候也会要应用签名的MD5值) const char *SIGN_MD5 = "C3DC5A2D4FAD89B0F71535E5B168FF8F"; jstring toMd5(JNIEnv *pEnv, _jbyteArray *source); void toHexStr(const char *source, char *dest, jsize sourceLen); bool getSignature(JNIEnv *pEnv); std::string jstring2str(JNIEnv *env, jstring jstr); extern "C" JNIEXPORT jstring JNICALL Java_com_android_key_ReadKey_stringFromJNI(JNIEnv *env, jclass clazz, jstring key) { std::string hello = "Hello from C++11"; if (getSignature(env)) { //校验通过 if (jstring2str(env, key) == "key1") { return env->NewStringUTF(KEY1); } else if (jstring2str(env, key) == "key2") { return env->NewStringUTF(KEY2); } else if (jstring2str(env, key) == "key3") { return env->NewStringUTF(KEY3); } } return env->NewStringUTF(UNKNOWN); } //string -> jstring jstring str2jstring(JNIEnv *env, const char *pat) { //定义java String类 strClass jclass strClass = (env)->FindClass("java/lang/String"); //获取String(byte[],String)的构造器,用于将本地byte[]数组转换为一个新String jmethodID ctorID = (env)->GetMethodID(strClass, "<init>", "([BLjava/lang/String;)V"); //建立byte数组 jbyteArray bytes = (env)->NewByteArray(strlen(pat)); //将char* 转换为byte数组 (env)->SetByteArrayRegion(bytes, 0, strlen(pat), (jbyte *) pat); // 设置String, 保存语言类型,用于byte数组转换至String时的参数 jstring encoding = (env)->NewStringUTF("GB2312"); //将byte数组转换为java String,并输出 return (jstring) (env)->NewObject(strClass, ctorID, bytes, encoding); } //jstring -> string std::string jstring2str(JNIEnv *env, jstring jstr) { char *rtn = nullptr; jclass clsstring = env->FindClass("java/lang/String"); jstring strencode = env->NewStringUTF("GB2312"); jmethodID mid = env->GetMethodID(clsstring, "getBytes", "(Ljava/lang/String;)[B"); auto barr = (jbyteArray) env->CallObjectMethod(jstr, mid, strencode); jsize alen = env->GetArrayLength(barr); jbyte *ba = env->GetByteArrayElements(barr, JNI_FALSE); if (alen > 0) { rtn = (char *) malloc(alen + 1); memcpy(rtn, ba, alen); rtn[alen] = 0; } env->ReleaseByteArrayElements(barr, ba, 0); std::string stemp(rtn); free(rtn); return stemp; } //获取Application实例 jobject getApplication(JNIEnv *env) { jobject application = NULL; //这里是你的Application的类路径 jclass baseapplication_clz = env->FindClass("com/android/ndk/CustomeApplication"); if (baseapplication_clz != NULL) { jmethodID currentApplication = env->GetStaticMethodID( baseapplication_clz, "getInstance", "()Lcom/android/ndk/CustomeApplication;"); if (currentApplication != NULL) { application = env->CallStaticObjectMethod(baseapplication_clz, currentApplication); } env->DeleteLocalRef(baseapplication_clz); } return application; } bool isRight = false; //获取应用签名的MD5值并判断是否与本应用的一致 bool getSignature(JNIEnv *env) { if (!isRight) { //避免每次都进行校验浪费资源,只要第一次校验通过后,后边就不在进行校验 jobject context = getApplication(env); // 获得Context类 jclass cls = env->GetObjectClass(context); // 得到getPackageManager方法的ID jmethodID mid = env->GetMethodID(cls, "getPackageManager", "()Landroid/content/pm/PackageManager;"); // 获得应用包的管理器 jobject pm = env->CallObjectMethod(context, mid); // 得到getPackageName方法的ID mid = env->GetMethodID(cls, "getPackageName", "()Ljava/lang/String;"); // 获得当前应用包名 jstring packageName = (jstring) env->CallObjectMethod(context, mid); const char *c_pack_name = env->GetStringUTFChars(packageName, NULL); // 比较包名,若不一致,直接return包名 if (strcmp(c_pack_name, PACKAGE_NAME) != 0) { return false; } // 获得PackageManager类 cls = env->GetObjectClass(pm); // 得到getPackageInfo方法的ID mid = env->GetMethodID(cls, "getPackageInfo", "(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;"); // 获得应用包的信息 jobject packageInfo = env->CallObjectMethod(pm, mid, packageName, 0x40); //GET_SIGNATURES = 64; // 获得PackageInfo 类 cls = env->GetObjectClass(packageInfo); // 获得签名数组属性的ID jfieldID fid = env->GetFieldID(cls, "signatures", "[Landroid/content/pm/Signature;"); // 得到签名数组 jobjectArray signatures = (jobjectArray) env->GetObjectField(packageInfo, fid); // 得到签名 jobject signature = env->GetObjectArrayElement(signatures, 0); // 获得Signature类 cls = env->GetObjectClass(signature); mid = env->GetMethodID(cls, "toByteArray", "()[B"); // 当前应用签名信息 jbyteArray signatureByteArray = (jbyteArray) env->CallObjectMethod(signature, mid); //转成jstring jstring str = toMd5(env, signatureByteArray); char *c_msg = (char *) env->GetStringUTFChars(str, 0); isRight = strcmp(c_msg, SIGN_MD5) == 0; return isRight; } return isRight; } //md5 jstring toMd5(JNIEnv *env, jbyteArray source) { // MessageDigest jclass classMessageDigest = env->FindClass("java/security/MessageDigest"); // MessageDigest.getInstance() jmethodID midGetInstance = env->GetStaticMethodID(classMessageDigest, "getInstance", "(Ljava/lang/String;)Ljava/security/MessageDigest;"); // MessageDigest object jobject objMessageDigest = env->CallStaticObjectMethod(classMessageDigest, midGetInstance, env->NewStringUTF("md5")); jmethodID midUpdate = env->GetMethodID(classMessageDigest, "update", "([B)V"); env->CallVoidMethod(objMessageDigest, midUpdate, source); // Digest jmethodID midDigest = env->GetMethodID(classMessageDigest, "digest", "()[B"); jbyteArray objArraySign = (jbyteArray) env->CallObjectMethod(objMessageDigest, midDigest); jsize intArrayLength = env->GetArrayLength(objArraySign); jbyte *byte_array_elements = env->GetByteArrayElements(objArraySign, NULL); size_t length = (size_t) intArrayLength * 2 + 1; char *char_result = (char *) malloc(length); memset(char_result, 0, length); toHexStr((const char *) byte_array_elements, char_result, intArrayLength); // 在末尾补\0 *(char_result + intArrayLength * 2) = '\0'; jstring stringResult = env->NewStringUTF(char_result); // release env->ReleaseByteArrayElements(objArraySign, byte_array_elements, JNI_ABORT); // 指针 free(char_result); return stringResult; } //转换为16进制字符串 void toHexStr(const char *source, char *dest, jsize sourceLen) { short i; char highByte, lowByte; for (i = 0; i < sourceLen; i++) { highByte = source[i] >> 4; lowByte = (char) (source[i] & 0x0f); highByte += 0x30; if (highByte > 0x39) { dest[i * 2] = (char) (highByte + 0x07); } else { dest[i * 2] = highByte; } lowByte += 0x30; if (lowByte > 0x39) { dest[i * 2 + 1] = (char) (lowByte + 0x07); } else { dest[i * 2 + 1] = lowByte; } } }
[ "m13162137315@163.com" ]
m13162137315@163.com
e181fecb358d9611232c8462a29be031dbaa000f
6d1abcb0e471f92dfe75c28d0bdb1611af0f420f
/chatclient/chatclientcontroller.h
54dcaa0c025063eaf2dedfb3f3c018b4d8eb1c82
[]
no_license
igorbushin/SmallChat
a39c7e4d496dffb9537f9b15c49b86ca58176013
13d1e92c4106d2c24d3319ca4a4dffc116384bfe
refs/heads/master
2020-04-28T02:19:42.648677
2019-03-16T14:52:38
2019-03-16T14:52:38
174,894,340
0
0
null
null
null
null
UTF-8
C++
false
false
391
h
#ifndef CHATCLIENTCONTROLLER_H #define CHATCLIENTCONTROLLER_H #include "chatclientview.h" #include "chatclientmodel.h" class ChatClientController { public: ChatClientController(); ~ChatClientController(); ChatClientView *getView(); private: ChatClientView *view = new ChatClientView; ChatClientModel *model = new ChatClientModel; }; #endif // CHATCLIENTCONTROLLER_H
[ "ingvar.gorbushin@gmail.com" ]
ingvar.gorbushin@gmail.com